query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Delete Microsoft Teams messages contained in an eDiscovery search. You can collect and purge the following categories of Teams content: Teams 1:1 chats Chat messages, posts, and attachments shared in a Teams conversation between two people. Teams 1:1 chats are also called conversations. Teams group chats Chat messages, posts, and attachments shared in a Teams conversation between three or more people. Also called 1:N chats or group conversations. Teams channels Chat messages, posts, replies, and attachments shared in a standard Teams channel. Private channels Message posts, replies, and attachments shared in a private Teams channel. Shared channels Message posts, replies, and attachments shared in a shared Teams channel. For more information about purging Teams messages, see: eDiscovery solution series: Data spillage scenario Search and purge eDiscovery (Premium) workflow for content in Microsoft Teams
def post(body, request_configuration=nil) raise StandardError, 'body cannot be null' if body.nil? request_info = self.to_post_request_information( body, request_configuration ) error_mapping = Hash.new error_mapping["4XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) } error_mapping["5XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) } return @request_adapter.send_async(request_info, nil, error_mapping) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_delete(token, channel_id, messages = [])\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/bulk_delete\",\n { messages: messages }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def destroy\n @home_searches_message = Home::Searches::Message.find(params[:id])\n @home_searches_message.destroy\n\n respond_to do |format|\n format.html { redirect_to home_searches_messages_url }\n format.json { head :no_content }\n end\n end", "def delete\n membership = Membership.find_by(uuid: conversation_params[:uuid])\n convo = membership.conversation\n leave_message = convo.messages.create(text: \"Conversation has ended\", user_index: -1)\n MessagesChannel.broadcast_to convo, MessageSerializer.new(leave_message)\n membership.update(is_active: false) if membership\n create_or_join\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n # delete a specific message\n end", "def destroy\n\t\tchannel_sid = params[:channel_sid]\n\t\tmessage_sid = params[:id]\n\t\tputs message_sid\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Remove the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tresponse = channel.messages(message_sid).delete\n\t\tputs response\n\t\tmessages_response= \"{\\n\\\"message\\\": \\\"Message was deleted\\\"\\n}\"\n\t\tjson_response(messages_response)\n\tend", "def deleteEntityFeatured_message( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/featured_message\",params)\n end", "def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end", "def delete_conversation(id)\n @client.raw('delete', \"/content/conversations/#{id}\")\n end", "def destroy\n # delete a specific message\n end", "def destroy\n # delete a specific message\n end", "def destroy\n destroy_q(@message, messages_url)\n end", "def delete_conversation(id)\n delete(\"conversations/#{id}\")\n end", "def delete_message(data); end", "def delete_message(data); end", "def destroy\n get_message().delete\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n\n desc = @conversation.topic\n add_event( EVENT_DELETE_CONVERSATION, desc[0,150], EVENTSOURCE_USER, session[:user_id], session[:user_name], nil)\n\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_conversations_path(@pad)) }\n format.xml { head :ok }\n end\n end", "def delete_message(message)\n API::Channel.delete_message(@bot.token, @id, message.resolve_id)\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end", "def delete_message(display_id, message_id)\n delete \"commandcenter/displays/#{display_id}/messages/#{message_id}\"\n end", "def delete(message_text)\n self.span(:class=>\"discussion_post_message\", :text=>message_text).parent.parent.button(:text=>\"Delete\").click\n end", "def destroy\n @message = Message.find(params[:id])\n\n message = \"You do not have access needed to delete the discussion <strong>'#{@message.subject}'</strong> at this time. If you are still interested in deleting this discussion, please let us know.\"\n authorize! :destroy, @message, :message => message.html_safe\n\n @message.destroy\n \n if @group\n redirect_to @group\n else\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @conversation.destroy\n\n head :no_content\n end", "def destroy\n @conversation.destroy\n\n head :no_content\n end", "def destroy\n #@message = Message.find(params[:id])\n #@message.destroy\n #redirect_to projects_path\n current_user.delete_message(ActsAsMessageable::Message.find(params[:id]))\n redirect_to trash_url\n end", "def messagedelete\n TDirmessage.find_by(\"dirmsg_id=?\", params[:messagedelete]).delete\n redirect_back(fallback_location: dirmsgcreate_path)\n end", "def delete_message_by_restaurant\n root_id = @parsed_json[\"message_id\"] if @parsed_json[\"message_id\"]\n check = Notifications.where(\"id=?\", root_id.to_i).first\n if check.nil?\n render :status=>412, :json=>{:status=>:failed, :error=>\"Not exist this message\"}\n else\n sql =\"notifications.alert_type != 'Publish Menu Notification' AND notifications.id=? OR notifications.reply=?\"\n notifications = Notifications.where(sql, root_id.to_i,root_id.to_i)\n for i in notifications\n i.update_attributes(:is_show=>0, :is_show_detail=>0)\n end\n render :status=>200, :json=>{:status=>:success}\n end\n end", "def destroy\n @message = Message.find(params[:id])\n if current_user.received_messages.find(@message)\n MessageRecipient.find_by_user_id_and_message_id(current_user, @message.id).destroy\n\n else\n @message.destroy\n end\n \n\n respond_to do |format|\n format.html { redirect_to account_messages_url }\n format.xml { head :ok }\n end\n end", "def delete\n @service.delete_message(self)\n end", "def destroy_direct_message(direct_message_id)\n delete \"direct_messages/destroy/#{direct_message_id}\"\n end", "def remove_records(messages)\n clause = deleted_query(messages)\n\n clause.delete_all\n end", "def destroy\n @message = Messages.find(params[:id])\n @message.destroy\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to user_project_app_thread_url(@user,@project,@app_thread), notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message_thread.destroy\n respond_to do |format|\n format.html { redirect_to message_threads_url }\n format.json { head :no_content }\n end\n end", "def message_delete\n messages = params[:mesg_ids]\n if messages.present?\n messages.each do |f|\n mesg = Message.find(f)\n mesg.update_columns(:is_deleted => 1 )\n flash[:success] = \"You have successfully Deleted the Message\"\n end\n else\n flash[:danger] = \"Please select checkbox to DELETE the messages\"\n end\n redirect_to :back\n end", "def bulk_delete(ids, strict = false, reason = nil)\n min_snowflake = IDObject.synthesise(Time.now - TWO_WEEKS)\n\n ids.reject! do |e|\n next unless e < min_snowflake\n\n message = \"Attempted to bulk_delete message #{e} which is too old (min = #{min_snowflake})\"\n raise ArgumentError, message if strict\n\n Discordrb::LOGGER.warn(message)\n true\n end\n\n API::Channel.bulk_delete_messages(@bot.token, @id, ids, reason)\n ids.size\n end", "def destroy\n @send_message = SendMessage.find(params[:id])\n @send_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(send_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message.destroy\n end", "def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end", "def delete_message(message_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Email/#{message_id}\")\n end", "def chat_deleteScheduledMessage(options = {})\n raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?\n raise ArgumentError, 'Required arguments :scheduled_message_id missing' if options[:scheduled_message_id].nil?\n options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]\n post('chat.deleteScheduledMessage', options)\n end", "def delete_message(token, id, user = nil)\n request_url = user_context(user) << \"/Messages/\" << id\n\n delete_response = make_api_call \"DELETE\", request_url, token\n\n return nil if delete_response.nil? || delete_response.empty?\n\n parse_response(delete_response)\n end", "def destroy\n @message = Admin::Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @euclid_user_message = EuclidUserMessage.find(params[:id])\n @euclid_user_message.destroy\n\n respond_to do |format|\n format.html { redirect_to euclid_user_messages_url }\n format.json { head :no_content }\n end\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def delete_notifications\n Notification.where(origin_type: 'Message', origin_id: @message.id).destroy_all\n end", "def destroy\n @fdn_received_message = Fdn::ReceivedMessage.find(params[:id])\n #@fdn_received_message.destroy\n @fdn_received_message.be_trashed(current_user)\n\n respond_to do |format|\n format.html { redirect_to fdn_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end", "def delete_facebook_channel(project_id, query_id)\n delete \"/projects/#{project_id}/facebookchannels/#{query_id}\"\n end", "def destroy\n @user = User.find(current_user)\n @message = @user.messages.find(params[:id])\n @message.destroy\n\n end", "def destroy\n @text_message = TextMessage.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to text_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @message = current_user.extension.messages.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def delete(key)\n messages.delete(key)\n end", "def destroy\n message = Message.find(params[:id])\n message.destroy\n end", "def destroy\r\n push_notification :remove\r\n @message.destroy\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel) }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @text_message = @profile.text_messages.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(profile_text_messages_url(@profile)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admins_message.destroy\n respond_to do |format|\n format.html { redirect_to admins_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy_all\r\n Message.destroy_all(channel: @channel)\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Chat erfolgreich geleert.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(conversations_url) }\n format.xml { head :ok }\n end\n end", "def destroy (name, update_seen_on=true)\n if where = exist?(name)\n @messages[where.last].delete(where.first)\n @by_id.delete(where.first.name)\n @seen_on[where.first.name] = Time.now.to_i if update_seen_on and where.first.options[:remember]\n end\n end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\n messages.delete(key)\n end", "def destroy\n\t\tg = GrouptestChatmessage.find(params[:id])\n\t\tg.destroy\n redirect_to( g.test ) \n end", "def destroy\n @message.images.purge\n @message.zh_tw_images.purge\n @message.zh_cn_images.purge\n @message.vi_images.purge\n @message.hmn_images.purge\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: \"Message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n respond_to do |format|\n if params[:attempt].eql?(@message.answer)\n @message.destroy\n @messages = Message.all\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n else\n format.html { redirect_to @message, notice: 'your answer is wrong, unable to delete the post' }\n end\n end\n end", "def destroy\n @forum_message.destroy\n respond_to do |format|\n format.html { redirect_to forum_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @direct_message = DirectMessage.find(params[:id])\n @direct_message.destroy\n\n respond_to do |format|\n format.html { redirect_to user_direct_messages_url(current_user) }\n format.json { head :ok }\n end\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n # Redirect to index\n redirect_to conversations_path\n end", "def delete_message_template(id)\n @client.raw('delete', \"/content/message-templates/#{id}\")\n end", "def delete(reason = nil)\n API::Channel.delete(@bot.token, @id, reason)\n end", "def delete_dm(settings, dmid)\n Net::HTTP.start('twitter.com') {|http|\n req = Net::HTTP::Post.new(\"/direct_messages/destroy/#{dmid}.json\")\n req.basic_auth settings[:user], settings[:pass]\n response = http.request(req)\n response.body\n }\nend", "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def delete\n if ensure_same_as_logged_person(@message.poster.guid)\n @message.delete\n render :status => :ok and return\n elsif ensure_same_as_logged_person(@channel.owner.guid)\n @message.delete\n render :status => :ok and return\n end\n render :status => :forbidden and return\n end", "def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to administrators_messages_path(@message), notice: 'Новость удалена.' }\n end\n end", "def delete(options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n\n response = @client.delete \"/api/topics/:id\", body, options\n\n return response\n end", "def destroy\n @message.destroy\n redirect_to action: :index\n end", "def destroy\n authorize_admin or return\n\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message_flow = MessageFlow.find(params[:id])\n @message_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to message_flows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @messagefact.destroy\n respond_to do |format|\n #format.html { redirect_to messagefacts_url, notice: 'Messagefact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @peer_to_peer_message.destroy\n respond_to do |format|\n format.html { redirect_to peer_to_peer_messages }\n format.json { head :no_content }\n end\n end", "def destroy\n @mentor_message = MentorMessage.find(params[:id])\n @mentor_message.destroy\n\n respond_to do |format|\n format.html { redirect_to mentor_messages_url }\n format.json { head :no_content }\n end\n end", "def delete(message_id)\n Mailgun.submit :delete, messages_url(message_id)\n end", "def test_should_destroy_message\n old_count = Message.count\n\n assert_equal false, messages(:jane_to_john).deleted_by_sender\n assert_equal false, messages(:jane_to_john).deleted_by_recipient\n\n login_as(:john)\n delete :destroy, :id => 2\n\n assert_redirected_to messages_path\n #assert_equal true, messages(:jane_to_john).deleted_by_recipient\n\n login_as(:jane)\n delete :destroy, :id => 2, :deleted_from => 'outbox'\n\n assert_redirected_to sent_messages_path\n #assert_equal old_count-1, Message.count\n end", "def delete(msg)\n read_write()\n uid = (msg.kind_of?(EasyIMAP::Message) ? msg.uid : msg)\n @conn.uid_store(uid, '+FLAGS', [:Deleted])\n expunge()\n end", "def destroy\n @user_message.destroy\n end", "def destroy\n @messaging_message = Messaging::Message.find(params[:id])\n @messaging_message.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n find = params[:find].blank? ? 0 : params[:find].to_i\n keyword = params[:keyword].blank? ? '' : params[:keyword]\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n ids = params[:id]\n \n Designation.delete_all(:id => ids)\n \n itemscount = DesignationHelper.item_message(find, keyword, pgnum, pgsize)\n \n render :json => { :success => 1, \n :itemscount => itemscount, \n :message => \"#{ids.size} Job Title(s) was successfully deleted.\" }\n end", "def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def removeConversations\n user = User.find(params[:id])\n conversation = Conversation.find_by_name(params[:conversation])\n\n userConversation = user.conversations.where(:name => conversation.name).first\n\n if !userConversation.blank?\n user.conversations.destroy(conversation)\n success = true\n else \n success = false\n end\n\n respond_to do |format|\n format.json {render :json => {:success => success}}\n end\n end", "def destroy\n @chat_message.destroy\n respond_to do |format|\n format.html { redirect_to chat_messages_url, notice: 'Room message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n\n deny_access_unless(current_user?(@message.user) || admin?)\n \n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to @message.article }\n format.json { head :ok }\n end\n end", "def destroy\n @outgoing_sms_content_group = OutgoingSmsContentGroup.find(params[:id])\n @outgoing_sms_content_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(outgoing_sms_content_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conversation.destroy\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :no_content }\n end\n end", "def delete_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling delete_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling delete_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:DELETE, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = ResponseMessage.new() and obj.build_from_hash(response)\n end", "def delete_from_cloud_search\n self.class.cloud_search_delete_document(\n self.cloud_search_document\n )\n end" ]
[ "0.6224203", "0.6218484", "0.6158605", "0.6158472", "0.60588366", "0.601287", "0.600896", "0.60047174", "0.59894377", "0.5931288", "0.58702606", "0.5869037", "0.5860077", "0.5793889", "0.5793889", "0.5768133", "0.57549363", "0.5718225", "0.5711568", "0.5711568", "0.5708272", "0.5702396", "0.56997633", "0.5624608", "0.5601925", "0.5601925", "0.5572991", "0.55698615", "0.5562672", "0.5553788", "0.55228215", "0.55115575", "0.5500895", "0.549587", "0.5470029", "0.54699755", "0.5459693", "0.54469395", "0.54461956", "0.5441306", "0.5433416", "0.54238033", "0.5414362", "0.5408422", "0.5400042", "0.5397785", "0.5392001", "0.5386665", "0.5376586", "0.53719723", "0.53718525", "0.5351789", "0.53504694", "0.5350152", "0.5348705", "0.5344593", "0.5340734", "0.5339576", "0.5334618", "0.5334268", "0.5332577", "0.5330467", "0.5315724", "0.53138894", "0.53129697", "0.53129697", "0.5306935", "0.53027993", "0.5301845", "0.5281568", "0.5277855", "0.526825", "0.5264021", "0.52618605", "0.5260878", "0.5259916", "0.52583355", "0.52512354", "0.5250959", "0.52506906", "0.5246662", "0.5236828", "0.52353895", "0.5233523", "0.5233219", "0.52311796", "0.5227055", "0.5225716", "0.5225131", "0.5220526", "0.5217365", "0.5206158", "0.52046615", "0.5200211", "0.5192091", "0.5190147", "0.51875347", "0.5183333", "0.51812404", "0.5180064", "0.5177991" ]
0.0
-1
Delete Microsoft Teams messages contained in an eDiscovery search. You can collect and purge the following categories of Teams content: Teams 1:1 chats Chat messages, posts, and attachments shared in a Teams conversation between two people. Teams 1:1 chats are also called conversations. Teams group chats Chat messages, posts, and attachments shared in a Teams conversation between three or more people. Also called 1:N chats or group conversations. Teams channels Chat messages, posts, replies, and attachments shared in a standard Teams channel. Private channels Message posts, replies, and attachments shared in a private Teams channel. Shared channels Message posts, replies, and attachments shared in a shared Teams channel. For more information about purging Teams messages, see: eDiscovery solution series: Data spillage scenario Search and purge eDiscovery (Premium) workflow for content in Microsoft Teams
def to_post_request_information(body, request_configuration=nil) raise StandardError, 'body cannot be null' if body.nil? request_info = MicrosoftKiotaAbstractions::RequestInformation.new() request_info.url_template = @url_template request_info.path_parameters = @path_parameters request_info.http_method = :POST unless request_configuration.nil? request_info.add_headers_from_raw_object(request_configuration.headers) request_info.add_request_options(request_configuration.options) end request_info.set_content_from_parsable(@request_adapter, "application/json", body) return request_info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_delete(token, channel_id, messages = [])\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/bulk_delete\",\n { messages: messages }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def destroy\n @home_searches_message = Home::Searches::Message.find(params[:id])\n @home_searches_message.destroy\n\n respond_to do |format|\n format.html { redirect_to home_searches_messages_url }\n format.json { head :no_content }\n end\n end", "def delete\n membership = Membership.find_by(uuid: conversation_params[:uuid])\n convo = membership.conversation\n leave_message = convo.messages.create(text: \"Conversation has ended\", user_index: -1)\n MessagesChannel.broadcast_to convo, MessageSerializer.new(leave_message)\n membership.update(is_active: false) if membership\n create_or_join\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n # delete a specific message\n end", "def destroy\n\t\tchannel_sid = params[:channel_sid]\n\t\tmessage_sid = params[:id]\n\t\tputs message_sid\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Remove the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tresponse = channel.messages(message_sid).delete\n\t\tputs response\n\t\tmessages_response= \"{\\n\\\"message\\\": \\\"Message was deleted\\\"\\n}\"\n\t\tjson_response(messages_response)\n\tend", "def deleteEntityFeatured_message( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/featured_message\",params)\n end", "def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end", "def delete_conversation(id)\n @client.raw('delete', \"/content/conversations/#{id}\")\n end", "def destroy\n # delete a specific message\n end", "def destroy\n # delete a specific message\n end", "def destroy\n destroy_q(@message, messages_url)\n end", "def delete_conversation(id)\n delete(\"conversations/#{id}\")\n end", "def delete_message(data); end", "def delete_message(data); end", "def destroy\n get_message().delete\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n\n desc = @conversation.topic\n add_event( EVENT_DELETE_CONVERSATION, desc[0,150], EVENTSOURCE_USER, session[:user_id], session[:user_name], nil)\n\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_conversations_path(@pad)) }\n format.xml { head :ok }\n end\n end", "def delete_message(message)\n API::Channel.delete_message(@bot.token, @id, message.resolve_id)\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end", "def delete_message(display_id, message_id)\n delete \"commandcenter/displays/#{display_id}/messages/#{message_id}\"\n end", "def delete(message_text)\n self.span(:class=>\"discussion_post_message\", :text=>message_text).parent.parent.button(:text=>\"Delete\").click\n end", "def destroy\n @message = Message.find(params[:id])\n\n message = \"You do not have access needed to delete the discussion <strong>'#{@message.subject}'</strong> at this time. If you are still interested in deleting this discussion, please let us know.\"\n authorize! :destroy, @message, :message => message.html_safe\n\n @message.destroy\n \n if @group\n redirect_to @group\n else\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @conversation.destroy\n\n head :no_content\n end", "def destroy\n @conversation.destroy\n\n head :no_content\n end", "def destroy\n #@message = Message.find(params[:id])\n #@message.destroy\n #redirect_to projects_path\n current_user.delete_message(ActsAsMessageable::Message.find(params[:id]))\n redirect_to trash_url\n end", "def messagedelete\n TDirmessage.find_by(\"dirmsg_id=?\", params[:messagedelete]).delete\n redirect_back(fallback_location: dirmsgcreate_path)\n end", "def delete_message_by_restaurant\n root_id = @parsed_json[\"message_id\"] if @parsed_json[\"message_id\"]\n check = Notifications.where(\"id=?\", root_id.to_i).first\n if check.nil?\n render :status=>412, :json=>{:status=>:failed, :error=>\"Not exist this message\"}\n else\n sql =\"notifications.alert_type != 'Publish Menu Notification' AND notifications.id=? OR notifications.reply=?\"\n notifications = Notifications.where(sql, root_id.to_i,root_id.to_i)\n for i in notifications\n i.update_attributes(:is_show=>0, :is_show_detail=>0)\n end\n render :status=>200, :json=>{:status=>:success}\n end\n end", "def destroy\n @message = Message.find(params[:id])\n if current_user.received_messages.find(@message)\n MessageRecipient.find_by_user_id_and_message_id(current_user, @message.id).destroy\n\n else\n @message.destroy\n end\n \n\n respond_to do |format|\n format.html { redirect_to account_messages_url }\n format.xml { head :ok }\n end\n end", "def delete\n @service.delete_message(self)\n end", "def destroy_direct_message(direct_message_id)\n delete \"direct_messages/destroy/#{direct_message_id}\"\n end", "def remove_records(messages)\n clause = deleted_query(messages)\n\n clause.delete_all\n end", "def destroy\n @message = Messages.find(params[:id])\n @message.destroy\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to user_project_app_thread_url(@user,@project,@app_thread), notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message_thread.destroy\n respond_to do |format|\n format.html { redirect_to message_threads_url }\n format.json { head :no_content }\n end\n end", "def message_delete\n messages = params[:mesg_ids]\n if messages.present?\n messages.each do |f|\n mesg = Message.find(f)\n mesg.update_columns(:is_deleted => 1 )\n flash[:success] = \"You have successfully Deleted the Message\"\n end\n else\n flash[:danger] = \"Please select checkbox to DELETE the messages\"\n end\n redirect_to :back\n end", "def bulk_delete(ids, strict = false, reason = nil)\n min_snowflake = IDObject.synthesise(Time.now - TWO_WEEKS)\n\n ids.reject! do |e|\n next unless e < min_snowflake\n\n message = \"Attempted to bulk_delete message #{e} which is too old (min = #{min_snowflake})\"\n raise ArgumentError, message if strict\n\n Discordrb::LOGGER.warn(message)\n true\n end\n\n API::Channel.bulk_delete_messages(@bot.token, @id, ids, reason)\n ids.size\n end", "def destroy\n @send_message = SendMessage.find(params[:id])\n @send_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(send_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message.destroy\n end", "def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end", "def delete_message(message_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Email/#{message_id}\")\n end", "def chat_deleteScheduledMessage(options = {})\n raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?\n raise ArgumentError, 'Required arguments :scheduled_message_id missing' if options[:scheduled_message_id].nil?\n options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]\n post('chat.deleteScheduledMessage', options)\n end", "def delete_message(token, id, user = nil)\n request_url = user_context(user) << \"/Messages/\" << id\n\n delete_response = make_api_call \"DELETE\", request_url, token\n\n return nil if delete_response.nil? || delete_response.empty?\n\n parse_response(delete_response)\n end", "def destroy\n @message = Admin::Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @euclid_user_message = EuclidUserMessage.find(params[:id])\n @euclid_user_message.destroy\n\n respond_to do |format|\n format.html { redirect_to euclid_user_messages_url }\n format.json { head :no_content }\n end\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def delete_notifications\n Notification.where(origin_type: 'Message', origin_id: @message.id).destroy_all\n end", "def destroy\n @fdn_received_message = Fdn::ReceivedMessage.find(params[:id])\n #@fdn_received_message.destroy\n @fdn_received_message.be_trashed(current_user)\n\n respond_to do |format|\n format.html { redirect_to fdn_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end", "def delete_facebook_channel(project_id, query_id)\n delete \"/projects/#{project_id}/facebookchannels/#{query_id}\"\n end", "def destroy\n @user = User.find(current_user)\n @message = @user.messages.find(params[:id])\n @message.destroy\n\n end", "def destroy\n @text_message = TextMessage.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to text_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @message = current_user.extension.messages.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def delete(key)\n messages.delete(key)\n end", "def destroy\n message = Message.find(params[:id])\n message.destroy\n end", "def destroy\r\n push_notification :remove\r\n @message.destroy\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel) }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @text_message = @profile.text_messages.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(profile_text_messages_url(@profile)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admins_message.destroy\n respond_to do |format|\n format.html { redirect_to admins_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy_all\r\n Message.destroy_all(channel: @channel)\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Chat erfolgreich geleert.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(conversations_url) }\n format.xml { head :ok }\n end\n end", "def destroy (name, update_seen_on=true)\n if where = exist?(name)\n @messages[where.last].delete(where.first)\n @by_id.delete(where.first.name)\n @seen_on[where.first.name] = Time.now.to_i if update_seen_on and where.first.options[:remember]\n end\n end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\n messages.delete(key)\n end", "def destroy\n\t\tg = GrouptestChatmessage.find(params[:id])\n\t\tg.destroy\n redirect_to( g.test ) \n end", "def destroy\n @message.images.purge\n @message.zh_tw_images.purge\n @message.zh_cn_images.purge\n @message.vi_images.purge\n @message.hmn_images.purge\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: \"Message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n respond_to do |format|\n if params[:attempt].eql?(@message.answer)\n @message.destroy\n @messages = Message.all\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n else\n format.html { redirect_to @message, notice: 'your answer is wrong, unable to delete the post' }\n end\n end\n end", "def destroy\n @forum_message.destroy\n respond_to do |format|\n format.html { redirect_to forum_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @direct_message = DirectMessage.find(params[:id])\n @direct_message.destroy\n\n respond_to do |format|\n format.html { redirect_to user_direct_messages_url(current_user) }\n format.json { head :ok }\n end\n end", "def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n # Redirect to index\n redirect_to conversations_path\n end", "def delete_message_template(id)\n @client.raw('delete', \"/content/message-templates/#{id}\")\n end", "def delete(reason = nil)\n API::Channel.delete(@bot.token, @id, reason)\n end", "def delete_dm(settings, dmid)\n Net::HTTP.start('twitter.com') {|http|\n req = Net::HTTP::Post.new(\"/direct_messages/destroy/#{dmid}.json\")\n req.basic_auth settings[:user], settings[:pass]\n response = http.request(req)\n response.body\n }\nend", "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def delete\n if ensure_same_as_logged_person(@message.poster.guid)\n @message.delete\n render :status => :ok and return\n elsif ensure_same_as_logged_person(@channel.owner.guid)\n @message.delete\n render :status => :ok and return\n end\n render :status => :forbidden and return\n end", "def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to administrators_messages_path(@message), notice: 'Новость удалена.' }\n end\n end", "def delete(options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n\n response = @client.delete \"/api/topics/:id\", body, options\n\n return response\n end", "def destroy\n @message.destroy\n redirect_to action: :index\n end", "def destroy\n authorize_admin or return\n\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message_flow = MessageFlow.find(params[:id])\n @message_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to message_flows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @messagefact.destroy\n respond_to do |format|\n #format.html { redirect_to messagefacts_url, notice: 'Messagefact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @peer_to_peer_message.destroy\n respond_to do |format|\n format.html { redirect_to peer_to_peer_messages }\n format.json { head :no_content }\n end\n end", "def destroy\n @mentor_message = MentorMessage.find(params[:id])\n @mentor_message.destroy\n\n respond_to do |format|\n format.html { redirect_to mentor_messages_url }\n format.json { head :no_content }\n end\n end", "def delete(message_id)\n Mailgun.submit :delete, messages_url(message_id)\n end", "def test_should_destroy_message\n old_count = Message.count\n\n assert_equal false, messages(:jane_to_john).deleted_by_sender\n assert_equal false, messages(:jane_to_john).deleted_by_recipient\n\n login_as(:john)\n delete :destroy, :id => 2\n\n assert_redirected_to messages_path\n #assert_equal true, messages(:jane_to_john).deleted_by_recipient\n\n login_as(:jane)\n delete :destroy, :id => 2, :deleted_from => 'outbox'\n\n assert_redirected_to sent_messages_path\n #assert_equal old_count-1, Message.count\n end", "def delete(msg)\n read_write()\n uid = (msg.kind_of?(EasyIMAP::Message) ? msg.uid : msg)\n @conn.uid_store(uid, '+FLAGS', [:Deleted])\n expunge()\n end", "def destroy\n @user_message.destroy\n end", "def destroy\n @messaging_message = Messaging::Message.find(params[:id])\n @messaging_message.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n find = params[:find].blank? ? 0 : params[:find].to_i\n keyword = params[:keyword].blank? ? '' : params[:keyword]\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n ids = params[:id]\n \n Designation.delete_all(:id => ids)\n \n itemscount = DesignationHelper.item_message(find, keyword, pgnum, pgsize)\n \n render :json => { :success => 1, \n :itemscount => itemscount, \n :message => \"#{ids.size} Job Title(s) was successfully deleted.\" }\n end", "def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def removeConversations\n user = User.find(params[:id])\n conversation = Conversation.find_by_name(params[:conversation])\n\n userConversation = user.conversations.where(:name => conversation.name).first\n\n if !userConversation.blank?\n user.conversations.destroy(conversation)\n success = true\n else \n success = false\n end\n\n respond_to do |format|\n format.json {render :json => {:success => success}}\n end\n end", "def destroy\n @chat_message.destroy\n respond_to do |format|\n format.html { redirect_to chat_messages_url, notice: 'Room message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n\n deny_access_unless(current_user?(@message.user) || admin?)\n \n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to @message.article }\n format.json { head :ok }\n end\n end", "def destroy\n @outgoing_sms_content_group = OutgoingSmsContentGroup.find(params[:id])\n @outgoing_sms_content_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(outgoing_sms_content_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conversation.destroy\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :no_content }\n end\n end", "def delete_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling delete_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling delete_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:DELETE, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = ResponseMessage.new() and obj.build_from_hash(response)\n end", "def delete_from_cloud_search\n self.class.cloud_search_delete_document(\n self.cloud_search_document\n )\n end" ]
[ "0.6224203", "0.6218484", "0.6158605", "0.6158472", "0.60588366", "0.601287", "0.600896", "0.60047174", "0.59894377", "0.5931288", "0.58702606", "0.5869037", "0.5860077", "0.5793889", "0.5793889", "0.5768133", "0.57549363", "0.5718225", "0.5711568", "0.5711568", "0.5708272", "0.5702396", "0.56997633", "0.5624608", "0.5601925", "0.5601925", "0.5572991", "0.55698615", "0.5562672", "0.5553788", "0.55228215", "0.55115575", "0.5500895", "0.549587", "0.5470029", "0.54699755", "0.5459693", "0.54469395", "0.54461956", "0.5441306", "0.5433416", "0.54238033", "0.5414362", "0.5408422", "0.5400042", "0.5397785", "0.5392001", "0.5386665", "0.5376586", "0.53719723", "0.53718525", "0.5351789", "0.53504694", "0.5350152", "0.5348705", "0.5344593", "0.5340734", "0.5339576", "0.5334618", "0.5334268", "0.5332577", "0.5330467", "0.5315724", "0.53138894", "0.53129697", "0.53129697", "0.5306935", "0.53027993", "0.5301845", "0.5281568", "0.5277855", "0.526825", "0.5264021", "0.52618605", "0.5260878", "0.5259916", "0.52583355", "0.52512354", "0.5250959", "0.52506906", "0.5246662", "0.5236828", "0.52353895", "0.5233523", "0.5233219", "0.52311796", "0.5227055", "0.5225716", "0.5225131", "0.5220526", "0.5217365", "0.5206158", "0.52046615", "0.5200211", "0.5192091", "0.5190147", "0.51875347", "0.5183333", "0.51812404", "0.5180064", "0.5177991" ]
0.0
-1
GET /orders/1 GET /orders/1.json
def show @order = Order.find(params[:id]) @net_total = 0 @gross_total = 0 @order.line_item.each do |line| @net_total += line.product.price end @gross_total = @net_total + @net_total * ::Rails.application.config.vat.to_d respond_to do |format| format.html # show.html.erb format.json { render :json => { :order => @order, :line_items => @order.line_item, :net => @net_total, :gross => @gross_total } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def show\n order = Order.find(params[:id])\n render json: order\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order\n end", "def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end", "def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def show\n render json: @order\n end", "def show\n render json: @order\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend", "def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end", "def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def index\n @orders = @group.orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end", "def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end", "def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end", "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "def index\n @orders = order.all\n end", "def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend", "def get_order(order_id)\n res = request('get', \"https://#{orders_path}/#{order_id}\")\n parse_response res\n end", "def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end", "def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end", "def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end", "def get(order_id)\n get_request(t_url(:order, order_id))\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end" ]
[ "0.75541574", "0.7488339", "0.7475185", "0.7377694", "0.73708034", "0.7341382", "0.73380613", "0.73162127", "0.73021704", "0.72915435", "0.72915435", "0.72915435", "0.72915435", "0.72914135", "0.7281102", "0.7266549", "0.72492564", "0.7228431", "0.7213597", "0.71825826", "0.71255296", "0.71255296", "0.709656", "0.70882815", "0.7045495", "0.70169884", "0.7011658", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.70051557", "0.69784856", "0.6974998", "0.69637406", "0.69516975", "0.69197875", "0.69197875", "0.6911124", "0.69071174", "0.6903772", "0.68895686", "0.6880591", "0.6870469", "0.6852626", "0.68313205", "0.6830282", "0.682785", "0.68217796", "0.68198013", "0.6808636", "0.6790433", "0.678807", "0.67848045", "0.67503476", "0.6737881", "0.6725027", "0.671472", "0.67058384", "0.6702486", "0.6702486", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037", "0.6698037" ]
0.0
-1
GET /orders/new GET /orders/new.json
def new @order = Order.new respond_to do |format| format.html # new.html.erb format.json { render json: @order } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @order = Order.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @path = '/orders'\n @method = 'post'\n @order = Order.new\n @bundles = Bundle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n #@order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html #new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n \t@title = \"New Order\"\n @navinner = \"1\"\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n \t@title = \"New Order\"\n @navtop = \"3\"\n @order = Order.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@order}\n end\n end", "def new\n @admin_order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_order }\n end\n end", "def new\n @title = t 'view.orders.new_title'\n @order = current_customer.orders.build(\n include_documents: session[:documents_to_order]\n )\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new_order(params)\n camelcase_params!(params)\n call_api('NewOrder', params)\n end", "def new\n @order_detail = OrderDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @order_detail }\n end\n end", "def new\n \t redirect_to orders_url\n# @order = Order.new\n\n# respond_to do |format|\n# format.html # new.html.erb\n# format.json { render json: @order }\n# end\n end", "def new\n @order = Order.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item}\n end\n end", "def new\n @breadcrumb = 'create'\n @order_status = OrderStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_status }\n end\n end", "def new\n @order = Order.new\n respond_with(@order)\n end", "def new\n @order_pick = OrderPick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_pick }\n end\n end", "def new\n @planned_order = PlannedOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planned_order }\n end\n end", "def new\n @item = Item.new\n \n @order = Order.new\n @order.order_number = 'NEW ORDER'\n \n @customer = Customer.new\n @address = Address.new\n @address.state = 'IL'\n \n # Ledgers\n @deposit_ledger = Ledger.new\n @payment_ledger = Ledger.new\n \n # Remaining balance\n @remaining_balance = 'NEW ORDER'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @delivery_order = DeliveryOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_order }\n end\n end", "def new\n @order_log = OrderLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_log }\n end\n end", "def new\n @sorder = Sorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sorder }\n end\n end", "def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end", "def new\n @purchaseorder = Purchaseorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchaseorder }\n end\n end", "def new\n # sets the current order to be the new order which the current customer is creating\n @order = current_customer.orders.new\n end", "def new\n @service_order = ServiceOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new_for_order\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html\n format.json { render json: @cliente }\n end\n end", "def new\n @order = Order.new\n @order.sales.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @order = Order.new\n @items = OrderItem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @joborder = Joborder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @joborder }\n end\n end", "def new\n @workorder = Workorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workorder }\n end\n end", "def new\n @store_manager_order = Store::Manager::Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_order }\n end\n end", "def new\n @yummy_tummy_day_order = YummyTummyDayOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yummy_tummy_day_order }\n end\n end", "def new\n\t\tif params[:client]\n\t\t\t@admin_order = Admin::Order.new(:status => 1, :client_id => params[:client], delivery: 0, confirmed_at: Time.now)\n\t\telse\n\t\t\t@admin_order = Admin::Order.new(:status => 1, delivery: 0, confirmed_at: Time.now)\n\t\t\t#@admin_order.client = Admin::Client.new\n\t\t\t#@admin_order.client.addresses.build\n\t\tend\n\t\t@admin_order.order_items.build\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @admin_order }\n\t\tend\n\tend", "def create\n order = Order.create(order_params)\n render json: order\nend", "def new\n redirect_to :action => 'index'\n return\n @title = 'Creating a new order'\n initialize_new_order\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @incomming_order = IncommingOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incomming_order }\n end\n end", "def new\n\t\t@cart = current_cart\n\t\tif @cart.line_items.empty?\n\t\t\tredirect_to store_url, notice: \"Your cart is empty\"\n\t\t\treturn\n\t\tend\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order_datail = OrderDatail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_datail }\n end\n end", "def new\n @order = Order.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def create\n order = Order.create(order_params)\n if order.save\n render json: order\n else\n render new\n end\n end", "def new\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.new\n @order_item.owner = current_user\n item_id = request[:item_id]\n unless item_id.nil?\n @order_item.item_id = item_id\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @order = Order.new\n\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @customer = current_user.customers.find(params[:customer_id])\n @order = current_user.orders.build(:name => @customer.name, \n :phone => @customer.phone, :address => @customer.address, \n :instruction => @customer.note,\n :customer_id => params[:customer_id], :total => 0.00)\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @order = Order.new\n end", "def new\n @order = Order.new\n end", "def new\n @order = Order.new\n end", "def new\n @order = Order.new\n end", "def new\n @order = Order.new\n end", "def new\n @order = Order.new\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @ped = Ped.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ped }\n end\n end", "def new\n @loaded_order = @order.build_loaded_order()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loaded_order }\n end\n end", "def new\n @order = Order.new\n @order.ingredients.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_order }\n format.xml { render xml: @work_order }\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end", "def new #if order(user_id) exists \"pending\", show else create new\n @order = Order.new #MAY NEED SESSION ID INPUT\n render :products #Assuming we've created new order for guest/created new account and are now logged in\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @cart = current_cart\n if @cart.line_items.empty?\n redirect_to root_url, notice: \"Your cart is empty\"\n return\n end\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @trade = Trade.new\n\n render json: @trade\n end", "def new\n # @url = \"http://rate-exchange.appspot.com/currency?from=IDR&to=USD\"\n @cart = current_cart\n @cart.line_items.each do |item|\n @productid = item.product.id\n end\n @destinations = Destination.find(:all, group: \"state_id\")\n # @states = State.find(:all, conditions: { state_status: 1 })\n @states = State.find(:all, conditions: { state_status: 1 })\n\n @user = current_user\n if @user.blank?\n @order = Order.new(cart_id: @cart.id)\n else\n @order = Order.new(account_member_id: @user.id, cart_id: @cart.id)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end" ]
[ "0.7949203", "0.79032564", "0.7840862", "0.7822019", "0.77941996", "0.77778167", "0.773388", "0.74842054", "0.7483639", "0.7427913", "0.72704005", "0.72664636", "0.7265858", "0.72648495", "0.7250548", "0.7250548", "0.7235224", "0.7225517", "0.72159165", "0.7198694", "0.71832716", "0.71665066", "0.7164588", "0.71335024", "0.71293926", "0.7126562", "0.7119108", "0.7116643", "0.7097141", "0.70693344", "0.70693344", "0.70693344", "0.70693344", "0.70693344", "0.70693344", "0.70664763", "0.706176", "0.70501286", "0.70390517", "0.70220584", "0.6994232", "0.6969639", "0.6968741", "0.69671345", "0.69638765", "0.6960523", "0.69534254", "0.69534254", "0.6952545", "0.6947295", "0.6934513", "0.69155604", "0.68895936", "0.6870656", "0.68280697", "0.68254054", "0.6823432", "0.68091977", "0.6807674", "0.6807674", "0.6807674", "0.6807674", "0.6807674", "0.6807674", "0.68067056", "0.6785726", "0.6780242", "0.6762365", "0.67613286", "0.6745689", "0.67419595", "0.67335504", "0.67254907", "0.67254907", "0.67254907", "0.67254907", "0.67253876", "0.6718356", "0.6718356", "0.6718356", "0.6700756", "0.66971505", "0.6694397", "0.6694397" ]
0.7956708
15
POST /orders POST /orders.json
def create @order = Order.new(params[:order]) respond_to do |format| if User.exists?(params[:order][:user_id]) if @order.save format.html { redirect_to @order, notice: 'Order was successfully created.' } format.json { render json: @order, status: :created, location: @order } else format.html { render action: "new" } format.json { render json: @order.errors, status: :unprocessable_entity } end else format.html { render action: "new" } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end", "def create_order(order_params)\n res = request('post', \"https://#{orders_path}\", order_params)\n parse_response res\n end", "def create\n @order = @orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Order was successfully created.\" }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_order(options)\n request :account, :post, 'order', options\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('app.orders.create.success') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: { order_id: @order.id }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n order = Order.create(order_params)\n if order.save\n render json: order\n else\n render new\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_orders params\n @orders_hash = JSON.parse(params)\n\n @orders_hash['orders'].each do |order|\n add_order(order[\"origin\"],order[\"destination\"],order[\"size\"])\n end\n true\n end", "def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end", "def create\n @order = current_owner.orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_path, notice: 'Order was created successfully' }\n format.json { render :show, status: :created, location: orders_path }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n @order_sales = @order.sales\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully created.' } }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def phone_order(params)\n path = @version + '/Phone/Order/'\n method = 'POST'\n return request(path, method, params)\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @v1_order = V1::Order.new(v1_order_params)\n\n if @v1_order.save\n render json: @v1_order, status: :OK, location: @v1_order\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n end", "def create_test_order(options)\n request :account, :post, 'order/test', options\n end", "def create\n @order = Order.new(params[:order])\n @order.user_id = current_user.user_id\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to order_url(@order), notice: I18n.t('orders.successfully_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = current_user.orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n @order.submitted_by_id = current_user.id\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_url, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order, @errors = Order.create_from_cart(@cart, order_params)\n\n if @order\n render json: @order, status: :created, location: @order\n else\n render json: @errors, status: :unprocessable_entity\n end\n end", "def create\n @admin_order = Order.new(params[:admin_order])\n\n respond_to do |format|\n if @admin_order.save\n format.html { redirect_to @admin_order, notice: 'Order was successfully created.' }\n format.json { render json: @admin_order, status: :created, location: @admin_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end", "def create\n @order = Order.new( order_params )\n @order.system_id = Order.set_system_id\n respond_to do |format|\n if @order.save\n set_order_values(@order,params)\n route = 'https://private-3643a-orderlordapi.apiary-mock.com/api/v1/jobs'\n respose = HTTParty.post(route, body: @body, :headers => @headers)\n parsed_response = respose.parsed_response.symbolize_keys!\n if \tparsed_response[:success] == \"true\"\n @order.tracker_hash = parsed_response[:tracker_hash]\n @order.save!\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if order.save\n format.html { redirect_to order, notice: 'Order was successfully created.' }\n format.json { render json: order, status: ':created', location: order }\n else\n format.html { render action: 'new' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def create\n # 前端傳回的資料,呼叫 order_params 過濾前端傳回來的資料,用 new 創出一個 Order 的物件 (此時還是 ruby 物件喔)\n @order = Order.new(order_params)\n\n respond_to do |format|\n # save 是指把該筆 物件裡的資料存入資料庫內\n if @order.save\n # 若儲存成功,就導回該筆資料的 show 頁面\n format.html { redirect_to order_path(@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n # 若儲存失敗,就導回新增的頁面重新填寫資料\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end", "def write_order(order, request_body = nil)\n path = \"/checkout/orders\"\n path += \"/#{order.id}\" if order.id\n\n request_body ||= order.to_json\n response = https_connection.post do |req|\n req.url path\n\n req.headers['Authorization'] = \"Klarna #{sign_payload(request_body)}\"\n req.headers['Accept'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json',\n req.headers['Content-Type'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json'\n req.headers['Accept-Encoding'] = ''\n\n req.body = request_body\n end\n handle_status_code(response.status, response.body)\n response\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n @order.order_create\n format.html { redirect_to @order, notice: 'Замовлення успішно створено.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_url, notice: 'Dati commessa caricati.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(order)\n build_persisted_order(\n post('/market/orders', order.symbolize_keys.merge(side: SIDES_MAP.fetch(order.fetch(:side))))\n )\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to home_path, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{order_params['email'].to_s}\")\n codeCustomer = res.code\n dataCustomer = res.parsed_response\n p res\n res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n #res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n codeItem = res.code\n dataItem = res.parsed_response\n p dataItem\n if codeCustomer != 404 && codeItem != 404\n newParams = order_params\n newParams[\"award\"] = dataCustomer[\"award\"] \n newParams[\"price\"] = dataItem[\"price\"]\n newParams[\"total\"] = dataItem[\"price\"] - dataCustomer[\"award\"]\n p newParams\n \n #HTTParty.put(\"http://localhost:8081/customers/order?award=#{newParams['award']}&total=#{newParams[\"total\"]}&customerId=#{newParams['customerid']}\")\n end\n if codeCustomer == 404 || codeItem == 404\n if codeCustomer == 404 and codeItem == 404\n render json: {error: \"Customer and Item do not exist\"}, status: 400\n return\n end\n if codeCustomer == 404 and codeItem != 404\n render json: {error: \"Customer does not exist\"}, status: 400\n return\n end\n if codeCustomer != 404 and codeItem == 404\n render json: {error: \"Item does not exist\"}, status: 400\n return\n end\n else\n @order = Order.new\n @order.customerid = dataCustomer[\"id\"]\n @order.email = dataCustomer[\"email\"]\n @order.itemid = order_params[:itemid]\n @order.description = dataItem[\"description\"]\n @order.award = newParams[\"award\"]\n @order.total = newParams[\"total\"]\n @order.price = newParams[\"price\"]\n \n orderResult = HTTParty.put('http://localhost:8081/customers/order', \n :body => @order.to_json,\n :headers => {'Content-Type' => 'application/json', 'ACCEPT' => 'application/json'}\n )\n\n res = HTTParty.put(\"http://localhost:8082/items/#{order_params[:itemid]}?stockQty=#{dataItem['stockQty']-1}&description=#{dataItem['description']}&price=#{dataItem['price']}&id=#{order_params[:id]}\")\n p res\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n \n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n end", "def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order.uuid = SecureRandom.hex(8)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render 'show', status: :created, location: @order }\n else\n format.html { render 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Create the order \n @order = Order.new\n @email = params[:email]\n \n # Invoke the customer service to retrieve the customer id using the customers\n customerCode, customer = Customer_Service.getCustomerByEmail(@email)\n \n # Check to make sure the customer can be found\n if customerCode != 200\n render json: { error: \"Customer could not be found. \", status: 400 }\n return\n end\n \n # Invoke the item service to retrieve the item information\n orderCode, item = Item_Service.getItemById(params[:itemId])\n # Check to see if the item can be found\n if orderCode != 200\n render json: { error: \"Item could not be found\", status: 400 }\n return\n end\n # Check to see if the item is in stock\n if item[:stockQty] <= 0\n render json: { error: \"Item is out of stock\", status: 400 }\n return\n end\n \n \n # Construct the object\n @order.itemId = params[:itemId]\n @order.description = item[:description]\n @order.customerId = customer[:id]\n @order.price = item[:price]\n @order.award = customer[:award]\n @order.total = @order.price - @order.award\n \n # Check to see if the order can be saved\n if @order.save\n # Save the order to the customer and save it to the item\n tempCode = Customer_Service.postOrder(@order)\n tempCode = Item_Service.postOrder(@order)\n render json: @order, status: 201\n else\n render json: @order.errors, status: 400\n end\n \n end", "def new\n @path = '/orders'\n @method = 'post'\n @order = Order.new\n @bundles = Bundle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n persist_order_address\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Don't think you're going to be there when we deliver? Leave cash in an envelope outside your door. Otherwise, we'll see you in person!\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@order = Order.new(order_params)\n\t\[email protected]_id = current_user.id\n\t\[email protected]_date = Time.now\n\t\[email protected] = 1\n\n\t\trespond_to do |format|\n\t\t\tif @order.save\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @order }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_path, notice: 'Order berhasil, tunggu untuk konfirmasi selanjutnya' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n\n @basket = ActiveSupport::JSON.decode(cookies[\"basket\"])\n p @basket\n @basket.each do |order_position|\n @order_detail = OrderDetail.create!(order: @order, product_id: order_position[0], qty: order_position[1])\n end\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@admin_order = Admin::Order.new(order_params)\n\n\t\trespond_to do |format|\n\t\t\tif @admin_order.save\n\t\t\t\tif params[:order_update].present?\n\t\t\t\t\tformat.html { redirect_to edit_admin_order_path(@admin_order), notice: 'Pedido criado com sucesso.'}\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @admin_order, notice: 'Pedido criado com sucesso.' }\n\t\t\t\t\tformat.json { render json: @admin_order, status: :created, location: @admin_order }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @admin_order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new_order(params)\n camelcase_params!(params)\n call_api('NewOrder', params)\n end", "def create\n @order = Order.new JSON.parse request.body.read\n\n respond_to do |format|\n rescue_connection_failure do\n if @order.save\n format.html { redirect_to @order, notice: 'ORder was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def create\n @order = Order.new :user_id => params[:user_id], :order_list => params[:order_list], :table_number => params[:table_number], :paid => params[:paid], :fb_user => params[:fb_user], :business_name => params[:business_name]\n @order.order_list = []\n @order.paid = false\n\n success_msg = {\n \"messages\": [\n {\"text\": \"Your order was created.\"},\n {\"text\": \"Thank you.\"}\n ]\n }\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :json => success_msg }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end", "def create\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save_with_items(current_user)\n format.json { render json: @order, status: :created }\n format.html { redirect_to @order }\n else\n format.html do\n set_feed_back\n set_addresses_add_express_fee\n\n set_wx_cards\n\n flash.now[:error] = @order.errors.full_messages.join(', ')\n\n render :confirmation, status: :unprocessable_entity\n end\n\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n @order.status = \"Pending\"\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def order_post(order, api_key, opts = {})\n data, _status_code, _headers = order_post_with_http_info(order, api_key, opts)\n return data\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Provider was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tredirect_to orders_url\n# @order = Order.new(params[:order])\n\n# respond_to do |format|\n# if @order.save\n# format.html { redirect_to @order, notice: 'Order was successfully created.' }\n# format.json { render json: @order, status: :created, location: @order }\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @order.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def create\n @title = t 'view.orders.new_title'\n @order = current_customer.orders.build(params[:order])\n session[:documents_to_order].try(:clear)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('view.orders.correctly_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n @order.user = current_user\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def create\n @order = Order.new(tl_params)\n\n if @order.save\n if params[:product]\n \[email protected]_order(params[:product])\n end\n render json: @order, status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def create\n fail = false\n itemId = order_params[:itemId]\n customerId = order_params[:customerId]\n \n #logger.debug \"getting item\"\n self.class.base_uri \"http://localhost:8082\"\n uri = \"/items/%d\" % [itemId]\n response = self.class.get uri\n \n #Check if item of this id was fetched correctly\n if response.code == 200\n item = response.body\n else\n fail = true\n end\n #logger.debug item\n\n #logger.debug \"getting customer\"\n self.class.base_uri \"http://localhost:8081\"\n uri = \"/customers?id=%d\" % [customerId]\n response = self.class.get uri\n \n\n #Check if customer of this id was fetched correctly\n if response.code == 200\n customer = response.body\n else\n fail = true\n end\n #logger.debug customer\n \n #If item and customer are found, create the order, otherwise, give a 404 not found error\n if !fail\n #logger.debug \"success\"\n item = JSON.parse(item)\n description = item[\"description\"]\n \n price = item[\"price\"].to_f #to float, as it's parsed as a string for some reason\n logger.debug price\n customer = JSON.parse(customer)\n \n award = customer[\"award\"]\n total = price - award\n \n @order = Order.new({itemId: itemId, customerId: customerId, description: description, price: price, award: award, total: total})\n if @order.save\n render json: @order, status: 201\n \n # #raise ActiveRecord::Rollback, \"Rolling back changes\"\n else\n render json: @order.errors.messages, status: 400\n end\n else\n head 404\n end\n\n end", "def create\n @order = Order.new(order_params)\n \n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :print => 'true' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @orders = Order.all\n @order = Order.create(order_params)\n\n=begin\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n redirect_to :action => :index\n else\n render :action => :new\n end\n end\n end", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end", "def make_api_call_for_order_creation(url, api_params, access_token)\n RestClient.post(url, api_params, Authorization: \"Bearer #{access_token}\", content_type: :json)\n end", "def create\n @ordered = Ordered.new(ordered_params)\n\n respond_to do |format|\n if @ordered.save\n format.html { redirect_to @ordered, notice: 'Ordered was successfully created.' }\n format.json { render :show, status: :created, location: @ordered }\n else\n format.html { render :new }\n format.json { render json: @ordered.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n @order.user_id = session[:user_id]\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t @order = Order.new\n\t code, customer = Customer.getCustomer(params[:email])\n\t \n\t if code != 200\n\t\t render json: { error: \"Customer email not found. #{params[:email]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t code, item = Item.getItemById(params[:itemId])\n\t if code != 200\n\t\t render json: { error: \"Item id not found. #{params[:itemId]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t if item[:stockQty] <= 0\n\t\t render json: { error: \"Item is out of stock.\"}, status: 400\n\t\t return\n\t end\n\t \n\t @order.itemId = item[:id]\n\t @order.description = item[:description]\n\t @order.customerId = customer[:id]\n\t @order.price = item[:price]\n\t @order.award = customer[:award]\n\t @order.total = @order.price - @order.award\n\t \n\t if @order.save\n \t\t# put order to customer and item subsystem to do their updates\n\t\t code = Customer.putOrder(@order)\n\t\t code = Item.putOrder(@order)\n\t\t render json: @order, status: 201\n\t else\n \t\trender json: @order.errors, status: 400\n \tend\n end", "def order_params\n params.require(:order).permit(:date, :obs, :client_id)\n end", "def create\n if params[:order][:id]\n build do\n message 'Повторый заказ'\n order Order.create_order_from_order(params[:order][:id])\n view 'consumer/orders/show'\n end\n elsif Order.create_orders_from_cart(params[:cart_id], current_user)\n build do\n message 'Создание заказов'\n view 'consumer/orders/create'\n end\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n UserMailer.order_email(@order).deliver\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247", "0.67782325", "0.6771919", "0.6771919", "0.67691034", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6754747", "0.6750308", "0.6741648", "0.6727289", "0.67202854", "0.67192626", "0.67174095", "0.66730356", "0.66511375", "0.66424936", "0.66256195", "0.66148645", "0.65905017", "0.6581552", "0.6574477", "0.65712935", "0.65698874", "0.6569679", "0.65657544", "0.656543", "0.6562849", "0.6553006", "0.65528905", "0.65511286", "0.65461224", "0.6544374", "0.65240365", "0.65232676", "0.6502522", "0.64868236", "0.6485337", "0.6483515", "0.64801395", "0.6467508", "0.6463724", "0.6455904", "0.64464027", "0.6438949", "0.64251065", "0.6424166", "0.6408214", "0.64042836", "0.6403627", "0.63958675", "0.639366", "0.63919747", "0.6391734", "0.6390046", "0.63786453", "0.6368862", "0.63676715", "0.63499165", "0.6326805", "0.6325994", "0.6319851", "0.63150823", "0.6309701", "0.6297522", "0.62932307", "0.6284583", "0.62811166", "0.6266786", "0.6266663", "0.62406427", "0.6232846", "0.6231927" ]
0.0
-1
PUT /orders/1 PUT /orders/1.json
def update @order = Order.find(params[:id]) respond_to do |format| if @order.update_attributes(params[:order]) format.html { redirect_to @order, notice: 'Order was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update_order(order_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice=>\"Order was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@order.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "def update\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n if @order1.update_attributes(params[:order1])\n format.html { redirect_to stores_path, notice: 'Order1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @order.update(order_params)\n render :show, status: :ok, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n @order.update_attributes(params[:order])\n redirect_to orders_path\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('orders.creat')}\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to order_url(@order), notice: I18n.t('orders.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to orders_url, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render json:@order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('app.orders.update.success') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @orders_path }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @orders = Order.all\n @order = Order.find(params[:id])\n\n @order.update_attributes(order_params)\n\n=begin\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params)\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.mobile { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.mobile { render action: 'edit' }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n redirect_to orders_path\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully updated.' } }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('Order was successfully updated') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: \"Order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = resource\n respond_to do |format|\n if @order.update_attributes(params[:order])\n flash[:notice] = 'Order was successfully updated.'\n format.html { redirect_to(@order) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was updated successfully' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6894482", "0.6894482", "0.680481", "0.66316754", "0.66230804", "0.661799", "0.6603682", "0.6577292", "0.6577292", "0.6543601", "0.6540103", "0.65316814", "0.6520171", "0.650758", "0.65062475", "0.6491979", "0.64841974", "0.6436091", "0.6424726", "0.6417646", "0.6415472", "0.6397289", "0.63890076", "0.63862795", "0.63842267", "0.6382166", "0.6379015", "0.63786685", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6378099", "0.6364922" ]
0.6553004
31
DELETE /orders/1 DELETE /orders/1.json
def destroy @order = Order.find(params[:id]) # @order.destroy respond_to do |format| format.html { redirect_to @order, notice: 'Deletion of orders not allowed.' } format.json { render json: @order.errors, status: :method_not_allowed } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n #@order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n render json: {success: true, status: :ok} \n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: t('orders.deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @allorder.destroy\n respond_to do |format|\n format.html { redirect_to allorders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to farm_orders_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @order1.destroy\n respond_to do |format|\n format.html { redirect_to order1s_url, notice: 'Order1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url, notice: I18n.t('orders.successfully_deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n head :no_content\n end", "def destroy\n @order = Order.get!(params[:id])\n @order.destroy if @order\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Замовлення скасовано.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @updateallorder.destroy\n respond_to do |format|\n format.html { redirect_to updateallorders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to api_orders_url, notice: \"Order was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to circle_orders_path, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'La transacción se ha eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7590849", "0.747398", "0.74286", "0.73708075", "0.73703325", "0.73698306", "0.7356173", "0.7356173", "0.7356173", "0.7356173", "0.7356173", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7346293", "0.7345968", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.7310058", "0.72912127", "0.7281585", "0.7278962", "0.72362", "0.7228051", "0.7187858", "0.7183578", "0.71490043", "0.7148081", "0.71446365", "0.713004", "0.71136177", "0.71009153", "0.7091535", "0.7080973", "0.70747125", "0.70746523", "0.7071042", "0.70603037", "0.70603037", "0.70586854", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148", "0.7058148" ]
0.0
-1
GET /orders/1/place GET /orders/1/place.json
def place @order = Order.find(params[:id]) if(@order.status == "DRAFT") if(LineItem.where(:order_id => params[:id]).count > 0) @order.status = "PLACED" respond_to do |format| if @order.save format.html { redirect_to @order, notice: 'Order was successfully upgraded to PLACED.' } format.json { render json: @order, status: :accepted, location: @order } else format.html { render action: "new" } format.json { render json: @order.errors, status: :unprocessable_entity } end end else respond_to do |format| format.html { redirect_to @order, notice: 'You must have a single line item in this order first.' } format.json { render json: @order.errors, status: :method_not_allowed } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @place = Place.find(params[:id])\n render json: @place\n end", "def show\n place = Place.find(params[:id])\n\n render json: place\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "def show\n render json: @place\n end", "def show\n render json: @place\n end", "def index\n render json: @places\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: @place }\n end\n end", "def locations(place)\n get :loc => place\n end", "def index\n @places = Place.order(\"place_type_id\").order(\"town_id\").order(\"name\").page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end", "def index\n @places = Place.all\n render json: { places: @places }, methods: [:reviews, :visit_ids, :image_url_large]\n # render json: @places, methods: :reviews # return a place object not a places object as above\n end", "def show\n respond_with @place, status: :ok, location: places_path(@place)\n end", "def show\n @places = @client.places.page params[:place_page]\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def show\n @place = Place.find(params[:id])\n #debugger\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def index\n respond_to do |format|\n format.html { @places = Place.order(:name) }\n format.json { @places = Place.order(:name) }\n end\n end", "def show\n @place = Place.find(params[:id])\n @comment = Comment.new(place_id: @place.id)\n @json = Place.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show \n @place = Place.find(params[:id]) \n render json: {status:'SUCCESS',message:'Louded place',data:@place},status: :ok\n\n\n end", "def show\n @place = Place.find(params[:id])\n respond_with(@place)\n end", "def show\n @place = Place.find(params[:id])\n end", "def show\n @order = Order.find(params[:id])\n @order_positions = @order.order_positions\n @address = Address.find(@order.address_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def geo(place_id)\n get \"/geo/id/#{place_id}.json\"\n end", "def google_places\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_KEY'])\n @results = @client.spots(params[:latitude], params[:longitude], :name => 'bar', :types => ['bar', 'night_club'], :radius => 10000)\n @spots = @results.map do |spot|\n spot.place_id = spot.id\n spot\n end\n render json: @spots\n end", "def show\n @place = Place.find_by(:id=> params[\"id\"])\n end", "def new\n place = Place.new\n\n render json: place\n end", "def index\n @places = Place.all\n render json: @places , status: 403\n end", "def places_kinds\n render json: Place.places_kinds\n end", "def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end", "def show\n @place = Place.find(params[:id])\n @locals = Local.all\n @ticket_type_groups = TicketTypeGroup.order(:value)\n @statuses = Status.order(:value)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @place }\n end\n end", "def index\n respond_to do |format|\n format.html {\n @places = Place.paginate(page: params[:page])\n }\n format.json {\n @places = Place.all\n }\n end\n end", "def find_place\n\t @place = Place.get(params[:place_id]) unless params[:place_id].nil?\n\tend", "def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show\n @dataele_place = DataelePlace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataele_place }\n end\n end", "def index\n @api_vi_places = Api::Vi::Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place.to_xml(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n format.json { render :json => @place.to_json(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n end\n end", "def show\n @place = @event.places.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def show\n render json: @place_visit\n end", "def index\n # @places = Place.get_nearby_places(params[:lat], params[:lon]).paginate(:page => get_page)\n @places = Kaminari.paginate_array(Place.get_close_places(params[:lat], params[:lon], params[:radius])).page(get_page)\n render :json => \n { \n :places => @places.as_json(:lean_list => true),\n :page_info => \n { \n :page => get_page,\n :per_page => Place.per_page,\n :total_entries => @places.total_count \n }\n }\n end", "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "def show\n render json: @order\n end", "def show\n render json: @order\n end", "def find_place\n\t @place = Place.get(params[:id]) unless params[:id].nil?\n\tend", "def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def place_search\n @places = []\n area = params[:area_id].blank? ? nil : Place.find(params[:area_id])\n if area.present? && area.area > 0\n search_text = Riddle::Query.escape(help.strip_links(params[:search]))\n results = Place.search(search_text, :field_weights => { :name => 10 })\n\n results.each do |place|\n @places << place if place.areas.include?(area)\n end\n end\n \n respond_to do |format|\n format.json\n end\n end", "def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def place\n Place.find(@place) if [email protected]?\n end", "def place_details(place_id:, language: nil)\n params = {'placeid' => place_id }\n if language\n params['language'] = language\n end\n\n self.client.request(url: \"/maps/api/place/details/#{self.client.response_format}\", params: params)\n end", "def show\n if params[:distancia]\n distancia = params[:distancia]\n else\n distancia = 100\n end\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@place.latitude},#{@place.longitude}&radius=#{distancia}&type=#{params[:tipo]}&key=#{Rails.application.secrets.google_places_key}\"\n uri = URI(url)\n http_call = Net::HTTP.get(uri)\n response = JSON.parse(http_call, {:symbolize_names => true})\n @locations = response[:results]\n @hash = Gmaps4rails.build_markers(@place) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place[:name]\n end\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end", "def place\n raise CatalogAPI::Error, 'No Items' if items.nil? || items.length.zero?\n raise CatalogAPI::Error, 'No Socket ID' if items.first.socket_id.nil?\n raise CatalogAPI::Error, 'No First Name' if first_name.nil?\n raise CatalogAPI::Error, 'No Last Name' if last_name.nil?\n raise CatalogAPI::Error, 'No Adress1' if address_1.nil?\n raise CatalogAPI::Error, 'No City' if city.nil?\n raise CatalogAPI::Error, 'No State' if state_province.nil?\n raise CatalogAPI::Error, 'No Postal Code' if postal_code.nil?\n raise CatalogAPI::Error, 'No Country' if country.nil?\n raise CatalogAPI::Error, 'No Items' if items.nil?\n\n request = CatalogAPI.request.new(:order_place)\n request.post(place_params(request))\n json = request.json.dig(:order_place_response, :order_place_result)\n request.data = CatalogAPI::Order.new(json)\n request\n end", "def index\n @place_visits = PlaceVisit.all\n render json: { place_visits: @place_visits }\n end", "def index\n if params[:creator_id].present?\n @creator = Creator.find(params[:creator_id])\n places = @creator.places.limit(@limit).offset(@offset).latest\n else if params[:tag_id].present?\n @tag = Tag.find(params[:tag_id])\n places = @tag.places.limit(@limit).offset(@offset).latest\n else\n places = Place.limit(@limit).offset(@offset).latest\n end\n end\n if places.present?\n respond_with places, status: :ok\n else\n render json: {error: 'Could not find any resources at all. Check if you are using the required parameters.'}, status: :not_found\n end\n end", "def get_place_detail(place_id)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_DETAILS)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n place_id: place_id,\n key: google_places_api_key\n })\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end", "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "def places\n body['places'].map { |p| Place.new(p, name) }\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order\n end", "def index\n @places = @event.places.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def find\n render json: format_places(closest(params[:latitude], params[:longitude]).take(3))\n end", "def set_places\n @place = Place.find(params[:id])\n end", "def show\n order = Order.find(params[:id])\n render json: order\n end", "def info\n @historic_place = HistoricPlace.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { render :xml => @historic_place }\n format.json { render :json => @historic_place }\n end\n end", "def show\n @placemark = Placemark.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @placemark }\n end\n end", "def index\n @places = Place.page(params[:page]).per(10).all\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n format.plist { render plist: @place }\n end\n end", "def show\n\n\t\t@ride ||= Ride.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { ride: @ride.as_json }, :methods => :nearby }\n end\n end", "def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def index\n authorize Place\n @places = Place.order(name: :asc).page params[:page]\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end", "def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end", "def show\n @order = Order.includes(:order_positions, :pizzeria => :pizzas).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def index\n @reviews = Review.order(:place_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show \n @order = Order.find(params[:order_id])\n @order_item = OrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end", "def get_place\n @spot = ((GooglePlaces::Client.new(ENV['GOOGLE_CLIENT_ID'])).spots_by_query(\"Food near #{@user.location}\"))\n @place = @spot[rand(20)]\n @url = @place.photos[0].fetch_url(800)\n end" ]
[ "0.7444841", "0.73956746", "0.71724457", "0.71724457", "0.71724457", "0.71674013", "0.7072788", "0.704947", "0.70300436", "0.7016436", "0.7007374", "0.6955768", "0.6921959", "0.6853333", "0.684218", "0.6831925", "0.6794288", "0.6778926", "0.67473364", "0.6732802", "0.67262685", "0.6699969", "0.66787416", "0.6588765", "0.6587587", "0.6561973", "0.6517258", "0.6508941", "0.650217", "0.64969", "0.64807177", "0.64722514", "0.6471767", "0.6445448", "0.6434536", "0.6413777", "0.63897854", "0.6388533", "0.63836336", "0.63836336", "0.63836336", "0.63836336", "0.63836336", "0.63836336", "0.635651", "0.6340736", "0.6333879", "0.63244265", "0.63244265", "0.63244265", "0.63244265", "0.63244265", "0.63084674", "0.6307633", "0.6303891", "0.6303891", "0.63036555", "0.63036555", "0.62947196", "0.62875354", "0.6269926", "0.6269926", "0.6269926", "0.6269926", "0.6269926", "0.6264009", "0.6240496", "0.6232625", "0.6221129", "0.6217606", "0.62119746", "0.62119746", "0.62119746", "0.61870015", "0.6186799", "0.6184171", "0.61689854", "0.614526", "0.61398625", "0.61355096", "0.6134198", "0.6125268", "0.6120198", "0.6117535", "0.6116843", "0.6113181", "0.61123025", "0.6111491", "0.6107228", "0.6087297", "0.6079383", "0.6075483", "0.60725963", "0.60687464", "0.60657907", "0.6063119", "0.60527164", "0.60507864", "0.60482097", "0.60449314", "0.6019414" ]
0.0
-1
GET /orders/1/cancel GET /orders/1/cancel.json remember a note parameter must be passed with this request (e.g., /orders/1/cancel/?note=test)
def cancel @order = Order.find(params[:id]) if((@order.status == "DRAFT" || @order.status == "PLACED") && params.has_key?(:note)) @order.cancel_note = params[:note] @order.status = "CANCELLED" if @order.save respond_to do |format| format.html { redirect_to @order, notice: 'Cancelled!'} format.json { render json: @order, status: :accepted, location: @order } end end else respond_to do |format| format.html { redirect_to @order, notice: 'You must have a note param and either be in draft or placed mode.' } format.json { render json: @order.errors, status: :method_not_allowed } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end", "def cancel(params={})\n self.request(__method__, params)\n end", "def cancel\n order = current_user.customer.orders.find(params[:id])\n order.update(status: 9)\n render json: {is_success: true}, status: :ok\n end", "def cancel\n @order.cancel\n render_update @order\n end", "def cancel\n\t\tif params[:id] != 'new'\n\t\t\tlyric_line = LyricLine.find params[:id]\n\t\t\tdump_line lyric_line\n\t\telse\n\t\t\t@order_number = params[:order_number]\n\t\tend\n\tend", "def cancel\n @order.cancel!\n return redirect_to order_path(@order), :notice => t(:update_success)\n end", "def cancel_order(source_account, order_id)\n\tputs \"Canceling order: \" + order_id + \" from: \" + source_account\n\tresponse = request_put(\"/api/order/\" + source_account + \"/\" + order_id + \"/cancel\")\n\tputs response.body\nend", "def cancel(params)\n Ciirus::Commands::Cancel.new(credentials).call(params[:reference_number])\n end", "def cancel_orders\n @orders = search_reasult(params).where(\"fulflmnt_state = 'cancel'\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def cancel!\n update(request_cancelled: true)\n end", "def cancel\n @order.cancel_by_location\n render 'status'\n end", "def cancel\n canceller = OrderCanceller.new(order).all!\n if canceller.success?\n flash[:success] = 'Order was cancelled successfully.'\n redirect_to(:back)\n else\n flash[:error] = \"#{canceller.error}\"\n redirect_to(:back)\n end\n end", "def cancel_trip\n label = request_label(:cancel, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/cancel_trip\", \n :delete,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label)\n end", "def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end", "def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end", "def order_cancel_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.order_cancel ...'\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 OrderApi.order_cancel\"\n end\n # resource path\n local_var_path = '/v2/private/order/cancel'\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 form_params['symbol'] = symbol\n form_params['order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n form_params['order_link_id'] = opts[:'order_link_id'] if !opts[:'order_link_id'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey', 'apiSignature', 'timestamp']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#order_cancel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sell_shop_orders_request_cancellation (order_number, reason_string, params={})\r\n url = api_url \"/sell/shop/orders/#{order_number}/request_cancellation\"\r\n req = request_params(params)\r\n load = MultiJson.dump reason: reason_string\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end", "def cancel\n appointment_service.put_cancel_appointment(cancel_params)\n head :no_content\n end", "def cancelorder(uuid)\n res = sget(\"/cancel\", {uuid: uuid})\n ::BittrexRb::Response::Market.new(res)\n end", "def canceled\n respond_to do |format|\n if @reservation.update_marked_as_canceled\n ReservationMailer.canceled_email(@reservation).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully canceled.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :cancel }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def cancel_request\n if params.key?(:tutor_id) && params.key?(:student_id) && params.key?(:tutor_subject_id)\n pending_request = PendingTutorRequest.where('tutor_id = ? AND student_id = ? AND tutor_subject_id = ?',\n params[:tutor_id],\n params[:student_id],\n params[:tutor_subject_id]).first\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n else\n pending_request = PendingTutorRequest.find(params[:request_id])\n # Look into see if there is another way to do this.\n course = Course.find(TutorSubject.find(pending_request.tutor_subject_id).course_id)\n end\n\n pending_request.destroy\n course_code = course.course_prefix + course.course_code\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request Cencelled',\n 'body' => 'A request for ' + course_code + ' has been cancelled.',\n 'icon' => 'request_cancelled',\n 'color' => 'lightgrey',\n 'type' => 'cancel' }\n Notifications.send_notification(notifcation_params)\n\n head :ok\n end", "def cancel\n\t\tuseid = params[:format]\n\t\t@order = Order.find_by(id: useid)\n if @order.nil?\n\t\t\tflash[:danger] = \"Order can not be cancelled - invalid order\"\n\t\t\tif current_user.admin?\n\t\t\t\tredirect_to admin_path and return\n\t\t\telse\n\t\t\t\tredirect_to current_user and return\n\t\t\tend\n\t\tend\n\t\t@user = User.find_by(id: @order.user_id)\n if @user.nil?\n\t\t\tflash[:danger] = \"Order \\\"#{@order.name}\\\" can not be cancelled - invalid user\"\n\t\t\tif current_user.admin?\n\t\t\t\tredirect_to admin_path and return\n\t\t\telse\n\t\t\t\tredirect_to current_user and return\n\t\t\tend\n\t\tend\n\n\t\tif !(current_user?(@user) || current_user.admin?)\n\t\t\tflash[:danger] = \"Must be owner to perform this action.\"\n\t\t\tredirect_to(root_url) and return\n\t\tend\n\n\t\ta = @order.destroy\n\t\tif !a\n\t\t\tflash[:danger] = \"Order \\\"#{@order.name}\\\" could not be cancelled\"\n\t\telse\n\t\t\tflash[:success] = \"Order \\\"#{@order.name}\\\" has been cancelled\"\n\t\tend\n\t\t\n\t\tif current_user.admin?\n\t\t\tredirect_back(fallback_location: admin_path) and return\n\t\telse\n\t\t\tredirect_to current_user and return\n\t\tend\n\tend", "def cancel\n find_order\n @order.cancel! unless @order.canceled?\n settle_payments_if_desired\n render text: @settlement_results.to_json\n end", "def link_to_cancel(url)\n link_to_remote(\"Cancel\", :url => url, :method => :get, :with => \"{ cancel: true }\")\n end", "def cancel!\n logger.debug 'Cancel all orders'\n canceled_orders = client.cancel_orders\n logger.debug \"Orders canceled #{canceled_orders.count}\"\n end", "def cancel_order (order)\n if order.is_a?(Numeric)\n id = order\n elsif order.is_a?(Array)\n id = order[0]\n elsif order.instance_of?(Models::Order)\n id = order.id\n elsif order.kind_of?(Hash)\n id = order[:id] || order['id']\n else\n raise Exception, 'tried to cancel order with invalid ID'\n end\n authenticated_post(\"auth/w/order/cancel\", params: { :id => id }).body\n end", "def cancel(comment)\n params = { shipmentId: id, comment: comment }\n self.class.request(\n :post,\n self.class.uri('cancel'),\n json: params.merge(self.class.credentials)\n )\n end", "def cancel\n payment = Spree::Payment.find_by(id: params[:payment_id])\n redirect_to redirect_path(payment.try(:order))\n end", "def cancel\n success = current_subscriber.cancel_subscription\n render json: { success: success }\n end", "def yunbi_cancel_order (id:0, base:nil)\n if 0 == id\n return nil\n end\n\n begin\n client = new_yunbi_client\n response = client.post '/api/v2/order/delete', {\"id\":id}\n $LOG.debug (method(__method__).name) { {\"return\"=>response} }\n return response\n rescue Exception => e\n puts e\n $LOG.debug (method(__method__).name) { {\"error\"=>e} }\n return nil\n end\nend", "def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end", "def destroy\n \n respond_to do |format|\n if @req.destroy\n flash[:notice] = \"Responsibility request with id : '#{@req.id}' has been cancelled\"\n format.html { redirect_to responsibility_requests_url }\n format.xml { head :ok }\n else\n flash[:error] = \"Failed to cancel responsibility request '#{@req.id}'\"\n format.html { redirect_to service_url(@service) }\n end\n end\n end", "def private_cancel_get_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TradingApi.private_cancel_get ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling TradingApi.private_cancel_get\"\n end\n # resource path\n local_var_path = '/private/cancel'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'order_id'] = order_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TradingApi#private_cancel_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n set_cancel_status\n @ticket.save\n Account::Tickets::TicketLogs.cancel(@ticket)\n respond_to do |format|\n format.html { redirect_to @last_page, notice: 'Ticket was successfully canceled.' }\n format.json { head :no_content }\n end\n end", "def cancel\n set_params\n show_translation\n end", "def cancel\n if admin_user?\n cancel_reason_id = 2 # Product Not Available\n else\n cancel_reason_id = 1 # Customer\n end\n respond_to do |format|\n if @order.update_attributes(order_status_id: 4, cancel_reason_id: cancel_reason_id)\n @order.order_products.each do |order_product|\n product = order_product.product\n quantity = order_product.quantity\n new_quantity_in_stock = (product.quantity_in_stock + quantity)\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.cancel') } # \"Order was successfully canceled.\"\n format.json { head :no_content }\n else\n format.html { redirect_to orders_path, notice: t('orders.cancel') } # \"Order was successfully canceled.\"\n format.json { head :no_content }\n end\n else\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.cancel_error') } # \"Error canceling order.\"\n format.json { render json: @order.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to orders_path, notice: t('orders.cancel_error') } # \"Error canceling order.\"\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def cancelar\n respond_to do |format|\n if @ticket.update(status:3)\n \n @ticket.payment.update(estatus:0) unless @ticket.payment.pagado \n @ticket.payment.update(estatus:1) if [email protected] and @ticket.payment.interes > 0\n \n format.html { redirect_to \"/tickets?clave=#{@ticket.payment.id}\", notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to incoming_notes_url }\n format.json { head :no_content }\n end\n end", "def cancel\n redirect_to checkid_request.cancel_url\n end", "def cancellation_request(tid)\n cancellation_request = Cielo::CancellationRequest.new\n resul = send_request(cancellation_request.serialize(tid,@affiliation, @affiliation_key))\n end", "def cancel(order_id, &blk)\n params = { orderId: order_id, auth: true }\n if block_given?\n websocket.subscribe :cancel, params: params, &blk\n else\n http.post :cancel, params\n end\n end", "def click_cancel_new_note\n wait_for_update_and_click new_note_cancel_button_element\n end", "def ocancel\n @aorder=Aorder.find_by_id(params[:id])\n @aorder.iscanceled=true\n @aorder.ttmid=session[:user].id\n @aorder.save!\n redirect_to aorders_path\n end", "def cancel\n if @event.cancel\n render :json => @event.to_json, :status => :ok\n else\n render :nothing => true, :status => :unprocessable_entity\n end\n end", "def cancel\n @api_v1_reservation.update(status: :canceled)\n Api::V1::ReservationMailer.cancel_reservation(@api_v1_reservation).deliver_now\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def cancel_order(order_id)\n res = request('post', \"https://#{orders_path}/#{order_id}/cancel\")\n parse_response res\n end", "def cancel(unique_id)\n request('payment/cancel', :cancel => {:unique_id => unique_id} )\n end", "def destroy\n if @order.update(order_status: OrderStatus::Canceled.first)\n respond_to do |format|\n format.html { redirect_to admin_preorders_url }\n format.json { head :no_content }\n end\n end\n end", "def cancel\n begin\n payment = Payment.find_by_token!(params[:token])\n payment.cancel!\n flash[:notice] = \"Sie haben die Bezahlung per Paypal abgebrochen.\"\n\n redirect_to edit_order_url(payment.order)\n rescue Exception => e\n redirect_to store_url, flash: { error: e.message }\n end\n end", "def cancel\n @reservation.update(status: false)\n @reservation.seats.update(reserved: false)\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Reservation was successfully cancelled.' }\n format.json { head :no_content }\n end\n end", "def cancel( address )\n body = { address: address }\n post(\"/cancelpending\", { body: body } )\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to noticias_notes_url }\n format.json { head :no_content }\n end\n end", "def click_cancel_note_edit\n logger.debug 'Clicking the edit note Cancel button'\n wait_for_update_and_click edit_note_cancel_button_element\n end", "def cancel(original_reference:, reference:, merchantAccount: @merchant_account)\n postJSON(\"/Payment/v12/cancel\",\n reference: reference,\n merchantAccount: merchant_account,\n originalReference: original_reference\n )\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to course_notes_url(@note.course.slug), notice: 'Note was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def cancel\n @confirmation_header = \"confirm cancellation\"\n @confirmation_body = \"Are you Sure to cancel this subscription?\"\n @cancel = \"No, Thank you\"\n @submit = \"Confirm cancellation\"\n end", "def cancel\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.cancel \n flash[:notice] = 'Job was successfully cancelled.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cancel\n sanitized = whitelist(params, :complete)\n travel = Travels::Travel.find(sanitized[:id])\n\n unless travel.submitted? && travel.customer == current_user.becomes(Users::Customer)\n fail(:any, :bad_request, \"Sorry! You're not eligible to cancel travels other than just submitted!\")\n return\n end\n\n respond_to do |format|\n if travel.cancel\n format.html { redirect_to status_travel_path(travel) }\n format.json { render json: travel.as_json, status: :ok }\n else\n format.html { redirect_to status_travel_path(travel), alert: \"Failed to complete! Errors: #{travel.errors.full_messages}\" }\n format.json { render json: travel.as_json, status: :unprocessable_entity }\n end\n end\n end", "def click_cancel_new_note_modal\n logger.debug 'Clicking the new note Cancel button'\n wait_for_update_and_click new_note_modal_cancel_button_element\n end", "def destroy\n @order_note.destroy\n respond_to do |format|\n format.html { redirect_to order_path(@order_note.order_id), notice: 'Order note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def cancel(*args)\n commit('cancel', *args)\n end", "def cancel_order_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.cancel_order ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling OrdersApi.cancel_order\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/cancel'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'OrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.cancel_order\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersApi#cancel_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def __cancel__(what, &blk)\n req = Request.new\n req.verb = Request::Verb::CANCEL\n req.id = what.tag\n\n # Hold on to the tag as unavaiable for reuse until the cancel succeeds.\n @cbx[what.tag] = nil\n\n send(req) do |res|\n # Do not send any more responses from the server to this request.\n @cbx.delete(what.tag)\n blk.call(res) if blk\n end\n end", "def destroy\n @note.update(status: false)\n respond_to do |format|\n format.html do\n redirect_to notes_url,\n notice: 'Note was successfully destroyed.'\n end\n format.json do\n head :no_content\n end\n end\n end", "def cancel\n @ride = Ride.find_by_id(params[:ride])\n current_user.cancel!(@ride)\n redirect_to root_path\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to curso_notes_path(params[:curso_id]), notice: 'Nota eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_note = InvoiceNote.find(params[:id])\n @invoice_note.destroy\n\n respond_to do |format|\n flash[:notice] = \"Invoice note '#{@invoice_note.description}' was deleted\"\n format.html { redirect_to( :controller => 'invoice_notes', :invoice_id => @invoice_note.invoice) }\n format.xml { head :ok }\n end\n end", "def destroy\n @crit_note = CritNote.find(params[:id])\n @crit_note.destroy\n\n respond_to do |format|\n format.html { redirect_to(crit_notes_url) }\n format.xml { head :ok }\n end\n end", "def user_cancel\n @order.cancel_by_user\n render 'user'\n end", "def cancel_trip_request\n\t\t# Get the trip referenced\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the user has actually requested this trip\n\t\tif @trip.user_requests.include?(current_user._id) && current_user.trips_requested.include?(trip_params[:trip_id])\n\t\t\t# Delete the request\n\t\t\[email protected]_requests.delete(current_user._id)\n\t\t\tcurrent_user.trips_requested.delete(trip_params[:trip_id])\n\t\t\[email protected]!\n\t\t\tcurrent_user.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tmessage: 'Successfully cancelled the request'\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user has not requested this trip and thus cannot cancel the request'\n\t\t\t}, status: 404\n\t\tend\n\tend", "def get_orders_to_cancel(trade_context)\n raise NotImplementedError, \"unimplemented method get_orders_to_cancel\"\n end", "def destroy\n @credit_note.destroy\n respond_to do |format|\n format.html { redirect_to credit_notes_url, notice: 'Credit note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cancel_order(options)\n request :account, :delete, 'order', options\n end", "def destroy\n @task_note = Note.find(params[:id])\n @task_note.destroy\n\n respond_to do |format|\n format.html { redirect_to task_notes_url }\n format.json { head :no_content }\n end\n end", "def cancel_order(pair: \"\", order_id: \"\")\n authenticated_delete(\"/orders/#{pair}/#{order_id}\")\n end", "def sub_cancel\n (@shift = find_params_id(Shift)) || return\n #only user can cancel his own sub request or admin can cancel anybody's sub request\n if request.delete? and (from_admin? or (@shift.user == get_user))\n #somehow @shift.sub.destroy shortcut does not work properly\n s = @shift.sub\n s.destroy\n @shift.save\n redirect_with_flash \"Sub request cancelled.\", :action => :index, :date => @shift.shift_date, :anchor => @shift.shift_date\n else\n redirect_with_flash 'Illegal URL call'\n end\n end", "def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end", "def cancel\n cookies.delete :payment_in_process\n redirect_to fines_path, flash: { error: (t 'mylibrary.fine_payment.cancel_html') }\n end", "def yunbi_cancel_orders (ids:[], base:nil)\n #client = new_yunbi_client\n ids.each { |id| yunbi_cancel_order id:id }\nend", "def cancel!\n self.update_attributes(status: CANCELLED)\n #self.line_items.update_attributes(status: LineItem::CANCELLED)\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: t('controllers.notes.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html {redirect_to subject_path(current_subject.id), notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cancel_order_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.cancel_order ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrderApi.cancel_order\"\n end\n # resource path\n local_var_path = '/order/orders/{order_id}/cancel'.sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'lock_self_ship_orders'] = opts[:'lock_self_ship_orders'] if !opts[:'lock_self_ship_orders'].nil?\n query_params[:'skip_refund_and_hold'] = opts[:'skip_refund_and_hold'] if !opts[:'skip_refund_and_hold'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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 = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BaseResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#cancel_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def check_cancel_submit\n redirect_to matters_path if params[:cancel]\n end", "def get_credit_notes(options = {})\n\n request_params = {}\n\n request_params[:CreditNoteID] = options[:credit_note_id] if options[:credit_note_id]\n request_params[:CreditNoteNumber] = options[:credit_note_number] if options[:credit_note_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/CreditNotes\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/CreditNotes'})\n end", "def cancelled_requests; end", "def private_cancel_all_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TradingApi.private_cancel_all_get ...'\n end\n # resource path\n local_var_path = '/private/cancel_all'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TradingApi#private_cancel_all_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @note = Note.find(params[:id])\n \n @note.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "def check_for_cancel\n redirect_to @article if params[:commit] == 'Cancel'\n end", "def cancel\n \n reservation = Reservation.where(:id => params[:reservation_id]).first\n room_info = reservation.reservation_rooms.where(:id => params[:res_room]).first \n @booking_information = Reservation.get_cancel_reservation_info(reservation,room_info)\n \n if request.post?\n booking_data = {\n \"itinerary_id\" => params[:itinerary_number],\n \"confirmation_number\" => params[:confirmation_number],\n \"email\" => params[:email]\n }\n \n (HotelService.new).cancel(booking_data)\n \n tooltip = \"Booking Amount: #{room_info.rate}<br/>\n Cancellation Charge: #{room_info.rate - params[:refund].to_f}<br/>\n Refund: #{params[:refund].to_f}\"\n room_info.update_attributes({:status => 'Cancelled',\n :rate => room_info.rate - params[:refund].to_f,\n :taxes_fees => 0,\n :tooltip => tooltip}) \n \n \n UserMailer.cancellation_mail(reservation.user_email,@booking_information).deliver \n reservation.update_total_rate_and_status_and_adults_and_children\n redirect_to reservation_path(params[:reservation_id])\n return \n end\n end" ]
[ "0.74228567", "0.7092439", "0.69464535", "0.68763286", "0.6772356", "0.6710119", "0.65814155", "0.65803593", "0.64887506", "0.64772916", "0.64544433", "0.6453141", "0.64417225", "0.6382091", "0.6382091", "0.6366752", "0.6331679", "0.62915486", "0.6282797", "0.6276153", "0.62744284", "0.6262838", "0.6248232", "0.62474555", "0.62389064", "0.62246203", "0.6206448", "0.6171457", "0.61612266", "0.6157318", "0.6152826", "0.61327475", "0.610886", "0.6105452", "0.61044496", "0.6086526", "0.6083002", "0.6075817", "0.60746276", "0.6059305", "0.6053695", "0.6053657", "0.6028312", "0.60263485", "0.6014904", "0.6010826", "0.6007097", "0.6005579", "0.6005541", "0.59901464", "0.5967917", "0.59614515", "0.59520596", "0.5949313", "0.59278727", "0.5921882", "0.5915421", "0.5911319", "0.5908905", "0.59012604", "0.5900117", "0.58947974", "0.5893131", "0.5891227", "0.58740515", "0.5871686", "0.58599925", "0.58546096", "0.58490765", "0.5816113", "0.58079964", "0.58079964", "0.58079964", "0.58079964", "0.5803924", "0.5798807", "0.5798207", "0.5796368", "0.57857656", "0.5777221", "0.5776754", "0.5771603", "0.5770118", "0.5769118", "0.5754089", "0.5753592", "0.5753193", "0.57166064", "0.57165724", "0.5710493", "0.5703983", "0.5694236", "0.5689638", "0.5683973", "0.56831783", "0.5682201", "0.5674637", "0.5671143", "0.5665124", "0.5664322" ]
0.80827737
0
GET /orders/1/pay GET /orders/1/pay.json
def pay @order = Order.find(params[:id]) if(@order.status == "PLACED") @order.status = "PAID" if @order.save respond_to do |format| format.html { redirect_to @order, notice: 'Paid!'} format.json { render json: @order, status: :accepted, location: @order } end end else respond_to do |format| format.html { redirect_to @order, notice: 'Order must first be placed before being paid.' } format.json { render json: @order.errors, status: :method_not_allowed } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pay\n @order = Order.find(params[:id])\n end", "def show\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay }\n end\n end", "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def index\n @orders = Order.paginate(page: params[:page], conditions: [\"has_paid = true\"], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def pay\n raise \"Only ajax request.\" if !request.xhr?\n begin\n @order = Order.find(params[:id])\n @order.status = 'Paid'\n if @order.save\n head :ok\n else\n head :unprocessable_entity\n end\n rescue\n head :unprocessable_entity\n end\n end", "def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end", "def show\n find_payment\n render json: @payment\n end", "def create\n @payment = Payment.new(payment_params)\n @payment.order_id = params[:order_id]\n respond_to do |format|\n if @payment.save\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount, _links: { next: {profile: \"http://#{my_address}:3000/order\", href: \"http://#{my_address}:3000/orders/#{@payment.order_id}\", enctype: 'application/json'}}}\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: response_json, status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pay = Pay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pay }\n end\n end", "def pay_now\n order = current_order || raise(ActiveRecord::RecordNotFound)\n session[:order_number] = current_order.number\n invoice = order.place_bitpay_order(notificationURL: api_bitpay_notification_url , redirectURL: DOMAIN+\"/confirm_order/reviewOrder\")\n @invoice_iframe_url = \"#{invoice['url']}\"\n render json: @invoice_iframe_url.to_json\n end", "def pay_callback\n\t \torder = params[:order]\n\t \tif (order.present? and order[:status] != \"expired\")\n\t \t\tpayment = Payment.new({\n \t\t\t\tdocument_id: order[:custom],\n\t \t\t\tsigner_id: current_user.id,\n\t \t\t\tpayment_amount: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_btc: order[:total_btc][:cents],\n\t \t\t\tbitcoin_total_native: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_payout: order[:total_payout][:cents],\n\t \t\t\tbitcoin_transaction_id: order[:transaction][:id],\n\t \t\t\tbitcoint_receive_address: order[:receive_address],\n\t \t\t\tbitcoin_order_id: order[:id],\n\t \t\t\tbitcoin_status_order: order[:status]\n\t \t\t})\n\t \t\tpayment.save\n\t \tend\t\n\t \trender :text => \"OK\"\n\t end", "def pay\n #definitin de l'url de base\n base_payment_url = 'http://197.159.2.146:7086/sprintpayapi/payment/orangemoney/request'\n #definition des headers\n\n headers: {\n 'Postman-Token': '9669f6e7-402b-4dc9-a370-472194583c32',\n 'cache-control': 'no-cache',\n 'Authorization': 'SP:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n 'DateTime': 'YYYYYYYYYYYYYYYYYYYY',\n 'Content-Type': 'application/json'\n }\n\n #defintion du bodies/main content\n setBody: {\n \"amount\": 1,\n \"currency\": \"EUR\",\n \"firstName\": \"AMADOU\",\n \"lastName\": \"BAKARI\",\n \"address1\": \"Yaounde\",\n \"address2\": \"Nkolfoulou\",\n \"city\": \"Yaounde\",\n \"state\": \"Centre\",\n \"country\": \"FR\",\n \"postal\": \"0332\",\n \"mobileNumber\": \"237690000999\",\n \"emailId\": \"[email protected]\",\n \"spMerchandUrl\": \"http://sprint-pay.com/\"\n }\n\n #envoi du paiement\n response = httparty.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n\n self.class.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n #puts response\n\n end", "def index\n @pays = Pay.all\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def checkout\n user = User.find(params[:id])\n\n render json: {\n cost: user.checkout,\n transaction: 'success'\n }\n\n\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def pay_order(order_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/{order_id}/pay',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def show\n @order = Order.find(params[:id])\n @customer = @order.customer\n @address = @order.address\n @items = @order.items\n @ledgers = @order.ledgers\n @notes = @order.notes\n\n # Remaining balance\n @remaining_balance = @order.remaining_balance\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n \trespond_to do |format|\n \tformat.html # show.html.erb\n \tformat.json { render json: @payment }\n\t\tend\n end", "def find\n @purchaseorder = Purchaseorder.find_by_po_no(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end", "def payment_status\n @shop_order = Shop::Order.cached_find(params[:uuid])\n render nothing: true, status: 404 and return unless @shop_order\n render json: {guid: @shop_order.id, status: @shop_order.state, error: @shop_order.error}\n end", "def create\n @pay = Pay.new(pay_params)\n\n respond_to do |format|\n if @pay.save\n format.html { redirect_to @pay, notice: 'Pay was successfully created.' }\n format.json { render :show, status: :created, location: @pay }\n else\n format.html { render :new }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment }\n end\n end", "def create\n @pay = Pay.new(params[:pay])\n\n respond_to do |format|\n if @pay.save\n format.html { redirect_to @pay, notice: 'Pay was successfully created. Happy!.' }\n format.json { render json: @pay, status: :created, location: @pay }\n #@user.rest = @user.rest - @pay.amount\n else\n format.html { render action: \"new\" }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_payment\n payment_id = params[:payment_id]\n user_id = params[:user_id]\n offer_id = params[:offer_id]\n response = Subscription.make_payment(payment_id, user_id, offer_id)\n render json: response\n end", "def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def index\n @payments = Payment.all.order('created_at DESC')\n render json: @payments\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment }\n end\n end", "def paid\n @orders = Order.paginate(:page => params[:page], :conditions => [\"status = 'Paid'\"], :order => :expiration_date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @orders }\n end\n end", "def set_pay\n @pay = Pay.find(params[:id])\n end", "def set_pay\n @pay = Pay.find(params[:id])\n end", "def get_coins\n get(\"/getcoins\")\n end", "def pay(prv)\n @prv = prv\n @err_code = '00'\n @err_desc = ''\n\n required_fields = [:org_code, :method, :sign, :data]\n required_datas = []\n return unless check_require_params(required_fields, required_datas)\n\n o_day = Time.current.strftime(\"%Y%m%d\")\n if Payment.find_by(org: @org, order_day: o_day, order_num: @js_recv[:order_num])\n @err_code = '03'\n @err_desc = \"order_num当日重复: [#{@js_recv[:order_num]}]\"\n return\n end\n\n payment = @prv.build_payment\n payment.org = @org\n payment.method = @prv.method\n payment.order_day = o_day\n Biz::PublicTools.update_fields_json(FLDS_PAYMENT, payment, @js_recv)\n payment.save!\n\n biz = Biz::ChannelBiz.new\n biz.pay(payment)\n @err_code = biz.err_code\n @err_desc = biz.err_desc\n @redirect_url = payment.pay_result.pay_url if @err_code == '00' && payment.method == 'wechat.jsapi'\n @resp_json = biz.resp_json\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def pay_now\n order = current_order || raise(ActiveRecord::RecordNotFound)\n session[:order_number] = current_order.number\n invoice = order.place_bitpay_order notificationURL: bitpay_notification_url\n @invoice_iframe_url = \"#{invoice['url']}&view=iframe\"\n render json: @invoice_iframe_url\n end", "def pay(payment)\n retval\n end", "def orders params={}\n params = get_defaults(params)\n path = join_params(params, :currency_pair, :book, :limit)\n request(:get, \"/stats/orders/#{path}\")\n end", "def show\n order = Order.find(params[:id])\n render json: order\n end", "def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def pay_params\n params.require(:pay).permit(:order_id, :payment_type, :transaction_status, :fraud_status, :gross_amount)\n end", "def payment\n Zapi::Models::Payment.new\n end", "def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def show\n @pay_profile = PayProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay_profile }\n end\n end", "def show\n render json: @payment_method\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end", "def payment_get(path, query = {})\n add_auth_token(query)\n HTTParty.get(GAME_SERVER_CONFIG['payment_provider_base_url'] + path, :query => query, :headers => header)\n end", "def show\n @payment_received = PaymentReceived.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_received }\n end\n end", "def new\n @payable = Payable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payable }\n end\n end", "def show\n @wallet = Wallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wallet }\n end\n end", "def index\n @pay_methods = PayMethod.all\n end", "def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend", "def show\n\n respond_to do |format|\n format.html\n format.json { render :json => @payment_request }\n end\n end", "def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def payment(method, data = {})\n call_endpoint(Endpoint::Payment, method, data)\n end", "def index\n @payments = Payment.status_based_payments(params[:payment_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @paymnts = Array.new\n format.json {\n @payments = @payments.select{|payment|\n paymnt = Hash.new\n payment.attributes.each do |key, value|\n paymnt[key] = value\n end\n paymnt[:payment_identifier] = CommonActions.linkable(payment_path(payment), payment.payment_identifier)\n paymnt[:vendor_name] = payment.organization.present? ? CommonActions.linkable(organization_path(payment.organization), payment.organization.organization_name) : \"-\"\n paymnt[:payment_type_name] = payment.payment_type.present? ? payment.payment_type.type_name : \"\"\n if can? :edit, Payment\n paymnt[:links] = CommonActions.object_crud_paths(nil, edit_payment_path(payment), nil)\n else\n paymnt[:links] = \"\"\n end\n @paymnts.push(paymnt)\n }\n render json: {:aaData => @paymnts}\n }\n end\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html { render layout: \"account\" }\n format.json { render :json => @orders }\n end\n end", "def is_paid\n order = current_user.customer.orders.find(params[:id])\n if order.payment.status == \"Success\"\n render json: {is_paid: true}\n else\n render json: {is_paid: false}\n end\n end", "def index\n @payment_requests = PaymentRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payment_requests }\n end\n end", "def index\n @pay_items = PayItem.all\n end", "def index\n @api_payments = Api::Payment.all\n end", "def payments_json_response\n {\n key: 'payments',\n type: 'async',\n html: render_to_string(formats: ['html'], layout: false)\n }\n end", "def wallet\n get 'wallet'\n end" ]
[ "0.72882515", "0.6926362", "0.6490118", "0.6449872", "0.64464885", "0.643709", "0.6404963", "0.62971634", "0.627812", "0.62639016", "0.6215126", "0.61929584", "0.61878437", "0.6183852", "0.61521167", "0.6151737", "0.6108971", "0.6103535", "0.6101567", "0.6051177", "0.6051177", "0.60465664", "0.60443354", "0.60248613", "0.60201114", "0.6018674", "0.6012658", "0.60104257", "0.6008886", "0.5994652", "0.5994652", "0.5994652", "0.5994652", "0.5994652", "0.5994652", "0.5994652", "0.5994652", "0.5985118", "0.59838617", "0.59727776", "0.59607387", "0.5951724", "0.59484607", "0.59332746", "0.592467", "0.59163123", "0.5914343", "0.5914343", "0.5910975", "0.5905226", "0.58885205", "0.5887641", "0.58857554", "0.58823705", "0.5872919", "0.5870867", "0.5864169", "0.58634794", "0.58604443", "0.58580464", "0.58580464", "0.58580464", "0.58580464", "0.58577013", "0.5857542", "0.5854486", "0.58500254", "0.5845545", "0.5834453", "0.58300835", "0.5827632", "0.5826562", "0.58229876", "0.5815906", "0.5811861", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5791702", "0.5785558", "0.57854116", "0.57799244", "0.57714915", "0.57688147", "0.576706", "0.5765988", "0.57643485", "0.5764251" ]
0.69251996
2
Create a deployment manifest (initially for AWS only)
def create_deployment_manifest cloud_properties = { "instance_type" => "m1.small", "availability_zone" => "us-east-1e" } cloud_properties["persistent_disk"] = flags[:disk] if flags[:disk] cloud_properties["static_ips"] = ip_addresses manifest = Bosh::Gen::Models::DeploymentManifest.new(name, director_uuid, release_properties, cloud_properties) manifest.jobs = job_manifests create_file manifest_file_name, manifest.to_yaml, :force => flags[:force] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 create\n GITHUB.create_deployment(\n @project.repository_path,\n @deploy.job.commit,\n payload: {\n deployer: @deploy.user.attributes.slice(\"id\", \"name\", \"email\"),\n buddy: @deploy.buddy&.attributes&.slice(\"id\", \"name\", \"email\"),\n },\n environment: @stage.name,\n description: @deploy.summary,\n production_environment: @stage.production?,\n auto_merge: false, # make deployments on merge commits not produce Octokit::Conflict and do not merge PRs\n required_contexts: [], # also create deployments when commit statuses show failure (CI failed)\n accept: \"application/vnd.github.ant-man-preview+json\" # special header so we can use production_environment field\n )\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 create\n deploy\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\n create_role_directory\n generate_manifests_file\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_manifests_node\n Bebox::Provision.add_node_to_step_manifests(self.project_root, self)\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 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 bootstrap!\n root_file = Gem::TUF::File.new 'metadata/root.txt',\n Gem::TUF::Serialize.canonical(signed_root)\n\n targets = Gem::TUF::Role::Targets.empty\n targets_file = build_role 'targets', targets\n\n release = Gem::TUF::Role::Release.empty\n release.replace(targets_file)\n release.replace(root_file)\n release_file = build_role 'release', release\n\n timestamp = Gem::TUF::Role::Timestamp.empty\n timestamp.replace(release_file)\n timestamp_file = build_role 'timestamp', timestamp\n\n [root_file, targets_file, release_file].each do |file|\n bucket.create file.path_with_hash, file.body\n end\n bucket.create timestamp_file.path, timestamp_file.body\n end", "def do_deploy()\n require 'digest/md5'\n require 'aws-sdk'\n require 'progressbar'\n require 'simple-cloudfront-invalidator'\n require 'yaml'\n\n # Validation check for environment variables\n if (!ENV['AWS_S3_BUCKET'] ||\n !ENV['AWS_ACCESS_KEY_ID'] ||\n !ENV['AWS_SECRET_ACCESS_KEY'] ||\n !ENV['AWS_CLOUDFRONT_DIST_ID'] ||\n !ENV['AWS_HOST_NAME'] )\n puts(\"The below required environment variable(s) have not been defined.\\n\"\\\n \"Without them, the Deploy process cannot complete.\\n\"\\\n \"Please verify that they have been correctly defined.\")\n puts(\" * AWS_S3_BUCKET\") if (!ENV['AWS_S3_BUCKET'])\n puts(\" * AWS_ACCESS_KEY_ID\") if (!ENV['AWS_ACCESS_KEY_ID'])\n puts(\" * AWS_SECRET_ACCESS_KEY\") if (!ENV['AWS_SECRET_ACCESS_KEY'])\n puts(\" * AWS_CLOUDFRONT_DIST_ID\") if (!ENV['AWS_CLOUDFRONT_DIST_ID'])\n puts(\" * AWS_HOST_NAME\") if (!ENV['AWS_HOST_NAME'])\n exit()\n end\n\n puts(\"========================================\")\n puts(\"Beginning Deploy Process...\")\n\n # Capture Hugo's config.yaml while we're in the same directory\n config_file = YAML.load_file('config.yaml')\n\n # Make sure we actually loaded a file, and didn't just set `config_file` to\n # the string \"config.yaml\".\n if (config_file == \"config.yaml\")\n Kernel.abort(\"ERROR: Could not find 'config.yaml'. Are you running Rake \"\\\n \"from the correct directory?\")\n end\n\n # Move into the Hugo destination directory, so file names are only prefixed\n # with \"./\"\n Dir.chdir(File.join(Dir.pwd, \"#{$hugo_dest}\"))\n\n # Generate a list of every file in $hugo_dest, and `map` them into the form,\n # [[\"«file_name»\", \"«md5sum»\"], ... ]\n puts(\" Aggregating Local Hash List...\")\n local_file_list = Dir[\"./**/*\"]\n .select { |f| File.file?(f) }\n .sort_by { |f| f }\n .map { |f|\n # The file names have a leading `./`. Strip those.\n [f[2..-1], Digest::MD5.file(f).hexdigest] }\n\n\n # Open up a connection to our S3 target bucket\n puts(\" Opening S3 Connection...\")\n aws_bucket = Aws::S3::Bucket.new(ENV['AWS_S3_BUCKET'], {\n :region => \"us-east-1\",\n :access_key_id => ENV['AWS_ACCESS_KEY_ID'],\n :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],\n })\n\n # Fetch all objects from the remote, and `map` them into the form,\n # [[\"«file_name»\", \"«md5sum»\"], ... ]\n puts(\" Fetching Remote Object List (this may take up to ~30 seconds)...\")\n aws_file_list = aws_bucket\n .objects()\n .sort_by { |objs| objs.key }\n .map { |objs|\n # the etag (which is the md5sum) is wrapped in double-quotes. Strip those\n # by 'translating' them into empty strings.\n [objs.key, objs.etag.tr('\"','')] }\n\n\n # Now that we have the two lists, we need to compare them and generate the\n # list of files we need to upload, and the list of files we need to delete.\n # To do this, we're going to use some brute force.\n puts(\" Comparing Object Hashes...\")\n new_list = []\n updated_list = []\n delete_list = []\n lcl_i = 0\n aws_i = 0\n lcl_len = local_file_list.length\n aws_len = aws_file_list.length\n progress = ProgressBar.new(\" Hash check\", lcl_len)\n while true\n # Check if we've reached the end of either list and should break\n break if (lcl_i == lcl_len || aws_i == aws_len)\n lcl_file_name = local_file_list[lcl_i][0]\n aws_file_name = aws_file_list[aws_i][0]\n\n # Compare the file/object names\n case lcl_file_name <=> aws_file_name\n when 0 # File names are identical\n # Compare md5sums. If they don't match, add the file to the updated list.\n if (local_file_list[lcl_i][1] != aws_file_list[aws_i][1])\n updated_list.push(lcl_file_name)\n end\n # In either case, increment both index variables\n lcl_i += 1; progress.inc\n aws_i += 1\n when -1 # Local file name sorts first...\n # The local file doesn't exist on AWS. Add it to the new list.\n new_list.push(lcl_file_name)\n # And only increment the local index variable.\n lcl_i += 1; progress.inc\n when 1 # AWS object name sorts first...\n # The AWS object doesn't (or no longer) exist in the locally built\n # artifacts. Schedule it for deletion.\n delete_list.push(aws_file_name)\n # And only increment the aws index variable.\n aws_i += 1\n end\n end\n\n # If we're not at the end of the local file list, we need to add any new files\n # to the new list.\n while (lcl_i < lcl_len)\n new_list.push(local_file_list[lcl_i][0])\n lcl_i += 1; progress.inc\n end\n\n # If we're not at the end of the aws object list, we need to add those file to\n # the delete list.\n while (aws_i < aws_len)\n delete_list.push(aws_file_list[aws_i][0])\n aws_i += 1\n end\n progress.finish\n\n upload_list = updated_list + new_list\n\n puts(\" Hash Check complete\")\n puts(\" #{new_list.length} new files, and #{updated_list.length} updated..\")\n puts(\" #{upload_list.length} files need to be uploaded to the remote\")\n puts(\" #{delete_list.length} files need to be deleted from the remote\")\n current_time = Time.now.getutc.to_s.gsub(\" \",\"_\")\n File.open(\"new_file_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(new_list)\n end\n File.open(\"updated_file_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(upload_list)\n end\n File.open(\"deleted_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(delete_list)\n end\n\n\n # Upload the files in the upload updated and new lists, and delete the files\n # in the delete list.\n if (upload_list.length > 0)\n puts(\" Uploading files...\")\n progress = ProgressBar.new(\" Uploads\", upload_list.length)\n upload_list.each { |obj_path|\n #TODO: Generate a log of the uploaded files?\n #TODO: Error checking.\n #TODO: Stop publishing read/write.\n aws_bucket.put_object({\n acl: \"public-read-write\",\n key: obj_path,\n body: File.open(obj_path)\n })\n progress.inc\n }\n progress.finish\n else\n puts(\" No files to upload...\")\n end\n\n if (delete_list.length > 0)\n delete_list.each_slice(1000).with_index do |slice, index|\n index_from = index * 1000\n index_to = ((index+1)*1000) < delete_list.length ? ((index+1)*1000) : delete_list.length\n puts(\" Requesting Batch Delete for objects #{index_from}-#{index_to}...\")\n # Generate a Aws::S3::Types::Delete hash object.\n delete_hash = {\n delete: {\n objects: slice.map{ |f| { key: f } },\n quiet: false\n }\n }\n #TODO: Generate a log of the deleted files?\n begin\n response = aws_bucket.delete_objects(delete_hash)\n rescue Exception => e\n require 'pp'\n Kernel.abort(\"ERRROR: Batch Deletion returned with errors.\\n\"\\\n \" Delete Hash Object:\\n\"\\\n \"#{pp(delete_hash)}\\n\"\\\n \" Error message:\\n\"\\\n \"#{e.message}\")\n end\n if (response.errors.length > 0)\n require 'pp'\n Kernel.abort(\"ERRROR: Batch Deletion returned with errors\\n\"\\\n \" Delete Hash Object:\\n\"\\\n \"#{pp(delete_hash)}\\n\"\\\n \" Response Object:\\n\"\\\n \"#{pp(response)}\")\n end\n end\n else\n puts(\" No files to delete...\")\n end\n\n # Fetch and rewrite the S3 Routing Rules to make sure the 'latest' of every\n # project correctly re-route.\n puts(\" Configuring S3 Bucket Website redirect rules...\")\n\n # Open an S3 connection to the Bucket Website metadata\n aws_bucket_website = Aws::S3::BucketWebsite.new(ENV['AWS_S3_BUCKET'], {\n :region => \"us-east-1\",\n :access_key_id => ENV['AWS_ACCESS_KEY_ID'],\n :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],\n })\n\n # Build the routing rules based on the config.yaml's 'project_descripts'. One\n # routing rule per project.\n routing_rules = []\n config_file['params']['project_descriptions'].each do |project, description|\n path = description['path']\n archived_path = description['archived_path']\n ver = description['latest']\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{archived_path}/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{archived_path}/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{path}/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{path}/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n end\n #TODO: We need to implement some way of adding arbitrary routing rules. Maybe\n # add a section in config.yaml that's just a JSON string that we parse?\n riak_path = config_file['params']['project_descriptions']['riak_kv']['path']\n riak_ver = config_file['params']['project_descriptions']['riak_kv']['latest']\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakee/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{riak_path}/#{riak_ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakee/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{riak_path}/#{riak_ver}\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakts/\" },\n :redirect => { :replace_key_prefix_with => \"riak/ts/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n\n new_website_configuration = {\n :error_document => {:key => \"404.html\"},\n :index_document => aws_bucket_website.index_document.to_hash,\n :routing_rules => routing_rules\n }\n\n aws_bucket_website.put({ website_configuration: new_website_configuration })\n\n # Invalidate any files that were deleted or modified.\n cf_client = SimpleCloudfrontInvalidator::CloudfrontClient.new(\n ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],\n ENV['AWS_CLOUDFRONT_DIST_ID'])\n invalidation_list = updated_list + delete_list\n if (invalidation_list.length == 0)\n puts(\" No files to invalidate...\")\n elsif (invalidation_list.length < 500)\n # The invalidation list is sufficiently short that we can invalidate each\n # individual file\n invalidation_list.each_slice(100).with_index do |slice, index|\n index_from = (index*100)\n index_to = ((index+1)*100) < delete_list.length ? ((index+1)*100) : delete_list.length\n puts(\" Sending Invalidation Request for objects #{index_from}-#{index_to}...\")\n cf_report = cf_client.invalidate(slice)\n end\n else\n # The invalidation list is large enough that we should skip getting charged\n # and invalidate the entire site.\n puts(\" Sending Invalidation Request for the entire site (\\\"/*\\\")...\")\n cf_report = cf_client.invalidate(['/*'])\n end\n\n puts(\"\")\n puts(\"Deploy Process Complete!\")\n puts(\"========================================\")\nend", "def create_deployment\n @api.account_id = @options[:src]\n inputs = format_inputs(@old_deployment.show.inputs)\n\n params = {\n :deployment => {\n :name => @old_deployment.name,\n :description => @old_deployment.description\n }\n }\n\n puts \"\\nCreating deployment: \\\"#{params[:deployment][:name]}\\\" in account: #{@options[:dst]} ...\\n\\n\"\n\n @api.account_id = @options[:dst]\n result = @api.deployments.create(params)\n @new_deployment = result.href\n\n # Set deployment level inputs. Cannot set them at create time, so do it now\n deployment = @api.resource(@new_deployment)\n deployment_inputs = {}\n deployment_inputs[:inputs] = inputs\n deployment.inputs.multi_update(deployment_inputs)\nend", "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 provision_aks(name, config)\n # @step: define the resource group\n resource_group_name = name\n\n # @step: check the resource group exists\n if resource_group?(resource_group_name)\n info \"skipping the resource group creation: #{resource_group_name}, already exists\"\n else\n info \"creating the resource group: #{resource_group_name} in azure\"\n params = ::Azure::Resources::Mgmt::V2019_05_10::Models::ResourceGroup.new.tap do |x|\n x.location = @region\n end\n # ensure the resource group is created\n @client.resource_groups.create_or_update(resource_group_name, params)\n\n # wait for the resource group to be created\n wait(max_retries: 20, interval: 10) do\n resource_group?(resource_group_name)\n end\n end\n\n info \"provisioning the azure deployment manifest: '#{name}', resource group: '#{resource_group_name}'\"\n # @step: generate the ARM deployments\n template = YAML.safe_load(cluster_template(config))\n\n # @step: check if a deployment is already underway and wait for completion - which\n # makes it eaisier to rerun quickly\n if deployment?(resource_group_name, name)\n info \"deployment: #{name}, resource group: #{resource_group_name} already underway, waiting for completion\"\n wait(interval: 30, max_retries: 20) do\n if deployment?(resource_group_name, name)\n d = deployment(resource_group_name, name)\n d.properties.provisioning_state == 'Succeeded'\n end\n end\n end\n\n # @step: kick off the deployment and cross fingers\n deployment = ::Azure::Resources::Mgmt::V2019_05_10::Models::Deployment.new\n deployment.properties = ::Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentProperties.new\n deployment.properties.template = template\n deployment.properties.mode = ::Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentMode::Incremental\n\n # put the deployment to the resource group\n @client.deployments.create_or_update_async(resource_group_name, name, deployment)\n # wait for the deployment to finish\n wait(interval: 30, max_retries: 20) do\n if deployment?(resource_group_name, name)\n d = deployment(resource_group_name, name)\n d.properties.provisioning_state == 'Succeeded'\n end\n end\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 generate\n generate_manifest\n fix_windows_manifest\n end", "def create_deployment_dir()\n deployment_datetime = Time.now.strftime(DEPLOYMENT_DATETIME_FORMAT)\n full_path = PathUtils.join(@container_dir, 'app-deployments', deployment_datetime)\n FileUtils.mkdir_p(full_path)\n FileUtils.mkdir_p(PathUtils.join(full_path, \"repo\"))\n FileUtils.mkdir_p(PathUtils.join(full_path, \"dependencies\"))\n FileUtils.mkdir_p(PathUtils.join(full_path, \"build-dependencies\"))\n FileUtils.chmod_R(0o0750, full_path, :verbose => @debug)\n set_rw_permission_R(full_path)\n\n prune_deployments\n\n deployment_datetime\n end", "def deploy\n cmd = \"deploy #{@resource[:source]} --name=#{@resource[:name]}#{runtime_name_param_with_space_or_empty_string}\"\n if @resource[:runasdomain]\n cmd = append_groups_to_cmd(cmd, @resource[:servergroups])\n end\n cmd = \"#{cmd} --force\" if force_deploy?\n display_lines 100\n bring_up 'Deployment', cmd\n @resource[:name]\n end", "def create_deployment(command, instances, timeout)\n instance_ids = nil\n instance_description = \"all instances\"\n\n if !instances.nil?\n instance_ids = instances.map(&:instance_id)\n instance_description = instances.map(&:hostname).join(',')\n end\n\n deployment_config = {\n stack_id: opsworks_app[:stack_id],\n app_id: app_id,\n instance_ids: instance_ids,\n command: command,\n comment: \"Git Sha: #{current_sha}\"\n }\n\n deployment = opsworks_client.create_deployment(deployment_config)\n print \"Running command \".light_blue\n print \"#{command[:name]}\".light_blue.bold\n puts \" on #{instance_description}\".light_blue\n\n begin\n _wait_until_deployed(deployment[:deployment_id], timeout)\n puts \"Deployment successful\".green\n true\n rescue Aws::Waiters::Errors::WaiterFailed => e\n puts \"Failed to deploy: #{e.message}\".red\n false\n end\n end", "def create_manifest(create_manifest_request_body, opts = {})\n data, _status_code, _headers = create_manifest_with_http_info(create_manifest_request_body, opts)\n data\n end", "def deploy(yaml_manifest)\n status, task_id = api.deploy(yaml_manifest)\n [status, task_id]\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_file_create_command(id, manifest_src)\n disk.file_create_command(manifest_filename(id), manifest_src)\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_manifest(dlls, dest)\n manifest = +\"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\\n\" \\\n \"<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\\n\" \\\n \" <assemblyIdentity type='win32' name='ruby_builtin_dlls' version='1.0.0.0'/>\\n\"\n dlls.each { |fn| manifest << \" <file name='#{File.basename(fn)}'/>\\n\" }\n manifest << \"</assembly>\\n\"\n File.open( File.join(dest, 'ruby_builtin_dlls.manifest'), 'wb') { |f| f << manifest }\n end", "def create(name, config)\n # @step: validate the user defined options\n validate(config)\n\n # @step: create the infrastructure deployment\n begin\n provision_aks(name, config)\n rescue StandardError => e\n raise InfrastructureError, \"failed to provision cluster, error: #{e}\"\n end\n\n # @step: bootstrap the cluster\n begin\n provision_cluster(name, config)\n rescue StandardError => e\n raise InfrastructureError, \"failed to bootstrap cluster, error: #{e}\"\n end\n end", "def create_manifest_with_http_info(create_manifest_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManifestsApi.create_manifest ...'\n end\n # verify the required parameter 'create_manifest_request_body' is set\n if @api_client.config.client_side_validation && create_manifest_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'create_manifest_request_body' when calling ManifestsApi.create_manifest\"\n end\n # resource path\n local_var_path = '/v1/manifests'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_manifest_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'CreateManifestResponseBody' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManifestsApi#create_manifest\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def generate_manifest\n available_versions.each do |version|\n puts \"Processing #{project_name} - #{channel_name} - #{version}\"\n\n artifacts_for(version).each do |artifact|\n p = artifact.platform\n pv = artifact.platform_version\n m = artifact.architecture\n\n manifest[p] ||= {}\n manifest[p][pv] ||= {}\n manifest[p][pv][m] ||= {}\n manifest[p][pv][m][artifact.version] = {\n sha1: artifact.sha1,\n sha256: artifact.sha256,\n url: artifact.url\n }\n end\n end\n\n manifest\n end", "def release_manifest_name\n \"#{name}-release-manifest\"\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def deploy!(archive, env)\n archive.upload(Beanstalk.api)\n \n if env.status.empty?\n puts \"Creating stack '#{@stack}' for #{archive.app_name}-#{archive.version}...\"\n env.create!(archive, @stack, @cnames, @config)\n env.wait_until_status_is_not \"Launching\"\n else\n puts \"Deploying #{archive.version} to #{env.name}...\"\n env.deploy!(archive, @config)\n env.wait_until_status_is_not \"Updating\"\n end\n \n env.wait_until_healthy\n puts \"Done. Visit http://#{env.url} in your browser.\"\n DeploymentInfo.new env, archive\n end", "def new_deployment(attrs)\n Deployment.from_hash(api, attrs.merge(:app_environment => self))\n end", "def create\n response.add(exec: \"kubectl create ns #{namespace}\", env: kube_env)\n response.add(exec: \"kubectl label namespace #{namespace} istio-injection=enabled --overwrite\", env: kube_env)\n # errors.add(:kubectl_label_namespace, stderr) if exit_code.positive? and stderr.index('AlreadyExists').nil?\n\n # deploy helm into namespace\n # TODO: Need to generate tiller-rbac\n response.add(exec: kubectl(\"apply -f #{target.write_path}/tiller-k8s-ns.yml\"), env: kube_env)\n response.add(exec: 'helm init --upgrade --wait --service-account tiller', env: kube_env)\n end", "def deploy_app(app, deploy_params = {})\n deploy_generated(app.services_xml, app.sd_files,\n deploy_params.merge(app.deploy_params), app.hosts_xml, nil, app.validation_overrides_xml)\n end", "def manifest_file_create_command(id, manifest_src)\n saver.file_create_command(manifest_filename(id), manifest_src)\n end", "def create_gemfile\n unless options[:skip_gemfile]\n puts \"Create #{name} gemfile manifest\"\n end\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def write_manifest(fullPath, archiveURL)\n manifest = read_manifest()\n\n name = File.basename(fullPath)\n manifest[name] = archiveURL\n\n f = File.new(MANIFEST, \"w\")\n yml = manifest.to_yaml()\n f.write(yml)\n f.close()\nend", "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 deploy\n unless serverside_version\n # only set serverside version if it's not set, to imitate the api\n # behavior of choosing its own serverside version if one is not\n # sent\n update :serverside_version => AWSM_SERVERSIDE_VERSION\n end\n finished!(\n :successful => true,\n :output => 'Deployment triggered by the API'\n )\n end", "def prepare_deploy\n @strategy.expects(:run).with(\"#{aws_credential_envs} s3cmd get com.example.bucket:testapp_154.tgz /tmp/1234567890.tar.gz\")\n @strategy.expects(:run).with(\"mkdir /u/apps/test/releases/1234567890 && cd /u/apps/test/releases/1234567890 && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz\")\n end", "def generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend", "def create_virtual_machine(params, options = {})\n image = get_image(params[:image])\n options[:os_type] = image.os_type\n validate_deployment_params(params, options)\n options[:deployment_name] ||= options[:cloud_service_name]\n Azure::Loggerx.info 'Creating deployment...'\n\n options[:cloud_service_name] ||= generate_cloud_service_name(params[:vm_name])\n options[:storage_account_name] ||= generate_storage_account_name(params[:vm_name])\n optionals = {}\n if options[:virtual_network_name]\n virtual_network_service = client.network_management\n virtual_networks = virtual_network_service.list_virtual_networks.select { |x| x.name == options[:virtual_network_name] }\n if virtual_networks.empty?\n Azure::Loggerx.error_with_exit \"Virtual network #{options[:virtual_network_name]} doesn't exists\"\n else\n vnet = virtual_networks.first\n if !vnet.affinity_group.empty?\n options[:affinity_group_name] = vnet.affinity_group\n else\n optionals[:location] = vnet.location\n end\n end\n elsif options[:affinity_group_name]\n optionals[:affinity_group_name] = options[:affinity_group_name]\n else\n optionals[:location] = params[:location]\n end\n cloud_service = client.cloud_service_management\n cloud_service.create_cloud_service(options[:cloud_service_name], optionals)\n cloud_service.upload_certificate(options[:cloud_service_name], params[:certificate]) unless params[:certificate].empty?\n unless image.category == 'User'\n options[:storage_account_name] ||= generate_storage_account_name(params[:vm_name])\n client.storage_management.create_storage_account(options[:storage_account_name], optionals)\n end\n body = Serialization.deployment_to_xml(params, image, options)\n path = \"/services/hostedservices/#{options[:cloud_service_name]}/deployments\"\n Azure::Loggerx.info 'Deployment in progress...'\n request = client.management_request(:post, path, body)\n request.call\n get_virtual_machine(params[:vm_name], options[:cloud_service_name])\n rescue Exception => e\n Azure::Loggerx.error_with_exit \"Failed to create virtual machine : \"+e.message\n end", "def create_deployment_file(host, provision_id, provision_name)\n ssh_key = try_read_file(host['connection']['public_key'])\n config = Base64.strict_encode64(host['configuration'].to_yaml)\n\n Nokogiri::XML::Builder.new do |xml|\n xml.HOST do\n xml.NAME \"provision-#{SecureRandom.hex(24)}\"\n xml.TEMPLATE do\n xml.IM_MAD host['im_mad']\n xml.VM_MAD host['vm_mad']\n xml.PM_MAD host['provision']['driver']\n xml.PROVISION do\n host['provision'].each do |key, value|\n if key != 'driver'\n xml.send(key.upcase, value)\n end\n end\n xml.send('PROVISION_ID', provision_id)\n xml.send('NAME', provision_name)\n end\n if host['configuration']\n xml.PROVISION_CONFIGURATION_BASE64 config\n end\n xml.PROVISION_CONFIGURATION_STATUS 'pending'\n if host['connection']\n xml.PROVISION_CONNECTION do\n host['connection'].each do |key, value|\n xml.send(key.upcase, value)\n end\n end\n end\n if host['connection']\n xml.CONTEXT do\n if host['connection']['public_key']\n xml.SSH_PUBLIC_KEY ssh_key\n end\n end\n end\n end\n end\n end.doc.root\n end", "def create(secret_token = nil, generate_app_key = false, create_initial_deployment_dir = true)\n output = ''\n notify_observers(:before_container_create)\n # lock to prevent race condition between create and delete of gear\n PathUtils.flock(@gear_lock) do\n resource = OpenShift::Runtime::Node.resource_limits\n no_overcommit_active = resource.get_bool('no_overcommit_active', false)\n overcommit_lock_file = \"/var/lock/oo-create.overcommit\"\n File.open(overcommit_lock_file, File::RDWR|File::CREAT|File::TRUNC, 0600) do |overcommit_lock|\n overcommit_lock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n\n begin\n if no_overcommit_active\n overcommit_lock.flock(File::LOCK_EX)\n\n nu = OpenShift::Runtime::Node.node_utilization\n if (nu['gears_active_usage_pct'] >= 100)\n raise GearCreationException.new(\"ERROR: Node capacity exceeded, unable to create container #{@uuid}\")\n end\n end\n\n @container_plugin = Containerization::Plugin.new(self)\n @container_plugin.create(create_initial_deployment_dir)\n ensure\n overcommit_lock.flock(File::LOCK_UN) if no_overcommit_active\n end\n end\n\n add_env_var('SECRET_TOKEN', secret_token, true) if secret_token\n\n output = generate_ssh_key if generate_app_key\n\n if @config.get(\"CREATE_APP_SYMLINKS\").to_i == 1\n unobfuscated = PathUtils.join(File.dirname(@container_dir), \"#{@container_name}-#{@namespace}\")\n if not File.exists? unobfuscated\n FileUtils.ln_s File.basename(@container_dir), unobfuscated, :force => true\n end\n end\n end\n\n notify_observers(:after_container_create)\n output\n end", "def generate()\n app_yaml = <<CONFIG\napplication: #{@app_name}\nversion: 1\nruntime: python27\napi_version: 1\nthreadsafe: true\n\nhandlers:\n- url: /.*\n script: #{@app_name}.application\nCONFIG\n\n script = <<SCRIPT\nimport webapp2\nclass MainPage(webapp2.RequestHandler):\n def get(self):\n self.response.out.write('<html><body>')\n self.response.out.write(\"\"\"<p>Your application failed to start</p>\"\"\")\n self.response.out.write(\"\"\"<p>#{@error_msg}</p>\"\"\")\n self.response.out.write(\"\"\"<p>If this is an AppScale issue please report it on <a href=\"https://github.com/AppScale/appscale/issues\">http://github.com/AppScale/appscale/issues</a></p>\"\"\")\n self.response.out.write('</body></html>')\n\napplication = webapp2.WSGIApplication([\n ('/', MainPage),\n], debug=True)\n\nSCRIPT\n\n HelperFunctions.write_file(\"#{@dir_path}app.yaml\", app_yaml)\n HelperFunctions.write_file(\"#{@dir_path}#{@app_name}.py\", script)\n\n app_tar = \"/opt/appscale/apps/#{@app_name}.tar.gz\"\n Djinn.log_run(\"rm #{app_tar}\")\n Dir.chdir(@dir_path) do\n Djinn.log_run(\"tar zcvf #{app_tar} app.yaml #{@app_name}.py\")\n end\n\n return true\n end", "def deploy\n # ensure the resource group is created\n params = @client.model_classes.resource_group.new.tap do |rg|\n rg.location = 'westus'\n end\n @client.resource_groups.create_or_update(@resource_group, params)\n\n # build the deployment from a json file template from parameters\n template = File.read(File.expand_path(File.join(__dir__, '../templates/template.json')))\n deployment = @client.model_classes.deployment.new\n deployment.properties = @client.model_classes.deployment_properties.new\n deployment.properties.template = JSON.parse(template)\n deployment.properties.mode = Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental\n\n # build the deployment template parameters from Hash to {key: {value: value}} format\n deploy_params = DEPLOYMENT_PARAMETERS.merge(sshKeyData: @pub_ssh_key)\n deployment.properties.parameters = Hash[*deploy_params.map{ |k, v| [k, {value: v}] }.flatten]\n\n # log the request and response contents of Template Deployment.\n # By default, ARM does not log any content. By logging information about the request or response, you could\n # potentially expose sensitive data that is retrieved through the deployment operations.\n debug_settings = @client.model_classes.debug_setting.new\n debug_settings.detail_level = 'requestContent, responseContent'\n deployment.properties.debug_setting = debug_settings\n\n # put the deployment to the resource group\n @client.deployments.create_or_update(@resource_group, 'azure-sample', deployment)\n\n # See logged information related to the deployment operations\n operation_results = @client.deployment_operations.list(@resource_group, 'azure-sample')\n unless operation_results.nil?\n operation_results.each do |operation_result|\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \"operation_id = #{operation_result.operation_id}\"\n unless operation_result.properties.nil?\n puts \"provisioning_state = #{operation_result.properties.provisioning_state}\"\n puts \"status_code = #{operation_result.properties.status_code}\"\n puts \"status_message = #{operation_result.properties.status_message}\"\n puts \"target_resource = #{operation_result.properties.target_resource.id}\" unless operation_result.properties.target_resource.nil?\n puts \"request = #{operation_result.properties.request.content}\" unless operation_result.properties.request.nil?\n puts \"response = #{operation_result.properties.response.content}\" unless operation_result.properties.response.nil?\n end\n end\n end\n end", "def create\n execute ['cmd', '/c', INSTALLUTIL, @resource[:arguments], @resource[:path]].flatten.compact.join(' ')\n end", "def create_arch_package(arch, arch_dir, src_dir, out_dir, pack_config)\n # Load manifest\n manifest = YAML.load_file(\"#{src_dir}/manifest.yaml\")\n manifest['arch'] = arch\n name = manifest['name']\n version = manifest['version']\n info \"Packing #{src_dir} (#{arch})\"\n\n npk = \"#{out_dir}/#{name}-#{arch}-#{version}.npk\"\n\n # TODO: do this seperatly\n # Remove existing containers\n Dir.glob(\"#{out_dir}/#{name}-#{arch}-*\").each { |c| FileUtils.rm(c, :verbose => false) }\n\n create_npk(src_dir, npk, manifest, arch_dir, pack_config)\n\n # Update/Create version list\n version_info_path = File.join(out_dir, \"packages-#{arch}.yaml\")\n update_version_list(version_info_path, name, version)\nend", "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 manifest\n seed = { 'label' => title }\n\n manifest = IIIF::Presentation::Manifest.new(seed)\n\n manifest['@id'] = uri(image_server, \"#{id}/manifest\")\n manifest.attribution = 'University of Pennsylvania Libraries'\n manifest.viewing_hint = viewing_hint\n manifest.viewing_direction = viewing_direction\n\n sequence = IIIF::Presentation::Sequence.new(\n '@id' => uri(image_server, \"#{id}/sequence/normal\"),\n 'label' => 'Current order'\n )\n\n assets.map.with_index do |asset, i|\n index = i + 1\n\n # Retrieve image information from image server\n url = uri(image_server, \"#{asset[:file]}/info.json\")\n info = JSON.parse(Faraday.get(URI.parse(url)).body)\n\n # Adding canvas that contains image as an image annotation.\n sequence.canvases << canvas(\n index: index,\n label: asset[:label],\n height: info['height'],\n width: info['width'],\n profile: info['profile'][0],\n filepath: asset[:file],\n additional_downloads: asset[:additional_downloads]\n )\n\n # Adding table of contents, if label and table of contents entries are provided.\n if asset[:label] && asset[:table_of_contents]&.any?\n manifest.structures << range(\n index: index,\n label: asset[:label],\n table_of_contents: asset[:table_of_contents]\n )\n end\n end\n\n manifest.sequences << sequence\n manifest.to_json\n end", "def pkg_manifest_file\n @pkg_manifest_file ||= File.join(staging_dir, \"#{safe_base_package_name}.p5m\")\n end", "def action_deploy\n notifying_block do\n directory new_resource.path do\n owner new_resource.owner\n group new_resource.group\n mode '755'\n end\n end\n end", "def create\n @deployment = current_user.deployments.new(params[:deployment])\n\n respond_to do |format|\n if @deployment.save\n unless @deployment.environment.running?\n @deployment.environment.start!\n end\n format.html { redirect_to(@deployment.app, :notice => 'Application was successfully deployed.') }\n format.xml { render :xml => @deployment, :status => :created, :location => @deployment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deployment.errors, :status => :unprocessable_entity }\n end\n end\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 deploy\n @operation = \"Deploy\"\n build_env = project[:build_env] || \"\"\n\n prepare_local_dir do\n run_cmd \"cap -q deploy #{build_env}\"\n run_cmd \"cap -q deploy:migrate #{build_env}\"\n run_cmd \"cap -q deploy:cleanup #{build_env}\"\n end\n end", "def deploy\n require 'rest_client'\n require 'uri'\n\n if (@role.nil? or !(@role.services_permissions)) and !current_actor.superadmin\n json_response({ message: \"You don't have permission to deploy services in this project\" }, :unauthorized)\n return\n end\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/stack'\n\n # Service name in query\n serviceName = params[\"service_name\"]\n service = Service.find(params[\"service_id\"])\n if service.nil? then\n return\n end\n\n # Find Service type to retrieve deploy template\n serviceType = ServiceType.find(service.service_type_id)\n serviceTypeName = serviceType.name\n serviceTypeVersion = serviceType.version\n composeData = serviceType.deploy_template\n\n # Getting external files needed by the compose\n externalFiles = []\n if !serviceType.local_path.nil? && serviceType.local_path != ''\n for path in Dir['./' + serviceType.local_path + '/*']\n externalFileName = File.basename(path)\n if (externalFileName != \"docker-compose.yml\" && externalFileName != \"mastermind.yml\" && !externalFileName.end_with?('.md'))\n externalFileContents = File.read(path)\n externalFiles.append({\"#{externalFileName}\" => externalFileContents})\n end\n end\n end\n\n # Making env variable string for Service Manager (YAML format)\n envVariables = \"\"\n begin\n serviceConf = JSON.parse(service.configuration)\n serviceConf.each do |k, v|\n envVariables = envVariables + k + \": \" + v.to_s + \"\\n\"\n end\n rescue JSON::ParserError\n json_response({message: \"Invalid configuration\"}, :unprocessable_entity)\n return\n end\n envVariables = envVariables.chomp(\"\\n\")\n\n # Preparing message for Service Manager\n stack = {\n 'name' => serviceName,\n 'engine-url' => @cluster.endpoint,\n 'compose-file' => composeData,\n 'compose-vars' => envVariables,\n 'external_files' => externalFiles,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, :created)\n # Update service as Active if successfully deployed\n # TODO: Perhaps make a better check\n service.update({endpoint: URI.parse(@cluster.endpoint).host, status: \"Active\", docker_service_id: serviceName})\n rescue Exception => e\n # If error, return it to the client\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end", "def manifest_write_cmd(id, manifest_src)\n ['write', manifest_filename(id), manifest_src]\n end", "def find_or_create(name)\n @log.info \"Looking for deployment: '#{name}'...\"\n deployment = @api_shim.find_deployment_by_name(name)\n @log.info \"Deployment #{deployment.nil? ? \"not found\" : \"found\"}.\"\n unless deployment\n deployment = @api_shim.create_deployment(name)\n @log.info \"Deployment created: '#{name}'\"\n end\n deployment\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def before_deploy(manifest)\n # do nothing by default\n end", "def manifest\n @manifest ||= Sprockets::Manifest.new(sprockets, File.join(public_folder, prefix))\n end", "def manifest\n record do |m|\n \n # Generates the Rake Tasks and Backup Database\n m.directory \"lib/tasks\"\n m.file \"backup.rake\", \"lib/tasks/backup.rake\"\n\n # Generates the configuration file\n m.directory \"config\"\n m.file \"backup.rb\", \"config/backup.rb\"\n \n # Generates the database migration file\n m.migration_template \"create_backup_tables.rb\",\n \"db/migrate\",\n :migration_file_name => \"create_backup_tables\"\n \n # Outputs the generators message to the terminal\n puts message\n end\n end", "def create\n @manifest = Manifest.new(manifest_params)\n @customers = @manifest.get_customers()\n @puntos = @manifest.get_puntos()\n\n respond_to do |format|\n if @manifest.save\n format.html { redirect_to @manifest, notice: 'Manifest was successfully created.' }\n format.json { render :show, status: :created, location: @manifest }\n else\n format.html { render :new }\n format.json { render json: @manifest.errors, status: :unprocessable_entity }\n end\n end\n end", "def publish!\n release_file = build_role 'release', release\n\n timestamp.replace(release_file)\n\n timestamp_file = build_role 'timestamp', timestamp\n\n bucket.create(release_file.path_with_hash, release_file.body)\n bucket.create(timestamp_file.path, timestamp_file.body)\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 manifest\n {}\n end", "def createEc2Instance\n name = @config[\"name\"]\n node = @config['mu_name']\n\n instance_descriptor = {\n :image_id => @config[\"ami_id\"],\n :key_name => @deploy.ssh_key_name,\n :instance_type => @config[\"size\"],\n :disable_api_termination => true,\n :min_count => 1,\n :max_count => 1\n }\n\n arn = nil\n if @config['generate_iam_role']\n role = @deploy.findLitterMate(name: @config['name'], type: \"roles\")\n s3_objs = [\"#{@deploy.deploy_id}-secret\", \"#{role.mu_name}.pfx\", \"#{role.mu_name}.crt\", \"#{role.mu_name}.key\", \"#{role.mu_name}-winrm.crt\", \"#{role.mu_name}-winrm.key\"].map { |file| \n 'arn:'+(MU::Cloud::AWS.isGovCloud?(@config['region']) ? \"aws-us-gov\" : \"aws\")+':s3:::'+MU.adminBucketName+'/'+file\n }\n role.cloudobj.injectPolicyTargets(\"MuSecrets\", s3_objs)\n\n @config['iam_role'] = role.mu_name\n arn = role.cloudobj.createInstanceProfile\n# @cfm_role_name, @cfm_prof_name\n\n elsif @config['iam_role'].nil?\n raise MuError, \"#{@mu_name} has generate_iam_role set to false, but no iam_role assigned.\"\n end\n if !@config[\"iam_role\"].nil?\n if arn\n instance_descriptor[:iam_instance_profile] = {arn: arn}\n else\n instance_descriptor[:iam_instance_profile] = {name: @config[\"iam_role\"]}\n end\n end\n\n security_groups = []\n if @dependencies.has_key?(\"firewall_rule\")\n @dependencies['firewall_rule'].values.each { |sg|\n security_groups << sg.cloud_id\n }\n end\n\n if security_groups.size > 0\n instance_descriptor[:security_group_ids] = security_groups\n else\n raise MuError, \"Didn't get any security groups assigned to be in #{@mu_name}, that shouldn't happen\"\n end\n\n if !@config['private_ip'].nil?\n instance_descriptor[:private_ip_address] = @config['private_ip']\n end\n\n vpc_id = subnet = nil\n if [email protected]? and @config.has_key?(\"vpc\")\n subnet_conf = @config['vpc']\n subnet_conf = @config['vpc']['subnets'].first if @config['vpc'].has_key?(\"subnets\") and !@config['vpc']['subnets'].empty?\n tag_key, tag_value = subnet_conf['tag'].split(/=/, 2) if !subnet_conf['tag'].nil?\n\n subnet = @vpc.getSubnet(\n cloud_id: subnet_conf['subnet_id'],\n name: subnet_conf['subnet_name'],\n tag_key: tag_key,\n tag_value: tag_value\n )\n if subnet.nil?\n raise MuError, \"Got null subnet id out of #{subnet_conf['vpc']}\"\n end\n MU.log \"Deploying #{node} into VPC #{@vpc.cloud_id} Subnet #{subnet.cloud_id}\"\n punchAdminNAT\n instance_descriptor[:subnet_id] = subnet.cloud_id\n end\n\n if [email protected]? and [email protected]?\n instance_descriptor[:user_data] = Base64.encode64(@userdata)\n end\n\n MU::Cloud::AWS::Server.waitForAMI(@config[\"ami_id\"], region: @config['region'], credentials: @config['credentials'])\n\n # Figure out which devices are embedded in the AMI already.\n image = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_images(image_ids: [@config[\"ami_id\"]]).images.first\n ext_disks = {}\n if !image.block_device_mappings.nil?\n image.block_device_mappings.each { |disk|\n if !disk.device_name.nil? and !disk.device_name.empty? and !disk.ebs.nil? and !disk.ebs.empty?\n ext_disks[disk.device_name] = MU.structToHash(disk.ebs)\n end\n }\n end\n\n configured_storage = Array.new\n cfm_volume_map = {}\n if @config[\"storage\"]\n @config[\"storage\"].each { |vol|\n # Drop the \"encrypted\" flag if a snapshot for this device exists\n # in the AMI, even if they both agree about the value of said\n # flag. Apparently that's a thing now.\n if ext_disks.has_key?(vol[\"device\"])\n if ext_disks[vol[\"device\"]].has_key?(:snapshot_id)\n vol.delete(\"encrypted\")\n end\n end\n mapping, cfm_mapping = MU::Cloud::AWS::Server.convertBlockDeviceMapping(vol)\n configured_storage << mapping\n }\n end\n\n instance_descriptor[:block_device_mappings] = configured_storage\n instance_descriptor[:block_device_mappings].concat(@ephemeral_mappings)\n instance_descriptor[:monitoring] = {enabled: @config['monitoring']}\n\n MU.log \"Creating EC2 instance #{node}\"\n MU.log \"Instance details for #{node}: #{instance_descriptor}\", MU::DEBUG\n#\t\t\t\tif instance_descriptor[:block_device_mappings].empty?\n#\t\t\t\t\tinstance_descriptor.delete(:block_device_mappings)\n#\t\t\t\tend\n\n retries = 0\n begin\n response = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).run_instances(instance_descriptor)\n rescue Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue => e\n if retries < 10\n if retries > 7\n MU.log \"Seeing #{e.inspect} while trying to launch #{node}, retrying a few more times...\", MU::WARN, details: instance_descriptor\n end\n sleep 10\n retries = retries + 1\n retry\n else\n raise MuError, e.inspect\n end\n end\n\n instance = response.instances.first\n MU.log \"#{node} (#{instance.instance_id}) coming online\"\n\n return instance\n\n end", "def deploy(attrs)\n Deployment.deploy(api, self, attrs)\n end", "def assets_manifest; end", "def assets_manifest; end", "def perform\n validate_system_config\n\n deployment_name = \"#{system_config.system_name}-core\"\n\n manifest = base_manifest(\n deployment_name,\n bosh_config.target_uuid,\n system_config.bosh_provider,\n system_config.system_name,\n system_config.release_name,\n system_config.release_version,\n system_config.stemcell_name,\n system_config.stemcell_version,\n cloud_properties_for_server_flavor(system_config.core_server_flavor),\n system_config.core_ip,\n system_config.root_dns,\n system_config.admin_emails,\n system_config.common_password,\n system_config.common_persistent_disk,\n system_config.security_group\n )\n\n dea_config.build_into_manifest(manifest)\n system_config.services.each do |service_config|\n service_config.build_into_manifest(manifest)\n end\n\n chdir system_config.system_dir do\n mkdir_p(\"deployments\")\n File.open(\"deployments/#{system_config.system_name}-core.yml\", \"w\") do |file|\n file << manifest.to_yaml\n end\n end\n end", "def deploy_application\n deploy(selfdir + \"app\")\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 built_manifest\n log.info(log_key) { \"Building version manifest\" }\n m = Omnibus::Manifest.new(build_version, build_git_revision, license)\n softwares.each do |software|\n m.add(software.name, software.manifest_entry)\n end\n m\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 create_deployment request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_deployment_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\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 deploy_stack(stack_name, parameters, template,\n capabilities = ['CAPABILITY_IAM'], disable_rollback: false)\n wait_options = {\n max_attempts: @wait_max_attempts,\n delay: @wait_delay\n }\n\n stack_parameters = {\n stack_name: stack_name,\n template_body: File.read(template),\n capabilities: capabilities,\n parameters: params(parameters)\n }\n\n attempt_to_update_stack(stack_name, stack_parameters, wait_options)\n rescue Aws::CloudFormation::Errors::ValidationError => error\n if error.to_s.include? 'No updates are to be performed.'\n puts 'Nothing to do.' if ENV['DEBUG']\n elsif error.to_s.include? 'Template error'\n raise error\n else\n stack_parameters[:disable_rollback] = disable_rollback\n attempt_to_create_stack(stack_name, stack_parameters, wait_options)\n end\n end", "def create(name, config)\n # @step: build the paramaters\n parameters = [\n { parameter_key: 'AvailabilityZones', parameter_value: config[:availability_zones] },\n { parameter_key: 'BucketName', parameter_value: @templates_bucket },\n { parameter_key: 'BucketVersion', parameter_value: @templates_version },\n { parameter_key: 'ClusterAutoScaler', parameter_value: 'Enabled' },\n { parameter_key: 'ClusterName', parameter_value: name },\n { parameter_key: 'KeyPairName', parameter_value: config[:ssh_keypair] },\n { parameter_key: 'KubernetesVersion', parameter_value: config[:version] },\n { parameter_key: 'NodeGroupName', parameter_value: 'compute' },\n { parameter_key: 'NodeInstanceType', parameter_value: config[:machine_type] },\n { parameter_key: 'NodeVolumeSize', parameter_value: config[:disk_size_gb].to_s },\n { parameter_key: 'NumberOfAZs', parameter_value: config[:availability_zones].split(',').size.to_s },\n { parameter_key: 'NumberOfNodes', parameter_value: config[:size].to_s },\n { parameter_key: 'PrivateSubnet1CIDR', parameter_value: config[:private_subnet1_cidr] },\n { parameter_key: 'PrivateSubnet2CIDR', parameter_value: config[:private_subnet2_cidr] },\n { parameter_key: 'PrivateSubnet3CIDR', parameter_value: config[:private_subnet3_cidr] },\n { parameter_key: 'PublicSubnet1CIDR', parameter_value: config[:public_subnet1_cidr] },\n { parameter_key: 'PublicSubnet2CIDR', parameter_value: config[:public_subnet2_cidr] },\n { parameter_key: 'PublicSubnet3CIDR', parameter_value: config[:public_subnet3_cidr] },\n { parameter_key: 'RemoteAccessCIDR', parameter_value: '0.0.0.0/0' },\n { parameter_key: 'VPCCIDR', parameter_value: config[:network] }\n ]\n\n # @step: provision the cloudformation stacks\n stack_name = 'aws-cluster'\n info \"provisioning the cloudFormation: #{stack_name}\"\n info \"using the template from: #{template_path(stack_name)}\"\n\n outputs = cloudformation(name, template_url: template_path(stack_name), parameters: parameters)\n\n info 'waiting for the kube apiserver to become available'\n client = HubClustersCreator::Kube.new(outputs['EKSEndpoint'], token: build_token(name))\n client.wait_for_kubeapi\n\n # @step: check if the awa-auth configmap exists already, we never overwrite\n unless client.exists?('aws-auth', 'kube-system', 'configmaps')\n info 'provition the aws-auth configureation configmap'\n client.kubectl(default_aws_auth(name))\n\n # @step: ensure we have some nodes\n info 'waiting for some nodes to become available'\n client.wait('aws-node', 'kube-system', 'daemonsets', version: 'extensions/v1beta1') do |x|\n x.status.numberReady.positive?\n end\n end\n\n # @step: provision the cluster\n info 'bootstraping the eks cluster'\n config[:credentials] = {\n access_id: @access_id,\n access_key: @access_key,\n account_id: @account_id,\n region: @region\n }\n\n result = HubClustersCreator::Providers::Bootstrap.new(name, 'eks', client, config).bootstrap\n {\n cluster: {\n ca: outputs['EKSCA'],\n endpoint: outputs['EKSEndpoint'],\n service_account_name: 'sysadmin',\n service_account_namespace: 'kube-system',\n service_account_token: Base64.decode64(client.account('sysadmin'))\n },\n config: config,\n services: result\n }\n end", "def deploy(environment, status, version)\n return if SharedStatus.dry_run?\n return unless status == 'success'\n\n sha = ReleaseTools::Qa::Ref.new(version).ref\n now = Time.now.utc.iso8601\n\n params = {\n environment: environment,\n dateStarted: now,\n dateFinished: now\n }\n\n logger.info('Creating Sentry deploy', version: sha, environment: environment)\n client.post(\"#{API_ENDPOINT}#{sha}/deploys/\", json: params)\n end", "def create(template_url)\n begin\n puts \"Creating stack #{@name}\"\n\n @cloudformation.create_stack(\n stack_name: @name,\n# template_url: template_url,\n template_body: File.open(\"hava-dns.json\").read,\n capabilities: [\"CAPABILITY_IAM\"],\n parameters: @parameters,\n disable_rollback: true,\n tags: [{\n key: \"environment\",\n value: @name\n }])\n\n wait_for_stack(\"CREATE_COMPLETE\")\n\n rescue Exception => e\n puts e.inspect\n puts e.backtrace\n end\n end", "def generate_manifest\n puts \"Creating AndroidManifest.xml\"\n manifest = \"\"\n open(File.join(@droidgap_src_dir, \"AndroidManifest.xml\"), 'r') do |old|\n manifest = old.read\n manifest.gsub! 'android:versionCode=\"5\"', 'android:versionCode=\"1\"'\n manifest.gsub! 'package=\"com.phonegap\"', \"package=\\\"#{ @pkg }\\\"\"\n manifest.gsub! 'android:name=\".StandAlone\"', \"android:name=\\\".#{ @name.gsub(' ','') }\\\"\"\n manifest.gsub! 'android:minSdkVersion=\"5\"', 'android:minSdkVersion=\"2\"'\n end\n open(File.join(@output_dir, \"AndroidManifest.xml\"), 'w') { |x| x.puts manifest }\n end", "def deploy!(options={})\n params = {}\n params['api_key'] = @api_key\n params['deploy[rails_env]'] = options[:framework_env] || 'development'\n params['deploy[local_username]'] = options[:username] || %x(whoami).strip\n params['deploy[scm_repository]'] = options[:scm_repository]\n params['deploy[scm_revision]'] = options[:scm_revision]\n response(@deploy_url, params)\n end", "def generate_python()\n app_yaml = <<CONFIG\napplication: #{@app_name}\nversion: 1\nruntime: python27\napi_version: 1\nthreadsafe: true\n\nhandlers:\n- url: /.*\n script: #{@app_name}.application\nCONFIG\n\n script = <<SCRIPT\nimport webapp2\nclass MainPage(webapp2.RequestHandler):\n def get(self):\n self.response.out.write('<html><body>')\n self.response.out.write(\"\"\"<p>Your application failed to start</p>\"\"\")\n self.response.out.write(\"\"\"<p>#{@error_msg}</p>\"\"\")\n self.response.out.write(\"\"\"<p>If this is an AppScale issue please report it on <a href=\"https://github.com/AppScale/appscale/issues\">http://github.com/AppScale/appscale/issues</a></p>\"\"\")\n self.response.out.write('</body></html>')\n\napplication = webapp2.WSGIApplication([\n ('/', MainPage),\n], debug=True)\n\nSCRIPT\n\n HelperFunctions.write_file(\"#{@dir_path}app.yaml\", app_yaml)\n HelperFunctions.write_file(\"#{@dir_path}#{@app_name}.py\", script)\n\n app_tar = \"/opt/appscale/apps/#{@app_name}.tar.gz\"\n Djinn.log_run(\"rm #{app_tar}\")\n Dir.chdir(@dir_path) do\n Djinn.log_run(\"tar zcvf #{app_tar} app.yaml #{@app_name}.py\")\n end\n\n return true\n end", "def deploy(data, replace=false, force=false)\n err = runWithData(\"kubectl create -f -\", data)\n if err\n if existsErr?(err) && replace\n return replace(data, force)\n end\n return \"could not create object: #{err}\"\n end\n return false\nend", "def create(name)\n package = Package.new(name)\n package.name = name\n package.version = '1.0.0'\n empty_directory(name)\n empty_directory(File.join(name, 'operations'))\n empty_directory(File.join(name, 'resources'))\n template('metadata.rb.erb', File.join(name, 'metadata.rb'))\n\n if options[:vagrant]\n template('Vagrantfile.erb', File.join(name, 'Vagrantfile'))\n end\n\n if options[:docker]\n template('Dockerfile.erb.erb', File.join(name, 'Dockerfile.erb'))\n end\n end", "def deploy_generated(applicationbuffer, sdfile=nil, params={}, hostsbuffer=nil, deploymentbuffer=nil, validation_overridesbuffer=nil)\n @vespa.deploy_generated(applicationbuffer, sdfile, params, hostsbuffer, deploymentbuffer, validation_overridesbuffer)\n end", "def manifest\n root + '.node.yml'\n end", "def generate_deployment_file(provision)\n @hosts = provision.info_objects('hosts')\n end", "def deploy(id, host, xml_text, lcm_state, deploy_id)\n # Restore if we need to\n if lcm_state != \"BOOT\" && lcm_state != \"BOOT_FAILURE\"\n restore(deploy_id)\n return deploy_id\n end\n\n # Otherwise deploy the VM\n\n begin\n ec2_info = get_deployment_info(host, xml_text)\n rescue Exception => e\n raise e\n end\n\n load_default_template_values\n\n if !ec2_value(ec2_info, 'AMI')\n raise \"Cannot find AMI in deployment file\"\n end\n\n opts = generate_options(:run, ec2_info, {\n :min_count => 1,\n :max_count => 1})\n\n # The OpenNebula context will be only included if not USERDATA\n # is provided by the user\n if !ec2_value(ec2_info, 'USERDATA')\n xml = OpenNebula::XMLElement.new\n xml.initialize_xml(xml_text, @provision_type == :host ? 'HOST' : 'VM')\n\n if xml.has_elements?('TEMPLATE/CONTEXT')\n # if requested, we generated cloud-init compatible data\n if ec2_value(ec2_info, 'CLOUD_INIT') =~ /^(yes|true)$/i\n context_str = generate_cc(xml, 'TEMPLATE/CONTEXT')\n else\n # Since there is only 1 level ',' will not be added\n context_str = xml.template_like_str('TEMPLATE/CONTEXT')\n\n if xml['TEMPLATE/CONTEXT/TOKEN'] == 'YES'\n # TODO use OneGate library\n token_str = generate_onegate_token(xml)\n if token_str\n context_str << \"\\nONEGATE_TOKEN=\\\"#{token_str}\\\"\"\n end\n end\n end\n\n userdata_key = EC2[:run][:args][\"USERDATA\"][:opt]\n opts[userdata_key] = Base64.encode64(context_str)\n end\n end\n\n instances = @ec2.create_instances(opts)\n instance = instances.first\n\n start_time = Time.now\n\n while Time.now - start_time < @state_change_timeout\n begin\n break if instance.exists?\n rescue => e\n OpenNebula::log_error(\"RESCUE: #{e.inspect}\")\n end\n\n sleep 2\n end\n\n tags = generate_options(:tags, ec2_info)[:tags] || {}\n\n tag_array = []\n tags.each{ |key,value|\n tag_array << {\n :key => key,\n :value => value\n }\n }\n\n instance.create_tags(:tags => tag_array) if tag_array.length > 0\n\n elastic_ip = ec2_value(ec2_info, 'ELASTICIP')\n\n wait_state('running', instance.id)\n\n if elastic_ip\n\n if elastic_ip.match(Resolv::IPv4::Regex)\n address_key = :public_ip\n else\n address_key = :allocation_id\n end\n\n address = {\n :instance_id => instance.id,\n address_key => elastic_ip\n }\n\n @ec2.client.associate_address(address)\n end\n\n if @provision_type == :host\n instance.create_tags(tags: [{\n key: 'Name',\n value: host['//HOST/TEMPLATE/PROVISION/HOSTNAME']\n },{\n key: 'ONE_HOST_ID',\n value: 'TODO'\n }])\n else\n instance.create_tags(tags: [{\n key: 'ONE_ID',\n value: id\n }])\n end\n\n puts(instance.id)\n end", "def deploy_asg config\n launch_config_name = create_new_asg config\n delete_old_asg config, launch_config_name\nend", "def create_role_directory\n `cd #{self.project_root} && mkdir -p puppet/roles/#{self.name}/manifests`\n end", "def gen_deploy(deploy_id, slug_url, config)\n require 'erb'\n require 'shellwords'\n template = ERB.new(File.read(File.join(data_dir, 'deploy.bash.erb')))\n template.result(binding)\n end", "def assets_manifest=(_arg0); end", "def assets_manifest=(_arg0); end", "def do_create_namespace(namespace, default_per_namespace_max_pods)\n name = namespace['name']\n annotations = namespace['annotations']\n labels = namespace['labels']\n max_pods = namespace['max_pods']\n filename=\"/var/vcap/data/action/ns_#{name}.yml\"\n filenameresourcequota=\"/var/vcap/data/action/ns_#{name}_quota.yml\"\n File.open(filename, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: Namespace\")\n f.puts(\"metadata:\")\n f.puts(\" name: #{name}\")\n f.puts(\" labels:\")\n f.puts(\" name: #{name}\")\n if labels != nil\n labels.each{ |label|\n f.puts(\" #{label['name']}: #{label['value']}\")\n }\n end\n\n if annotations != nil\n f.puts(\" anotations: \")\n annotations.each{ |annotation|\n f.puts(\" #{annotation['name']}: #{annotation['value']}\")\n }\n end\n end\n cmd = \"kubectl apply -f #{filename} \"\n\n if max_pods ==nil\n max_pods = default_per_namespace_max_pods\n end\n if max_pods != \"-1\"\n File.open(filenameresourcequota, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: ResourceQuota\")\n f.puts(\"metadata:\")\n f.puts(\" name: quota-#{name}\")\n f.puts(\" namespace: #{name}\")\n f.puts(\"spec:\")\n f.puts(\" hard:\")\n f.puts(\" pods: #{max_pods}\")\n cmd =\"kubectl apply -f #{filename}; kubectl apply -f #{filenameresourcequota}\"\n end\n end\n cmd\nend", "def cap_deploy(site, env, maintenance_flag, action=\"deploy\")\n\t\tif action == \"deploy\"\n\t\t\ts3object = @options[:s3object] || \"\"\n\t\t\tprint_disclaimer(\"call cap #{env} #{site}\")\n\t\t\tsystem \"cap #{env} #{site} BEAVER_S3_OBJECT_PATH=#{s3object}\"\n\t\telsif action == \"rollback\"\n\t\t\tprint_disclaimer(\"call cap #{env} #{site}:#{action}\")\n\t\t\tsystem \"cap #{env} #{site}:#{action}\"\n\t\tend\n\tend" ]
[ "0.82224447", "0.6431784", "0.64210236", "0.63673073", "0.6306414", "0.6198516", "0.60902333", "0.60780704", "0.60432297", "0.60331005", "0.6028615", "0.6024294", "0.5991769", "0.5985003", "0.59678775", "0.5953389", "0.5912079", "0.59018546", "0.58889157", "0.5806116", "0.5782274", "0.5740842", "0.5676513", "0.56634384", "0.5644538", "0.56143916", "0.5610103", "0.55883473", "0.5581053", "0.5580977", "0.55774146", "0.5561281", "0.5559992", "0.5535205", "0.55111897", "0.55025405", "0.5502045", "0.5494961", "0.5440625", "0.54157877", "0.541191", "0.54058087", "0.54047596", "0.5390546", "0.5373457", "0.5356119", "0.5354771", "0.53539544", "0.5351372", "0.53390735", "0.53255534", "0.5309558", "0.5307077", "0.53010696", "0.5293172", "0.52921015", "0.52878326", "0.52871567", "0.52829474", "0.5274878", "0.5258456", "0.5248382", "0.5240392", "0.52323437", "0.5230024", "0.52233136", "0.52194166", "0.52176464", "0.52161855", "0.5214892", "0.5213881", "0.52105784", "0.521047", "0.5209427", "0.52037495", "0.52011675", "0.51882094", "0.517869", "0.51705414", "0.5162083", "0.5161781", "0.5145651", "0.5132781", "0.5126618", "0.5114625", "0.5105864", "0.5105071", "0.51029885", "0.50985146", "0.50954974", "0.5089113", "0.5083705", "0.5074157", "0.50689", "0.5067841", "0.50582045", "0.5056755", "0.5056755", "0.5054585", "0.5046594" ]
0.82858497
0
Whether +name+ contains .yml suffix or nor, returns a .yml filename for manifest to be generated
def manifest_file_name basename = name.gsub(/\.yml/, '') + ".yml" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest_file_name\n basename = \"#{name}.yml\"\n end", "def manifest_name(name, type)\n return name if File.extname(name.to_s).empty?\n\n File.basename(name, type)\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, '.' + pack_type)\n end", "def deployment?(filename)\n filename.include?('.yml') and not filename.include?('example.yml')\n end", "def file_extension\n \"yml\"\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end", "def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_type(entry_type)\n extension ? \"#{ name }.#{ extension }\" : name\n end", "def filename\n @filename ||= \"#{ @component.name }-#{(t=Time.now).to_i}-#{t.usec}.yaml\"\n end", "def gen_filename\n name = @issue[\"created\"].strftime(\"%Y-%m-%d-\") + \n @issue[\"title\"].gsub(/\\W+/, \"_\") +\n \".yaml\"\n n = 1\n while File.exist?(File.join(@dir, name))\n name = File.basename(name, \".yaml\") + \"-\" + n.to_s + \".yaml\"\n n += 1\n end\n\n name\n end", "def yaml_filename(file)\n ::File.basename(file).split('.').first\n end", "def manifest_name(name, pack_type)\n name.chomp(\".#{pack_type}\")\n end", "def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end", "def file_name(name)\r\n return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)\r\n return ext_name(name).downcase + '.rb'\r\n end", "def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend", "def yaml_file?\n YAML_FILE_EXTS.include?(extname)\n end", "def normalize_content_name(name)\n return if name.nil?\n\n if name.start_with?(@annotations_directory.name)\n \"#{full_name}/#{name}\"\n elsif name.start_with?(\"/#{@annotations_directory.full_name}\")\n name.slice(1, name.length)\n else\n nil\n end\n end", "def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end", "def filename\n \"wallpaper.#{file.extension}\" if file\n end", "def serialized_filename\n \"#{self.name}.yaml\"\n end", "def filename\n \"application_#{model.hash}.#{file.extension}\" if original_filename.present?\n end", "def configuration_path_of(original_path)\n original_path.sub(/\\.#{extention}$/,'.yml')\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def name\n @manifest_options[:name] || \"\"\n end", "def filename_extension # required\n if manifest_property.is_a? Array\n manifest_property # eg [ \".c\", \".h\" ]\n else\n [ manifest_property ] # eg \".py\"\n end\n end", "def epub_name(configuration_suffix = nil)\n epub_name = if [email protected]_base_name.nil?\n @book.output_base_name\n elsif @book.from_file?\n ::File.basename(@book.file_path, ::File.extname(@book.file_path))\n else\n @book.title\n end\n\n epub_name += @book.build_version.to_s unless @book.build_version.nil?\n epub_name += \"-#{@target.name}\" if @target != @book.default_target\n epub_name += \"-#{configuration_suffix}\" unless configuration_suffix.nil?\n epub_name + '.epub'\n end", "def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end", "def basename_without_ext; end", "def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end", "def should_generate? config\n File.basename(source_file)[0] != '_'\n end", "def build(name)\n output_path = File.join(__dir__, \"#{name}.yml\")\n File.write(output_path, GENERATED_BANNER + template(name, params: { header: false }))\n end", "def generate_file_name\n file_name = attachment.instance_read(:file_name).slugged_filename\n attachment.instance_write :file_name, file_name\n end", "def name\n extension = rails? ? rails_extension : format\n \"#{sprite_name}.#{extension}\"\n end", "def release_manifest_name\n \"#{name}-release-manifest\"\n end", "def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end", "def mkyml(yml, allow_suffix=true)\n file = \"#{$config[:'config-dir']}/#{yml.downcase}.yml\"\n file += '.new' if File.exists?(file) && allow_suffix\n if !File.exists?(file)\n File.open(file, 'w') do |f|\n f.puts eval(yml).rekey(&:to_s).to_yaml\n end\n File.chmod(0640, file)\n File.chown($config[:uid], $config[:gid], file)\n end\n end", "def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end", "def basename\n suffixed? ? name.sub(/\\.#{Regexp.escape(template.name)}$/, '') : name\n end", "def data_file_exported?(filename)\n exported_filename = $PROJECT_DIR + '/' + $YAML_DIR + '/' + File.basename(filename, File.extname(filename)) + \".yaml\"\n return File.exist?( exported_filename )\nend", "def output_filename(path, opts)\n filename = File.basename(path) + '.png'\n if opts.filename\n if opts.targets.length == 1\n return opts.filename\n else\n opts.filename + '.' + filename\n end\n end\n filename\nend", "def yaml_file\n @yaml_file ||= begin\n filename = self.class.to_s.split(\"::\").last\n filename << \"-#{storage_id}\" if storage_id\n File.join(Config.data_path, package.trigger, \"#{filename}.yml\")\n end\n end", "def dotfile( name )\n File.join( build_dir, \".#{name}\" )\n end", "def package_basename(extension='.gem')\n [ package_name, version ].join('-') + extension\n end", "def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end", "def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def filename\n 'app.swf' if original_filename\n end", "def version_file_from( name )\n\t\treturn name.\n\t\t\tsplit( /-/ ).\n\t\t\treject {|word| PACKAGE_IGNORE_WORDS.include?(word) }.\n\t\t\tjoin( '/' )\n\tend", "def get_filename filename, extension = 'png'\n unless filename.nil?\n file_extension = get_extension filename\n filename = (file_extension.empty?) ? filename + '.' + extension : filename\n else\n false\n end\n end", "def name_for(payload, asset_name)\n File.join(determine_namespace(payload), asset_name)\n asset_name\n end", "def url_safe_name\n name == '/' ? \"root-dir--#{file_type}\" : \"#{name}--#{file_type}\"\n end", "def file_name\n name.underscore\n end", "def file_name\n \"#{full_name}.gem\"\n end", "def dotfile!( name )\n File.open( dotfile( name ), \"w\" ) do |f|\n h = { 'name' => self.name, 'version' => self.version, \"#{name}_timestsamp\" => Time.now }\n f.puts h.to_yaml\n end\n end", "def suffix\n name.scan(MetaDep::TEMPLATE_SUFFIX).flatten.first\n end", "def name_without_extension\n tmp = name\n i = tmp.index('.')\n i ? tmp[0...i] : tmp\n end", "def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end", "def config_file_with_name(name)\n File.join(wasko_directory, \"#{name}.color\")\n end", "def generate_unique_filename\n name = options[:file_name] || wrapper.name\n # TODO: Sanitize the file name\n\n filename = \"#{name}.swatches\"\n\n related_files = related_file_indexes(filename)\n\n filename = if related_files.present?\n \"#{name}-#{related_files.max + 1}#{SWATCHES_EXTENSION}\"\n else\n \"#{name}#{SWATCHES_EXTENSION}\"\n end\n\n @swatches_path = File.join(options[:export_directory], filename)\n end", "def to_name\n basename.to_s.sub extname, ''\n end", "def file_suffix\n file_name.split('.').last \n end", "def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end", "def basename_tmpl\n ##p @cfg[:filename_tmpl]\n mode=Dyndoc.guess_mode(@cfg[:filename_tmpl])\n ##p [\"mode\",mode,Dyndoc.tmplExt[mode]]\n if mode\n name,ext=@cfg[:filename_tmpl].scan(/^(.*)(?:#{Dyndoc.tmplExt[mode].join(\"|\")})$/).flatten.compact\n else\n name,ext=@cfg[:filename_tmpl].scan(/^(.*)(?:_tmpl(\\..*)|(\\.dyn))$/).flatten.compact\n end\n #p [:name,@cfg[:filename_tmpl],name]\n name\n end", "def path\n path = @file.sub(File.expand_path(root_path), '')\n\n # if xx.haml (but not xx.html.haml), \n if tilt?\n path = path.sub(/\\.[^\\.]*$/, \"\")\n path += \".#{default_ext}\" unless File.basename(path).include?('.')\n end\n\n path\n end", "def archive_name(opts)\n if (name = opts[:output])\n return Pathname.new(name)\n end\n\n name = params[:name] ||\n raise(\"Cannot create an archive without a profile name! Please \"\\\n \"specify the name in metadata or use --output to create the archive.\")\n version = params[:version] ||\n raise(\"Cannot create an archive without a profile version! Please \"\\\n \"specify the version in metadata or use --output to create the archive.\")\n ext = opts[:zip] ? \"zip\" : \"tar.gz\"\n slug = name.downcase.strip.tr(\" \", \"-\").gsub(/[^\\w-]/, \"_\")\n Pathname.new(Dir.pwd).join(\"#{slug}-#{version}.#{ext}\")\n end", "def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end", "def asset_output_filename(path, processed_extensions)\n path = Pathname.new(path) if path.is_a?(String)\n\n return path if path.basename.to_s.split('.').length == 2\n\n extension = path.extname\n processed_extensions.map! { |ext| (ext[0] != '.' ? '.' : '') + ext }\n\n if processed_extensions.include?(extension)\n asset_output_filename(path.to_s.sub(/#{extension}\\Z/, ''), processed_extensions)\n else\n path\n end\n end", "def bundle_resouce_file_name\n self.title.gsub(/\\s/,\"_\")\n end", "def manifest\n template \"#{favorite_cleaned}.txt\", 'Song.txt'\n end", "def page_file_name(name, format)\n format.nil? ? name : \"#{name}.#{::Gollum::Page.format_to_ext(format)}\"\n end", "def filename_path(dir, filename)\n # we need to check .yaml, .yml, and .json versions\n filename = filename.to_s.sub(/\\.[^.]*$/, '')\n base = @options[:root] + @options[dir]\n %w[.yaml .yml .json .rb].map { |ext| base + (filename + ext) }.detect(&:exist?)\n end", "def get_config_file_name(config, stage)\n path = File.dirname(config)\n extension = File.extname(config)\n filename = File.basename(config, extension)\n extension.sub!(/^\\./, '')\n local_file = [filename, stage].join('.')\n local_file = [local_file, extension].join('.') unless extension.empty?\n local_path = File.join(path, local_file)\n end", "def filename\n \"words.txt\" if original_filename\n end", "def yaml_file?\n false\n end", "def filename\n #\"#{original_filename.split('.').first}.png\" if original_filename\n \"img.#{original_filename.split('.').last}\" if original_filename\n #original_filename if original_filename\n end", "def filename(version=nil)\n if version.blank?\n return \"#{unique_name}.#{file_ext}\"\n else\n return nil unless (workflow_version = self.find_version(version))\n return \"#{workflow_version.unique_name}.#{workflow_version.file_ext}\"\n end\n end", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def Check_File(_Filename)\r\n unless File.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\nend", "def example_config_filename\n return @example_config_filename unless @example_config_filename.nil?\n filename = self.config_filename\n target_ext = File.extname(filename)\n return \"#{filename[0, filename.size-target_ext.size]}.example#{target_ext}\" if '' != target_ext\n nil\n end", "def db_name\n\treturn File.basename($0, \".*\") + \"_db.yml\"\nend", "def output_filename_without_extension\n File.basename @output_path_without_extension\n end", "def extify(name) # :doc:\n if Gem.win_platform?\n \"#{name}.bat\"\n else\n name\n end\n end", "def ext_name(name)\r\n return name.to_s if name.kind_of?(Symbol)\r\n return name.gsub(/\\s/, '_')\r\n end", "def process(name)\n return unless name\n\n self.ext = File.extname(name)\n self.basename = name[0..-ext.length - 1].gsub(%r!\\.*\\z!, \"\")\n end", "def scrubbed_name\n extension = @fileName.split(\".\")[@fileName.split(\".\").length-1]\n \n if @season.to_i < 10\n season_string = \"S0{#@season}\"\n else\n season_string = \"S#{@season}\"\n end\n \n if @episode.to_i < 10\n episode_string = \"E0#{@episode}\"\n else\n episode_string = \"E#{@episode}\"\n end \n \n [@name.gsub(\" \",\".\"),[season_string,episode_string].join(\"\"),extension].join(\".\")\n end", "def find_filename(name)\n return name if not File.exists?(name)\n\n new_name = name\n count = 0\n until not File.exists?(new_name)\n count += 1\n new_name = \"#{name}_#{count}\"\n end\n\n new_name\n end", "def get_path(filename)\n\n Pathname(__FILE__).ascend{ |directory|\n path = directory + \"ansiblealexa.yml\"; break path if path.file?\n }\n\nend", "def _config_files(name, ext='.yml')\n return [name.to_s] if File.exist?(name.to_s) && !File.directory?(name.to_s)\n\n basename = File.basename(name.to_s, ext) || nil\n dirname = File.dirname(name.to_s)\n path_ary = if _config_path.empty?\n [dirname]\n else\n _config_path\n end\n\n _suffixes.for(basename, ext).inject([]) do |all_files, name_x|\n # for :path style configs\n path_ary.reverse.inject(all_files) do |files, dir|\n fn = File.join(dir, name_x)\n files << fn if File.exist? fn\n files\n end\n end\n end", "def name\n @name ||= @project.dir.path.match(/.*\\/(.*)$/).nil? ? \"unknown\" : $1\n end", "def file_name_for(*args)\n \"%s.%s\" % [args.compact.join(self.class.thumbnail_separator), extension]\n end", "def file_name\n case variant\n when :sample\n \"sample-#{md5}.#{file_ext}\"\n else\n \"#{md5}.#{file_ext}\"\n end\n end", "def package_set_name(path, branch='master')\n file = dir_git(path,branch,/source\\.yml/)\n raw = raw_file_from_git(path,file[0])\n yaml = YAML.load(raw)\n yaml[\"name\"]\n end", "def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend", "def layout_name(filename)\n\t\tif filename == LAYOUT_FILE_REGEX\n\t\t\treturn filename.split('_')[1].split('.')[0]\n\t\telse\n\t\t\treturn filename\n\t\tend\n\tend" ]
[ "0.78180194", "0.6748234", "0.6631062", "0.6631062", "0.66275173", "0.64387393", "0.63893795", "0.63122404", "0.6267875", "0.62355494", "0.61685336", "0.61416733", "0.61275667", "0.6125846", "0.61069953", "0.6059352", "0.60551053", "0.60381323", "0.6034736", "0.60092545", "0.5931111", "0.5919657", "0.59077966", "0.58450484", "0.5825429", "0.5825429", "0.5818147", "0.58046585", "0.57540876", "0.5751717", "0.5747305", "0.5729716", "0.5725112", "0.5693059", "0.567913", "0.56740224", "0.5670654", "0.56662244", "0.56587666", "0.56452453", "0.5640717", "0.5639415", "0.56306374", "0.5622977", "0.56095994", "0.56043625", "0.5596016", "0.55876684", "0.5583483", "0.5582903", "0.5582151", "0.55702025", "0.55606765", "0.5551334", "0.5550107", "0.554565", "0.554514", "0.5544494", "0.5539497", "0.5522709", "0.55191576", "0.5502872", "0.549252", "0.5480657", "0.54791445", "0.5467515", "0.5463978", "0.5457564", "0.5457157", "0.5450444", "0.54398656", "0.5436137", "0.5434466", "0.5432983", "0.54297185", "0.54224664", "0.5420663", "0.54142094", "0.5411799", "0.5410221", "0.5410221", "0.5410221", "0.5410221", "0.5409271", "0.5407724", "0.5407308", "0.5391713", "0.53904027", "0.5385534", "0.538169", "0.5381575", "0.53644955", "0.53633285", "0.5359483", "0.5355334", "0.53546804", "0.5350638", "0.53483945", "0.5343693", "0.5340608" ]
0.802029
0
Return list of job names
def detect_jobs release_detector.latest_dev_release_job_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_names\n @nodes.keys\n end", "def jobs\n command('.jobs').split(\"\\n\")\n end", "def names_list\n backend.queue_names\n end", "def job_items\n job_arguments(1)\n end", "def list_jobs(args)\n Morpheus::Cli::BackupJobsCommand.new.list(args)\n end", "def job_grep name='.'\n recipe_grep(name)\n .map{ |r| r.job.select{ |n| n.name === name } }\n .flatten\n end", "def all_jobs\n\n find_jobs()\n end", "def job_titles\n collection(\"job_titles\")\n end", "def list_jobs\n @glue_client.list_jobs\n rescue Aws::Glue::Errors::GlueException => e\n @logger.error(\"Glue could not list jobs: \\n#{e.message}\")\n raise\n end", "def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end", "def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end", "def getCurrentJobs\n getJobs('0/')\n end", "def jobs\n @jobs || {}\n end", "def task_names\n map do |task|\n task.name\n end\n end", "def jobs\n self.ListJobs.first.map { |j| map_job(j) }\n end", "def job_history\n history = []\n record = nil\n\n command('llist jobs').split(\"\\n\").each do |line|\n next unless line.index ': '\n key, value = line.split(': ', 2)\n key.strip!\n value.chomp!\n\n if key == 'JobId'\n record = { key => value }\n history << record\n elsif record\n record[key] = value\n end\n end\n\n history\n end", "def jobs_without_template\n []\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end", "def jobs\n return nil unless @rufus\n return @saved_job_list if !running\n\n @rufus.jobs.collect do |job|\n {\n :job => job,\n :job_spec_id => job.handler.job_spec_id,\n :job_spec_name => job.handler.job_spec_name,\n :launched_job => job.handler.launched_job,\n :running => job.running?,\n :last_time => job.last_time,\n :next_time => job.next_time,\n :opts => job.opts,\n :scheduled_at => job.scheduled_at,\n :unscheduled_at => job.unscheduled_at,\n :id => job.id,\n :tags => job.tags,\n :last_work_time => job.last_work_time,\n :mean_work_time => job.mean_work_time\n }\n end\n end", "def current_jobtitle\n self.profiles.map {|p| p.element('jobtitle')}.join(', ')\n end", "def jobs\n ApplicationJob.descendants\nend", "def job(job_name)\n jobs job_name\n end", "def jobs\r\n @parser.jobs\r\n end", "def as_jobs\n @jobs ||= find_latest_completed_jobs\n end", "def get_jobs_list(status = :all, page = 1, reload = false)\n Bitmovin::Job.list(status, page, reload)\n end", "def print_jobs_list(opts = {})\n data, _status_code, _headers = print_jobs_list_with_http_info(opts)\n data\n end", "def jobs\n\t\t# ...\n\tend", "def jobs\r\n end", "def list_of_node_names(options={})\n list_of_running_instances.collect {|ri| ri.name }\n end", "def display_name\n job_class\n end", "def job_spec_name\n self.job_spec.name\n end", "def available_jobs\n active_jobs + eligible_jobs\n end", "def view_waitlist_people\n str = \"\"\n array = @queue.to_array\n array.each do |order|\n str += order.get_name.to_s + \",\"\n end\n str.chop\n end", "def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end", "def list\n puts \"\\n\\n#{Job.count} job postings found\\n\\n\"\n Job.list.map do |job|\n puts \"#{job.id}. #{job.firstline}\"\n end\n puts menu\n end", "def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end", "def job_titles\n reject_nil(\n job_title_1, job_title_2, job_title_3,\n job_title_4, job_title_5, job_title_6\n )\n end", "def display_jobs\n jobs = SearchJobs::Jobs.all\n\n jobs.each.with_index(1) do |job, index|\n puts \"#{index}.\".colorize(:red) + \"==========#{job.company.upcase.strip}=========\".colorize(:yellow)\n puts \"#{job.name.upcase}\".colorize(:blue)\n end\n end", "def scheduler_agent_jobs\n jobs(tag: SCHEDULER_AGENT_TAG)\n end", "def getDeadJobs\n getJobs('1/')\n end", "def array_for_stage(jobs)\n jobs, _ = jobs.to_a.first if jobs.is_a? Hash\n\n jobs.inject([]) do |arr, job|\n arr << if job.is_a? Hash\n # Take just the job class, without any dependents\n job.keys[0]\n else\n job\n end\n end\n end", "def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend", "def jobs\n raise NotImplementedError\n end", "def job_name\n return settings[:job_name] if settings[:job_name]\n relevant_filename = args.compact.uniq.map { |path| File.basename(path, '.rb') }.join('-')\n \"#{relevant_filename}---#{input_paths}---#{output_path}\".gsub(%r{[^\\w/\\.\\-\\+]+}, '')\n end", "def active_jobs\n result = Array.new\n self.jobs.each do |j|\n if j.private?\n result << j\n elsif j.active?\n result << j\n end\n end\n result\n end", "def job_name\n @job_name ||= QA::Runtime::Env.ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n end", "def set_job_name(*); end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end", "def process_names\n @processes.map { |p| @names[p] }\n end", "def task_names\n @task_names ||= tasks.map { |task| task.name.underscore }\n end", "def names\n map(&:name)\n end", "def all\n Array(@@job_scheduler_instance)\n end", "def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend", "def names\n map(&:names).flatten\n end", "def job_service\n job_arguments(0)\n end", "def jobs\n JobPolicy::Scope.new(self, Job).resolve\n end", "def get_job_runs(job_name)\n response = @glue_client.get_job_runs(job_name: job_name)\n response.job_runs\n rescue Aws::Glue::Errors::GlueException => e\n @logger.error(\"Glue could not get job runs: \\n#{e.message}\")\n end", "def names\n map(&:name)\n end", "def get_hook_names(job, hook_method_prefix)\n methods = (job.respond_to?(:hooks) && job.hooks) || job_methods(job)\n methods.select{|m| m.start_with?(hook_method_prefix)}.sort\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def current_cron_jobs\n client.get_cron_jobs(label_selector)\n end", "def failed_jobs\n @failed_jobs ||= []\n end", "def get_jobs_by_client_id(client_id)\n jobs = []\n for job in get_data(\"jobs\")\n if client_id == job[\"client_id\"]\n jobs.push(job)\n end\n end\n\n return jobs\n end", "def available_jobs\n details.at('#filmography').css(\"div[data-category$='Movie']\").map{ |job| job['data-category'].gsub('Movie', '') }\n end", "def job_type_name\r\n job_type.job_name rescue nil\r\n end", "def rocket_job_active_workers(server_name = nil)\n return [] if !running? || (server_name && !worker_on_server?(server_name))\n [ActiveWorker.new(worker_name, started_at, self)]\n end", "def get_monitors\n return @jobs\n end", "def lost_jobs\n @lost_jobs ||= []\n end", "def parse_jobs\r\n @jobs.scan(/([a-z]) => ([a-z]|)/).inject({}) do |jobs_hash, pair|\r\n jobs_hash[pair.first] = pair.last.empty? ? '' : pair.last\r\n jobs_hash\r\n end\r\n end", "def get_task_list_by_job_id(job_id)\n list_tasks = []\n for task in get_data(\"tasks\")\n if job_id == task[\"job_id\"]\n list_tasks.push(task)\n end\n end\n\n return list_tasks\n end", "def service_names(status: :running)\n services = query_cluster(:pods, component: :server)\n services.map { |m| m.split('-')[0] }.uniq\n end", "def name\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n job_id\n end", "def jobinfo\n dir + JOBINFO_FILENAME\n end", "def list_jobs project_id:, location:\n # [START transcoder_list_jobs]\n # project_id = \"YOUR-GOOGLE-CLOUD-PROJECT\" # (e.g. \"my-project\")\n # location = \"YOUR-JOB-LOCATION\" # (e.g. \"us-central1\")\n\n # Require the Transcoder client library.\n require \"google/cloud/video/transcoder\"\n\n # Create a Transcoder client.\n client = Google::Cloud::Video::Transcoder.transcoder_service\n\n # Build the resource name of the parent.\n parent = client.location_path project: project_id, location: location\n\n # Get the list of jobs.\n response = client.list_jobs parent: parent\n\n puts \"Jobs:\"\n # Print out all jobs.\n response.each do |job|\n puts job.name\n end\n # [END transcoder_list_jobs]\nend", "def job_name\n [\n ENV[\"OOD_PORTAL\"], # the OOD portal id\n ENV[\"RAILS_RELATIVE_URL_ROOT\"].to_s.sub(/^\\/[^\\/]+\\//, \"\"), # the OOD app\n token # the Batch Connect app\n ].reject(&:blank?).join(\"/\")\n end", "def job\n fetch('games.final_fantasy_xiv.jobs')\n end", "def all_etl_jobs\n fargate_etl_jobs + glue_etl_jobs\n end", "def search(*args)\n\t\t\targs = args[0] if args.is_a?(Array) && args.count == 1\n\n\t \tcb_response = self.api_get(Cb.configuration.uri_job_search, :query => args)\n\t \tjson_hash = JSON.parse(cb_response.response.body)\n\n\t \tpopulate_from json_hash, \"ResponseJobSearch\"\n\n\t \tjobs = []\n\t \tjson_hash[\"ResponseJobSearch\"][\"Results\"][\"JobSearchResult\"].each do |cur_job|\n\t \t\tjobs << CbJob.new(cur_job)\n\t \tend\n\n\t \treturn jobs\n\t\tend", "def index\n @jobs = Job.all\n end", "def jobs\n @jobs ||= Beaneater::Jobs.new(self)\n end", "def names\n @names ||= []\n end", "def instances_names_list\n return [] unless configured?\n\n aws_instances_ids = instances_list || []\n aws_instances_ids.map { |instance| instance[:node_name] }\n end", "def names\n\n get_list['list'].collect { |re, pa| re }\n end", "def find_jobs (tag=nil)\n\n jobs = @cron_jobs.values + @non_cron_jobs.values\n jobs = jobs.select { |job| job.has_tag?(tag) } if tag\n jobs\n end", "def jobdirs\n @target.exist? ? @target.children.select { |i| jobdir?(i) } : []\n end", "def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end", "def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end", "def list_names\n @lib.list_names\n end", "def all\n Dir[\"#{DOTDIR}/**/job.yaml\"]\n .map { |f| fetch File.basename File.dirname f }\n end", "def node_names\n @cluster.nodes.map(&:name)\n end", "def get_job_name(file)\n package = \"\"\n job = nil\n default = nil\n if file =~ EXTENSION_RE\n default = $1\n File.readlines(file).each { |s|\n if s =~ /^package ([^;]+)/\n package = $1.chop + \".\"\n elsif s =~ /class\\s+([^\\s(]+).*extends\\s+.*Job/\n unless job and default and (job.downcase == default.downcase)\n #use either the last class, or the one with the same name as the file\n job = $1\n end\n end\n }\n raise \"Could not find job name\" unless job\n \"#{package}#{job}\"\n elsif file =~ /(.*):(.*)/\n begin\n CONFIG[\"namespaces\"][$1] + \".\" + $2\n rescue\n $stderr.puts \"Unknown namespace: #{$1}\"\n exit(1)\n end\n else\n file\n end\nend", "def job(name)\n @manifest[\"jobs\"].find { |job| job[\"name\"] == name }\n end", "def index\n jobs_index(Job.all)\n end", "def names\n Array(@name)\n end", "def vm_names\n machines = manager.vbox.machines.find_all do |machine|\n machine.name =~ /#{Travis::Worker.config.vms.name_prefix}/\n end\n machines ? machines.map { |machine| machine.name } : []\n end", "def names\n @j_map.names()\n end", "def get_job_name(course, assessment, submission)\n \"#{course.name}_#{assessment.name}_#{submission.version}_#{submission.course_user_datum.email}\"\n end" ]
[ "0.76036364", "0.7409595", "0.7022217", "0.6957284", "0.6929985", "0.67825466", "0.659639", "0.6587585", "0.6562242", "0.65453494", "0.6497673", "0.6486111", "0.6485549", "0.647718", "0.6473285", "0.64258707", "0.6390483", "0.6387652", "0.63443875", "0.6315985", "0.62975943", "0.6282326", "0.6269126", "0.6239997", "0.6216339", "0.61307025", "0.6124494", "0.61131096", "0.6108392", "0.6105935", "0.60894895", "0.60816455", "0.6036407", "0.60361165", "0.6014652", "0.60002095", "0.5992475", "0.5989938", "0.59889823", "0.5914718", "0.5910979", "0.59085613", "0.59049094", "0.5899346", "0.58835423", "0.5882072", "0.5876809", "0.5874573", "0.58700866", "0.5841334", "0.58396906", "0.5834359", "0.5823075", "0.5822654", "0.5814031", "0.58029974", "0.5802397", "0.57949644", "0.57910603", "0.5784424", "0.57742727", "0.57659584", "0.5745948", "0.5740625", "0.57405555", "0.572497", "0.5717895", "0.56886405", "0.5679298", "0.56759083", "0.5656832", "0.5642899", "0.56381434", "0.5637974", "0.5636759", "0.5626813", "0.561276", "0.5591312", "0.5585985", "0.5583204", "0.55798763", "0.5576308", "0.55748034", "0.5567025", "0.556098", "0.55557275", "0.55540097", "0.5553958", "0.5550835", "0.55467397", "0.551921", "0.55162686", "0.5507308", "0.5505003", "0.5502564", "0.54994035", "0.5499387", "0.5497743", "0.54927295" ]
0.61682564
26
The "release" aspect of the manifest, which has two keys: name, version
def release_properties release_detector.latest_dev_release_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_manifest_name\n \"#{name}-release-manifest\"\n end", "def release_name\n return nil unless @data['name'] && @data['version']\n [ dashed_name, @data['version'] ].join('-')\n end", "def release_metadata\n @release_metadata ||= {\n package: {\n name: name,\n repo: {\n type: \"git\", # Hardcoded until we have other support\n url: repo_url\n },\n hashref: release_hashref,\n timestamp: timestamp\n }\n }\n end", "def release(options)\n options = options.rekey\n\n unixname = self.unixname\n\n package = options[:package] || metadata.name\n version = options[:version] || metadata.version\n\n date = options[:date] || metadata.released || Time::now.strftime('%Y-%m-%d %H:%M')\n\n changes = options[:changes] || project.history.releases[0].changes\n notes = options[:notes] || project.history.releases[0].note\n\n release = options[:release] || version\n\n files = options[:files] || options[:file] || []\n\n #store = options[:store] || 'pkg'\n\n processor = options[:processor] || 'Any'\n\n is_public = !options[:private]\n\n #raise ArgumentError, \"missing unixname\" unless unixname\n raise ArgumentError, \"missing package\" unless package\n raise ArgumentError, \"missing release\" unless release\n\n # package name has to be 3+ characters.\n if package.size < 3\n package = package + \"'s\"\n end\n\n # sub in for version if %s is used in release name.\n release = release % version if release.index(\"%s\")\n\n release_notes = notes\n release_changes = changes\n\n # Gather package files to release.\n if files.empty?\n files = find_packages(version)\n else\n files = files.map do |file|\n if File.directory?(file)\n find_packages(version, file)\n else\n file\n end\n end\n files = files.flatten\n end\n files = files.select{ |f| File.file?(f) }\n\n abort \"No package files.\" if files.empty?\n\n files.each do |file|\n abort \"Not a file -- #{file}\" unless File.exist?(file)\n puts \"Release file: #{File.basename(file)}\"\n end\n\n # which package types\n #rtypes = [ 'tgz', 'tbz', 'tar.gz', 'tar.bz2', 'deb', 'gem', 'ebuild', 'zip' ]\n #rtypes -= exclude\n #rtypes = rtypes.collect{ |rt| Regexp.escape( rt ) }\n #re_rtypes = Regexp.new('[.](' << rtypes.join('|') << ')$')\n\n puts \"Releasing #{package} #{release} to #{unixname} project...\" #unless options['quiet']\n\n login do\n\n raise ArgumentError, \"missing group_id\" unless group_id\n\n unless package_id = package?(package)\n if trial?\n puts \"Package '#{package}' does not exist.\"\n puts \"Create package #{package}.\"\n abort \"Cannot continue in trial mode.\"\n else\n #unless options['force']\n q = \"Package '#{package}' does not exist. Create?\"\n a = ask(q, 'yN')\n abort \"Task canceled.\" unless ['y', 'yes', 'okay'].include?(a.downcase)\n #end\n puts \"Creating package #{package}...\"\n create_package(package, is_public)\n unless package_id = package?(package)\n raise \"Package creation failed.\"\n end\n end\n end\n if release_id = release?(release, package_id)\n #unless options[:force]\n if trial?\n puts \"Release #{release} already exists.\"\n else\n q = \"Release #{release} already exists. Re-release?\"\n a = ask(q, 'yN')\n abort \"Task canceled.\" unless ['y', 'yes', 'okay'].include?(a.downcase)\n #puts \"Use -f option to force re-release.\"\n #return\n end\n files.each do |file|\n fname = File.basename(file)\n if file_id = file?(fname, package)\n if trial?\n puts \"Remove file #{fname}.\"\n else\n puts \"Removing file #{fname}...\"\n remove_file(file_id, release_id, package_id)\n end\n end\n if trial?\n puts \"Add file #{fname}.\"\n else\n puts \"Adding file #{fname}...\"\n add_file(file, release_id, package_id, processor)\n end\n end\n else\n if trial?\n puts \"Add release #{release}.\"\n else\n puts \"Adding release #{release}...\"\n add_release(release, package_id, files,\n :processor => processor,\n :release_date => date,\n :release_changes => release_changes,\n :release_notes => release_notes,\n :preformatted => '1'\n )\n unless release_id = release?(release, package_id)\n raise \"Release creation failed.\"\n end\n end\n #files.each do |file|\n # puts \"Added file #{File.basename(file)}.\"\n #end\n end\n end\n puts \"Release complete!\" unless trial?\n end", "def define_on_distro_release(distro, release, name, version=nil)\n distro_releases[[distro, release]] << [name, version]\n end", "def release\n case new_resource.version\n when 'latest'\n require 'octokit'\n Octokit.releases(repo).first[:tag_name]\n else\n \"v#{new_resource.version}\"\n end\n end", "def manifest(versions: @versions, latest_release: self.latest_release)\n manifest = versions.try(:[], latest_release)\n\n # In the short API, it may have a \"latest\" string value, so make sure it's a hash\n manifest.is_a?(Hash) ? manifest : nil\n end", "def final_release_metadata_json\n @final_release_metadata_json ||= Pathname(\"#{final_name}-release-metadata.json\")\n end", "def info\n release = args.shift.downcase.strip rescue nil\n raise(CommandFailed, \"Specify a release\") unless release\n\n release = heroku.release(app, release)\n\n display \"=== Release #{release['name']}\"\n display_info(\"Change\", release[\"descr\"])\n display_info(\"By\", release[\"user\"])\n display_info(\"When\", time_ago(Time.now.to_i - Time.parse(release[\"created_at\"]).to_i))\n display_info(\"Addons\", release[\"addons\"].join(\", \"))\n display_vars(release[\"env\"])\n end", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def created_release(version)\n puts green(\"Release #{version} created\")\n end", "def release\n @release ||= ENV[\"RELEASE\"] || \"1\"\n end", "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def version_key version=nil\n\n version = \"release\" if version.blank?\n\n Rails.logger.info \"*\"*25\n Rails.logger.info \"VersionKey:\"\n Rails.logger.info version\n\n case version\n when 'release' then 'release'\n when 'canary' then $redis.lindex('releases',0)\n else\n version\n end\n end", "def deploy_key\n params[:version] ||= 'release'\n case params[:version]\n when 'release' then 'release'\n when 'canary' then redis.lindex('releases', 0)\n else\n params[:version]\n end\n end", "def ver\n @values.fetch('ver') { \n @values['ver'] = 1\n }\n end", "def release!\n version = Origen.app.version\n body = { version: version.to_s }\n if version.production?\n body[:type] = :production\n else\n body[:type] = :development\n end\n post(\"plugins/#{Origen.app.name}/release\", body: body)\n end", "def release\n variables[:release]\n end", "def valid_package_entry(match, data)\n {\n name: match[:name],\n version: data[:version],\n metadata: {\n \"scm\" => match[:scm],\n \"repo\" => data[:repo]\n }\n }\n end", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def release\n configs = store(:get, 'configs').to_s.gsub(\"\\n\", \" \")\n \n # TODO: if error, user need to deploy code first (nothing to deploy) => use a special exit code \n # when code is not pushed or only deploy if app has a correct build\n version = @api.release(@name, configs).to_s.chomp.gsub(\"\\n\", \" \")\n backend = @api.run(@name, :web, version).to_s.chomp.gsub(\"\\n\", \" \")\n @api.route @name, backend\n return version\n end", "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end", "def map_releases\n releases.sort! {|x,y| x[1] <=> y[1] }\n .map { |release|\n {\n \"version\" => release[1],\n \"status\" => \"active\",\n \"description_html\" => \"<p>#{release[0]}</p>\",\n \"description_markdown\" => release[0],\n \"providers\" => [\n {\"name\" => \"virtualbox\", \"url\" => \"#{RELEASE_URL}#{release[0]}\"}\n ]\n }\n }\n end", "def version\n name.split('_')[1]\n end", "def release\n warn 'Envjs does not yet support --release' if options[:release]\n 'edge'\n end", "def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end", "def release\n warn 'Rhino does not yet support --release' if options[:release]\n 'rhino1_7R2'\n end", "def create_release(attrs = {})\n release = build_release(attrs)\n release.save\n release\n end", "def ver\n @values['ver']\n end", "def generate_manifest\n available_versions.each do |version|\n puts \"Processing #{project_name} - #{channel_name} - #{version}\"\n\n artifacts_for(version).each do |artifact|\n p = artifact.platform\n pv = artifact.platform_version\n m = artifact.architecture\n\n manifest[p] ||= {}\n manifest[p][pv] ||= {}\n manifest[p][pv][m] ||= {}\n manifest[p][pv][m][artifact.version] = {\n sha1: artifact.sha1,\n sha256: artifact.sha256,\n url: artifact.url\n }\n end\n end\n\n manifest\n end", "def native_release_packages\n @attributes[:native_release_packages]\n end", "def publish_to_package_manager(version)\nend", "def publish_to_package_manager(version)\nend", "def execute_ruby_release(type:)\n version_regex = %r{.version\\s*=\\s*'([\\d\\.]+)'}\n gemspec_path = Dir.glob(\"*.gemspec\").first\n gemspec_contents = File.read(gemspec_path)\n version = gemspec_contents.match(version_regex)[1]\n version = Semverse::Version.new(version)\n new_version = \"0.0.5\"\n gemspec_contents = gemspec_contents.sub(version_regex, \".version = '#{new_version}'\")\n\n gemspec_folder_obj = octokit.contents(@originating_repo,)\n gemspec_file_obj = gemspec_folder_obj.find { |file| file[:name] == gemspec_path }\n gemspec_file = octokit.blob(@originating_repo, gemspec_file_obj[:sha])\n gemspec_obj = octokit.contents(@originating_repo, path: gemspec_path)\n gemspec_sha = gemspec_file['sha']\n contents = Base64.encode64(gemspec_contents)\n json = {\n message: \"Updating to #{new_version}\",\n content: contents,\n sha: gemspec_sha\n }.to_json\n\n gemspec_file_obj = octokit.update_contents(@originating_repo, gemspec_path, \"Release #{new_version}\", gemspec_sha, gemspec_contents)\n octokit.add_comment(@originating_repo, @pr_number, \"Thanks! This is now out in #{new_version}\")\n end", "def key\n \"gem-package-#{name}\"\n end", "def test_method_release\n value_ = ::Versionomy.create(:major => 1, :minor => 9, :tiny => 2, :release_type => :alpha, :alpha_version => 4)\n value2_ = value_.release\n assert_equal([1, 9, 2, 0, :final, 0, 0], value2_.values_array)\n value_ = ::Versionomy.create(:major => 1, :minor => 9, :tiny => 2)\n value2_ = value_.release\n assert_equal(value_, value2_)\n end", "def publish!\n release_file = build_role 'release', release\n\n timestamp.replace(release_file)\n\n timestamp_file = build_role 'timestamp', timestamp\n\n bucket.create(release_file.path_with_hash, release_file.body)\n bucket.create(timestamp_file.path, timestamp_file.body)\n end", "def tag_version_task\n sh git, 'tag', '-a', \"#{gemspec.name}-#{gemspec.version}\", '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end", "def test_bump_release_candidate_to_release\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :release_candidate, :release_candidate_version => 2)\n value_ = value_.bump(:release_type)\n assert_equal(2, value_.major)\n assert_equal(0, value_.minor)\n assert_equal(1, value_.tiny)\n assert_equal(0, value_.tiny2)\n assert_equal(:final, value_.release_type)\n assert_equal(0, value_.patchlevel)\n assert_equal(0, value_.patchlevel_minor)\n end", "def target_version; end", "def own_version(version)\n version.release_type == :final\n end", "def prerelease_specs; end", "def add_key_and_product_to_releases(releases, key, product)\n releases.each do |release|\n release[:repo_key] ||= key unless key.nil?\n release[:product] = product\n end\n end", "def write_release(payload)\n info 'Creating new release on GitHub'\n rel = payload[:data][:github_kit].delete(:release)\n release = github_client.create_release(\n rel[:repository],\n rel[:tag_name],\n :name => rel[:name],\n :target_commitish => rel[:reference],\n :prerelease => rel[:prerelease],\n :body => rel[:body]\n )\n\n api_release_url = release.rels[:self].href\n public_release_url = release.rels[:html].href\n\n info 'New release created on GitHub. Uploading assets.'\n assets = rel[:assets].map do |asset|\n debug \"Uploading release asset - #{asset}\"\n response = github_client.upload_asset(\n api_release_url,\n asset_store.get(asset),\n :name => asset.sub(/^.+?_/, ''),\n :content_type => 'application/octet-stream'\n )\n debug \"Completed release asset upload - #{asset}\"\n Smash.new(\n :url => response[:url],\n :browser_url => response[:browser_download_url],\n :name => response[:name],\n :id => response[:id]\n )\n end\n payload.set(:data, :github_kit, :release, :assets, assets)\n payload.set(:data, :github_kit, :release, :api_url, api_release_url)\n payload.set(:data, :github_kit, :release, :public_url, public_release_url)\n\n true\n end", "def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end", "def built_manifest\n log.info(log_key) { \"Building version manifest\" }\n m = Omnibus::Manifest.new(build_version, build_git_revision, license)\n softwares.each do |software|\n m.add(software.name, software.manifest_entry)\n end\n m\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def release\n fail AlreadyRelease unless prerelease?\n @special = ''\n @metadata = ''\n end", "def set_version_name!\n if patterns = @name.match(/^(.*) \\[(.*)\\](.*)$/)\n @name = \"#{patterns[1]}#{patterns[3]}\"\n @version_name = patterns[2]\n end\n end", "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\nend", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def tag_release(version)\n system \"git tag v#{version}\"\n system \"git push origin v#{version}\"\n end", "def installed_version(package_name, arch = nil)\n version(package_name, arch, false, true)\n end", "def version\n build_string\n end", "def test_method_release\n value_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = value_.release\n assert_equal([1, 9, 2, 0, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.create([1, 9, 2, 5, 2], :rubygems)\n value2_ = value_.release\n assert_equal(value_, value2_)\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def versioned_filename_for( filename )\n\n manifest = Rails.application.config.assets[:manifest]\n manifest.key?(filename) ? manifest[filename] : filename\n\n end", "def published_version\n Rails.cache.fetch(\"published_version_for_#{name}\", expires_in: 10.minutes) do\n f = open(\"http://download.opensuse.org/factory/repo/oss/media.1/build\")\n matchdata = %r{openSUSE-(.*)-i586-.*}.match(f.read)\n matchdata[1]\n end\n end", "def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend", "def version\n @attributes[:version]\n end", "def version\n @attributes[:version]\n end", "def package_name\n ver = if new_resource.version == 'latest'\n package_metadata[:version]\n else\n new_resource.version\n end\n \"Chef Development Kit v#{ver}\"\n end", "def ver\n @values.fetch('ai.application.ver') { \n @values['ai.application.ver'] = nil\n }\n end", "def version_info\n return @children['version-info'][:value]\n end", "def release\n git :archive, fetch(:branch), fetch(:project_root), '| tar -x -C', release_path, \"--strip=#{fetch(:project_root).count('/')+1}\"\n end", "def post_release_v2(app_name, slug, dyno_types, user, token,\n slug_url, repo_size)\n slug_url_regex = /https:\\/\\/(.+?)\\.s3\\.amazonaws\\.com\\/(.+?)\\?/\n _, slug_put_key, slug_put_bucket = slug_url.match(slug_url_regex).to_a\n start = Time.now\n payload = {\n # \"head\" => head,\n # \"prev_head\" => commit_hash,\n # \"current_seq\" => current_seq,\n \"slug_put_key\" => slug_put_key,\n \"slug_put_bucket\" => slug_put_bucket,\n \"repo_size\" => repo_size,\n \"release_descr\" => \"sokoban-built release\", # punting for v2\n \"language_pack\" => \"Sokoban\", # punting for v2\n \"buildpack\" => \"Sokoban\", # punting for v2\n \"slug_version\" => 2,\n \"slug_size\" => File.size(slug),\n \"stack\" => \"cedar\",\n \"user\" => user,\n \"process_types\" => dyno_types,\n \"git_log\" => \"\",\n \"run_deploy_hooks\" => false,\n \"addons\" => {},\n \"config_vars\" => {}}\n\n release_name =\n Timeout.timeout(30) do\n uri = URI.parse(release_uri(app_name))\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request.basic_auth(user, token)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.unparse(payload)\n response = http.request(request)\n if (response.code != \"200\")\n error_message = begin\n response.body && JSON.parse(response.body)[\"error\"] || \"failure releasing code\"\n rescue Timeout::Error\n \"timed out releasing code\"\n rescue\n \"failure releasing code\"\n end\n raise(error_message)\n end\n response.body\n end\n release_name\n end", "def hashmap_releases\n all.each_with_object({}) do |release, hash|\n hash[release.to_s] = release.attributes\n end\n end", "def release_state\n \"public_release\"\n end", "def latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\n end", "def test_bump_preview_to_release\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :preview)\n value_ = value_.bump(:release_type)\n assert_equal(2, value_.major)\n assert_equal(0, value_.minor)\n assert_equal(1, value_.tiny)\n assert_equal(0, value_.tiny2)\n assert_equal(:final, value_.release_type)\n assert_equal(0, value_.patchlevel)\n assert_equal(0, value_.patchlevel_minor)\n end", "def tag_release(tag)\n unless this_version == extract_version\n puts \"Committing buildfile with version number #{extract_version}\"\n Perforce.p4 'edit', Rake.application.rakefile.to_s\n Perforce.commit message\n end\n puts \"Tagging release #{tag}\"\n Perforce.p4 'tag', '-l', tag, \"//#{ENV['P4CLIENT']}/...\"\n end", "def full_name\n \"#{@name}-#{@version}\"\n end", "def versioned?\n Bones::VersionedRelease === release\n end", "def release\n return self unless prerelease?\n rel_parts = parts.dup\n rel_parts.pop while rel_parts.any? { |part| part.alpha? }\n self.class.new(rel_parts.join('.'))\n end", "def announcement\n cfg = Configuration.for(\"project\") \n { \n :subject => \"#{cfg.name} #{Crate::VERSION} Released\",\n :title => \"#{cfg.name} version #{Crate::VERSION} has been released.\",\n :urls => \"#{cfg.homepage}\",\n :description => \"#{cfg.description.rstrip}\",\n :release_notes => Utils.release_notes_from(cfg.history)[Crate::VERSION].rstrip \n }\n end", "def version\n res = {}\n res[:branch] = @branch\n res[:history] = @history\n res[:releases] = @releases\n res[:diffs] = @diffs.keys\n res\n end", "def package_version\n @semver.to_s '%M.%m.%p%s'\n end", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def test_that_bumping_with_prereleases\r\n v = Bumper::Version.new\r\n assert_equal '0.0.0.0', v.to_s\r\n assert_equal 1, v.bump_minor\r\n assert_equal '0.1.0.0', v.to_s\r\n assert_equal 'beta', v.bump_patch_tag('beta')\r\n assert_equal '0.1.1-beta.0', v.to_s\r\n assert_equal 'beta2', v.bump_patch_tag('beta')\r\n assert_equal '0.1.1-beta2.0', v.to_s\r\n assert_equal '1', v.bump_build\r\n assert_equal '0.1.1-beta2.1', v.to_s\r\n assert_equal 'rc', v.bump_patch_tag('rc') # replaces tag\r\n assert_equal '0.1.1-rc.0', v.to_s\r\n assert_equal 'rc2', v.bump_patch_tag('rc')\r\n assert_equal '0.1.1-rc2.0', v.to_s\r\n assert_equal 1, v.bump_patch # drops tag\r\n assert_equal '0.1.1.0', v.to_s\r\n assert_equal 2, v.bump_patch\r\n assert_equal '0.1.2.0', v.to_s\r\n assert_equal 2, v.bump_minor\r\n assert_equal '0.2.0.0', v.to_s\r\n assert_equal 'alpha', v.bump_patch_tag('alpha')\r\n assert_equal '0.2.1-alpha.0', v.to_s\r\n assert_equal 3, v.bump_minor\r\n assert_equal '0.3.0.0', v.to_s\r\n v.build = 'rc1'\r\n assert_equal '0.3.0.rc1', v.to_s\r\n assert_equal 'rc2', v.bump_build\r\n assert_equal '0.3.0.rc2', v.to_s\r\n end", "def create_release(node)\n if node.attributes['id'] and @releases[node.attributes['id']]\n release = @releases[node.attributes['id']]\n else\n release = @factory.new_release\n @releases[node.attributes['id']] = release\n end\n \n # Read all defined data fields\n release.id = node.attributes['id']\n release.title = node.elements['title'].text if node.elements['title']\n release.asin = node.elements['asin'].text if node.elements['asin']\n release.artist = create_artist(node.elements['artist']) if node.elements['artist']\n \n # Read the types\n node.attributes['type'].split(' ').each {|type|\n release.types << Utils.add_namespace(type)\n } if node.attributes['type']\n \n # Read the text representation information.\n if text_representation = node.elements['text-representation']\n release.text_language = text_representation.attributes['language']\n release.text_script = text_representation.attributes['script']\n end\n \n # Read the track list\n read_track_list(node.elements['track-list'], release.tracks) {|track|\n track.artist = release.artist unless track.artist\n track.releases << release\n }\n \n # Read the release event list\n read_release_event_list(node.elements['release-event-list'], release.release_events)\n \n # Read the disc list\n read_disc_list(node.elements['disc-list'], release.discs)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n release.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], release.tags)\n \n return release\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def get_released_version(date)\n @minor_versions.each do |pv|\n if pv.release_date == date then\n return pv\n end\n end\n return nil\n end", "def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend", "def debian_meta_name(name, with_rock_release_prefix = true)\n if with_rock_release_prefix\n rock_release_prefix + \"meta-\" + Deb.canonize(name)\n else\n pkg_prefix_base + \"meta-\" + Deb.canonize(name)\n end\n end", "def version_config version, data\n end", "def rock_release_prefix(release_name = nil)\n release_name ||= rock_release_name\n if release_name\n pkg_prefix_base + \"-#{release_name}-\"\n else\n pkg_prefix_base + \"-\"\n end\n end", "def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end", "def ver=(value)\n @values['ver'] = value\n end", "def full_name\n \"#{spec.name}-#{spec.version}\"\n end" ]
[ "0.78892446", "0.7040838", "0.6902158", "0.6544243", "0.6469421", "0.6433281", "0.6424208", "0.64108175", "0.6274178", "0.6260653", "0.6237225", "0.618807", "0.6161508", "0.6149678", "0.6108881", "0.60965866", "0.6076818", "0.60500747", "0.6041651", "0.5958193", "0.59431094", "0.59375983", "0.59111285", "0.59060687", "0.5843607", "0.5843528", "0.5840948", "0.58322304", "0.58284944", "0.5788283", "0.57744485", "0.5768365", "0.57570016", "0.57570016", "0.57548445", "0.57536757", "0.5750822", "0.5746902", "0.5739977", "0.57272196", "0.57235694", "0.5723461", "0.57232547", "0.57184047", "0.57054263", "0.57053226", "0.5701775", "0.56965244", "0.56920713", "0.5691223", "0.56862134", "0.56797475", "0.56797475", "0.56797475", "0.56797475", "0.56797475", "0.56768996", "0.56722474", "0.56612635", "0.5655733", "0.56539226", "0.56539226", "0.56539226", "0.56539226", "0.56539226", "0.56539226", "0.5646466", "0.56418604", "0.5639745", "0.5638509", "0.5638509", "0.563315", "0.5630016", "0.56218934", "0.56187445", "0.5616041", "0.56139493", "0.5613194", "0.56128883", "0.56083864", "0.56053126", "0.56039315", "0.56029075", "0.5597313", "0.5594964", "0.5588213", "0.5586656", "0.55858845", "0.558127", "0.5572076", "0.55619603", "0.5560261", "0.5547222", "0.55448353", "0.55432063", "0.5542957", "0.5532006", "0.55268115", "0.5526621" ]
0.5736138
40
Use callbacks to share common setup or constraints between actions.
def set_standupdesk @standupdesk = Standupdesk.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def standupdesk_params params.require(:standupdesk).permit(:desklocation, :deskwant) 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
I worked on this challenge with Ian Wudarski. I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented. 0. Pseudocode What is the input? An Array of numbers of strings. What is the output? An array of the most frequent values. What are the steps needed to solve the problem? =begin Iterate through the array and count the instance of each object. create a new Hash add each object in the array as a key add one to the value of the key if it repeats Identify the largest value or values. Create an array from the values of the most occurring object or objects. Return said array. =end 1. Initial Solution
def mode (array) newhash=Hash.new array.each do |x| newhash[x] = newhash[x].to_i + 1 end modevalue = newhash.values.max modearray= Array.new newhash.each do |x, y| if y == modevalue modearray.push(x) end end return modearray end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 #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 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 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 # -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 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 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 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# 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# 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(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 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 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 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 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 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 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 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 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 h = Hash.new\n num = 0\n largest = 0\n while num < array.length\n h[array[num]] = array.count(array[num])\n num = num + 1\n end\n max_quantity = h.values.max\n max_h = h.select { |k, v| v == max_quantity }.keys\n p max_h\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 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 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 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 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\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 mode(input_array)\n\n counts = Hash.new(0)\n input_array.each do |element|\n counts[element] += 1\n end\n\n output_array = Array.new\n\n counts.each do |word, count|\n if count == counts.values.max\n output_array << word\n end\n end\n\n return output_array\n\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 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 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 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 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 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 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 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 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 mode(input_array)\n counts = Hash.new\n\n # i=0\n # while i < input_array.length\n # if counts.has_key?(input_array[i])\n # counts[input_array[i]]+=1\n # else\n # counts[input_array[i]]=1\n # end\n # i+=1\n # end\n\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 # puts counts\n\n max=0\n\n counts.each do |word,count|\n if count > max\n max = count\n end\n end\n\n # puts max\n\n output_array = Array.new\n\n counts.each do |word,count|\n if count == max\n output_array.push(word)\n end\n end\n\n p output_array\n\nend", "def most_frequent_word(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase!}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\nmost_frequent_item = hash.max_by{ |i| hash.count( i ) }\nputs most_frequent_item\nend", "def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend", "def 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 greatestRepeats = 0\n frequent = []\n array.each do |current|\n totalCurrent = array.count current\n puts \"For \" + current.to_s + \" we have found: \" + totalCurrent.to_s + \" repeats\"\n if totalCurrent > greatestRepeats\n counter = 0\n while frequent.length > 0 #wipe frequent\n frequent.delete(counter)\n counter += 1\n end\n greatestRepeats = totalCurrent\n frequent.push current\n elsif totalCurrent == greatestRepeats && totalCurrent > 0 #add without wiping frequent\n frequent.push current\n end\n end\n\n frequent.uniq\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 mode(arr)\n counter = Hash.new(0)\n arr.each{|key| counter[key] += 1}\n solution = []\n counter.select {|key, value| solution << key if value == counter.values.max}\n p solution\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)\n count = Hash.new(0) \n array.each do |x| count[x] += 1 end\n max_val = count.values.max\n puts max_val\n if array == array.uniq\n return array\n else\n array1 = array.keep_if do |x| array.count(x) >= count.values.max end\n array1.uniq!\n end\n \nend", "def mode(array)\n\thash = Hash.new(0)\n \t\tarray.each do |i|\n \t\thash[i] += 1\n \tend\n\tfinal_array = []\n \tn = 0\n \tfrequent_value = hash.values[0]\n \twhile n < hash.length\n\t\tif frequent_value < hash.values[n]\n \t\tfrequent_value = hash.values[n]\n \tend\n \tn += 1\n \tend\n \thash.each do |key, val|\n \tif val == frequent_value\n \t\tfinal_array.push(key)\n \tend\n \tend\n \tp final_array\nend", "def mode(array)\n hash = Hash.new {|hash,key| hash[key] = 0} #creates a default value of 0 for all hash values\n\n array.each {|num| #iterate through the array and count +1 for each value\n hash[num] += 1\n }\n\n\n\n values = [] # Declare array of all values\n hash.each do |key, value|\n values.push(value)\n end\n\n\nmax_value = values.max #find the key with the maximum value\nresult = [] # Declare array where we return result\n\nhash.each do |key, value|\n if value == max_value\n result.push(key)\n end\nend\n return result\nend", "def mode(ary)\n mode_count = ary.inject({}){|x, y| x[y] = ary.count(y); x }\n mode_count.select {|x,y| y == mode_count.values.max }.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 top_k_frequent_elements(list, k)\n result = []\n\n hash = Hash.new\n \n list.each do |letter|\n if hash[letter]\n hash[letter] += 1\n else \n hash[letter] = 1\n end \n end \n\n k.times do \n max = nil\n hash.each do |num, value|\n\n if value && (max.nil? || value > max)\n max = num \n end \n end \n\n if max \n hash[max] = nil \n result << max \n end \n end \n return result end", "def array_mode(array)\n new_array = Array.new\n freq = Hash.new\n max_count = 1\n\n array.each do |i|\n if freq.include? (i)\n freq[i] += 1\n if freq[i] > max_count\n max_count = freq[i]\n end\n else\n freq[i] = 1\n end\n end\n freq.each {|k,v| new_array.push(k) if v == max_count}\n new_array\nend", "def most_used_letter\n s1 = @text.gsub(/[^a-z]/, '')\n arr= s1.split('')\n arr1 = arr.uniq #rids chars array of duplicates\n arr2 = {}\n\n #makes an object with a count of all unique characters\n arr1.map do |c|\n arr2[c] = arr.count(c) #count searches an array and returns the number of occurrances of the specified element\n end\n\n #to start the following loop with the first key/value pair of arr2\n biggest = { arr2.keys.first => arr2.values.first }\n arr2.each do |key, value|\n if value > biggest.values.first\n biggest = {}\n biggest[key] = value\n end\n end\n\n biggest\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 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 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 mode(array)\nfinal_array = []\nmax_count = []\narray.map do |r| \n max_count << array.count(r)\n end\n max_num = max_count.max\narray.map do |m|\n if array.count(m) == max_num\n final_array << m\n end\n end\n final_array.uniq\n\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 word_with_most_repeats(sentence)\n words = sentence.split\n\n hash = {}\n\n words.each do |word|\n hash[word] = count_repeats(word)\n end\n\n max = hash.values.max\n\n ties = hash.select {|k, v| v == max }.first.first\n\n\n\n\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 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 solution(a)\n # write your code in Ruby\n grouped_array = a.group_by(&:itself).values\n grouped_array.max_by(&:length).count\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 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 mode(list)\n my_hash = {}\n list.each do |item| \n if my_hash[item]\n my_hash[item] += 1\n else\n my_hash[item] = 1\n end\n end\n max_count = my_hash.values.max\n my_hash.select { |key, value| value == max_count }.keys\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 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 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 = {}\n \tarray.each do |item|\n \t\tif hash[item]\n \t\thash[item] = hash[item] + 1\n \t\telse\n \t\thash[item] = 1\n \t\tend\n \tend\n \tmax_value = hash.values.max\n\thash.select {|k, v| k if (v == max_value)}.keys\n\nend", "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 hash = Hash.new(0)\n array.each {|item| hash[item] += 1}\n answer = hash.max_by {|key, value| value}\n p answer\nend", "def most_frequent_occurrence(str)\n lower_str = str.downcase\n letters = {}\n most_frequent = []\n\n for i in 0..lower_str.length - 1\n if letters[lower_str[i]]\n letters[lower_str[i]] += 1\n else\n letters[lower_str[i]] = 1\n end\n end\n\n letters.each do |key, value|\n if most_frequent.length == 0 || letters[key] > most_frequent[1]\n most_frequent = [key, value]\n end\n end\n\n return most_frequent[0]\nend", "def find_most_popular(array)\n url_hash = {}\n \n array.each do |url|\n if url_hash[url]\n url_hash[url] += 1\n else\n url_hash[url] = 1\n end\n end\n \n max_url = url_hash.max_by(1) do |url, count|\n count\n end\n \n return max_url[0][0]\nend", "def mode(array)\n hash = Hash.new\n array.each do |x|\n quantity = array.count(x)\n hash[x] = quantity\n end\n mode_value = hash.values.max\n new_array= []\n hash.select do |key, value|\n if value == mode_value\n new_array.push(key)\n end\n end\n return new_array\nend", "def most_frequent_bigram(str)\n new_array =[]\n new_arr = []\n hash = {}\n hash = Hash.new {|k, v| hash[k] = 0}\n new_str = str.split(\"\")\n (0...new_str.length).each do |i0|\n (i0...new_str.length).each do |iz|\n pair = new_str[i0..iz]\n new_array << pair\n end\n end\n\n new_array.each do |combined|\n if combined.length == 2\n new_arr << combined \n end\n end\n \n new_arr.each do |pairs| \n hash[pairs] += 1\n end\n \n hash.each {|k, v| return k.join(\"\") if v == hash.values.max}\n\n \nend", "def top_k_frequent_elements(list, k)\n\n return [] if list.empty?\n \n # create a hash that has each element as key and number of occurrences as value: [1, 1, 1, 2, 2, 3] => {1=>3, 2=>2, 3=>1}\n hash = {}\n list.each do |element|\n if hash[element].nil?\n hash[element] = 1\n else \n hash[element] += 1\n end\n end\n \n # get the keys associated with k max values. There is almost certainly a better way to do this \n max_arrays = hash.max_by(k) {|key, value| value} # this returns k hash pairs as arrays: {1=>3, 2=>2, 3=>1}, k = 2 => [[1, 3], [2, 2]]\n\n # return the first element from each array\n max_keys = []\n max_arrays.each do |array|\n if k == 1\n # \"will work for an array when k is 1 and several elements appear 1 time\" situation: return the first key with value of 1 in the element counts hash\n max_keys << hash.min[0]\n else\n max_keys << array[0]\n end\n end\n\n return max_keys\n\nend", "def mode(array) \n hash = Hash.new(0) \n array.each do |x| \n hash[x] += 1\n end\n mode_array = []\n hash.each do |k,v|\n if v == hash.values.max\n mode_array << k\n end\n end\n mode_array\nend", "def most_common_value(a)\n a.group_by do |e|\n e\n end.values.max_by(&:size).first\nend", "def highest_rank(arr)\n #make a unique array so that I am not checking the same number multiple times\n unique = arr.uniq\n res = []\n #check count the instances of each number in the original array and\n #create a hash with the count of instances, and the number.\n unique.each do |n|\n res.push({arr.count(n)=>n})\n end\n # sort by the count and value, and grab the last result as it will be the highest count\n res.sort_by!(&:first)\nreturn res[-1].first[1]\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 mode(array)\n mode_array = []\n counter = Hash.new(0)\n array.each do |x|\n counter[x] += 1 \n end\n counter.each do |k, v|\n if v == counter.values.max\n mode_array.push(k)\n end\n end\n return mode_array\nend", "def repeats(sentence)\n\n words = sentence.split\n hash = {}\n\n words.each do |word|\n hash[word] = count(word)\n end\n\n greatest_value = hash.sort_by{|k, v| v}.last.last\n\n hash.select{|k,v|v=greatest_value}.first.first\n\nend", "def mode(array)\n results = {}\n array.each do |e|\n if results.has_key?(e)\n results[e] += 1\n else\n results[e] = 1\n end\n end\n max = results.max_by{|k,v| v}\n results.select!{|k,v| v == max[1]}\n results.keys\nend", "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 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 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 (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\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 solution(a)\n return 0 if a.empty?\n sorted_hash = a.sort.group_by { |x| x }\n sorted_hash.values.last.count\nend", "def mode(array)\n\n mode_hash = Hash.new\n for x in 0..(array.length - 1)\n if mode_hash.has_key?(array[x]) == true\n mode_hash[array[x]] = mode_hash[array[x]] + 1\n else\n mode_hash[array[x]] = 1\n end\n puts mode_hash\n end\n\n max_val = 0\n output_array =[]\n\n mode_hash.each do |key, value|\n\n if value > max_val\n output_array = []\n output_array[0] = key\n max_val = value\n\n elsif value == max_val\n\n output_array[output_array.length] = key\n max_val = value\n end\n end\n return output_array\nend", "def mode(array)\n mode_machine = Hash.new(0)\n array.each do |element|\n mode_machine[element] += 1\n end\n highest_count = 0\n mode_container = []\n mode_machine.each do |element, count|\n mode_container << element if count == highest_count\n if count > highest_count\n mode_container = []\n mode_container << element\n highest_count = count\n end\n end\n mode_container\nend", "def mode(array)\n hash = Hash.new(0)\n array.each do |x|\n hash[x] += 1\n end\n result = []\n hash.each { |x,y|\n if y == hash.values.max\n result.push(x)\n end\n }\n return result\nend", "def mode(array)\n\thash = Hash.new{|key, value| key[value] = 0}\n\thash[1]\n\tarray.each do |number|\n\t\thash[number] += 1\n\t\tend\n\t\tarray = []\n\thash.each do |key, value| \n\t\tif value == hash.values.max\n\t\tarray.push(key)\n\tend\n\tend\n\tp array\nend", "def most_common(string)\n # binding.pry\n arr = string.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\" \")\n arr = arr.map { |x| x.downcase }\n words_hash = arr.group_by { |x| x }\n final_arr = []\n words_hash.each do |k,v|\n #binding.pry\n if v.length > 1\n final_arr << k\n end\n end\n p final_arr\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 top_k_frequent_elements(list, k)\n return [] if list == []\n hash = Hash.new(0)\n counter = 0;\n list.each do |value|\n hash[value] = [] if hash[value].nil?\n hash[value]+=1\n end\n \n if k > hash.size()\n raise ArgumentError, \"Not Enough Values to Display\"\n end\n \n solution = hash.max(k){ |a, b| b<=>a} \n p solution\n numbers = []\n solution.each do |array|\n numbers << array[0]\n end\n return numbers\nend", "def mode(numbers)\n counts = {}\n numbers.each do |num|\n if counts.has_key?(num)\n counts[num] = counts[num] + 1\n else\n counts[num] = 1\n end\n end\n\n num_list = counts.values\n highest_count = num_list.max\n\n modes = []\n counts.each do |key, count|\n if count == highest_count\n modes.push(key)\n end\n end\n return modes\nend", "def most_frequent_bigram(str)\n\n new_hash = Hash.new(0)\n str.each_char.with_index do |ele, i|\n if i < (str.length - 1)\n new_hash[ele + str[i +1]] += 1\n end\n end\n # p new_hash.values.max\n new_hash.each do |k, v|\n if new_hash.values.max == v\n return k\n end\n end\n\nend", "def majority_element(nums)\n counter_hash = Hash.new(0)\n\n nums.each do |num|\n counter_hash[num] += 1\n end\n\n counter_hash.find { |k,v| v == counter_hash.values.max }.first\nend", "def mode(array)\n\n mode_hash = {}\n mode_array = []\n max = 0\n\n array.each do |element|\n\n if mode_hash.has_key?(element)\n mode_hash[element] += 1\n else\n mode_hash.store(element, 1)\n end\n end\n\n mode_hash.each do |key,value|\n if value > max\n max = value\n mode_array.clear\n mode_array.push(key)\n elsif value == max\n mode_array.push(key)\n else\n end\n end\n return mode_array\n end" ]
[ "0.7803973", "0.7765087", "0.7738651", "0.76785", "0.76529264", "0.76350033", "0.76212525", "0.75524485", "0.7514413", "0.75000226", "0.74984944", "0.74865216", "0.74851894", "0.7462243", "0.746068", "0.7454032", "0.74509585", "0.7426969", "0.7350484", "0.733441", "0.7324112", "0.7314759", "0.7311013", "0.7306759", "0.7297913", "0.7263938", "0.7262171", "0.72588694", "0.7241821", "0.72338676", "0.72302365", "0.72187334", "0.71908635", "0.7185424", "0.71638656", "0.71529317", "0.7151848", "0.71383137", "0.7134869", "0.7112179", "0.7105521", "0.70863533", "0.7075775", "0.7075502", "0.7070159", "0.7067364", "0.70579976", "0.7052237", "0.7050049", "0.70429444", "0.7034807", "0.7033959", "0.703235", "0.7019372", "0.701751", "0.7010478", "0.7010095", "0.7004347", "0.6987647", "0.6982957", "0.6960453", "0.69529855", "0.6947304", "0.6880242", "0.6877849", "0.68743014", "0.68717784", "0.68717784", "0.6871649", "0.68704706", "0.68485147", "0.6841117", "0.68370974", "0.6825475", "0.68252474", "0.6811791", "0.6788761", "0.67882174", "0.6787237", "0.67860556", "0.67772484", "0.67533475", "0.6751695", "0.6736146", "0.67311466", "0.672453", "0.6699484", "0.6695577", "0.6684159", "0.66817635", "0.6675239", "0.6662173", "0.6653067", "0.66494304", "0.66471356", "0.6644959", "0.6644795", "0.6626166", "0.6599383", "0.6596547", "0.65920573" ]
0.0
-1
Scrape information across all relevant records.
def scrape (2..tot_rec).collect do |row| aggregate_col_data(row) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend", "def scrape()\n scrapeForCurrentData\n end", "def scrape_details\n unscraped.each do |item|\n item.scrape_detail\n item.save!\n end\n end", "def scrape\n end", "def scrape_table(page)\n page.css('.listing_content').collect do |x|\n record = {}\n record['Business'] = x.css('.business-name a').text\n record['Address'] = x.css('.street-address').text.sub(/,[\\s]*/, '') || \"not listed\"\n record['City'] = x.css('.locality').text || \"not listed\"\n record['State'] = x.css('.region').text || \"not listed\"\n record['Zipcode'] = x.css('.postal-code').text || \"not listed\"\n record['Phone'] = x.css('.business-phone').text || \"not listed\"\n\n ## collect secondary info\n url = x.at_css('.business-name a').attribute(\"href\")\n page2 = Nokogiri::HTML(open(url))\n ext_record = scrape_page2(page2)\n \n record.merge!(ext_record)\n ScraperWiki.save([\"Business\"], record)\n end\nend", "def scrape_table(page)\n page.css('.listing_content').collect do |x|\n record = {}\n record['Business'] = x.css('.business-name a').text\n record['Address'] = x.css('.street-address').text.sub(/,[\\s]*/, '') || \"not listed\"\n record['City'] = x.css('.locality').text || \"not listed\"\n record['State'] = x.css('.region').text || \"not listed\"\n record['Zipcode'] = x.css('.postal-code').text || \"not listed\"\n record['Phone'] = x.css('.business-phone').text || \"not listed\"\n\n ## collect secondary info\n url = x.at_css('.business-name a').attribute(\"href\")\n page2 = Nokogiri::HTML(open(url))\n ext_record = scrape_page2(page2)\n \n record.merge!(ext_record)\n ScraperWiki.save([\"Business\"], record)\n end\nend", "def scrape_table(page)\n event_list = page.css('div.listing-search-result').each do |row|\n # new record, initialize to empty\n record = {}\n\n #record['Longitude'] = record['Start'] = record['Title'] = record['Id_event'] = record['Link'] = record['End'] = record['Tel'] = record['Latitude'] = record['Id'] = record['Venue'] = record['Address'] = record['Description'] = record['VenueInfo'] = record['Category'] = \"\"\n\n record['Link'] = row.css('div.secondary-info a')[0]['href']\n record['Id_event'] = record['Link'][16..20]\n if !record['Id_event'].to_s.empty?\n record['Title'] = row.css('div.secondary-info a')[0].inner_text\n if(!row.css('div.secondary-info span.venue a').empty?)\n record['LinkVenue'] = row.css('div.secondary-info span.venue a')[0]['href']\n record['Venue'] = row.css('div.secondary-info span.venue a')[0].inner_text\n else\n record['Venue'] = \"Multiple Venues\"\n end\n record['Category'] = row.css('span.category')[0].inner_text\n record['Id']=@i\n @i+=1\n\n thr_event=Thread.new{\n scrape_event('http://www.citylife.co.uk'+record['Link']) { |description|\n record['Description']=description\n }\n }\n\n thr_venue=Thread.new{\n if(record['Venue']!='Multiple Venues')\n scrape_venue('http://www.citylife.co.uk'+record['LinkVenue'],@date,record['Id_event']) { |latitude,longitude,address,tel,venueInfo,starts,ends|\n record['Latitude']=latitude\n record['Longitude']=longitude\n record['Address']=address\n record['Tel']=tel\n record['VenueInfo']=venueInfo\n record['Start']=starts\n record['End']=ends\n }\n end\n }\n\n #puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n\n thr_event.join\n thr_venue.join\n\n #save_to_file(record)\n save_to_calagator(record)\n \n end\n end\nend", "def scrape\n\n\t\tcustomer_api = Bigcommerce::Customer\n\t\tcustomer_count = customer_api.count.count\n\n\t\t#Bigcommerce api gives 50 items at once\n\t\tlimit = 50\n\t\tcustomer_pages = (customer_count/limit) + 1\n\n\t\tpage_number = 1\n\n\t\t# Loop through pages - each with 50 items\n\t\tcustomer_pages.times do \n\n\t\t\tcustomers = customer_api.all(page: page_number)\n\n\t\t\tcustomers.each do |c|\n\n\t\t\t\tinsert_sql(c, 1)\n\t\t\t\t\n\t\t\tend\n\n\t\t\tpage_number += 1\n\t\tend\n\n\tend", "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {}\n record['Product'] = row.css('h1')[0].inner_text\n record['Price'] = row.css('.details_price_now_main')[1].inner_text\n record['Description'] = row.css('details_right')[2].inner_text\n record['Sales (m)'] = row.css('td')[4].inner_text\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save(\"Artist\", record)\n end\nend", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {}\n record['Product'] = row.css('h1')[0].inner_text\n record['Price'] = row.css('.details_price_now_main')[1].inner_text\n record['Description'] = row.css('details_right')[2].inner_text\n record['Sales (m)'] = row.css('td')[4].inner_text\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save(\"Artist\", record)\n end\nend", "def scrape_contacts; end", "def scrape(page)\n data_table = page.css('table.ttable tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n id = row.at_css('td.opis_td .link1')\n if id\n record = {\n ID: row.at_css('td.opis_td .link1')['href'].scan(/^.+(opis)(\\d+)(\\.html)$/).first[1],\n Product: row.css('td.opis_td .link1').inner_text + ' ' + row.css('td.opis_td').children[3].inner_text,\n Price: row.css('span.cena span.price').inner_text\n }\n \n # Print out the data we've gathered\n p record\n \n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\n end\nend", "def scrape(page)\n data_table = page.css('table.ttable tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n id = row.at_css('td.opis_td .link1')\n if id\n record = {\n ID: row.at_css('td.opis_td .link1')['href'].scan(/^.+(opis)(\\d+)(\\.html)$/).first[1],\n Product: row.css('td.opis_td .link1').inner_text + ' ' + row.css('td.opis_td').children[3].inner_text,\n Price: row.css('span.cena span.price').inner_text\n }\n \n # Print out the data we've gathered\n p record\n \n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\n end\nend", "def scrape_details(new_page, new_date)\n# Pick out xpaths for data\n council_reference = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[3]/td[2]/*\").text\n address = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[4]/td[2]/*\").text\n type = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[1]/td[2]/*\").text\n description = \"#{new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[2]/td[2]/*\").text} (#{type})\"\n info_url = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[4]/td/div/table[2]/tr/td[2]/a\").attribute(\"href\").to_s\n\n# prep dates\n date_received = new_date.to_s\n on_notice_from = new_date.to_s\n on_notice_to = (new_date+14).to_s\n \n record = {\n 'council_reference' => council_reference,\n 'address' => address,\n 'description' => description,\n 'info_url' => info_url,\n 'date_received' => date_received,\n 'on_notice_from' => on_notice_from,\n 'on_notice_to' => on_notice_to,\n 'date_scraped' => @date_scraped,\n 'comment_url' => @comment_url,\n }\n# puts \"\\n :: RECORD :: \\n#{record}\"\n if (ScraperWiki.select(\"* from data where `council_reference`='#{record['council_reference']}'\").empty? rescue true)\n puts \"Storing \" + record['council_reference']\n ScraperWiki.save_sqlite(['council_reference'], record)\n else\n puts \"Skipping already saved record \" + record['council_reference']\n end\nend", "def extract_page_data(data)\n comment_url = \"https://www.spear.land.vic.gov.au/spear/pages/public-and-other-users/objectors.shtml\"\n\n apps = []\n # Skip first two row (header) and last row (page navigation)\n\n\n JSON.parse(data)[\"resultRows\"].each do |row|\n \n # Type appears to be either something like \"Certification of a Plan\" or \"Planning Permit and Certification\"\n # I think we need to look in detail at the application to get the description\n # TODO: Figure out whether we should ignore \"Certification of a Plan\"\n #type = values[3].inner_html.strip\n #status = values[4].inner_html.strip\n # I'm going to take a punt here on what the correct thing to do is - I think if there is a link available to\n # the individual planning application that means that it's something that requires deliberation and so interesting.\n # I'm going to assume that everything else is purely \"procedural\" and should not be recorded here\n\n # If there is a link on the address record this development application\n \n info_url = \"https://www.spear.land.vic.gov.au/spear/applicationDetails/RetrievePublicApplication.do?cacheApplicationListContext=true&spearNum=#{row['spearReference']}\"\n # puts row.to_yaml\n record = {\n # We're using the SPEAR Ref # because we want that to be unique across the \"authority\"\n 'council_reference' => row['spearReference'],\n 'address' => row['property'],\n 'date_received' => Date.strptime(row['submittedDate'], \"%d/%m/%Y\").to_s,\n 'info_url' => info_url,\n 'comment_url' => comment_url,\n 'date_scraped' => Date.today.to_s\n }\n\n # Get more detailed information by going to the application detail page (but only if necessary)\n record[\"description\"] = extract_description(info_url)\n #p record\n ScraperWiki.save_sqlite(['council_reference'], record)\n\n end\nend", "def scrape_it\n \n end", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table div.ItemResult').collect.with_index do |row, index|\n place_rec = {}\n main_cat_rec = {}\n sub_cat_rec = {}\n place_cat_rel_rec = {}\n main_cat_id = -9999\n sub_cat_id = -9999\n address = \"\"\n\n # create a place id\n place_id = SecureRandom.uuid\n title_links = row.css('div#HotspotResult_Info').css('a')\n\n address = row.xpath('//span[contains(@id, \"_lblAddress\")]')[index].inner_text\n address.gsub!(/\\\\u([\\da-fA-F]{4})/) {|m| [$1].pack(\"H*\").unpack(\"n*\").pack(\"U*\")}\n address.strip!\n address.gsub!(\"Địa chỉ: \", \"\")\n\n # see if the place has already been saved, if so, move on to the next\n place_already_saved = rec_exists?(\"places\", [\"name\", \"address\"], {\"name\" => title_links[0].inner_text, \"address\" => address})\n p place_already_saved\n next if place_already_saved\n\n # main cat info\n unless title_links[1].nil? \n main_cat_rec['name'] = title_links[1].inner_text\n main_cat_id = title_links[1][\"href\"].match(/.*CategoryID=(.*?)&.*/)[1]\n main_cat_id = main_cat_id.nil? ? -9999 : main_cat_id\n main_cat_rec['id'] = main_cat_id\n\n # save the main cat info for this row\n write(\"main_cats\", [\"name\"], main_cat_rec.to_s + \",\")\n end\n # sub cat info\n (2..title_links.count).each do |i|\n unless title_links[i].nil? \n sub_cat_name = title_links[i].inner_text\n sub_cat_name.gsub!(\", \", \"\")\n sub_cat_rec['name'] = sub_cat_name\n\n next if title_links[i][\"href\"].nil? \n kd = title_links[i][\"href\"].match(/.*kd=(.*?)$/)\n sub_cat_id = kd[1] unless kd.nil? \n sub_cat_id = sub_cat_id.nil? ? -9999 : sub_cat_id\n #p sub_cat_id\n #p main_cat_id\n sub_cat_rec['id'] = sub_cat_id\n sub_cat_rec['main_cat_id'] = main_cat_id\n write(\"sub_cats\", [\"id\", \"main_cat_id\"], sub_cat_rec.to_s + \",\")\n\n # add a new record to place - cat - relation table\n place_cat_rel_rec[\"place_id\"] = place_id\n place_cat_rel_rec[\"main_cat_id\"] = main_cat_id\n place_cat_rel_rec[\"sub_cat_id\"] = sub_cat_id\n write(\"place_cat_rels\", [\"place_id\", \"sub_cat_id\", \"main_cat_id\"], place_cat_rel_rec.to_s + \",\")\n end\n end\n # place's info\n unless title_links[0].nil? \n place_rec[\"id\"] = place_id\n place_rec['name'] = title_links[0].inner_text\n place_rec[\"address\"] = address\n p place_rec['name']\n \n # getting phone number, website, hours, parking info\n item_page_link = title_links[0][\"href\"]\n p item_page_link\n # since their db is mixed up with all locations in one place\n # save this link so that we can sort them out easily later\n # \"http://thodia.vn/khach-san-thuy-van-vung-tau.html\"\n # \"http://thodia.vn/khach-san-thuy-van-ha-noi.html\n # \"http://thodia.vn/khach-san-thuy-van-ho-chi-minh.html\n place_rec[\"tho_dia_link\"] = item_page_link\n\n item_page = Nokogiri::HTML(@br.get(item_page_link).body)\n phone = item_page.xpath(\"//span[contains(@id, '_lbTel')]\").inner_text\n email = item_page.xpath(\"//span[contains(@id, '_lbEmail')]\").inner_text\n website = item_page.xpath(\"//a[contains(@id, '_lblWebsite')]\").first\n website = website.nil? ? \"\" : website.inner_text\n tag_list = \"\"\n tag_all = item_page.xpath(\"//div[contains(@id, '_dvListTag')]\").children\n tag_all.each do |tag|\n # in the form of \"<span>blah</span>\", \"<span>, </span>\", \"<span> blah</span>\"\n tag_list += tag.text\n end\n \n #p phone, email, website\n #p tag_list\n \n place_rec[\"phone\"] = phone\n place_rec[\"email\"] = email\n place_rec[\"website\"] = website\n place_rec[\"tag_list\"] = tag_list\n \n write(\"places\", [\"id\", \"name\"], place_rec.to_s + \",\")\n end\n end\nend", "def records\n doc = @session.request(:get, @records_url)\n return doc.css(\"entry\").map(){ |e| Record.new(@session, e) }\n end", "def scrape_and_look_for_next_link(url)\n i = 0;\n page = Nokogiri::HTML(open(url))\n counties = scrape_timesbycounty(page)\n counties.collect do |county| \n if county \n county_url = BASE_URL + URI.escape(county['href'])\n areapage = Nokogiri::HTML(open(county_url))\n churches = scrape_area(areapage)\n churches.collect do |church| \n if church \n church_url = BASE_URL + URI.escape(church['href'])\n masstimes = Nokogiri::HTML(open(church_url))\n times = scrape_masstimes(masstimes)\n puts \"------------------------------------------\"\n puts \"county = \" +county.inner_text.strip\n puts \"church = \" +church.inner_text.strip\n puts \"times = \" +times.map { |str| \"'\" + str.to_s + \"'\" }.join(\",\")\n puts \"------------------------------------------\" \n i+=1\n record = {}\n record['ID'] = i \n record['County'] = county.inner_text.strip \n record['Church'] = church.inner_text.strip \n record['Times'] = times.map { |str| \"'\" + str.to_s + \"'\" }.join(\",\") \n ScraperWiki.save([\"ID\"], record)\n end\n end\n end\n end\nend", "def scrape_and_look_for_next_link(url)\n i = 0;\n page = Nokogiri::HTML(open(url))\n counties = scrape_timesbycounty(page)\n counties.collect do |county| \n if county \n county_url = BASE_URL + URI.escape(county['href'])\n areapage = Nokogiri::HTML(open(county_url))\n churches = scrape_area(areapage)\n churches.collect do |church| \n if church \n church_url = BASE_URL + URI.escape(church['href'])\n masstimes = Nokogiri::HTML(open(church_url))\n times = scrape_masstimes(masstimes)\n puts \"------------------------------------------\"\n puts \"county = \" +county.inner_text.strip\n puts \"church = \" +church.inner_text.strip\n puts \"times = \" +times.map { |str| \"'\" + str.to_s + \"'\" }.join(\",\")\n puts \"------------------------------------------\" \n i+=1\n record = {}\n record['ID'] = i \n record['County'] = county.inner_text.strip \n record['Church'] = church.inner_text.strip \n record['Times'] = times.map { |str| \"'\" + str.to_s + \"'\" }.join(\",\") \n ScraperWiki.save([\"ID\"], record)\n end\n end\n end\n end\nend", "def scrape_detail\n self.doc = Scrapable::Helpers.parse detail_url\n self.class.attributes.each do |attribute,id|\n if id['anchor'] # substring\n self[attribute] = doc.at_css('#' + id).andand[:href]\n else\n self[attribute] = doc.at_css('#' + id).andand.text.andand.sub(/\\A[[:space:]]+\\z/, '')\n end\n end\n end", "def get_da_urls (doc,comment_url)\n doc.search('table tbody tr').each do |tr|\n # Columns in table\n # Show Number Submitted Details\n tds = tr.search('td')\n\n break if tds[0].inner_text =~ /no records/\n\n h = tds.map{|td| td.inner_html}\n\n puts h\n info_url = 'https://pdonline.toowoombarc.qld.gov.au/Masterview/Modules/ApplicationMaster/' + tds[0].at('a')['href'].strip\n puts info_url\n descParts = h[3].split('<br>')\n record = {\n 'info_url' => info_url,\n 'comment_url' => comment_url,\n 'council_reference' => clean_whitespace(h[1]),\n 'date_received' => Date.strptime(clean_whitespace(h[2]), '%d/%m/%Y').to_s,\n # TODO: Some DAs have multiple addresses, we're just getting the first :(\n 'address' => clean_whitespace(descParts[0]),\n 'description' => clean_whitespace(descParts[1]),\n 'date_scraped' => Date.today.to_s\n }\n\n if (ScraperWiki.select(\"* from data where `council_reference`='#{record['council_reference']}'\").empty? rescue true)\n ScraperWiki.save_sqlite(['council_reference'], record)\n else\n puts \"Skipping already saved record \" + record['council_reference']\n end\n end\nend", "def scrape_all\n\t\tpage = fetch_page(@base_url)\n\t\turl_list = get_url_list(page)\n\t\turl_list.each do |url|\n\t\t\t#scrape the page\n\t\t\tuser = User.new(url,@user_agent)\n\t\t\tuser.scrape\n\t\tend\n\tend", "def scrape_table(page)\n level = \"No Level\"\n puts 'here'\n data_table = page.css('table.fixtures tr').collect do |row|\n puts row \n record = {}\n #puts row['class'] == competition\n if row['class'] == \"competition\"\n puts 'here1'\n level = row.css('td p')[0].inner_text\n elsif row['class'] == \"item\"\n puts 'here2'\n record['Home Club'] = row.css('td.homeClub')[0].inner_text\n record['Away Club'] = row.css('td.awayClub')[0].inner_text\n record['Venue'] = row.css('td.venue')[0].inner_text\n record['Date'] = row.css('td.time')[0].inner_text\n record['Time'] = row.css('td.time')[1].inner_text\n record['Referee'] = row.css('td.referee')[0].inner_text\n record['Comment'] = row.css('td.comment')[0].inner_text\n record['Level'] = level\n else\n # do nothing\n puts \"here3\"\n end\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n # ScraperWiki.save(\"Game\", record)\n end\nend", "def scrape_table(page)\n level = \"No Level\"\n puts 'here'\n data_table = page.css('table.fixtures tr').collect do |row|\n puts row \n record = {}\n #puts row['class'] == competition\n if row['class'] == \"competition\"\n puts 'here1'\n level = row.css('td p')[0].inner_text\n elsif row['class'] == \"item\"\n puts 'here2'\n record['Home Club'] = row.css('td.homeClub')[0].inner_text\n record['Away Club'] = row.css('td.awayClub')[0].inner_text\n record['Venue'] = row.css('td.venue')[0].inner_text\n record['Date'] = row.css('td.time')[0].inner_text\n record['Time'] = row.css('td.time')[1].inner_text\n record['Referee'] = row.css('td.referee')[0].inner_text\n record['Comment'] = row.css('td.comment')[0].inner_text\n record['Level'] = level\n else\n # do nothing\n puts \"here3\"\n end\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n # ScraperWiki.save(\"Game\", record)\n end\nend", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {\n Product: row.css('h1')[0].inner_text,\n Price: row.css('.details_price_now_main')[1].inner_text,\n Description: row.css('details_right')[2].inner_text,\n :'Sales (m)' => row.css('td')[4].inner_text\n }\n\n # Print out the data we've gathered\n p record\n\n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\nend", "def process_xml\n @doc.css(\"Details\").children.each do |ir8arecord|\n data_map = {}\n\n # IR8ARecord --> ESubmissionSDSC --> IR8AST\n\n ir8arecord.child.child.children.each do |data|\n data_map[data.name] = data.content\n end\n\n @xml_map << data_map\n end\n\n @xml_map\n\n end", "def scrape_venue(url,date,eventId)\n latitude=longitude=address=tel=venueInfo=starts=ends=\"\"\n page = get_url_or_cache(url)\n #puts 'name : '+page.css('div#listingheader h2')[0].inner_text\n scriptMap = page.css('div.venue-map script').inner_text\n scriptMapArray = scriptMap.split(/\\n/)\n scriptMapArray.each {|line|\n line=line.split(/\"/)\n #puts \"latitude : \"+line[3] if line[1]=='latitude'\n latitude=line[3] if line[1]=='latitude'\n #puts \"longitude : \"+line[3] if line[1]=='longitude'\n longitude=line[3] if line[1]=='longitude'\n }\n details = page.css('div#listing-details li').each { |detail|\n detailSplit = detail.inner_text.split(/:/)\n detail=detail.inner_text\n detail.strip!\n detailSplit[0].strip!\n if(detailSplit[0]=='Address')\n #puts \"Venue address: \"+detail.gsub('Address: ','')\n address=detail.gsub('Address: ','')\n elsif(detailSplit[0]=='Tel')\n #puts \"Venue phone number: \"+detail.gsub('Tel: ','')\n tel=detail.gsub('Tel: ','')\n else\n #puts \"Other info: \"+detail\n venueInfo+=detail\n end\n }\n\n allEvents = page.css('table.event-table tr').each {|rowEvent|\n if((rowEvent.css('td')[0].inner_text == date) && (rowEvent.css('td')[3].css('a')[0]['href'].include? eventId.to_s))\n #puts \"Start time: \"+rowEvent.css('td')[1].inner_text.gsub('Starts ','')\n starts=rowEvent.css('td')[1].inner_text.gsub('Starts ','')\n #puts \"End time: \"+rowEvent.css('td')[2].inner_text.gsub('Ends ','')\n ends=rowEvent.css('td')[2].inner_text.gsub('Ends ','')\n break\n end\n }\n\n yield latitude,longitude,address,tel,venueInfo,starts,ends\nend", "def parse_results\n #TODO: log an error if the return is empty\n profiles_array = find_elements PROFILE_CARD_SECTION_LOCATOR\n profiles_array.each do |profile|\n @profiles_data <<\n {\n name: get_element_text(PROFILE_NAME_LOCATOR, profile),\n title: get_element_text(PROFILE_TITLE_LOCATOR, profile),\n description: get_element_text(PROFILE_DESCRIPTION_LOCATOR, profile),\n country: get_element_text(PROFILE_COUNTRY_LOCATOR, profile),\n rate: get_element_text(PROFILE_RATE_LOCATOR, profile),\n skills: get_profile_skills(profile)\n }\n end\n\n @profiles_data\n end", "def get_item_general_info(page, da_container, detail_page)\n\n #get td item that contains detail general info\n\n tds = da_container.search('td')\n item_general_info = {}\n item_general_info[:info_url] = get_info_url(page, tds)\n item_general_info[:council_reference] = get_council_reference(tds)\n item_general_info[:comment_url] = get_comment_url(tds)\n item_general_info[:address] = get_address(tds)\n item_general_info[:description] = get_description(detail_page, tds)\n item_general_info[:date_scraped] = get_date_scraped\n return item_general_info\n\nend", "def get_item_general_info(page, da_container, detail_page)\n\n #get td item that contains detail general info\n\n tds = da_container.search('td')\n item_general_info = {}\n item_general_info[:info_url] = get_info_url(page, tds)\n item_general_info[:council_reference] = get_council_reference(tds)\n item_general_info[:comment_url] = get_comment_url(tds)\n item_general_info[:address] = get_address(tds)\n item_general_info[:description] = get_description(detail_page, tds)\n item_general_info[:date_scraped] = get_date_scraped\n return item_general_info\n\nend", "def search_results(all_pages)\n formatted_list = []\n all_pages.each do |show_hash|\n formatted_list << \"id. #{show_hash[\"id\"]} - #{show_hash[\"name\"]}\"\n end\n if formatted_list.count != 1\n self.print_search_results(formatted_list)\n else\n fetch_show_by_id(all_pages[0][\"id\"].to_s)\n end\nend", "def gather\n @likes = @api.get_connections(id, 'likes', :limit => 10).map {|x| x['name']}.sample(4)\n @groups = @api.get_connections(id, 'groups', :limit => 10).map {|x| x['name']}.sample(4)\n @events = @api.get_connections(id, 'events', :limit => 10).map {|x| x['name']}.sample(4)\n\n @bio = if target['bio'].present?\n target['bio'].scan(/(.*)\\n?/).first.slice(0, 140)\n end\n\n @quotes = if target['quotes'].present?\n target['quotes'].scan(/(.*)\\n?/).first.slice(0, 140)\n end\n\n @gender = if target['gender'].present?\n target['gender']\n end\n\n @relationship_status = if target['relationship_status'].present?\n target['relationship_status']\n end\n\n @favorite_athletes = if target['favorite_athletes'].present?\n target['favorite_athletes'].\n map {|x| x['name']}.\n reject! {|x| x.count(' ')}\n end\n\n @languages = if target['languages'].present?\n target['languages'].map {|x| x['name']}\n end\n\n @birthday = if target['birthday'].present?\n Time.parse(target['birthday']).year rescue nil\n end\n\n @hometown = if target['hometown'].present?\n target['hometown']['name']\n end\n\n @work = if target['work'].present?\n target['work'].map {|x| x['employer']['name']}\n end\n end", "def results\n extract_rows.map do |result|\n hash = {}\n hash[:price] = result.xpath(\".//a[contains(concat(' ',normalize-space(@class),' '),' results_price ')]\").text.strip\n hash[:airline] = result.xpath(\".//div[contains(concat(' ',normalize-space(@class),' '),' rsAirlineName ')]\").text.strip\n legs = result.xpath(\".//div[@class='singleleg']\")\n hash[:leg0_departure_time] = legs[0].xpath(\".//div[@class='flighttime']\")[0].text.strip\n hash[:leg0_arrival_time] = legs[0].xpath(\".//div[@class='flighttime']\")[1].text.strip\n hash[:leg0_duration] = legs[0].xpath(\".//div[@class='duration']\")[0].text.strip\n hash[:leg1_departure_time] = legs[1].xpath(\".//div[@class='flighttime']\")[0].text.strip\n hash[:leg1_arrival_time] = legs[1].xpath(\".//div[@class='flighttime']\")[1].text.strip\n hash[:leg1_duration] = legs[1].xpath(\".//div[@class='duration']\")[0].text.strip\n hash[:booking_url] = @base_url + result.xpath(\".//a[@class='dealsinresult']\")[0].attributes['rel'].value\n hash\n end\n end", "def data_results(data)\n #data search p row. Creates a tree pattern that mirrors the html.\n results = data.search('p.row')\n\n apartments = []\n results.each do |listing| #listing is a bunch of data for each p row.\n apartments.push(create_apartment(listing))\n end\n create_csv(apartments) #list of apartments here.\nend", "def scrape\n scraped_articles=[]\n scraped_articles=scrape_articles(false)\n # Iterate through the API List\n scraped_articles['response']['docs'].each do |item|\n process_item (item)\n end\n end", "def data_search_results(data)\n results = data.search('p.row')\n results.each do |listing|\n create_apartment(listing)\n end\nend", "def parse_multiple_search_results(page)\n companies = []\n rows = page.body.split('<tr class=\\'alt')\n rows.shift\n rows.each do |row|\n company = {\n 'name' => '',\n 'id' => '',\n 'records' => ''\n }\n company['name'] = row.split('<a class=\\'nowrap\\' title=\\'')[1].split('\\' href=')[0]\n company['id'] = row.split('\\' href=\\'/id')[1].split('/')[0].to_i\n company['records'] = row.split('=showCompDir&\\'>')[1].split('</a>')[0]\n companies << company\n end\n return companies\nend", "def scrape_data_and_create_records link\n\n # Scrapes bracket/game data as JSON \n bracket_json = scrape_bracket link\n games_json = get_games_json bracket_json\n\n create_regions bracket_json\n create_teams games_json\n create_games games_json\n\n end", "def scrape_table(page_body, register)\n doc = Nokogiri::HTML(page_body)\n return if doc.at('#labelResultsMessage').inner_text.match(/More than 500 rows/) # to trigger increase in prefix size\n return true unless data_rows = doc.css('table#GridView1 tr')[1..-1] # silently skip if no results\n data_table = data_rows.collect do |row|\n record = {}\n address = row.css('td')[2].inner_text.strip\n record['CompanyName'] = row.css('td')[0].inner_text.strip\n record['CompanyNumber'] = row.css('td')[1].inner_text.strip\n # record['Status'] = (register == 'Previous' ? 'Dissolved' : 'Active') . # we can't trust status\n record['RegisteredAddress'] = address.match(/NO ADDRESS/) ? nil : address \n record['date_scraped'] = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n end\nend", "def scrape_table(page_body, register)\n doc = Nokogiri::HTML(page_body)\n return if doc.at('#labelResultsMessage').inner_text.match(/More than 500 rows/) # to trigger increase in prefix size\n return true unless data_rows = doc.css('table#GridView1 tr')[1..-1] # silently skip if no results\n data_table = data_rows.collect do |row|\n record = {}\n address = row.css('td')[2].inner_text.strip\n record['CompanyName'] = row.css('td')[0].inner_text.strip\n record['CompanyNumber'] = row.css('td')[1].inner_text.strip\n # record['Status'] = (register == 'Previous' ? 'Dissolved' : 'Active') . # we can't trust status\n record['RegisteredAddress'] = address.match(/NO ADDRESS/) ? nil : address \n record['date_scraped'] = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n end\nend", "def scrape_table(page)\n rows = Nokogiri.HTML(page).css('#ContentPlaceMain_SearchResultsGridView tr')[1..-1]\n if rows.nil?\n puts \"No data found\"\n return true\n elsif rows.size == 300\n puts \"***Too many rows to show on one page. Need to refine prefix\"\n return\n end\n puts \"Found #{rows.size} companies\"\n\n rows.each do |row|\n begin\n record = {}\n company_number_link = row.at('td a') || row.at('td')\n record['CompanyNumber'] = company_number_link.inner_text.strip\n record['CompanyName'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[1].inner_text.strip\n record['RegistryUrl'] = \"https://www.jerseyfsc.org/registry/documentsearch/NameDetail.aspx?id=\" + company_number_link[:href].scan(/showDetail\\(\\'(\\d+)/).flatten.first.to_s rescue nil\n record['date_scraped'] = Time.now\n next unless COMPANY_TYPES.include?(record['EntityType'])\n # beginning_time = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n # puts \"Time elapsed #{(Time.now - beginning_time)*1000} milliseconds\"\n rescue Exception => e\n puts \"Exception raised while extracting data from row html: #{e.inspect}, #{row.to_html}\"\n end\n end\nrescue Exception => e\n puts \"Exception raised while parsing data: #{e.inspect}, #{e.backtrace}\"\nend", "def scrape_table(page)\n rows = Nokogiri.HTML(page).css('#ContentPlaceMain_SearchResultsGridView tr')[1..-1]\n if rows.nil?\n puts \"No data found\"\n return true\n elsif rows.size == 300\n puts \"***Too many rows to show on one page. Need to refine prefix\"\n return\n end\n puts \"Found #{rows.size} companies\"\n\n rows.each do |row|\n begin\n record = {}\n company_number_link = row.at('td a') || row.at('td')\n record['CompanyNumber'] = company_number_link.inner_text.strip\n record['CompanyName'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[1].inner_text.strip\n record['RegistryUrl'] = \"https://www.jerseyfsc.org/registry/documentsearch/NameDetail.aspx?id=\" + company_number_link[:href].scan(/showDetail\\(\\'(\\d+)/).flatten.first.to_s rescue nil\n record['date_scraped'] = Time.now\n next unless COMPANY_TYPES.include?(record['EntityType'])\n # beginning_time = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n # puts \"Time elapsed #{(Time.now - beginning_time)*1000} milliseconds\"\n rescue Exception => e\n puts \"Exception raised while extracting data from row html: #{e.inspect}, #{row.to_html}\"\n end\n end\nrescue Exception => e\n puts \"Exception raised while parsing data: #{e.inspect}, #{e.backtrace}\"\nend", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def each(&block)\n @raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) }\n\n np = next_page\n while np\n np.current_page.each(&block)\n np = np.next_page\n end\n end", "def crawl\n event_ids = []\n\n url = \"https://www.residentadvisor.net/events.aspx?ai=#{@city_id}&v=day&mn=#{@date.month}&yr=#{@date.year}&dy=#{@date.day}\"\n doc = Nokogiri::HTML(open(url))\n doc.search('.bbox').each do |link|\n event_id = link.at(\"h1 a[href]\").to_s.scan(/(\\d\\d\\d\\d\\d\\d)/).flatten.first\n event_ids << event_id unless event_id.blank?\n end\n\n event_ids.map do |event_id|\n \"https://www.residentadvisor.net/event.aspx?#{event_id}\"\n end\n end", "def extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend", "def extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend", "def records\n @records ||= search.records\n end", "def parse_results(raw_results)\n results = []\n results << ['Name', 'URL', 'Price', 'Neighborhood']\n\n raw_results.each do |result|\n link = result.css('a')[1] #mechanize library\n name = link.text.strip\n url = \"http://sfbay.craigslist.org\" + link.attributes[\"href\"].value\n price = result.search('span.price').text\n neighborhood = result.search('span.pnr').text[3..-13]\n\n puts \"This apartment is located in #{neighborhood}\"\n\n a = Apartment.new(name,url,price,neighborhood)\n\n results << [a.name, a.url, a.price, a.neighborhood]\n create_csv(results)\n end\nend", "def scrape_details(partner_urls)\n\t\tcsv_data = []\n\t\tcsv_data << [\"City\",\"Partner Name\",\"Address\",\"Latitude\",\"Longitude\",\"Avarage Rating\",\"Phone Number\"]\n\n\t\tpartner_urls.each do |url|\n\t\t\tp 'Started scraping '+ url\n\t\t\tscrap_page = @mechanize.get(url)\n\t\t\tpartner_name = scrap_page.at('.studio-info .studio-name h2').text.strip\n\t\t\taddress = scrap_page.at('.list-unstyled.studio-details li p').text.strip\n\t\t\tlat_lng = scrap_page.search('.studio-sidebar script')[0].children.to_s.split(\"LatLng\")[1].split(\"'\")\n\t latitude = lat_lng[1].strip\n\t longitude = lat_lng[3].strip\n #For some partners raring is not available\n\t if rating = scrap_page.search(\".rating\")\n\t \t\t average_rating = rating[0].text.strip if rating[0]\n\t \telse\n average_rating = 0\n\t \tend\n\t phone = get_partner_phone_no(scrap_page)\n\t\t\tcsv_data << [@city.capitalize, partner_name, address,latitude,longitude,average_rating,phone]\n\t\tend\n return csv_data\n\tend", "def get_specific_listing_info a, info\n parsed_listing = Nokogiri::HTML(a.get(info[:link]).body)\n additional_info = parsed_listing.css('dl').text.split(\"\\n\")\n additional_info.each_with_index do |element, i|\n # Searches for pay, duration, and hours within each job page, filtering accordingly\n if /Pay/.match?(element)\n info[:pay] = additional_info[i + 2].strip\n info[:pay] = 'N/A' if info[:pay].nil? || info[:pay].empty?\n info[:pay] = info[:pay].slice(0...67) + '...' if info[:pay].length > 70\n elsif /Job Duration/.match?(element)\n info[:duration] = additional_info[i + 2].strip\n info[:duration] = 'N/A' if info[:duration].nil? || info[:duration].empty?\n info[:duration] = info[:duration].slice(0...67) + '...' if info[:duration].length > 70\n elsif /Hours/.match?(element)\n info[:hours] = additional_info[i + 2].strip\n info[:hours] = 'N/A' if info[:hours].nil? || info[:hours].empty?\n info[:hours] = info[:hours].slice(0...67) + '...' if info[:hours].length > 70\n end\n end\nend", "def get_listing_data\n listing_data = []\n # get_pages.each do |page|\n local_pages.each do |page|\n listing_data << page.css('div[@class = \"item\"]')\n end\n listing_data\n end", "def get_info_group(detail_page)\n info_group_panel = detail_page.search('div#ctl00_MainBodyContent_group_16 table')[2]\n info_group_tr = info_group_panel.search('tr')\n \n info_group_info = []\n for i in 0..info_group_tr.length - 2\n tr = info_group_tr[i]\n info_group_td = tr.search('td')\n if (info_group_td.size > 0)\n info_group_obj = {}\n info_group_obj[:key] = clean_whitespace(info_group_td[0].inner_text).gsub(\" \",\"_\").downcase\n info_group_obj[:field] = clean_whitespace(info_group_td[1].inner_text).downcase\n info_group_info << info_group_obj\n end\n end\n return info_group_info\nend", "def get_info_group(detail_page)\n info_group_panel = detail_page.search('div#ctl00_MainBodyContent_group_16 table')[2]\n info_group_tr = info_group_panel.search('tr')\n \n info_group_info = []\n for i in 0..info_group_tr.length - 2\n tr = info_group_tr[i]\n info_group_td = tr.search('td')\n if (info_group_td.size > 0)\n info_group_obj = {}\n info_group_obj[:key] = clean_whitespace(info_group_td[0].inner_text).gsub(\" \",\"_\").downcase\n info_group_obj[:field] = clean_whitespace(info_group_td[1].inner_text).downcase\n info_group_info << info_group_obj\n end\n end\n return info_group_info\nend", "def records\n live_lookup_service.new(@ids).records\n end", "def collect_data\n doc = Nokogiri::HTML(open('https://www.microcenter.com/search/search_results.aspx?N=4294967288&NTK=all&sortby=match&rpp=96'))\n product_price = []\n product_brand = []\n\n # collect information for product, price, and brand\n # product= doc.xpath('//div/h2/a/@data-name').collect {|node| node.text.strip}\n product_listing = doc.search('div.normal h2 a').map(&:text) #css('div').css('h2').search('a').map(&:text)\n product_price = doc.xpath('//div/a/@data-price').collect { |node| node.text.strip }\n product_brand = doc.xpath('//div/a/@data-brand').collect { |node| node.text.strip }\n product_link = doc.xpath('//div/h2/a/@href').collect { |node| node.text.strip }\n\n # setup Array product_attribute with values from product, price, and brand\n i = 0\n product_listing.each do |title|\n item = Product.new\n core_link = 'https://www.microcenter.com'\n item.name = title\n item.price = product_price[i].to_f\n item.brand = product_brand[i]\n item.link = core_link + product_link[i]\n @products.append(item)\n end\n end", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def scrap_data\n\turl_array = get_townhall_urls \n url_array.each do |townhall_url| \n# -> Pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\t\tget_townhall_email(townhall_url)\n\tend\nend", "def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table#WFDGRDCompanies tr.resultsGridBody').collect do |row|\n record = {}\n record['CompanyNumber'] = row.css('td')[0].inner_text.strip\n record['CompanyName'] = row.css('td')[1].inner_text.strip\n record['Status'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[3].inner_text.strip\n record['NameType'] = row.css('td')[4].inner_text.strip\n record['date_scraped'] = Time.now\n next if ['NameType'] == 'PREVIOUS' #these have the same company numbers as 'CURRENT' ones, and so would over-write them. Previous name details are avail on the company page, so we can discard this info\n begin\n ScraperWiki.save([\"CompanyNumber\"], record)\n rescue Exception=>e\n puts \"Exception (#{e.inspect}) raised saving company record:#{record.inspect}\"\n end\n end\nend", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table#WFDGRDCompanies tr.resultsGridBody').collect do |row|\n record = {}\n record['CompanyNumber'] = row.css('td')[0].inner_text.strip\n record['CompanyName'] = row.css('td')[1].inner_text.strip\n record['Status'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[3].inner_text.strip\n record['NameType'] = row.css('td')[4].inner_text.strip\n record['date_scraped'] = Time.now\n next if ['NameType'] == 'PREVIOUS' #these have the same company numbers as 'CURRENT' ones, and so would over-write them. Previous name details are avail on the company page, so we can discard this info\n begin\n ScraperWiki.save([\"CompanyNumber\"], record)\n rescue Exception=>e\n puts \"Exception (#{e.inspect}) raised saving company record:#{record.inspect}\"\n end\n end\nend", "def get_recordings()\n puts \"Retrieving list of current recordings...\" if $verbose\n xml = mythxml(\"GetRecordedList\")\n\n recordings = []\n xml.elements.each(\"ProgramList/Programs/Program\") do |program| \n\n\trec = Recording.new\n\tchannel = program.elements[\"Channel\"] || raise\n\trecording = program.elements[\"Recording\"] || raise\n\trec.title = CGI.unescapeHTML(program.elements[\"Title\"].text) || raise\n\trec.season = program.elements[\"Season\"].text || raise\n\trec.episode = program.elements[\"Episode\"].text || raise \n\trec.filename = program.elements[\"FileName\"].text || raise\n\tputs(\"found #{rec.season}x#{rec.episode} #{rec.title}\") if $verbose\n\tstarttime = recording.elements[\"StartTs\"].text || raise\n\tendtime = recording.elements[\"EndTs\"].text || raise\n\trec.chanid = channel.elements[\"ChanId\"].text || raise\n\trec.subtitle = program.elements[\"SubTitle\"].text \n\tif rec.subtitle\n\t rec.subtitle = CGI.unescapeHTML(rec.subtitle) \n\telse\n\t rec.subtitle = \"\"\n\tend\t\n\trec.recgroup = recording.elements[\"RecGroup\"].text || raise\n \n\n\trec.starttime_str = starttime.delete(\"^0-9\")\n\trec.endtime_str = endtime.delete(\"^0-9\")\n\n\tputs(\"from #{rec.starttime_str} to #{rec.endtime_str} on #{rec.chanid}\") if $verbose\n\tif pos = rec.title.index(\" (Includes\") \n\t\trec.title = rec.title[0,pos] \n\tend\n\n\tif rec.recgroup != \"Deleted\"\n\t\trecordings << rec\n\tend\n end\n return recordings\nend", "def parse_single_page(page)\n rows = page.search(\"form[name='search'] table > tr > td > table > tr\")\n \n dentist_name = ''\n company_name = ''\n address = ''\n \n rows.each do |row|\n plain = row.text.gsub(/\\s*\\302\\240\\302\\240/, '').gsub(/\\s\\s/, '').strip\n if plain.start_with?(\"Name\")\n dentist_name = plain.gsub(/Name/, '')\n end\n if plain.start_with?(\"Primary Practice Place\")\n company_name = plain.gsub(/Primary Practice Place/, '')\n end\n if plain.start_with?(\"Practice Address\")\n address = row.text.gsub(/\\s\\s/, '').gsub(/\\302\\240\\302\\240/, ' ').gsub(/Practice Address/, '').strip\n end\n end\n p [dentist_name, company_name, address]\n\n RESULT_COLL.insert(:contact => [dentist_name, company_name, address])\nend", "def fetch_details\n @csv_report_job = CsvReportJob.where(id: @csv_report_job_id).first\n\n @filters = @csv_report_job.extra_data[:filters]\n @sortings = @csv_report_job.extra_data[:sortings]\n\n @admin = Admin.get_from_memcache(@csv_report_job.admin_id)\n\n @client_id = @csv_report_job.client_id\n @client = Client.get_from_memcache(@client_id)\n end", "def results\n populate\n @results\n end", "def extract_target_entries\n extract_host_entries\n extract_event_entries\n extract_service_entries\n extract_note_entries\n extract_vuln_entries\n extract_web_entries\n end", "def scrape\n # Set our start and end date\n start_date = ::Date.today - 7\n end_date = ::Date.today\n\n # Count for reporting at the end\n count = 0\n\n # For each importer, iterate through the keys and importers\n # and instantiate an importer with the date range.\n # Then scrape and collect articles, before exporting\n @importers.each_pair do |key, importer_klass|\n \n #create a new importer source\n instance = importer_klass.new(start_date, end_date)\n instance.scrape\n \n #gonna get a new formatter\n formatter = @formatters[key].new\n \n #export those articles to a file\n exporter = Exporter.new importer_klass, formatter\n exporter.export(instance.articles)\n count += instance.articles.count\n end\n\n # Report back to the use\n $stderr.puts \"Succesfully scraped and exported #{count} articles from #{@importers.count} sources.\"\n end", "def parse_single_page(page)\n rows = page.search(\"form[name='search'] table > tr > td > table > tr\")\n\n vacation_name = ''\n country = ''\n auction_time = ''\n price = ''\n\n rows.each do |row|\n plain = row.text.gsub(/\\s*\\302\\240\\302\\240/, '').gsub(/\\s\\s/, '').strip\n if plain.start_with?(\"Name\")\n vacation_name = plain.gsub(/Name/, '')\n end\n if plain.start_with?(\"Primary Practice Place\")\n country = plain.gsub(/Primary Practice Place/, '')\n end\n if plain.start_with?(\"Practice auction_time\")\n auction_time = row.text.gsub(/\\s\\s/, '').gsub(/\\302\\240\\302\\240/, ' ').gsub(/Practice auction_time/, '').strip\n end\n end\n p [vacation_name, country, auction_time]\n\n RESULT_COLL.insert(:contact => [vacation_name, country, auction_time])\nend", "def read_scrapers scrapers, related_scrapers, response\n \n logger.info(\"Trying to find #{scrapers.length} scrapers\") if scrapers.length > 0\n \n # create and yield all scrapers found\n scrapers.each_pair do |name, scraper_setup|\n response.query(scraper_setup[:item_path]).each do |item_scope|\n \n scraper = related_scrapers[name].deep_clone\n scraper_fields = perform_data_requests(response, scraper_setup[:fields],item_scope)\n\n # TODO it should make request fields into sets (eg, no repeated fields)\n scraper.requests.each do |request| \n request.fields.merge!(scraper_fields)\n end\n \n # yield the finished scraper\n logger.info(\"Yielding a #{scraper.name} scraper found with #{scraper_setup[:item_path]}\")\n yield scraper\n end\n end\n\n end", "def crawl\n # TODO flush the page cache. We cache the crawled pages.\n begin\n account_detail_page #This will get us as far as we want to go, through several pages\n rescue *ERRORS_TO_RESCUE_FROM => e\n errors[:message] = e.message\n errors[:page_url] = e.page.uri\n errors[:page_body] = e.page.body\n return nil\n end\n end", "def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend", "def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend", "def parse_records(response, elements, paged_results, base_module, standalone_model = false)\n elements.each do | element |\n new_record = model_class.build_from_node(element, self, base_module, standalone_model)\n if element.attribute('status').try(:value) == 'ERROR'\n new_record.errors = []\n element.xpath('.//ValidationError').each do |err|\n new_record.errors << err.text.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end\n end\n if standalone_model\n if response.response_items.count == 0\n response.response_items << new_record\n else\n # http://developer.xero.com/documentation/payroll-api/settings/\n # tracking categories have subcategories of timesheet categoires and employee groups\n # which we group together here as it's much easier to model\n fields_to_fill = model_class.fields.find_all do |f|\n new_record_field = new_record[f[0]]\n if new_record_field.respond_to?(:count)\n new_record_field.count > 0\n else\n !new_record_field.nil?\n end\n end\n fields_to_fill.each {|field| response.response_items.first[field[0]] = new_record[field[0]]}\n end\n else\n response.response_items << new_record\n end\n new_record.paged_record_downloaded = paged_results\n end\n response.response_items\n end", "def pullingListingAddress(buildingURL, listing)\n buildingDocContact = Nokogiri::HTML(open(URI.parse(buildingURL + \"/contact\")))\n buildingDocDetails = Nokogiri::HTML(open(URI.parse(buildingURL + \"/features\")))\n buildingDocImages = Nokogiri::HTML(open(URI.parse(buildingURL + \"/media\")))\n #REMEMBER TO ADD BROOKLYN INTO THIS!!!!!\n contactText = buildingDocContact.css(\"#community-contact-text\")\n #contactText.css(\"p\")[1].text\n #puts buildingDocImages.css(\".slides\").css(\"img\").length\n #puts buildingDocImages.css(\".slides\").css(\"img\")\n listing[:images] = []\n countInt = 0 #used for image count\n while (countInt < (buildingDocImages.css(\".slides\").css(\"img\").length)/2) do #too many photos so i cut in half\n listing[:images] << { origin_url: buildingDocImages.css(\".slides\").css(\"img\")[countInt][\"src\"] }\n countInt = countInt + 1\n end\n #retrieve_images(buildingDocImages, listing)\n #puts contactText.css(\"p\")[2].text\n #puts buildingDocContact.css(\".phone-number\")\n if listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0] != nil\n listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0].text\n end\n listing[:amenities] = []\n #listing[:amenities] <<\n #puts (buildingDocDetails.css(\".row.feature\").css(\"#li_cont2\")).length\n listing[:contact_name] = \"Bozzuto Management\"\n\n if contactText.css(\"p\")[1].text.include?(\"New York\")\n matchText = (/New York, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = matchText.to_s\n listing[:title] = (matchText.pre_match).to_s #Street Address, but the matching part is like \"New York, \"\n listing[:city_name] = ((/, /).match(matchTextString).pre_match).to_s\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Hoboken\")\n #((/Hoboken, /) === (contactText.css(\"p\")[1].text))\n matchText = (/Hoboken, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:raw_neighborhood] = \"Hoboken\"\n listing[:city_name] = \"Jersey City\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Brooklyn\")\n matchText = (/Brooklyn, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:city_name] = \"Brooklyn\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n listing\n end", "def collect_results\n while collect_next_line; end\n end", "def find_all\n response = fetch()\n new(response)\n end", "def scrape_timesbycounty(page)\n rows = Array.new\n data_table = page.css('table a').collect do |row|\n record = {}\n if row['href'].include? \"churchbycounty\"\n rows.push(row)\n end\n end\n\n return rows\nend", "def scrape_timesbycounty(page)\n rows = Array.new\n data_table = page.css('table a').collect do |row|\n record = {}\n if row['href'].include? \"churchbycounty\"\n rows.push(row)\n end\n end\n\n return rows\nend", "def scrape_job_listings\n queries = [\"Rails+Developer\", \"front+end+Developer\", \"ruby+developer\", \"junior+web+Developer\", \"javascript+Developer\"]\n locations = [\"San+Francisco\"]\n\n locations.each do |location|\n queries.each do |query|\n scrape_indeed(query, location)\n scrape_github(query, location)\n # scrape_glassdoor(query, location)\n ; scrape_careerbuilder(query, location)\n end\n end\nend", "def get_info\n doc = Hpricot(open(noaa_url))\n puts noaa_url\n if !self.description\n doc.search(\"h1\").each do |elem| \n desc = elem.inner_html\n # remove imbeded links in the middle of the description\n desc.gsub!(/\\<a.href.*?\\<\\/a\\>/,' ')\n self.description = desc\n puts self.description\n self.save\n end\n end\n if !self.geo_location\n begin\n elems = doc.search(\"p/b\").to_a.map{|elm| elm.inner_html}\n if elems[1] == \"Owned and maintained by National Data Buoy Center\"\n puts elems[4]\n self.geo_location = elems[4]\n self.save\n end\n rescue\n end \n end\n end", "def record_attributes\n @doc.elements.each(\"ROOT/data/record\") do |record|\n record.elements.each do |element|\n element_name = element.attributes[\"name\"]\n\n case element_name\n when \"Country or Area\"\n @original_country_name = element.text.strip\n @country_name = @original_country_name\n un_abrev_country_name(@country_name)\n when \"Year\"\n year = element.text.to_i\n set_year(year)\n when \"Year(s)\"\n year = element.text.to_i\n set_year(year)\n when \"Unit\"\n measurement = element.text\n if measurement == \"%\"\n measurement = \"percent\"\n end\n set_record(\"measurement\", measurement)\n when \"Value\"\n value = element.text.to_f\n set_record(\"value\", value)\n when \"GENDER\"\n gender = element.text\n set_record(\"gender\", gender)\n when \"Value Footnotes\" \n if element.text != nil \n clean_footnotes(element.text)\n end\n else\n name = element_name.downcase.gsub(\"/ /\", \"_\")\n set_record(name, element.text)\n end\n end\n new_record = Record.new(@record)\n @country.records << new_record\n end\n end", "def ScrapAnalyse()\n @result = {}\n @line = \"\"\n @result['status'] = 0\n @result_nb = 0\n @quota = {}\n @movies_info = []\n \n doc = Document.new(@xml_data)\n root = doc.root\n \n @movies_info = []\n root.each_element('movie') do |movie|\n @movies_info.push ScrapAnalyseOneMovie(movie)\n end\n @result_nb = @movies_info.count()\n \n if @result_nb == 0\n @status = 0\n elsif @result_nb == 1\n @status = 1\n elsif @result_nb > 1\n @status = 2\n end\n \n quota = root.elements['quota']\n if not quota.nil?\n @quota['authorize'] = quota.attributes['authorize']\n @quota['use'] = quota.attributes['use']\n @quota['reset_date'] = quota.attributes['reset_date']\n end\n \n @result['quota'] = @quota\n @result['result_nb'] = @result_nb\n @result['line'] = @line\n @result['xml'] = doc.root\n @result['status'] = @status\n @result['movies_info'] = @movies_info\n \n return @result\n end", "def gather_credit_info\r\n credit_accounts = @page.css(\"table[id='dashboardAccounts'] tr[id]\")\r\n @ca_index = 1\r\n while @ca_index <= credit_accounts.count do\r\n #account_name = @page.css(\"#dashboardAccounts td.ng-scope.icon-two-line-col > div > div > a > span\").text\r\n account_name = @page.search(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(1) span\").text\r\n account_available_balance = @page.css(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(3) span\").text\r\n account_currency = @page.css(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(2) span\").text\r\n ca = Accounts.new(account_name, account_available_balance, account_currency,\"Credit\")\r\n @available_accounts << ca\r\n @ca_index += 1\r\n end\r\n end", "def scrapeESPN()\n # Delete databases\n Conference.delete_all\n Team.delete_all \n Game.delete_all\n\n puts \"Getting Conferences\"\n # Gets all the Conferences\n get_confs()\n\n puts \"Getting Teams\"\n # Gets teams and team stats for each conference\n Conference.find_each do |conf|\n puts \"--\" + conf.name\n get_teams_from_conf(conf)\n get_conference_standings(conf)\n get_team_scoring_stats(conf)\n get_team_adv_scoring_stats(conf)\n get_team_assists_stats(conf) \n get_team_rebounds_stats(conf)\n get_team_steals_stats(conf)\n get_team_blocks_stats(conf)\n end\n\n puts \"Getting Team Logos and Games\"\n Team.find_each do |team|\n puts \"--\" + team.name\n get_team_logo(team)\n get_team_games(team)\n end\n end", "def getHiredEmployees\n # This is kind of a rediculous way to get this data\n # and should probably be done via api call or upload-esque\n # form if it's a broader service used outside of Hired\n # (or both?)\n \n employees = [] #All employees\n about_url = 'https://hired.com/about'\n doc = Nokogiri::HTML(open(about_url))\n\n doc.css('.layout__item').each do | lli |\n if lli.children.count == 5\n ehh = {}\n ehh[:image] = lli.css('img').attr('src')\n ehh[:name] = lli.children[2].text\n ehh[:position] = lli.children[4].text\n employees << ehh \n end\n end\n \n return employees\nend", "def scrap\n\t\tdef get_townhall_email(townhall_url)\n\t\t\tpage = Nokogiri::HTML(open(townhall_url))\n\t\t\temail = page.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n\n\t\t\tif email.size < 1\n\t\t\t\temail = \"nill\"\n\t\t\tend\n\t\t\treturn email\n\t\tend\n\n\t\tdef get_townhall_urls\n\t\t\ti = 0\n\t\t\tpage = Nokogiri::HTML(open('http://annuaire-des-mairies.com/val-d-oise.html'))\n\t\t\tarray_ville = []\n\t\t\tarray_mail = []\n\t\t\thachier = {}\n\t\t\tarray = []\n\t\t\tville = page.xpath('//a[@class=\"lientxt\"]')\n\n\t\t\tville.each do |a|\n\t\t \tarray_ville[i] = a['href'][1..-1]\n\t\t \tarray_mail = get_townhall_email(\"http://annuaire-des-mairies.com#{array_ville[i].downcase}\")\n\t\t \thachier = {}\n\t\t \thachier[a.text] = array_mail\n\t\t \tarray[i] = hachier\n\t\t \ti = i + 1\n\t\t \tputs hachier\n\t\t end\n\t\t return array\n\t\tend\n\t\treturn get_townhall_urls\n\tend", "def format_records(records)\n records.each do |record|\n report record\n end\n end", "def scrape_data\n rows = @page.search(\"//tr[contains(@class,'Item')]\")\n data = { }\n rows.each do |row|\n cells = row.search(\"td\")\n data[cells.first.text.downcase.gsub(/\\\\|:/, '')] = cells.last.text\n end\n data\n end", "def retrieve_data\n # Define the url\n url = 'http://www.abc.net.au/radionational/feed/3771046/rss.xml'\n\n # Open the url and parse the rss feed\n open(url) do |rss|\n # Start parsing\n feed = RSS::Parser.parse(rss, false)\n\n # Iterate each item and scrape information\n feed.items.each do |item|\n # If the title of thie article matches the title of the last saved article,\n # stop scraping to avoid from saving duplicates in database\n break if !@last_title.nil? && @last_title.eql?(item.title.to_s)\n\n # If thie article is already stored then ignore\n next if Article.find_by(title: item.title.to_s)\n\n # Get the author\n regex_author = /<dc:creator>(.*)<\\/dc:creator>/\n regex_author.match(item.to_s)\n author = Regexp.last_match(1)\n\n author = nil if author.eql? ''\n\n # Get categories values\n regex_category = /<category>(.*)<\\/category>/\n\n categories = []\n item.categories.each do |category|\n regex_category.match(category.to_s)\n categories.push(Regexp.last_match(1))\n end\n\n # Make a template dictionary to put @articles\n temp = {\n author: author,\n title: item.title,\n summary: item.description.to_s,\n image: nil,\n date_time: DateTime.parse(item.pubDate.to_s),\n link: item.link,\n categories: categories.join(',')\n }\n\n # Put the object into articles array\n @articles << temp\n end\n end\n end" ]
[ "0.70556396", "0.67155397", "0.6482333", "0.6392706", "0.6258947", "0.6258947", "0.6199773", "0.6165487", "0.61499983", "0.61499983", "0.61499983", "0.61499983", "0.6079358", "0.6079358", "0.60717297", "0.6057071", "0.6057071", "0.60419285", "0.6037121", "0.6027765", "0.59982127", "0.59982127", "0.59982127", "0.59982127", "0.5974884", "0.5962322", "0.59507793", "0.59507793", "0.58814025", "0.5875976", "0.5874906", "0.58575886", "0.58575886", "0.58525896", "0.5845244", "0.58361876", "0.5808859", "0.5807035", "0.5807035", "0.5782805", "0.57783777", "0.5773565", "0.5771914", "0.57647616", "0.572482", "0.5715", "0.5713229", "0.5707761", "0.5707761", "0.5707128", "0.5707128", "0.57070667", "0.57070667", "0.57066476", "0.57024163", "0.570048", "0.570048", "0.56951517", "0.56934786", "0.5692946", "0.5691029", "0.56762064", "0.565808", "0.565808", "0.56559336", "0.5645233", "0.5644192", "0.5644192", "0.5643089", "0.5637244", "0.563368", "0.563368", "0.5633163", "0.56227297", "0.56185496", "0.5615232", "0.5608269", "0.5595851", "0.5588487", "0.5583931", "0.5569203", "0.5569108", "0.5569108", "0.55622226", "0.55568963", "0.5551371", "0.55490965", "0.55490077", "0.55490077", "0.55395406", "0.55387497", "0.55224866", "0.5521285", "0.55209935", "0.5519239", "0.5514189", "0.5510705", "0.5507517", "0.55071354", "0.5505539" ]
0.6846094
1
Collect column information, formatting the first row.
def aggregate_col_data(row) data_cols = (1..NUM_COL).reject{|i| REJECT.include?(i)}.compact format_first_col(row) .concat( data_cols.collect do |col| text = doc.css('div.games-fullcol').css('table').css('tr')[row].css('td')[col].text col == 2 ? format_team_owner(text) : text end).join(",") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_column\n @first_column ||= first_last_row_col[:first_column]\n end", "def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.width\n case c.align\n when :right\n #fmt << \"%.#{w}s \"\n fmt << \"%#{w}.#{w}s \"\n else\n fmt << \"%-#{w}.#{w}s \"\n end\n }\n ## the next line will put a separator after hidden columns also\n fmstr = fmt.join(@y)\n #puts \"format: #{fmstr} \" # 2011-12-09 23:09:57\n return fmstr\n end", "def col\n horizontals_push; alignments_reset ; widths_reset\n end", "def highlight_first_column\n return @highlight_first_column\n end", "def colrow() @records.get_data(GRT_COLROW); end", "def headers\n rows.first\n end", "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end", "def col; end", "def columns()\n ([email protected](GRT_COLROW)) ? cr[0] : nil\n end", "def columns; @columns; end", "def columns\n @header.to_a\n end", "def col\r\n @lines[@line_num].cursor\r\n end", "def first_row\n @first_row ||= first_last_row_col[:first_row]\n end", "def columns; end", "def column_header\n (0..upper_bound_x+1)\n .to_a\n .map { |num| num.to_s.rjust((upper_bound_y + 1).to_s.size,'0')}\n .map { |num| num.chars }\n .transpose\n .map { |num| num.join }\n .map { |num| num.rjust(num.size + 5,\" \") }\n .join(\"\\n\") + \"\\n\"\n end", "def data_with_head(columnheader)\r\n Array(raw_data_sheet.column(columnheaders_raw.index(columnheader)))\r\n end", "def highlight_first_column=(value)\n @highlight_first_column = value\n end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column_headings\n {\n :line_count => \"Lines\",\n :loc_count => \"LOC\",\n :file_count => \"Classes\",\n :method_count => \"Methods\",\n :average_methods => \"M/C\",\n :method_length => \"LOC/M\",\n :class_length => \"LOC/C\"\n }\n end", "def row_first\n\t\t\trow_value * 9\n\t\tend", "def column_attributes\n @column_attributes ||= begin\n col_attrs = {}\n col_attrs[0] = { orderable: first_column_attribute[:orderable], title: first_column_attribute[:title], width: \"#{FIRST_COLUMN_WIDTH_PERCENTAGE}%\" }\n PointActivity.reportable_types.each do |activity_type|\n col_attrs[col_attrs.length] = { orderable: false,\n width: \"#{non_first_columns_width_percentage}%\",\n title: I18n.t(\"point_activities.count_labels.#{activity_type}\"),\n defaultContent: 0 }\n end\n additional_column_attributes.each do |column_attribute|\n col_attrs[col_attrs.length] = { orderable: column_attribute[:orderable] || false,\n title: column_attribute.fetch(:title),\n width: \"#{non_first_columns_width_percentage}%\",\n defaultContent: 0 }\n end\n col_attrs\n end\n end", "def each_column\n end", "def data_column_info_for_columnheader(columnheader)\r\n method_index = method_index_for_columnheader(columnheader)\r\n\r\n data_header_ch = {}\r\n data_header_ch[:columnheader] = columnheader\r\n data_header_ch[:columnnr] = 1 + columnheaders_raw.index(columnheader)\r\n\r\n if method_index.nil? # columnheader does not appear in the method sheet\r\n data_header_ch[:definition] = columnheader\r\n else\r\n data_header_ch[:definition] = Array(data_description_sheet.column(*WBF[:column_definition_col]))[method_index].blank? ? columnheader : clean_string(Array(data_description_sheet.column(*WBF[:column_definition_col]))[method_index])\r\n data_header_ch[:unit] = clean_string(Array(data_description_sheet.column(*WBF[:column_unit_col]))[method_index])\r\n data_header_ch[:comment] = clean_string(Array(data_description_sheet.column(*WBF[:column_keywords_col]))[method_index])\r\n data_header_ch[:import_data_type] = clean_string(Array(data_description_sheet.column(*WBF[:group_methodvaluetype_col]))[method_index])\r\n end\r\n\r\n return data_header_ch\r\n\r\n end", "def columnheaders_raw\r\n columns = Array(raw_data_sheet.row(0)).compact\r\n columns = columns.collect!{ |col| clean_string(col) } unless columns.nil?\r\n columns\r\n end", "def store_colinfo(firstcol=0, lastcol=0, width=8.43, format=nil, hidden=0, level=0, collapsed=0) #:nodoc:\n record = 0x007D # Record identifier\n length = 0x000B # Number of bytes to follow\n\n # Excel rounds the column width to the nearest pixel. Therefore we first\n # convert to pixels and then to the internal units. The pixel to users-units\n # relationship is different for values less than 1.\n #\n width ||= 8.43\n if width < 1\n pixels = width *12\n else\n pixels = width *7 +5\n end\n pixels = pixels.to_i\n\n coldx = (pixels *256/7).to_i # Col width in internal units\n grbit = 0x0000 # Option flags\n reserved = 0x00 # Reserved\n\n # Check for a format object\n if !format.nil? && format.kind_of?(Format)\n ixfe = format.get_xf_index\n else\n ixfe = 0x0F\n end\n\n # Set the limits for the outline levels (0 <= x <= 7).\n level = 0 if level < 0\n level = 7 if level > 7\n\n\n # Set the options flags. (See set_row() for more details).\n grbit |= 0x0001 if hidden != 0\n grbit |= level << 8\n grbit |= 0x1000 if collapsed != 0\n\n header = [record, length].pack(\"vv\")\n data = [firstcol, lastcol, coldx,\n ixfe, grbit, reserved].pack(\"vvvvvC\")\n\n prepend(header, data)\n end", "def fetch_first_column(sql)\n fetch_rows(sql).map(&:values).map(&:first)\n end", "def column_styles\n # [\n # {:name => 'general', :column => 0},\n # {:name => 'general', :column => 1},\n # {:name => 'general', :column => 2}\n #]\n []\n end", "def header\n self.mult_table.header_line.to_s + \"\\n\"\n end", "def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @[email protected]\n end", "def columns(line)\n line[ox...(ox + width)] || ''\n end", "def each_col\n cols.each\n end", "def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end", "def parse_header(row)\r\n @first_month = 0 # January.\r\n row.each do |col|\r\n next unless col.nil?\r\n index = Date::MONTHNAMES.index(col.strip)\r\n unless index.nil?\r\n @first_month = index\r\n break\r\n end\r\n end\r\n @header_parsed = true\r\n end", "def columns\n @columns ||= @csv_data[0].zip(*@csv_data[1..])\n end", "def details_data\n# column_widths = @settings.collect{|s| pdf.width_of(s[:header].last, :size => pdf.font_size) + 5 }\n\n font_size = pdf.font_size\n padding = (cell_padding + cell_border_width)*2\n @rows.collect do |r|\n @settings.collect{|s|\n content = \"\"\n align = :left\n contents = []\n \n if s[:header].first == \"remark\"\n content = r.remark.to_s\n contents += content.split(/\\r?\\n/)\n elsif s[:header].first == \"revision_no\"\n case r\n when HeaderRow\n content = r.latest_revision_no.to_s\n when RevisionRow\n content = r.rev_no.to_s\n when DetailRow\n content = r.revision_row.rev_no.to_s\n end\n contents << content\n else\n field = Field.field_by_row(s[:header].first, r)\n actual_row = Field.row_by_field(field, r)\n content = Field.value_by_field_name(field, actual_row) unless actual_row.nil?\n contents += content.to_s.split(/\\r?\\n/)\n\n case field\n when Fields::Formula, Fields::Accumulation\n align = :right\n else\n case field.custom_field\n when CustomFields::NumericField\n align = :right\n when CustomFields::DateTimeField\n align = :center\n end\n end\n end\n \n max_content_width = contents.collect{|c| pdf.width_of(c, :size => font_size) }.max\n\n width = max_content_width.to_i + padding\n \n {\n :content => content,\n :align => align,\n :width => width\n }\n }\n end\n end", "def render(row, header)\n hash = header.to_hash(row)\n\n result = \"\"\n fixed_layout.each do |map|\n # A nil value is considered an empty string\n value = hash[map.key].to_s\n result << format(\"%-#{map.size}.#{map.size}s\", value)\n end\n result\n end", "def expected_columns; end", "def columns \n @c\n end", "def header\n @header ||= csv_rows.first\n end", "def header\n @header ||= csv_rows.first\n end", "def header_array\n @columns.collect {|c|\n if @table[c]\n @table[c][:name].to_s\n else\n \"\"\n end\n }.compact\n end", "def data_for_columnheader(columnheader)\r\n\r\n data_lookup_ch = {:data => nil, :rowmax => 1}\r\n data = data_with_head(columnheader)\r\n if data.length > 1\r\n data_hash = generate_data_hash(data) # deletes dataheader\r\n data_lookup_ch[:data] = data_hash\r\n data_lookup_ch[:rowmax] = data_hash.keys.max.nil? ? 0 : data_hash.keys.max - 1 # starting at second row\r\n end\r\n\r\n return data_lookup_ch\r\n end", "def colrow_record() @records.get(GRT_COLROW); end", "def columns_to_s # :nodoc:\n nameline = ' ' * indent\n barline = nameline.dup\n last_col = nil\n last_idx = nil\n columns.each_with_index { |col,idx|\n if (last_col)\n # This produces clean to_s output without truncation\n # Preserves full string in cells for to_csv output\n padding = pad(' ', last_col, last_idx)\n nameline << padding\n remainder = padding.length - cellpad\n remainder = 0 if remainder < 0\n barline << (' ' * (cellpad + remainder))\n end\n\n nameline << col\n barline << ('-' * col.length)\n\n last_col = col\n last_idx = idx\n }\n\n return \"#{nameline}\\n#{barline}\"\n end", "def columns\n _columns || columns!\n end", "def probe\n name_pad = columns.map { |c| c.name.length }.max + 1\n type_pad = columns.map { |c| c.type.length }.max + 2\n sql_type_pad = columns.map { |c| c.sql_type.length }.max + 1\n\n columns.sort { |a, b| a.name <=> b.name }.map do |column|\n name = column.name\n name = \"* #{name}\" if primary_key_column?(column)\n print yellow(name.to_s.rjust(name_pad))\n print \" \"\n print blue(column.type.to_s.ljust(type_pad, \".\"))\n print magenta(column.sql_type.to_s.ljust(sql_type_pad))\n column.null ? print(red(\"NULL\")) : print(\" \")\n print \" [#{column.default}]\" if column.default\n print \" #{gray column.comment}\" if column.comment\n puts\n end\n nil\n end", "def columns!\n ds = clone(opts.merge(:sql => \"SELECT TOP 1 [T1].* FROM (#{opts[:sql]}) \\\"T1\\\"\"))\n ds.each{break}\n\n if cols = ds.cache[:_columns]\n self.columns = cols\n else\n []\n end\n end", "def columns\n end", "def columns\n 1\n end", "def display_columns(input)\n output = \"\"\n input.each_with_index do |element, index|\n # spaces to add inbetween = column.length - word.length\n output += \"#{element.capitalize + (\" \" * (15 - element.to_s.chars.count))}\"\n if index % 4 == 0 && index != 0\n output += \"\\n\"\n end\n end\n puts \"\"\n puts ColorizedString[output].bold\n end", "def columns_title\n self.columns.collect{|c|c.label}\n end", "def formatted_grid\n grid.each do |row|\n puts row.map { |cell| cell.value.empty? ? \"_\" : cell.value }.join(\" \")\n end\n end", "def columns!\n @columns = nil\n columns\n end", "def columns\n collect = []\n recursive_columns(@base, collect)\n end", "def column_value(rec, drawer)\n rec.inspect\n end", "def _draw_head(col, label=nil, &block)\n _draw_2_lane{\n sprintf(\"<th>%s</th><td>\", label || @vc.column_label(col)).html_safe +\n\n # add operator for appropreate data type.\n if col.name == 'id'\n @vc.draw_search_operator(@operator_builder, '_id')\n else\n case col.type\n when :date, :datetime, :integer\n @vc.draw_search_operator(@operator_builder, col.name)\n else\n ''\n end\n end + '</td><td>'.html_safe + yield + '</td>'.html_safe\n }\n end", "def content\n number_to_skip = 0 # Keeps track of the # of columns to skip\n \n html = ''\n table.header.column_names.each do |column|\n number_to_skip -= 1 and next if number_to_skip > 0\n \n if cell = @cells[column]\n number_to_skip = (cell[:colspan] || 1) - 1\n else\n cell = Cell.new(column, nil)\n end\n \n html << cell.html\n end\n \n html\n end", "def columns \n []\n end", "def column_print(things, color=:white)\n # return unless things.any?\n # sizes = things.map{|x|x.size}\n # col_width = sizes.max\n # cols = 80 / (col_width+3)\n # cols = 4 if cols > 4\n \n # if things.size % cols != 0\n # things += [''] * (cols - (things.size % cols))\n # end\n \n # things.map!{|thing| thing.ljust(col_width)}\n \n # things.each_slice(cols) do |slice|\n # puts slice.join(' | ').send(color)\n # end\n puts Term::Table.new(things).to_s.send(color)\n end", "def grid_row_undisplayed_columns\n []\n end", "def map_first_row\n VoltTableUtils.map_first_row_from_volt_table(self, &block)\n end", "def first\n header_data\n end", "def column_fields(json=true)\n data = @data.map do |data|\n data = data.dup\n editor = parse_column_editor(data.delete(\"editor\"))\n renderer = parse_column_renderer(data.delete(\"renderer\"))\n data.merge!(editor) if editor\n data.merge!(renderer) if renderer\n data.delete(\"method\")\n data.delete(\"mapping\")\n data\n end\n json ? JSON.pretty_generate(data) : data\n end", "def get_columns_name\r\n columns = []\r\n if @columns != nil\r\n @columns.each do |column|\r\n columns.push column\r\n end\r\n end\r\n \r\n if @stats != nil and @stats.length > 0\r\n @stats.each do |stat|\r\n columns.push stat.to_column_name\r\n end\r\n end\r\n \r\n return columns\r\n end", "def current_column\n @col_offset\n end", "def getCol\n return @col\n end", "def item_column(detail)\n ''\n end", "def opx_pp(items, col, start_col, fill_col)\n return print(\"\\n\") if (items.length == 0)\n item = items.shift\n print (item = item + (items.length == 0 ? \"\" : \", \"))\n col += item.length\n if ((items.length > 0) && (fill_col <= (col + items[0].length)))\n print \"\\n\"\n start_col.times { |x| print(\" \") }\n col = start_col\n end\n opx_pp(items, col, start_col, fill_col)\n rescue => e\n opx_err(\"Fatal failure while pretty-printing Tabulator data\", e)\n end", "def column_value(rec, drawer)\n if (enum = drawer.vc.get_enum(rec.class, @ar_column_info))\n drawer.vc.draw_column_enum(rec, @ar_column_info, enum)\n else\n case @ar_column_info.type\n when :datetime\n drawer.vc.datetime_fmt(rec.send(name))\n when :date\n drawer.vc.date_fmt(rec.send(name))\n when :integer\n rec.send(name).to_s\n when :boolean\n rec.send(name) ? '√' : ''\n else\n # NOTE: rec.send(col.name) is not used since sssn.send(:data)\n # becomes hash rather than actual string-data so that following\n # split() fails for Hash.\n if str = rec.attributes[name]\n draw_trimmed_str(str)\n else\n ''\n end\n end\n end\n end", "def columns\n single_record unless @columns\n @columns || []\n end", "def column_value\n row.fetch(column){row[@column.to_s]}\n end", "def output\n # This results in a hash of two-element arrays. The key is the header and\n # the value is an array of the header and formatted header. We do the\n # latter so the structure parallels the structure for rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n result += hline(widths) if loc_row.nil?\n next if loc_row.nil?\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end", "def unfilled_columns\n @cells[0].each_with_object([]).with_index do |(cell, nonFull_columns), idx|\n nonFull_columns << idx if cell.eql?(' ')\n end\n end", "def table_header\n line = \"File|Total\".dup\n line << \"|Line\" if header_line_rate?\n line << \"|Branch\" if header_branch_rate?\n line << \"\\n\"\n end", "def columns\n @columns ||= @stats.values.flatten.map { |a| a.column_name }\n end", "def cols\n count == 0 ? Array.new(@order) :\n first.inject([]) { |arr, item| \n arr << map { |row| row[arr.count] }; arr }\n end", "def format\n rows = @children\n rows = @children[1..-1] if @skip_first_row\n rows ||= []\n rows = rows.collect { |row| row.format }.join(\"\\n\")\n\n return nil if rows.length == 0\n rows\n end", "def pm_first(row)\r\n\t# splits mega row into multiple rows for easier final processing\r\n\toutput, new_row = [], []\r\n\trow.each do |datum|\r\n\t\tunless datum[0] == \"\\n\"\r\n\t\t\tunless ['0','1','2','3','4','5','6','7','8','9'].include?(datum[0])\r\n\t\t\t\toutput.push(new_row) if new_row.length > 1\r\n\t\t\t\tnew_row = [] \r\n\t\t\tend\r\n\t\t\tnew_row.push(datum)\r\n\t\tend\r\n\tend\r\n\treturn output\r\nend", "def column_attrs\n attrs = {}\n attrs[\"Service Provider\"] = \"identity.full_name\"\n attrs[\"Provider/Program (First Available)\"] = \"self.identity.display_available_provider_program_name\"\n attrs[\"Date Entered\"] = \"self.created_at.try(:strftime, \\\"%Y-%m-%d\\\")\"\n attrs[\"Subject of Interaction\"] = :display_subject\n attrs[\"Type of Interaction\"] = :display_interaction_type\n attrs[\"Duration in minutes\"] = :duration_in_minutes\n attrs[\"Investigator Name\"] = :name\n attrs[\"Investigator Email\"] = :email\n attrs[\"Investigator Institution\"] = :institution\n attrs[\"Notes\"] = :note\n \n attrs\n end", "def table_column(header, options = {}, &blk)\n raise \"table_column out of table_by_columns block\" if @table_listing_columns.nil?\n row_count = options[:grouping] ? 1 : nil\n @table_listing_columns << [header, blk, options, row_count]\n end", "def columns\n CellCollection.new(@data, @row)\n end", "def empty_col\n # We need the :order parameter here because self.cols uses this as a hash\n # key\n col(nil, SecureRandom.hex)\n end", "def generate_header_row\n (@header.map {|x| generate_header_item(x)}).join\n end", "def information_header\n info_table_src = TTY::Table.new\n @defaults.label_value_pairs.each {|pair| info_table_src << pair}\n info_table_src << [\"Disposition Columns:\", MmMovie.dispositions.join(', ')]\n info_table_src << [\"Transcode File Location:\", self.tempfile ? tempfile&.path : 'n/a']\n\n info_table = C.bold(\"Looking for file(s) and processing them with the following options:\\n\").dup\n info_table << info_table_src.render(:basic) do |renderer|\n a = @defaults.label_value_pairs.map {|p| p[0].length }.max + 1\n b = OutputHelper.console_width - a - 2\n renderer.alignments = [:right, :left]\n renderer.multiline = true\n renderer.column_widths = [a,b]\n end << \"\\n\\n\"\n end", "def headers\n columns.map(&:header)\n end", "def appropriate_column_listing(columns = columns_joined)\n has_config_defined_cols? == true ? \", #{columns}\" : \"\"\n end", "def columns\n @columns || 150\n end", "def column\n @__col\n end", "def column_for_position(position); end", "def column_for_position(position); end", "def column_for_position(position); end", "def add_default_col_rows\n series = @chart.chart_series.select{|cs| cs.ready_for_data? }\n return if series.empty?\n if @chart.cols.empty?\n @chart.cols.push series.first.attribute_name\n elsif @chart.rows.empty?\n @chart.rows.push series.first.attribute_name\n end\n end", "def columns(*args, &block)\n column_options, html_options = get_column_and_html_options( args.extract_options! )\n @collection.each do |object|\n @current_object = object\n if block_given?\n @lines << FormatLine.new(args, column_options, html_options)\n yield(object)\n else\n @lines << FormatLine.new(args, column_options, html_options, object)\n end\n end\n render_tbody\n end", "def scanFirstRowOfIndividualLogFile(row)\n @csvColumnLabelList = [] ;\n @csvColumnIndex = {} ;\n row.each{|val|\n index = @csvColumnLabelList.length ;\n @csvColumnIndex[val] = index ;\n self.instance_variable_set(\"@index_\" + val.to_s, index) ;\n @csvColumnLabelList.push(val) ;\n }\n RequiredColumnName.each{|colName|\n if([email protected]_key?(colName)) then\n p [:missingColumn, colName] ;\n raise(\"log CSV file should have the column: \" + colName) ;\n end\n }\n end" ]
[ "0.67120844", "0.6414379", "0.6374562", "0.61509955", "0.6100733", "0.60851765", "0.6078367", "0.60381794", "0.5964711", "0.5912359", "0.59041226", "0.5895161", "0.58906543", "0.5875549", "0.58743805", "0.58648825", "0.58225244", "0.58215815", "0.58215815", "0.58215815", "0.58215815", "0.58215815", "0.58215815", "0.58215815", "0.58075106", "0.5799361", "0.57744026", "0.5757891", "0.5730935", "0.57251644", "0.57216126", "0.5707748", "0.56962204", "0.5691469", "0.5691345", "0.5677261", "0.5671312", "0.5639291", "0.56084096", "0.5598428", "0.55837876", "0.5580762", "0.55587846", "0.5540763", "0.55060273", "0.55060273", "0.54936475", "0.54776365", "0.54724747", "0.5460723", "0.54574996", "0.5457275", "0.54550517", "0.5445628", "0.5435946", "0.5429232", "0.54189765", "0.54146564", "0.5412894", "0.5408501", "0.54053116", "0.5404131", "0.53971374", "0.5396283", "0.53865224", "0.53810525", "0.5380599", "0.53799796", "0.53781295", "0.53771263", "0.53745204", "0.5356874", "0.5354977", "0.53497237", "0.5345591", "0.5339415", "0.5336918", "0.53293467", "0.53220177", "0.5309849", "0.53088254", "0.53047585", "0.52978635", "0.52838206", "0.52801377", "0.5271221", "0.5267334", "0.5263767", "0.5260153", "0.5259817", "0.52503324", "0.52500516", "0.52498895", "0.52495074", "0.5246988", "0.5246988", "0.5246988", "0.52416664", "0.52382135", "0.5238109" ]
0.61947817
3
show the embed chart if the id was provided and can be decoded and parsed into hash id base64 encoded string of a hash of parameters
def embed @missing = true pars = embed_params sid = pars[:id] type = pars[:type] is_static = type == "static" gon.tp = pars[:c] if sid.present? shr = ShortUri.by_sid(sid, is_static ? :embed_static : :explore) if shr.present? && shr.other.present? && (shr.other == 0 || shr.other == 1) gon.is_donation = shr.other == 0 if (gon.is_donation ? ["a", "b"] : ["a"]).index(gon.tp).present? gon.data = is_static ? shr.pars : ((gon.is_donation ? Donor : Dataset).explore(shr.pars, "co" + gon.tp, true)) @missing = false end end end respond_to do |format| format.html { render :layout => 'embed' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n url = params[:url]\n width = params[:maxwidth] || '100%'\n height = params[:maxheight] || '100%'\n format = request.query_parameters[:format]\n\n if (width =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect width')\n end\n if (height =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect height')\n end\n\n uri = URI.parse(url)\n\n if uri.host != request.host\n raise ActionController::RoutingError.new('URL origin not allowed')\n end\n\n begin\n uuid = /(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})/.match(uri.path)[0]\n rescue NoMethodError\n raise ActionController::RoutingError.new('UUID not found in URL')\n end\n\n begin\n viz = CartoDB::Visualization::Member.new(id: uuid).fetch\n rescue KeyError\n raise ActionController::RoutingError.new('Visualization not found: ' + uuid)\n end\n\n url = URI.join(public_visualizations_show_url(id: uuid) + \"/\", 'embed_map')\n html = \"<iframe width='#{width}' height='#{height}' frameborder='0' src='#{url}' allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>\"\n\n response_data = {\n :type => 'rich',\n :version => '1.0',\n :width => width,\n :height => height,\n :title => viz.name,\n :html => html\n }\n\n if format == 'xml'\n render xml: response_data.to_xml(root: 'oembed')\n else\n render json: response_data.to_json\n end\n end", "def show_graph\n url_for_data = url_for(controller.params.merge(:action => :data)).gsub('&amp;', '&')\n relative_url_path = ActionController::Base.respond_to?(:relative_url_root) ? ActionController::Base.relative_url_root : ActionController::AbstractRequest.relative_url_root\n html, div_name = controller.open_flash_chart_object_and_div_name('100%', '400', url_for_data, true, \"#{relative_url_path}/\")\n\n html << '<script type=\"text/javascript\">' << \"\\n\"\n html << \"var charts_to_image_title = '#{h(controller.title)}';\\n\" \n html << \"var charts_to_image_id = '#{div_name}';\\n\"\n html << '</script>'\n\n html\n end", "def flash_chart(data=nil, opts={}, id=Time.now.usec)\r\n return unless data\r\n \r\n width = opts[:width] ? opts[:width] : 680\r\n height = opts[:height] ? opts[:height] : 400\r\n \r\n div_name = \"chart#{id}\"\r\n \r\n <<-CHART\r\n <div id=\"#{div_name}\" class=\"notices flash_content\">It seems like you don't have Adobe Flash Player installed. Please install it and reload this page.</div>\r\n \r\n <script type=\"text/javascript\">\r\n function #{div_name}Data(){ return '#{data}'; };\r\n \r\n swfobject.embedSWF('/flash/chart.swf',\r\n '#{div_name}',\r\n '#{width}',\r\n '#{height}',\r\n '9.0.0',\r\n '/flash/express_install.swf',\r\n {'get-data':'#{div_name}Data'},\r\n { wmode:'opaque' },\r\n {});\r\n </script>\r\n CHART\r\n end", "def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end", "def display_ipaper(options = {})\n <<-END\n <script type=\"text/javascript\" src=\"http://www.scribd.com/javascripts/view.js\"></script>\n <div id=\"embedded_flash\">#{options.delete(:alt)}</div>\n <script type=\"text/javascript\">\n var scribd_doc = scribd.Document.getDoc(#{ipaper_id}, '#{ipaper_access_key}');\n #{js_params(options)}\n scribd_doc.write(\"embedded_flash\");\n </script>\n END\n end", "def embed_code(options={})\n \"<img src=\\\"#{@url}\\\" width=\\\"#{embed_width}\\\"/>\"\n end", "def _embed_me \n self.class._aqua_opts[:embed]\n end", "def show\n @visualization = Visualization.find(params[:id])\n @project = Project.find_by_id(@visualization.project_id)\n tmp = JSON.parse(@visualization.data)\n param_vis = param_vis_check(params)\n\n # The finalized data object\n @data = {\n savedData: @visualization.data,\n savedGlobals: @visualization.globals,\n defaultVis: param_vis || tmp['defaultVis'],\n relVis: tmp['relVis']\n }\n\n recur = params.key?(:recur) ? params[:recur] == 'true' : false\n\n options = {}\n\n # Detect presentation mode (and force embed)\n if params.try(:[], :presentation) and params[:presentation]\n @presentation = true\n options[:presentation] = 1\n params[:embed] = true\n else\n @presentation = false\n end\n\n respond_to do |format|\n format.html do\n if params.try(:[], :embed) and params[:embed]\n options[:isEmbed] = 1\n options[:startCollapsed] = 1\n @globals = { options: options }\n render 'embed', layout: 'embedded'\n else\n @layout_wide = true\n render\n end\n end\n format.json { render json: @visualization.to_hash(recur) }\n end\n end", "def render_chart_html(chart_swf,str_url,str_xml,chart_id,chart_width,chart_height,debug_mode,&block)\n chart_width=chart_width.to_s\n chart_height=chart_height.to_s\n \n debug_mode_num=\"0\"\n if debug_mode==true\n debug_mode_num=\"1\"\n end \n str_flash_vars=\"\"\n if str_xml==\"\"\n str_flash_vars=\"chartWidth=\"+chart_width+\"&chartHeight=\"+chart_height+\"&debugmode=\"+debug_mode_num+\"&dataURL=\"+str_url\n logger.info(\"The method used is setDataURL.The URL is \" + str_url)\n else\n str_flash_vars=\"chartWidth=\"+chart_width+\"&chartHeight=\"+chart_height+\"&debugmode=\"+debug_mode_num+\"&dataXML=\"+str_xml\n logger.info(\"The method used is setDataXML.The XML is \" + str_xml)\n end\n concat(\"\\t\\t<!-- START Code Block for Chart -->\\n\\t\\t\",block.binding)\n \n object_attributes={:classid=>\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"}\n object_attributes=object_attributes.merge(:codebase=>\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\")\n object_attributes=object_attributes.merge(:width=>chart_width)\n object_attributes=object_attributes.merge(:height=>chart_height)\n object_attributes=object_attributes.merge(:id=>chart_id)\n \n param_attributes1={:name=>\"allowscriptaccess\",:value=>\"always\"}\n param_tag1=content_tag(\"param\",\"\",param_attributes1)\n \n param_attributes2={:name=>\"movie\",:value=>chart_swf}\n param_tag2=content_tag(\"param\",\"\",param_attributes2)\n \n param_attributes3={:name=>\"FlashVars\",:value=>str_flash_vars}\n param_tag3=content_tag(\"param\",\"\",param_attributes3)\n \n param_attributes4={:name=>\"quality\",:value=>\"high\"}\n param_tag4=content_tag(\"param\",\"\",param_attributes4)\n \n embed_attributes={:src=>chart_swf}\n embed_attributes=embed_attributes.merge(:FlashVars=>str_flash_vars)\n embed_attributes=embed_attributes.merge(:quality=>\"high\")\n embed_attributes=embed_attributes.merge(:width=>chart_width)\n embed_attributes=embed_attributes.merge(:height=>chart_height).merge(:name=>chart_id)\n embed_attributes=embed_attributes.merge(:allowScriptAccess=>\"always\")\n embed_attributes=embed_attributes.merge(:type=>\"application/x-shockwave-flash\")\n embed_attributes=embed_attributes.merge(:pluginspage=>\"http://www.macromedia.com/go/getflashplayer\")\n \n embed_tag=content_tag(\"embed\",\"\",embed_attributes)\n \n concat(content_tag(\"object\",\"\\n\\t\\t\\t\\t\"+param_tag1+\"\\n\\t\\t\\t\\t\"+param_tag2+\"\\n\\t\\t\\t\\t\"+param_tag3+\"\\n\\t\\t\\t\\t\"+param_tag4+\"\\n\\t\\t\\t\\t\"+embed_tag+\"\\n\\t\\t\",object_attributes),block.binding)\n concat(\"\\n\\t\\t<!-- END Code Block for Chart -->\\n\",block.binding)\n end", "def embed_code(width = 500, height = 315)\n if self.vimeod?\n '<iframe src=\"http://player.vimeo.com/video/' + self.vimeo_id.to_s + '?api=1&player_id=video_' + self.id.to_s + '&title=0&byline=0&portrait=0\" id=\"video_' + self.id.to_s + '\" width=\"' + width.to_s + '\" height=\"' + height.to_s + '\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'\n else\n self.embed_code_html(width, height)\n end\n end", "def embed_id\n match = @node.inner_text.strip.match(self.class.url_regexp)\n match[:id] if match\n end", "def youtube_embed_code(size)\n width, height = video_embed_size(size)\n \"<iframe id='embedded_video' width='#{width}' height='#{height}' src='http://www.youtube.com/embed/#{self.params['v'][0]}?autohide=1&hd=1&border=1&showinfo=0' frameborder='0' allowfullscreen></iframe>\".html_safe\n end", "def embed_url\n params = {\n showChat: false,\n userName: Rack::Utils.escape(h.current_user.username)\n }\n\n \"#{url}?#{params.to_query}\"\n end", "def to_html\n w = 400\n h = 300\n id = @url.match(REGEX)[1]\n embed_image = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}&etp=im\"\n embed_3d = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}\"\n <<HTML\n<div class=\"onebox-3dwh\" id=\"#{id}\">\n <iframe src=\"#{embed_image}\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" width=\"#{w}\" height=\"#{h}\" allowfullscreen></iframe>\n <div class=\"onebox-3dwh-circle\" onclick=\"$('##{id} iframe').attr('src', '#{embed_3d}'); $(this).remove()\" />\n</div>\nHTML\n end", "def set_embed_code_variable\n @embed_code_variable = EmbedCodeVariable.find(params[:id])\n end", "def embed(src, mime_type, label)\nend", "def show\n akt_zeit\n #chart_kurven\n highchart_kurven\n init_diaquenauswahl\n # macht folgende Zeile �berfl�ssig\n #@diagramm = Diagramm.find(params[:id])\n @titelzeile = @diagramm.name + \" - KabDiag\"\n respond_to do |format|\n format.html {\n }\n format.json {\n p @chart\n render :inline => @chart.render #, :layout => false\n }\n end\n end", "def render_chart_html(chart_swf,str_url,str_xml,chart_id,chart_width,chart_height,debug_mode,&block)\n chart_width=chart_width.to_s\n chart_height=chart_height.to_s\n debug_mode_num=\"0\"\n if debug_mode==true\n debug_mode_num=\"1\"\n end\n str_flash_vars=\"\"\n if str_xml==\"\"\n str_flash_vars=\"chartWidth=\"+chart_width+\"&chartHeight=\"+chart_height+\"&debugmode=\"+debug_mode_num+\"&dataURL=\"+str_url\n logger.info(\"The method used is setDataURL.The URL is \" + str_url)\n else\n str_flash_vars=\"chartWidth=\"+chart_width+\"&chartHeight=\"+chart_height+\"&debugmode=\"+debug_mode_num+\"&dataXML=\"+str_xml\n logger.info(\"The method used is setDataXML.The XML is \" + str_xml)\n end\n object_attributes={:classid=>\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"}\n object_attributes=object_attributes.merge(:codebase=>\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\")\n object_attributes=object_attributes.merge(:width=>chart_width)\n object_attributes=object_attributes.merge(:height=>chart_height)\n object_attributes=object_attributes.merge(:id=>chart_id)\n param_attributes1={:name=>\"allowscriptaccess\",:value=>\"always\"}\n param_tag1=content_tag(\"param\",\"\",param_attributes1)\n param_attributes2={:name=>\"movie\",:value=>chart_swf}\n param_tag2=content_tag(\"param\",\"\",param_attributes2)\n param_attributes3={:name=>\"FlashVars\",:value=>str_flash_vars}\n param_tag3=content_tag(\"param\",\"\",param_attributes3)\n param_attributes4={:name=>\"quality\",:value=>\"high\"}\n param_tag4=content_tag(\"param\",\"\",param_attributes4)\n param_attributes5={:name=>\"wmode\",:value=>\"transparent\"}\n param_tag5=content_tag(\"param\",\"\",param_attributes5)\n embed_attributes={:src=>chart_swf}\n embed_attributes=embed_attributes.merge(:FlashVars=>str_flash_vars)\n embed_attributes=embed_attributes.merge(:quality=>\"high\")\n embed_attributes=embed_attributes.merge(:width=>chart_width)\n embed_attributes=embed_attributes.merge(:wmode=>'transparent')\n embed_attributes=embed_attributes.merge(:height=>chart_height).merge(:name=>chart_id)\n embed_attributes=embed_attributes.merge(:allowScriptAccess=>\"always\")\n embed_attributes=embed_attributes.merge(:type=>\"application/x-shockwave-flash\")\n embed_attributes=embed_attributes.merge(:pluginspage=>\"http://www.macromedia.com/go/getflashplayer\")\n embed_tag=content_tag(\"embed\",\"\",embed_attributes)\n concat(content_tag(\"object\",\"\\n\\t\\t\\t\\t\"+param_tag1+\"\\n\\t\\t\\t\\t\"+param_tag2+\"\\n\\t\\t\\t\\t\"+param_tag3+\"\\n\\t\\t\\t\\t\"+param_tag4+\"\\n\\t\\t\\t\\t\"+param_tag5+\"\\n\\t\\t\\t\\t\"+embed_tag+\"\\n\\t\\t\",object_attributes),block.binding)\n end", "def hash_to_embed\n if not self.initial?\n self.params_hash\n else\n \"\"\n end\n end", "def show\n id = params[:id] || extract_id_from(params[:encoded_id])\n @playing = Playing.find(id)\n\n respond_to do |format|\n format.html { render locals: { short_url: short_link_to(@playing) } }\n format.json { render json: @playing }\n end\n end", "def flash_chart data_url, opts={}\n width = opts[:width] ? opts[:width] : 680\n height = opts[:height] ? opts[:height] : 400\n base = \"\"\n flash_base = \"/flash/\"\n # and now render the flash object\n open_flash_chart_2(width, height, data_url, base, generate_hash(data_url), flash_base)\n end", "def embed_screen(params = {})\n @iframe_src = screen_uri(params)\n render \"iframe\"\n end", "def build_embed(embed = Discordrb::Webhooks::Embed.new, message = nil)\n embed.title = AcnhBot.client.bot_app.name\n embed.timestamp = Time.at(Time.now.to_i)\n if message\n embed.footer = Discordrb::Webhooks::EmbedFooter.new(:text => \"Demandé par #{message.author.name}\",\n :icon_url => message.author.avatar_url)\n end\n embed\n end", "def show\n @data1 = params[:id] # id is the NAME of the activity/aspect not the ID\n page = params[:page] ? params[:page] : 1 # to allow for multiple page retrieval\n @response = Hash.new\n \n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/'+params[:id]))\n \n \n #TODO _> query last how to verify that the content is tagged accordingly\n \n respond_to do |format|\n format.html {render \"stream\"}\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def handler\n if parameters['id'] && parameters['param_x'].to_s && parameters['param_y'].to_s\n script_tag_for_chart = {}\n data = get_line_dev_data(experiment, parameters['param_x'].to_s, parameters['param_y'].to_s)\n if parameters['type'] == 'data'\n script_tag_for_chart = content[JSON.stringify(data)]\n elsif parameters['chart_id']\n script_tag_for_chart = prepare_lindev_chart_content(data)\n else\n raise MissingParametersError.new([\"chart_id\"])\n end\n script_tag_for_chart\n else\n raise MissingParametersError.new([\"chart_id\"])\n end\n end", "def show\n @event = @campus.events.find(params[:id])\n authorize! :show, @event, :message => 'Acceso denegado.'\n @university = @event.campus.university\n @campus = @event.campus\n @url = \"https://chart.googleapis.com/chart?cht=qr&chs=200x200\"+\"&chl=E-\"[email protected]_s\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n format.js\n end\n end", "def embed\n if youtube_url then youtube_embed\n # Uploads don't get put in the embed field on Kitsu\n elsif upload_url then nil\n elsif image then image_embed\n elsif link then link\n end\n end", "def new_embedded_run_url(id_or_model)\n id = workflow_id(id_or_model)\n\n raw(taverna_player.new_run_url(:workflow_id => id, :embedded => true))\n end", "def prepare_lindev_chart_content(data)\n output = \"<script>(function() { \\nvar i=\" + parameters['chart_id'] + ';'\n output += \"\\nvar data = \" + data.to_json + ';' if data != nil\n output += \"\\nlindev_main(i, \\\"\" + parameters['param_x'] + \"\\\", \\\"\" + parameters['param_y'] + \"\\\", data);\"\n output += \"\\n})();</script>\"\n output\n end", "def show\n #id = Base64.decode64(params[:id])\n @story = Story.find(params[:id])\n end", "def embed_code_html(width = 500, height = 315)\n '[video saved - will display when done]'\n end", "def embed width, height\n string = <<EOF\n<object type=\"application/x-shockwave-flash\" width=#{width} height=#{height} data=\"http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0'&show_byline=0&showportrait=0&color=00ADEF\">\n<param name=\"quality\" value=\"best\" />\n<param name=\"allowfullscreen\" value=\"false\" />\n<param name=\"scale\" value=\"showAll\" />\n<param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0&show_byline=0&showportrait=0&color=00ADEF\" /></object>\nEOF\n string.gsub(\"\\n\", \"\")\n end", "def oembed_data\n oembed_resolver&.oembed_data\n end", "def show\n @product = Product.find(params[:id])\n if Rails.env.development?\n @domain = \"http://localhost:3000\"\n else\n @domain = \"https://hawkeye360.herokuapp.com\"\n end\n @iframe = '<iframe src=\"%s/products/%s/preview\" width=\"%s\" height=\"%s\"></iframe>' % [@domain, @product.id, @product.display_width, @product.display_height]\n gon.image_path = \"https://s3-us-west-2.amazonaws.com/#{ENV['S3_BUCKET']}/uploads/product/images/#{@product.id}/\"\n gon.total_frames = @product.total_frames\n gon.file_extension = @product.file_extension\n gon.display_width = @product.display_width\n gon.display_height = @product.display_height\n end", "def swf_embed(id, url, width, height, bgcolor, click_tag, alt = '')\n url = h(url)\n click_tag = h(click_tag)\n\n result = <<HTML\n <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"#{width}\" height=\"#{height}\" id=\"#{id}\">\n <param name=\"movie\" value=\"#{url}\" />\n <param name=\"bgcolor\" value=\"#{bgcolor}\" />\n <param name=\"wmode\" value=\"opaque\" />\n <param name=\"allowfullscreen\" value=\"false\" />\n <param name=\"allowscriptaccess\" value=\"never\" />\n <param name=\"quality\" value=\"autohigh\" />\n <param name=\"flashvars\" value=\"clickTAG=#{click_tag}\" />\n\n <!--[if !IE]>-->\n <object type=\"application/x-shockwave-flash\" data=\"#{url}\" width=\"#{width}\" height=\"#{height}\">\n <param name=\"bgcolor\" value=\"#{bgcolor}\" />\n <param name=\"wmode\" value=\"opaque\" />\n <param name=\"allowfullscreen\" value=\"false\" />\n <param name=\"allowscriptaccess\" value=\"never\" />\n <param name=\"quality\" value=\"autohigh\" />\n <param name=\"flashvars\" value=\"clickTAG=#{click_tag}\" />\n <!--<![endif]-->\n\n #{alt}\n\n <!--[if !IE]>-->\n </object>\n <!--<![endif]-->\n </object>\n <script type=\"text/javascript\">\n try { swfobject.registerObject(\"#{id}\", \"9.0.0\"); } catch(e) {}\n\t\t </script>\nHTML\n result.html_safe\n end", "def embed_link\n self.embed = detect_host\n end", "def embeddable_url\n\t\turl.sub('watch?v=', 'embed/')\n\tend", "def get_video_embed_code(args = {})\n receive_video_id? args\n args = receive_should_validate? args\n\n get('redtube.Videos.getVideoEmbedCode', args,\n [:video_id], args[:should_validate])\n end", "def fileset_embed_markup(file_name)\n fileset = fileset(file_name)\n #emb_markup = fileset[\"embed_code\"] unless fileset[\"noid\"].empty?\n noid = fileset[\"noid\"]\n embed_markup = \"\"\n unless noid.empty?\n # Found fileset. Determine the embed link from the\n # \"Embed Code\" property. This will give the correct host.\n # If fileset has no property, then it can't be embedded.\n external_res = fileset['external_resource_url']\n fmarkup = fileset['embed_code']\n unless fmarkup.nil? or fmarkup.empty?\n if external_res.nil? or external_res.strip.empty?\n embed_doc = Nokogiri::XML::DocumentFragment.parse(fmarkup)\n iframe_node = embed_doc.xpath(\"descendant-or-self::*[local-name()='iframe']\").first\n embed_link = iframe_node['src']\n ititle = iframe_node['title']\n title = HTMLEntities.new.encode(ititle)\n\n href = fileset['link'][12..-3]\n #title = fileset['title'].nil? ? \"\" : fileset['title']\n\n link_uri = URI(embed_link)\n link_scheme_host = link_uri.scheme + \"://\" + link_uri.host\n\n embed_markup = sprintf(RESOURCE_EMBED_MARKUP, link_scheme_host, noid, noid, noid, noid, embed_link, title)\n else\n embed_markup = fmarkup\n end\n end\n end\n return embed_markup\n end", "def oembed_options\n { :maxwidth => \"560\", :maxheight => \"315\" }.merge(options[:oembed]||{})\n end", "def show\n unless parent.chart\n parent.update_attributes chart: Chart.find_or_create(parent.dob)\n end\n @chart = parent.chart\n @name = parent.full_name\n\n @chart = Chart.find(params[:id])\n respond_with(@chart)\n \n respond_to do |format|\n format.html\n # format.html { render :layout => 'chart' }\n format.pdf {\n pdf = ChartPdf.new(@chart, @name, view_context)\n send_data pdf.render, filename: \"#{parent.friendly_id}-natal-chart.pdf\", type: \"application/pdf\", disposition: 'inline'\n }\n end\n end", "def show\n get_chapter(params[:id])\n if @chapter\n @book = Book.find_by_id(@chapter.book_id)\n @questions = @chapter.questions.sort!{|a, b| a.created_at <=> b.created_at}\n @ytID = @chapter.media_url.match(\"v=[a-zA-Z0-9\\--_]*\").to_s.gsub(\"v=\", \"\") if @chapter.media_url\n @preview_path = \"#{STUDYEGG_PATH}/review/#{(@chapter.id)}/embed\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :text => \"#{params[:callback]}(#{@questions.to_json})\", :content_type => 'text/javascript' }\n end\n else\n redirect_to \"/\"\n end\n end", "def show\n if valid_chart?\n render status: :ok,\n json: { success: true, data: Metrics.new(chart, metadata).render }.to_json\n else\n render json: { success: false, error: 'Chart not found.' }\n end\n end", "def get_youtube_video(id)\n uri = URI(\"https://noembed.com/embed?url=https://www.youtube.com/watch?v=#{id}\")\n begin\n resp_body = Net::HTTP.get(uri)\n title = JSON.parse(resp_body)['title']\n rescue\n title = \"Title wasn't found\"\n end\n # render html for youtube video embed\n \"<div class='video-title'>#{title}</div><iframe width='420' frameborder='0' height='315'\"+\n \" src='https://www.youtube-nocookie.com/embed/#{id.to_s}' allowfullscreen></iframe>\"\n end", "def embed(embed_params)\n @params[:embeddable] = convert_to_bool_valued_hash(embed_params)\n self\n end", "def foorth_embed\r\n 'true'\r\n end", "def enable_embed\r\n session[:embed] = params[:embed] if params[:embed]\r\n if session[:embed]\r\n \"embed\"\r\n else\r\n \"application\"\r\n end\r\n end", "def oembed_html\n oembed && oembed[:html]\n end", "def show\n @report = Report.find(params[:id].to_s.tr('-', '_'), I18n.locale)\n\n respond_to do |wants|\n wants.html\n wants.pdf do\n pdf = WickedPdf.new.pdf_from_url(\n report_pdf_fetch_url,\n print_media_type: true,\n window_status: 'chartsDidLoad',\n margin: { top: 40, bottom: 40, left: 40, right: 40 }\n )\n\n render plain: pdf, layout: nil\n end\n end\n end", "def oembed_url\n 'https://www.slideshare.net/api/oembed/2?format=json&url='\\\n \"#{source_url}\"\n end", "def show\n #setup_reporting_fields\n rqrcode\n end", "def chart_params\n params.require(:chart).permit(:code, :content, :glcode, :gst, :header, :users_id)\n end", "def embed_link\n return nil if self.youtube_link.nil?\n\n id_regex = /(?:http:\\/\\/)?(?:www\\.)?(?:youtube\\.com|youtu\\.be)\\/(?:watch\\?v=)?(.+)/\n youtube_id = self.youtube_link.match(id_regex)\n return nil if youtube_id.nil?\n\n return YOUTUBE_EMBED_PREFIX + youtube_id[1] + \"?rel=0\"\n end", "def embedyoutube(videonumber)\n %{\n <body style=\"margin:0;\">\n <object height=\"100%\" width=\"100%\"><param name=\"movie\" value=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" /><embed height=\"100%\" src=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" type=\"application/x-shockwave-flash\" width=\"100%\"></embed></object>\n </body>\n }\n end", "def embed_chart(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n row = args[0]\n col = args[1]\n chart = args[2]\n x_offset = args[3] || 0\n y_offset = args[4] || 0\n scale_x = args[5] || 1\n scale_y = args[6] || 1\n\n raise \"Insufficient arguments in embed_chart()\" unless args.size >= 3\n # raise \"Couldn't locate $chart: $!\" unless -e $chart;\n\n @charts[row][col] = [row, col, chart,\n x_offset, y_offset, scale_x, scale_y, ]\n\n end", "def show\n @replay = Replay.find(params[:id])\n\n send_data @replay.data, :filename => @replay.level_id.to_s + \".replay\"\n end", "def show\n\t\trender plain: params[:id]\n\tend", "def get_snippet(id)\n # Make an API call using 'rest-client' gem\n target_url = 'https://publish.twitter.com/oembed?' \\\n 'url=https%3a%2f%2ftwitter%2ecom%2fInterior%2fstatus%2f' +\n id.to_s + '&omit_script=true'\n response = RestClient::Request.execute(\n method: :get,\n url: target_url\n )\n result = JSON.parse(response)\n\n return result['html']\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def show\n @music = Music.friendly.find(URI.unescape(params[:id]))\n # select random genre from all the music\n # create a client object with your app credentials\n client = Soundcloud.new(:client_id => 'd99d78670c7f1d537d0ae3d67a7be95c')\n @embed_info = client.get('/oembed', :url => @music.song_api,:auto_play => true)\n end", "def save_screenshot_embed(screenshot, id)\n if driver\n driver.save_screenshot(screenshot)\n embed(screenshot, 'image/png', \"Screenshot #{id}\")\n end\nend", "def embed_code(url, options={})\n begin\n EmbedLinkFactory.get_embed_link(url).embed_code(options)\n rescue\n begin\n DefaultLink.new(url).embed_code(options)\n rescue\n url\n end\n end\n end", "def get_interview_embed_code_with_http_info(interview_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InterviewsApi.get_interview_embed_code ...'\n end\n # verify the required parameter 'interview_id' is set\n if @api_client.config.client_side_validation && interview_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interview_id' when calling InterviewsApi.get_interview_embed_code\"\n end\n # resource path\n local_var_path = '/interviews/{interviewId}/embed_code'.sub('{' + 'interviewId' + '}', CGI.escape(interview_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'String' \n\n # auth_names\n auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InterviewsApi#get_interview_embed_code\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def to_html(input_args=Hash.new)\n #puts \"to_html arg #{input_args}\"\n\n reset_chart(input_args)\n \n open_tag('script',script_content)\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:column]) do\n if @id\n if @do_not_save_chart\n open_tag('small',\"user generated json has no chart expand function\") \n else \n open_tag('small') do\n #open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"Expand\",href: \"/chart_expand/#{chart_url}\")\n #end\n #if @args[:time] # if time chart, srg wants to button user can click to show status last month\n # open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"last month\",href: \"/chart_last_month/#{chart_url}\")\n # end\n #end\n if @args[:title] # jason 111516, intentionally write the chart's title here. this one is useful when there are a lot of chart and people can search chart by using browser's search function\n open_tag('span',\"#{@args[:title]}\");\n end\n open_tag('span','',id: 'tooltip_info') do # this field gets populated when user hovers on tool tip\n end\n end\n end\n end\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:css]) do\n open_tag('canvas',\"\",id: \"#{@chart_id}\" ) do # matches the javascript code which expect to populate LineChart\n end \n end \n end\n @out\n end", "def get_embed_link_meta(work)\n chapters_text = ts(\"Chapters: \") + work.chapter_total_display + tag(\"br\")\n fandom_text = add_label_for_embed(ts(\"Fandom: \"), work.fandoms.map {|fandom| link_to fandom.name, tag_url(fandom)}.join(', ').html_safe, tag(\"br\"))\n rating_text = add_label_for_embed(ts(\"Rating: \"), work.ratings.map {|rating| rating.name}.join(', '), tag(\"br\"))\n warning_text = add_label_for_embed(ts(\"Warnings: \"), work.warnings.map {|warning| warning_display_name(warning.name)}.join(', '), tag(\"br\"))\n relationship_text = add_label_for_embed(ts(\"Relationships: \"), work.relationships.map {|rel| rel.name}.join(', '), tag(\"br\"))\n char_text = add_label_for_embed(ts(\"Characters: \"), work.characters.map {|char| char.name}.join(', '), tag(\"br\"))\n tags_text = add_label_for_embed(ts(\"Additional Tags: \"), work.freeforms.map {|freeform| freeform.name}.join(', '), tag(\"br\"))\n if work.series.count != 0\n series_text = add_label_for_embed(ts(\"Series: \"), series_list_for_feeds(work), tag(\"br\"))\n end\n summary_text = add_label_for_embed(ts(\"Summary: \"), sanitize_field(work, :summary))\n \n if work.series.count != 0\n [chapters_text, fandom_text, rating_text, warning_text, relationship_text, char_text, tags_text, series_text, summary_text].compact.join\n else\n [chapters_text, fandom_text, rating_text, warning_text, relationship_text, char_text, tags_text, summary_text].compact.join\n end \n end", "def to_s; \"#<Veritable::Analysis _id='#{_id}'>\"; end", "def show\n @medium = Video.find(params[:id])\n if [email protected]?\n language = params[:language]\n form = params[:form]\n @transcript_params = {:video_id => @medium.id}\n @transcript_params[:language] = language if !language.nil?\n @transcript_params[:form] = form if !form.nil?\n end\n respond_to do |format|\n format.html # show.rhtml\n format.js\n format.xml { render :xml => @medium.to_xml }\n end\n end", "def chart_params\n params.require(:chart).permit(:speech_id, :name, :member_id)\n end", "def audio_url_chartable\n ENV['CHARTABLE_ID'].nil? ? @audio_url : @audio_url.gsub('https://', \"https://chtbl.com/track/#{ENV['CHARTABLE_ID']}/\")\n end", "def to_embed(url)\n %Q[<script src=\"#{url}.js\"></script>]\n end", "def embed(youtube_url)\n youtube_id = youtube_url.split('=').last\n content_tag(:iframe, nil, src: \"//www.youtube.com/embed/#{youtube_id}\")\n end", "def embedSwf( swfURL, idNum, widthStr, heiStr, colStr, attrs=nil )\n\t\thaml_tag :object, { :data=>swfURL, :id=>idNum, :type=>'application/x-shockwave-flash', :width=>widthStr, :height=>heiStr } do\n\n\t\t\tstdAttrs = {:rootID=>idNum}\n\t\t\tstdAttrs.merge!(attrs)\n\t\t\tattrsAsString = stdAttrs.collect { |k, v| \"#{k}=#{v}\" }.join('&')\n\n\t\t\thaml_tag :param, { :name=>'movie', :value=>swfURL }\n\t\t\thaml_tag :param, { :name=>\"scale\", :value=>\"noscale\" }\n\t\t\thaml_tag :param, { :name=>\"salign\", :value=>\"lt\" }\n\t\t\thaml_tag :param, { :name=>\"bgColor\", :value=>colStr }\n\t\t\thaml_tag :param, { :name=>'allowScriptAccess', :value=>'always' }\n\t\t\thaml_tag :param, { :name=>\"wmode\", :value=>\"window\" }\n\t\t\thaml_tag :param, { :name=>'FlashVars', :value=>attrsAsString }\n\t\tend\n\tend", "def graphql_id\n Base64.encode64(\"04:#{self.class.name}#{id}\").rstrip\n end", "def show_single_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(:get, path, query_params, form_params, headers)\n response\n \n\n end", "def embed(type, options={})\n self._embed = type\n self._root_embed = true if options[:include]\n end", "def show\n @api_v1_canvas = Api::V1::Canvas.find(params[:id])\n end", "def embed\n sign_out\n response.headers.delete 'X-Frame-Options'\n if params[:slot_type]\n slot_type = @newsletter.slot_types.find(params[:slot_type])\n collect_slots_of_type(slot_type)\n @table_title = slot_type.name\n else\n collect_all_slots\n end\n end", "def show\n handle_hashed_id_query\n end", "def show\n id = params.keys[1] # Query variable is the ID of the TV show that the user clicks on.\n\n #template = Addressable::Template.new('https://api.themoviedb.org/3/tv/{?query*}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n #url = template.expand({\"query\" => id})\n #response = HTTParty.get(url)\n\n url = Addressable::URI.parse(\"https://api.themoviedb.org/3/tv/#{id}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US\")\n response = HTTParty.get(url)\n\n @show = JSON.parse(response.body, symbolize_names: true) \n end", "def prepare_boxplot_chart_content(data)\n output = \"<script>(function() { \\nvar i=\" + parameters['chart_id'] + ';'\n output += \"\\nvar data = \" + data[:data].to_json + ';' if data[:data] != nil\n output += \"\\nvar categories = \" + data[:categories].to_json + ';' if data[:categories] != nil\n output += \"\\nvar outliers = \" + data[:outliers].to_json + ';' if data[:outliers] != nil\n output += \"\\nvar mean = \" + data[:mean].to_json + ';' if data[:mean] != nil\n output += \"\\nboxplot_main(i, \\\"\" + parameters['param_x'] + \"\\\", \\\"\" + parameters['param_y'] + \"\\\", data, categories, outliers, mean);\"\n output += \"\\n})();</script>\"\n output\n end", "def get_interview_embed_code(interview_id, opts = {})\n data, _status_code, _headers = get_interview_embed_code_with_http_info(interview_id, opts)\n data\n end", "def show\n client_playlist = Soundcloud.new(:client_id => Rails.application.secrets.soundcloud_client_id,\n :client_secret => Rails.application.secrets.soundcloud_secret,\n :username => Rails.application.secrets.soundcloud_username,\n :password => Rails.application.secrets.soundcloud_password)\n client_track = SoundCloud.new(:client_id => Rails.application.secrets.soundcloud_client_id)\n # create an array of track ids\n track_url = Post.find(params[:id]).try(:track_url)\n # puts track_url.inspect\n embed_info = client_track.get('/oembed', :url => track_url)\n @song = embed_info['html']\n @track_id = client_track.get('/resolve', :url => track_url).id\n @playlists = client_playlist.get(\"/me/playlists\")\n end", "def show\n @ad_set = AdSet.find(params[:id])\n #The next line are a security to validate that the object being shown is owned by the current session holder.\n if !validate_account_id(@ad_set.account_id).call().nil? then return end\n @video = Video.find_by_id(@ad_set[:video_id])\n @iqeinfos = Iqeinfo.where(:video_id => @ad_set[:video_id]).paginate(:page => params[:page], :per_page => 20).order('id')\n @ad = Ad.new\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @ad_set }\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n\t\t\t{message: 'read_chat', data: {id: params[:id], token: cookies['example_token'], example_data: 'we missed you.'}}.to_json\n\t\tend", "def show\n #@event_id = params[:event_id]\n #@university_id = params[:university_id]\n #@events_university = EventsUniversity.where(event_id: @event_id, embed_code_variable_university_id: @university_id).take\n #@embed_code_variable = EmbedCodeVariable.where(events_university_id: @events_university.id)\n #if @embed_code_variable.empty?\n # @embed_code_variable = EmbedCodeVariable.new(events_university_id: @events_university.id)\n #end\n #@embed_code_variable.save\n end", "def print_init(init)\n InitTrackerLogger.log.debug(\"embed init\")\n new_embed = build_embed\n message = command.event.channel.send_embed do |embed|\n embed.title = new_embed[:title]\n embed.colour = new_embed[:color]\n embed.description = new_embed[:description]\n end\n\n # Add the reaction emojis\n InitTracker::Models::ReactionCommand::EMOJIS.each do |emoji|\n message.create_reaction(emoji)\n end\n\n # Stamp the message id on the init so it can be referenced later\n init.update_attribute(:message_id, message.id)\n end", "def embed(youtube_url)\n youtube_id = youtube_url.split(\"=\").last\n content_tag(:iframe, nil, src: \"//www.youtube.com/embed/#{youtube_id}\")\n end", "def show\n @chord = Chord.find_by_hash_ref(params[:id]) or raise ActiveRecord::RecordNotFound\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chord }\n end\n end", "def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end", "def display_scribd(object, options = {})\n # Resolve the right scribd ID, access key, and alt text.\n if object.respond_to?(\"scribd_id\")\n scribd_id = object.scribd_id\n scribd_ak = object.scribd_access_key\n alt_text = object.alt_text\n else\n scribd_id = object.send \"#{options[:object]}_scribd_id\"\n scribd_ak = object.send \"#{options[:object]}_scribd_access_key\"\n alt_text = object.alt_text options[:object]\n end\n \n # Collect a set of addParam statements to set up JS parameters for the scribd document\n # (only if they are valid).\n if options[:params]\n params = options[:params].collect do |param, value|\n \"scribd_doc.addParam('#{param}', '#{value}');\" if AVAILABLE_JS_PARAMS.include?(param)\n end.compact.join(\"\\n\")\n end\n \n <<-END\n <div id=\\\"embedded_flash\\\">#{alt_text}</div>\n <script type=\\\"text/javascript\\\">\n var scribd_doc = scribd.Document.getDoc(#{scribd_id}, '#{scribd_ak}');\n #{params}\n scribd_doc.write(\\\"embedded_flash\\\");\n </script>\n END\n end", "def show\n @music = Music.find(params[:id])\n @tag_data_hash=tag_info(\"public#{@music.audio.to_s}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end", "def show\n @user_video = UserVideo.find(params[:id]) \n @vid_id = @user_video.video_embed.split('?v=')[1]\n @u = \"http://www.youtube.com/embed/\" + @vid_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_video }\n end\n end", "def embedded(options={})\n autoplay = options[:autoplay].nil? ? true : options[:autoplay]\n autoplay = !!autoplay ? '1' : '0'\n embeded_template = case self.service\n when :youtube then YOUTUBE_EMBEDDED_TEMPLATE\n when :vimeo then VIMEO_EMBEDDED_TEMPLATE\n end\n return embeded_template % [self.id, autoplay]\n end", "def html(user_id, configuration = {})\n m_configuration = Faces::Common.merge_configurations([Faces::Configuration::FLICKR, configuration])\n Faces::Public.generate_html(url(user_id, configuration), m_configuration)\n end", "def soundcloud_resource(resource_id)\n return <<-EOL\n <div class=\"soundcloud-container column is-mobile center\">\n <iframe width=\"100%\" height=\"300\" scrolling=\"no\" \n frameborder=\"no\" allow=\"autoplay\" \n src=\"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/#{resource_id}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true\"> \n </iframe>\n </div>\n EOL\n end", "def show\n @url = \"https://www.karmagrove.com/events/#{@event.id}/tickets/#{@ticket_purchase.ticket.id}/ticket_purchases/#{@ticket_purchase.id}\"\n @qr = RQRCode::QRCode.new( @url, :size => 7, :level => :h )\n end" ]
[ "0.5884109", "0.58626586", "0.58090925", "0.572748", "0.5635104", "0.5616314", "0.5520968", "0.55078644", "0.5434764", "0.54001236", "0.53902465", "0.5390185", "0.5378951", "0.53740484", "0.5338497", "0.533755", "0.53353953", "0.5296625", "0.52937067", "0.5293194", "0.5275872", "0.526293", "0.52572596", "0.52447677", "0.5222947", "0.5216903", "0.51805484", "0.51722044", "0.51678604", "0.51573247", "0.5153995", "0.5147919", "0.51474744", "0.5144925", "0.51268935", "0.5120828", "0.5097016", "0.50868225", "0.5073255", "0.5064823", "0.5047257", "0.50464606", "0.5042961", "0.50371593", "0.5029427", "0.50135654", "0.501065", "0.5010566", "0.5005976", "0.5005421", "0.49827927", "0.49806154", "0.49775422", "0.49763024", "0.49736175", "0.4969267", "0.496704", "0.49665123", "0.4958215", "0.4958215", "0.4958215", "0.494442", "0.4942771", "0.49413943", "0.4939853", "0.49380314", "0.4919646", "0.49163997", "0.49051818", "0.49035183", "0.49008632", "0.48974678", "0.48831084", "0.48824152", "0.48765385", "0.48749548", "0.4867752", "0.48477596", "0.4846463", "0.48393908", "0.4836868", "0.483657", "0.48354217", "0.4834473", "0.4831199", "0.48158604", "0.48158604", "0.48148978", "0.48148856", "0.48094875", "0.4809276", "0.480612", "0.48058364", "0.47984147", "0.47956264", "0.47949606", "0.47913796", "0.47908717", "0.47882873", "0.47873056" ]
0.6111621
0
WARNINGGGGGGGGGG Fira sans regular and book should be installed on server pc
def export_highchart(id, chart, data, is_donation, file_type = "png", return_url = true) ok = true image_stream = nil file_type = "png" if ["png","jpeg","svg","pdf"].index(file_type).nil? is_pdf = file_type == "pdf" is_base64 = file_type != "svg" image_name = "#{id}#{chart}.#{file_type}" image_rel_dir = "/system/share_images/#{is_donation ? 'donation' : 'finance'}/#{I18n.locale}" image_abs_dir = "#{Rails.root}/public#{image_rel_dir}" image_rel_path = "#{image_rel_dir}/#{image_name}" image_abs_path = "#{image_abs_dir}/#{image_name}" uri = URI.parse("http://127.0.0.1:3003/") headers = { 'Content-Type' => 'application/json' } jsn = highchart_options_by_type(is_donation ? :bar : :column, file_type) k = ("c#{chart}").to_sym jsn["infile"].gsub!("_title_", data[k][:title]) if is_donation jsn["infile"].gsub!("_bg_", chart == "a" ? "#EBE187" : "#B8E8AD") jsn["infile"].gsub!("_subtitle_", data[k][:subtitle]) jsn["infile"].gsub!("_series_", data[k][:series].to_s) jsn["infile"].gsub!("_width_", "1200") jsn["infile"].gsub!("_height_", "628") else cats = data[k][:categories] jsn["infile"].gsub!("_categories_", cats.to_json.to_s) jsn["infile"].gsub!("_series_", data[k][:series].to_json.to_s) rotated = cats[0].class == Hash && cats[0].dig(:categories).present? && cats[0].dig(:categories).length > 1 cat_max_len = 0 if rotated cats[0].dig(:categories).each { |cat| cat_max_len = cat.length if cat_max_len < cat.length } end jsn["infile"].gsub!("_grouped_options_", !rotated ? "[]" : "[{ \"rotation\": 0 }, { \"rotation\": -90 }]") jsn["infile"].gsub!("_rotation_", (!rotated ? "0" : "-90")) jsn["infile"].gsub!("_width_", rotated && cats[0].dig(:categories).length > 6 ? "2400" : "1200") jsn["infile"].gsub!("_height_", (628 + cat_max_len*9).to_s) end tmp_path = "#{Rails.root}/tmp/assets/#{image_name}" jsn["outfile"] = tmp_path if is_pdf # Rails.logger.fatal("fatal----------------------#{jsn}") # jsn["width"] = 1200 if return_url # FileUtils.mkdir_p(image_abs_dir) unless File.directory?(image_abs_dir) http = Net::HTTP.new(uri.host, uri.port) http.request_post(uri.path, jsn.to_json, headers) {|response| if is_pdf if File.file?(tmp_path) image_stream = IO.read(tmp_path) File.unlink(tmp_path) end else image_stream = is_base64 ? Base64.urlsafe_decode64(response.body) : response.body end } rescue => e # Rails.logger.fatal("fatal----------------------#{e}") ok = false image_stream = nil ensure return { ok: ok, data: image_stream } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_book_availability_in_library\n\t\tputs \"To check availability of book,\"\n\t\tprint \" Enter Book Id :\"\n\t\ttarget_book_id=gets.to_i\n\t\tif is_book_exist_in_library?(target_book_id)\tthen\n\t\t\tif is_book_available_in_library?(target_book_id) then\n\t\t\t\tputs \"\\tBook is available\"\n\t\t\telse\n\t\t\t\tputs \"\\tThat book is not available\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"\\tNo such book with Book ID #{target_book_id} rergistered in library\"\t\t\n\t\tend\n\tend", "def gem_warning(server)\n if(!server.command_available?)\n puts \"WARNING: The #{server.server} gem does not appear to be installed\"\n end\n end", "def pre_install; end", "def server_software; end", "def install_message; end", "def prepare_for_installation; end", "def stru(msg); \"202 Only accepts file\"; end", "def install\n yaourt('--noconfirm', '-Sy', @resource[:name])\n end", "def book\n 'Book' if record.leader[6] == 'a' && record.leader[7] == 'm' && local_formats.include?('Archives/Manuscripts')\n end", "def install_sol11_pkg(options,pkg_name)\n pkg_test = %x[which #{pkg_name}]\n if pkg_test.match(/no #{pkg_name}/)\n message = \"Information:\\tChecking Package \"+pkg_name+\" is installed\"\n command = \"pkg info #{pkg_name} 2>&1| grep \\\"Name:\\\" |awk \\\"{print \\\\\\$3}\\\"\"\n output = execute_command(options,message,command)\n if not output.match(/#{pkg_name}/)\n message = \"Information:\\tChecking publisher is online\"\n command = \"pkg publisher | grep online\"\n output = execute_command(options,message,command)\n if output.match(/online/)\n message = \"Information:\\tInstalling Package \"+pkg_name\n command = \"pkg install #{pkg_name}\"\n execute_command(options,message,command)\n end\n end\n end\n return\nend", "def install\n safe_system \"pax --insecure -rz -f Payload.gz -s ',./bin,#{bin},' -s ',./man,#{man},' -s ',./lib,#{lib},' -s ',./license_gpl_pdftk,#{prefix}/LICENSE,' -s ',./,#{prefix}/README/,'\"\n end", "def install\n \n end", "def post_install; end", "def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end", "def verifyInstalledContent(iLocation)\n return File.exists?(\"#{iLocation}/DummyBinary\")\n end", "def usage\n abort \"mint epub publish file\"\nend", "def package_if_necessary(pkg)\n if !package_is_installed?(pkg)\n banner \"#{pkg}...\"\n run \"apt-get -y install #{pkg}\"\n end\n end", "def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Validate info.plist\n validateInfoPlist(path+\"info.plist\")\n \n #4 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #5 Copy balloons folder\n copyZipContents(\"balloons_images.zip\", @book_prod_folder+\"images/\")\n copyZipContents(\"balloons_script.zip\", @book_prod_folder+\"script/\") \n if !File::directory?(@book_prod_folder+\"icons/\")\n if File::directory?(path+\"/icons/\")\n Dir.mkdir(@book_prod_folder+\"icons/\")\n end\n end\n copyFolderContents(path+\"icons/\",@book_prod_folder+\"icons/\");\n \n #6 Verify Folders\n verifyFolders(@book_prod_folder)\n \n #7 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #8 Create Zip\n createZip(@book_prod_folder,@book_zip_generated_folder+@book_full_name+\".zip\",1)\n \n puts \"New Book Generated -\"+@book_full_name\nend", "def pack\n #Throw the postflight script into the Scripts directory\n safe_system(\"sudo #{INSTALL} -m 0755 postflight #{@working_tree['SCRIPT_D']}\")\n safe_system(\"sudo #{INSTALL} -m 0755 Welcome.txt #{@working_tree['RESOURCE_D']}\")\nend", "def issue_library_book_to_member\n\t\tmember_id,member_name=get_registered_member_id_and_name\n\t\tbook_id,book_name=get_available_book_id_and_name\n\t\tregister_book_to_member(book_id,member_id)\n\t\tputs \"\\tDone!! A book '#{book_name}' has been issued to #{member_name} \"\n\tend", "def tailor_package_to_platform\n @package.app('Dropbox')\n @package.volumes_dir('Dropbox Installer')\n @package.source(URI.encode(\"file://#{download_dest}\"))\n end", "def cfs_kit_launch_tutorial_screen\n\n tutorial_scr_file = \"#{Osk::SCR_DIR}/#{Osk::TUTORIAL_SCR_FILE}\"\n\n scr_tutorial_dir = File.open(tutorial_scr_file) {|f| f.readline}\n\n if scr_tutorial_dir.index(Osk::SCR_DIR).nil? \n cfs_kit_create_tutorial_screen\n end\n \n display(\"CFS_KIT #{File.basename(Osk::TUTORIAL_SCR_FILE,'.txt')}\",500,50)\n \nend", "def cfs_kit_launch_tutorial_screen\r\n\r\n tutorial_scr_file = \"#{Osk::SCR_DIR}/#{Osk::TUTORIAL_SCR_FILE}\"\r\n\r\n scr_tutorial_dir = File.open(tutorial_scr_file) {|f| f.readline}\r\n\r\n if scr_tutorial_dir.index(Osk::SCR_DIR).nil? \r\n cfs_kit_create_tutorial_screen\r\n end\r\n \r\n display(\"CFS_KIT #{File.basename(Osk::TUTORIAL_SCR_FILE,'.txt')}\",500,50)\r\n \r\nend", "def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #4 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #5 Create Zip\n createZip(@book_prod_folder,@book_prod_final_zip_folder+@book_full_name+\".zip\")\nend", "def supports_auto_book_delivery?\n false\n end", "def install\n end", "def install\n end", "def checkInstall\n\t\t#create our dir if we need\n\t\tDir.mkdir(ENV['ProgramFiles'] + '/Paseya/') if !Dir.exist?(ENV['ProgramFiles'] + '/Paseya/')\n\t\tif Dir.exist?(ENV['ProgramFiles'] + '/Paseya')\n\t\t\tourPath = File.realdirpath(ENV['OCRA_EXECUTABLE']).gsub(File.basename(ENV['OCRA_EXECUTABLE']),'').to_s\n\t\t\[email protected](ourPath)\n\t\t\tdesiredPath = File.realdirpath(ENV['ProgramFiles'] + '/Paseya/').to_s \n\t\t\t\n\t\t\[email protected](desiredPath)\n\t\t\tif (desiredPath + \"/\" +@clientName).downcase != ENV['OCRA_EXECUTABLE'].downcase.gsub('\\\\','/')\n\t\t\t\[email protected]('Our client install is in ' + ENV['OCRA_EXECUTABLE'].downcase.gsub('\\\\','/'))\n\t\t\t\[email protected]('We want to be in ' + (desiredPath + \"/\" +@clientName).downcase)\n\t\t\t\tbegin\n\t\t\t\t\tPaseyaClient.installService if !Service.exists?('Paseya-client')\n\t\t\t\t\tService.stop('Paseya-client') if Service.status('Paseya-client').current_state.to_s == \"running\"\n\t\t\t\t\[email protected](Service.status('Paseya-client').current_state.to_s )\n\t\t\t\t\t#delete the old client if it exists\n\t\t\t\t\tFile.delete(desiredPath + @clientName) if File.exist?(desiredPath + @clientName)\n\t\t\t\t\tFileUtils.cp(ENV['OCRA_EXECUTABLE'],desiredPath + \"/\" +@clientName)\n\t\t\t\trescue Exception => e\n\t\t\t\t\[email protected]('Failure trying to place client executable in the proper directory')\n\t\t\t\t\[email protected](e.message)\n\t\t\t\tend\n\t\t\t\tbegin\n\t\t\t\t\t#start up the proper copy\n\t\t\t\t\tService.start('Paseya-client')\t\n\t\t\t\trescue Exception => e\n\t\t\t\t\[email protected]('Failure trying to execute service')\n\t\t\t\t\[email protected](e.message)\n\t\t\t\tend\n\t\t\t\texit\n\t\t\tend\n\t\tend\t\t\n\tend", "def firmware_upgrade_manual(rule_name,info,strLot)\n \n # Under the page \"Firmware Upgrade\"?\n if not @ff.text.include? 'Firmware Upgrade'\n \n # Go to \"Firmware Upgrade\" page.\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Firmware Upgrade\" page.\n begin\n @ff.link(:text, 'Firmware Upgrade').click\n self.msg(rule_name, :info, 'firmware_upgrade_manual', 'Reached page \\'Firmware Upgrade\\'.')\n rescue\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not reach \\'Firmware Upgrade\\' page')\n return\n end\n \n end\n \n # Click the \"upgrade now\" link\n begin\n @ff.link(:text, 'Upgrade Now').click\n rescue\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not reach upgrade now page')\n return\n end\n self.msg(rule_name,:info,'Click Upgrade Now','Done')\n \n # set the firmware filename\n begin\n @ff.file_field(:name, \"image\").set(strLot)\n rescue\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not set firmware file name')\n return\n end\n \n # Click ok\n begin\n @ff.link(:text, 'OK').click\n rescue\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not click firmware OK')\n return\n end\n \n # look for the successful upload text\n if not @ff.text.include? 'Do you want to reboot?'\n #Tom add 2009.5.21 to show the output error\n if @ff.text.include? 'Input Errors' then\n\tsTable = false\n\[email protected] do |t|\n\t if ( t.text.include? 'Upgrade File' and \n\t\t( not t.text.include? 'Input Errors') and\n\t\t#( not t.text.include? 'Check Now') and\n\t\tt.row_count >= 1 ) then\n\t\t sTable = t\n\t\t break\n\t end\n\tend\n\tif sTable == false then\n\t# Wrong here\n\t self.msg(rule_name,:error,'Upgrade Chenck Now','Did NOT find the target table.')\n\telse\n\t sTable.each do |row|\n\t\tif row.text.include? 'Upgrade File' then\n\t\t error_type = row[1].to_s().delete(\":\");\n\t\t error_info = row[2].to_s().delete(\".\");\n\t\t self.msg(rule_name,:error,error_type,error_info);\n\t\tend\n\t end\n\tend\n else\n\tself.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not reach the reboot page')\n end\n return\n \n end\n\n # Click \"Apply\"\n begin\n @ff.link(:text, 'Apply').click\n rescue\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not click firmware Apply')\n return\n end\n \n # Check for the wait message\n if not @ff.text.include? 'system is now being upgraded'\n self.msg(rule_name, :error, 'firmware_upgrade_manual', 'Did not see upgrading marker text')\n return\n end\n\n # give it some time to upgrade\n sleep 60\n @ff.refresh\n @ff.wait\n\n while not (@ff.text.include? 'is up again' or @ff.text.include? 'Login Setup' or @ff.text.include? 'User Name:')\n\tsleep 5\n\[email protected]\n\[email protected]\n end\n self.msg(rule_name, :info, 'firmware_upgrade_manual', 'Firmware upgrade success') \n \n end", "def installed?\n false\n end", "def CheckAvailable(gedit)\n\tif gedit.versionNumber()<1.29\n\t\tputs \"This script requires GEDitCOM II, Version 1.3 or newer.\"\n\t\treturn 0\n\telsif gedit.documents().count()<1\n\t\tprint \"You have to open a document in GEDitCOM II to use this script\"\n\t\treturn 0\n\tend\n\treturn 1\nend", "def install_hack(installer)\n server_installer_name = File.basename(installer)\n return \";\" if server_installer_name.nil?\n<<SCRIPT\ncp /home/vagrant/.gitconfig /root/.gitconfig\nif [ -d \"/opt/opscode/embedded\" ]\nthen\n echo \"Bypassing server install, it appears done.\"\nelse\n echo \"PATH=/opt/opscode/embedded/bin:$PATH\" > /root/.bashrc\n sudo dpkg -i \"/installers/#{server_installer_name}\"\nfi\nSCRIPT\nend", "def enshelf \n a_to_g = ('a'..'g').to_a\n \th_to_p = ('h'..'p').to_a\n\t\tif (a_to_g.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[0].add_book (self)\n\t\telsif (h_to_p.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[1].add_book (self)\n\t\telse \n\t\t @library.get_shelves[2].add_book (self)\n\t\tend\n \n\tend", "def upgrade_app_explain; \"Check for updates to Hobix.\"; end", "def install\n end", "def before_processing_hook(msg, connection)\n validate :package, :shellsafe\n end", "def no_remote_instructions(unlicensed)\n puts <<-INST\nThere is no license defined for #{counter(unlicensed)}. You are running with the `--disable-api`\noption. If you remove this option, gemterms will attempt to use RubyGems and \nother sources for license information.\nINST\n true\n end", "def bookmarklet_installation_instructions\n if chrome? # this comes first, because safari? will return true when the browser is really chrome\n # drag to bookmarks bar\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.chrome\")\n elsif safari?\n # drag to bookmarks bar\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.safari\")\n elsif firefox?\n # drag to bookmarks toolbar, right click + Bookmark This Link + Folder - Bookmarks Toolbar\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.firefox\")\n elsif opera?\n # drag to personal bar, right click + \"Bookmark Link...\" + Details - check Show on Personal Bar\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.opera\")\n elsif ie6?\n # right click + \"Add to Favorites...\" + Yes to Security Alert + Create in - Links\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.ie6\")\n elsif ie7?\n # right click + \"Add to Favorites...\" + Yes to Security Alert + Create in - Favorites Bar\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.ie7\")\n elsif ie8?\n # right click + \"Add to Favorites...\" + Yes to Security Alert + Create in - Links\n t(\"winnow.feeds.header.bookmarklet_installation_instructions.ie8\")\n end\n end", "def present?\n\tFile.exist?(\"Berksfile\") and `berks`\n end", "def book_choir\r\n\t@title = \"Book the Choir\"\r\n end", "def needs_sudo!\n spinner.update title: Pastel.new.yellow(\"#{good} (please add the --sudo flag)\")\n spinner.stop\n end", "def is_book?()\n end", "def security_prevent_install_apps_from_unknown_sources\n return @security_prevent_install_apps_from_unknown_sources\n end", "def eula\n @file = Rails.configuration.crowbar.eula_base || '../doc/licenses/README.md'\n if File.exist? @file\n @raw = IO.read(@file)\n fix_encoding! unless @raw.valid_encoding?\n @raw.encode!('UTF-8', :invalid=>:replace)\n @text = Maruku.new(@raw).to_html\n else\n @text = \"#{I18n.t('.topic_missing', :scope=>'docs.topic')}: #{@file}\"\n end\n render :show\n end", "def should_do_pig_install?(pig_version)\n not (File.exists?(pig_directory(pig_version)))\n end", "def ri_installed?\n File.exist?(File.join(@doc_dir, \"ri\"))\n end", "def do_usage()\n puts \"Usage: gamera_dir [flags] server directory\"\n puts \"Import gamera OCR for book into specified TypeWright server from given directory.\"\n puts \"If book does not already exist, issue error.\"\n puts \" -v Verbose output\"\n puts \" -t Test only -- don't actually upload files\"\nend", "def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend", "def check_tool_belgio(file_tool_belpex)\n s = Roo::Excel.new(file_tool_belpex.to_s)\n\n if s.sheet(\"Buy summary\").cell(\"G\",2) != \"OK\"\n @errore << \"Nel file #{file_tool_belpex.to_s} nel foglio \\\"Buy summary\\\" il check verbale non è OK\"\n end\n if s.sheet(\"Sell summary\").cell(\"G\",2) != \"OK\"\n @errore << \"Nel file #{file_tool_belpex.to_s} nel foglio \\\"Sell summary\\\" il check verbale non è OK\"\n end\n if s.sheet(\"Buy summary\").cell(\"B\",1) != $data\n @errore << \"Data presente nel file #{file_tool_belpex.to_s} non corrisponde con la data selezionata\"\n end\n end", "def backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def book\n fetch('harry_potter.books')\n end", "def install(f_paquete)\n status = `whereis #{f_paquete[0]} |grep bin |wc -l`.to_i\n action = \"#{f_paquete[1]}\".to_s\n\nif action == \"install\"\n if status == 0\n `apt-get install -y #{f_paquete[0]}`\n puts \"#{f_paquete[0]} -> Este paquete se instaló hace nada\"\n elsif status == 1\n puts \"#{f_paquete[0]} -> Este paquete ya estaba instalado\"\n end\n\n elsif action == \"remove\"\n if status == 1\n `apt-get remove -y #{f_paquete[0]}`\n puts \"#{f_paquete[0]} -> Este paquete se ha desinstalado\"\n elsif status == 0\n puts \"#{f_paquete[0]} -> Este paquete no está instalado\"\n end\n end\nend", "def updateBook(path)\n puts \"Book update operation\"\n \n #1 Create diff & update folders\n createFolders(path)\n \n #2 Run Book Difference operation\n runDiffOperation(path+\"output/ihtml/\", @outputRenamed+\"/ihtml/\", @book_diff_folder)\n \n #3 Copy searchDB.sql to diff path\n copyFile( path+\"output/searchDB.sql\", @book_diff_folder)\n \n #4 Run Encryptor\n runEncryptor(@book_diff_folder,@book_update_folder)\n \n #5 Update timestamp for bundle\n if @bundle_type==@BUNDLE_BY_SIZE\n bundleTimestampBundleSize(@book_update_folder,@update_timestamp,@max_file_size.to_i()) \n elsif @bundle_type==@BUNDLE_BY_FILE_COUNT \n bundleTimestampFileCount(@book_update_folder,@update_timestamp,@max_file_count.to_i())\n \n elsif @bundle_type==@BUNDLE_BY_NONE \n changeTimestamp(@book_update_folder,@update_timestamp)\n end\n \n #6 Copy to original book\n copyFolderContents(@book_update_folder,@book_prod_folder)\n\n #7. create zip for update & existing book\n update_ts=@update_timestamp.to_s()\n update_ts = update_ts.gsub(\":\",\"-\");\n update_ts = update_ts.gsub(\" \",\"_\");\n createZip(@book_update_folder,@book_prod_final_update_folder+@book_full_name+\"_update_\"+update_ts+\".zip\")\n createZip(@book_prod_folder,@book_prod_final_zip_folder+@book_full_name+\".zip\")\nend", "def pkg_binary; \"pacaur\" end", "def get_library_book_return\n\t\tputs \"To return a book,\"\n\t\tprint \" Enter Book Id :\"\n\t\ttarget_book_id=gets.to_i\n\t\tif is_book_exist_in_library?(target_book_id)\tthen\n\t\t\tif is_book_available_in_library?(target_book_id) then\n\t\t\t\tputs \"\\tBook is not issued to any one.It is already available in library\"\n\t\t\telse\n\t\t\t\tmark_return(target_book_id)\n\t\t\t\tputs \"\\tBook successfully marked as Return\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"\\tNo such book with #{target_book_id} rergistered in library\"\t\t\n\t\tend\n\tend", "def post_install\n end", "def check_for_macgpg2\n return if File.exist? \"/usr/local/MacGPG2/share/gnupg/VERSION\"\n\n suspects = %w[\n /Applications/start-gpg-agent.app\n /Library/Receipts/libiconv1.pkg\n /usr/local/MacGPG2\n ]\n\n if suspects.any? { |f| File.exist? f }\n t(\"cmd.doctor.macgpg2\")\n end\n end", "def install_custom!\n do_dmg_package_resource!\n end", "def osx_installer(package)\n\t\t\t\tsystem(\"brew install #{package}\")\n\t\t\tend", "def verify_not_in_chefdk\n raise UnsupportedInstallation.new if script_path =~ /chefdk/\n end", "def fonts\n package 'ttf-freefarsi', :ensure => :installed\n package 'ttf-farsiweb', :ensure => :installed\n end", "def version_installed()\n droplet=droplet_file_path()\n return unless droplet\n version_available_file = version_available_file_path()\n unless version_available_file\n puts \"Don't know what file stores the version installed of #{@current_name}\" if VMC::Cli::Config.trace\n return\n end\n cmd = cmd_read_version_installed()\n unless cmd\n puts \"Don't know how to read the version installed with a cmd.\" if VMC::Cli::Config.trace\n return\n end\n puts \"Looking for the installed version here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n puts \" with cmd #{cmd}\" if VMC::Cli::Config.trace\n droplet_dot_version=\"#{droplet}.version\"\n unless File.exists? droplet_dot_version\n Dir.chdir(\"/tmp\") do\n `[ -f #{version_available_file} ] && rm #{version_available_file}`\n `tar -xzf #{droplet} #{version_available_file}`\n if File.exist?(version_available_file)\n `cp #{version_available_file} #{droplet_dot_version}`\n else\n put \"Could not find the installed version file here: here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n end\n end\n end\n installed_version=read_version(droplet_dot_version,cmd)\n end", "def getPr2\n if !File.exists?(\"pr2_genus.txt\")\n `wget http://application.sb-roscoff.fr/redgenes//static/pr2_gb191_taxonomy.xls`\n # Problem -- need manual parsing of microsoft silliness as useful text file not provided\n STDERR << \"Please save genus tab as text to pr2_genus.txt\\n\"\n exit(1)\n end\nend", "def accediLibreria\n oggetto=PdfStuff::Receipt.new()\n oggetto.hello\n end", "def install\n end", "def cfs_kit_launch_app(screen, app)\n\n\n if (app == \"UPDATE_TUTORIAL\")\n # An exception will report any errors \n if cfs_kit_create_tutorial_screen\n prompt (\"Successfuly created tutorial screen file #{tutorial_scr_file}\\nusing #{tutorial_def_file}\")\n end\n elsif (app == \"PROTO_APPP\")\n #TODO - Investigate generic text table editor or tutorial screen\n\t Cosmos.run_process(\"ruby lib/OskCfeFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/cfs_kit/file_server/cfe_es_syslog.dat'\")\n\t #Cosmos.run_process(\"ruby lib/OskTxtFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/test.json'\")\n #require 'osk_tbl_editor'\n #Cosmos.run_process(\"ruby lib/OskTblEditor\")\n\t #require 'cfs_fcx_cmdgen'\n #Cosmos.run_process(\"ruby lib/CfsFcxCmdGen\")\n #Cosmos.run_process(\"ruby tools/ConfigEditor\")\n #Cosmos::OskTblEditor.run\n #Cosmos.run_cosmos_tool('ConfigEditor')\n\n elsif (app == \"TUTORIAL\")\n cfs_kit_launch_tutorial_screen\n end\n\nend", "def installable?\n uninstallable_reasons.empty?\n end", "def install\n system \"cp\", \"pdfmeat.py\", \"#{HOMEBREW_PREFIX}/bin\"\n end", "def lybunt_setup\n end", "def isBookAvailable?(book_name)\n book_record = @books.find do |book|\n book.title == book_name\n end\n if book_record == nil then return false end\n if book_record.copies_available != 0 then return true end\n false\n end", "def updateBook(path)\n puts \"Book update operation\"\n \n #1 Create diff & update folders\n createFolders(path)\n \n #2 Run Book Difference operation\n runDiffOperation(path+\"output/ihtml/\", @outputRenamed+\"/ihtml/\", @book_diff_folder)\n \n #3 Copy searchDB.sql to diff path\n copyFile( path+\"output/searchDB.sql\", @book_diff_folder)\n \n #4 Run Encryptor\n runEncryptor(@book_diff_folder,@book_update_folder)\n \n #5 Check for update size and delete updates if it exceeds max_update_limit\n update_limit_check()\n \n #6 Copy to original book\n copyFolderContents(@book_update_folder,@book_prod_folder)\n \n #7 Update timestamp for bundle\n if @bundle_type==@BUNDLE_BY_SIZE\n bundleTimestampBundleSize(@book_update_folder,@update_timestamp,@max_file_size.to_i()) \n elsif @bundle_type==@BUNDLE_BY_FILE_COUNT \n bundleTimestampFileCount(@book_update_folder,@update_timestamp,@max_file_count.to_i())\n elsif @bundle_type==@BUNDLE_BY_NONE \n bundleTimestampNone(@book_update_folder,@update_timestamp)\n end\n if File.directory?(@book_update_folder)\n File.utime(@update_timestamp, @update_timestamp, @book_update_folder)\n File.utime(@latest_ts, @latest_ts, @book_prod_folder+\"/info.plist\")\n end\n \n #8 Verify Folders\n verifyFolders(@book_prod_folder)\n \n #9 create zip for update & existing book\n createZip(@updateFolder,@book_zip_generated_folder+@book_full_name+\"_update\"+\".zip\",0)\n createZip(@book_prod_folder,@book_zip_generated_folder+@book_full_name+\".zip\",1)\n \n puts @book_full_name+\" - Update generated :\"+ @update_timestamp.to_s()\nend", "def run\n header\n what_is_installed?\n install_pianobar\n setup_config_file\n make_fifos\n setup_auto_play_station\n end", "def check_license()\n return true\n end", "def get_available_book_id_and_name\n\t\twhile true do\n\t\t\tprint \"\\n Enter a Book ID :\"\n\t\t\tbook_id=gets.to_i\n\t\t\tif is_book_exist_in_library?(book_id) then\n\t\t\t\tif is_book_available_in_library?(book_id) then\n\t\t\t\t\treturn book_id,get_library_book_name_by_id(book_id)\n\t\t\t\telse\n\t\t\t\t\tputs \"\\tSorry !! Book is already issued , not available to you. Try another book!!\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"\\tNo such book with book ID #{book_id} is Registered with library, Correct it please!!!\"\n\t\t\tend\n\t\tend\n\tend", "def add_webpub_manifest!\n system \"cd #{share_path}; #{Rails.root.join('script/create_manifest')} #{edition.store_link}\"\n end", "def install\n # nothing to do\n end", "def gem_error(server)\n if(!server.command_available?)\n puts \"ERROR: The #{server.server} gem does not appear to be installed\"\n exit(1)\n end\n end", "def check_install(item)\n check_package(item)\n if @catagory == 'Theme'\n item_location = '/Themes'\n elsif @catagory == 'Bundle'\n item_location = '/Bundles'\n end\n FileUtils.cd(TXMP_SUPPORT_PATH + item_location)\n result = File.exists?(@filename)\n if result == true\n puts \"The monkeys found that this package is currently installed\"\n exit\n end\nend", "def ebook?(filepath)\n ['.epub', '.mobi'].include? File.extname(filepath).downcase\n end", "def check_online?\n url = @record.fulltext_link[:url]\n # SFX URLs observed in the wild: owens.mit.edu/sfx_local,\n # sfx.mit.edu/sfx_local, library.mit.edu/?func=service-sfx\n url.present? && (\n @record.fulltext_link[:label] == 'Check SFX for availability'\n )\n end", "def check_offerte(offerte)\n sheet = apri_file(offerte)\n if (sheet.cell(\"k\",5) != \"#{$day}/#{$month}/#{$year}\") || (sheet.cell(\"k\",7) != \"#{$day}/#{$month}/#{$year}\")\n @errore << \"Data presente nel file #{offerte.basename} non corrisponde con la data selezionata\"\n end\n mercato = ((offerte.basename.to_s).split(\"_\").last).sub(\".xls\",\"\")\n\n if mercato.match(\"MI\")\n unless (sheet.cell(\"G\",9)) == mercato\n @errore << \"Nel file #{offerte.basename} non ci sono le offerte #{mercato}\"\n end\n else\n unless (sheet.cell(\"G\",9)) == \"MGP\" \n @errore << \"Nel file #{offerte.basename} non ci sono le offerte MGP\"\n end\n\n end\n end", "def want_to_install?\n say \"Want to install #{name} feature?\"\n detail\n # TODO make ENTER behave as \"yes\"\n yes? \"[y/n]\"\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend", "def unoconv_pname\n 'LibreOffi'\n end", "def setup(g,file,rs_name = nil)\r\n systemos #Determine whether the OS is Chinese or English\r\n base_xl = (file).gsub('/','\\\\').chomp('rb')<<'xls'\r\n if(ARGV.length != 0) # called from controller\r\n excel = xls_timestamp(g,base_xl,nil,ARGV[2]) # called ,connect to existing excel instance. # ARGV[2] is the result sub-folder name.\r\n g.attach_ie(excel[1][2]) # test site ip\r\n else\r\n excel = xls_timestamp(g,base_xl,'ind',rs_name) # independent, start new excel instance\r\n g.open_ie(excel[1][2])\r\n support(g,excel[0])\r\n g.ver_info(excel[0])\r\n end\r\n return excel\r\nend", "def bundled?(filename); end", "def missing name\n warn \"** #{name} is missing or in the wrong format for auto-intuiting.\"\n warn \" run `sow blah` and look at its text files\"\n end", "def check_utils\n\tif not File.exists?(\"/usr/bin/avahi-browse\")\n\t\tprint_error(\"Avahi Utils are not installed: run `apt-get install avahi-utils` to install them.\")\n\t\texit\n\tend\nend", "def install\n nil\n end", "def pkg_installed?(pkg)\n cmd_if %{dpkg-query --showformat='${Essential}\\n' --show '#{pkg}' > /dev/null 2>&1}\nend", "def check_bingo\n\t\t\n\tend", "def pdf_error\n message = 'Le fichier pdf n\\'a pas pu être créé !'\n message_box = Qt::MessageBox.new(Qt::MessageBox::Warning, 'Jacinthe', message)\n message_box.setWindowIcon(Icons.from_file('Board-11-Flowers-icon.png'))\n message_box.exec\n 'Fichier pdf non créé'\n end", "def caveats; <<-EOS.undent\n After installation please follow the instruction here to make it work on Mavericks\n http://synergy-foss.org/blog/mac-os-x-10-9-mavericks-support/\n EOS\n end", "def proprietary?\n include?(\"AOL\") || include?(\"NETSCAPE\") || include?(\"NOVONYX\") || include?(\"SUN\") || include?(\"MMP\")\n end", "def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n super\n end", "def show\n\n # #3shan al ageb al 2sm al 2abl al dot\n # #a5d al path w al type 3shan lo pdf or ay 7aga\n # [email protected]('.')\n # send_file Rails.root.join('public','uploads',@lecture.attatchment),\n # :type=>\"application/#{extension[1]}\",:x_sendfile=>true\n\n\n end", "def convert_to_mobi\r\n print \"Converting to Kindle format... \"\r\n kindlegen = 'kindlegen'\r\n if (RUBY_PLATFORM.downcase.include?(\"mswin\"))\r\n kindlegen = kindlegen+\".exe\"\r\n end\r\n kindlegen = File.join(@dirs[:bin], kindlegen)\r\n # skip mobi creation if kindlegen can not be found\r\n if File.exists?(kindlegen)\r\n output = `#{kindlegen} #{@epub} -c2`\r\n if File.exists?(@mobi)\r\n puts \"done\"\r\n else\r\n puts \"failed\"\r\n puts output\r\n end\r\n\r\n else\r\n puts \"skipped\"\r\n puts \"The program kindlegen was not found. Please obtain the kindlegen executable from Amazon.\"\r\n end\r\n end", "def display_lib\n\t\ti=0\n\t\twhile i < @shelves.length\n\t\t\tif @shelves[i].num_book != nil\n\t\t\t\t@shelves[i].display_shelf\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend", "def tailor_package_to_platform\n @package.source(URI.encode(download_dest))\n @package.installer_type(:nsis)\n end", "def display_book\n\t\tputs \"Author: #@author, Title: #@title, Publisher: #@publisher, Year: #@year, Location: Shelf: #@shelf_num\"\n\tend", "def validate\n name && install_path && maintainer && homepage\n if package_name == replaces\n log.warn { BadReplacesLine.new.message }\n end\n end" ]
[ "0.5601701", "0.54670036", "0.5399369", "0.5388134", "0.5368289", "0.5339636", "0.53297746", "0.52554375", "0.52132463", "0.5205334", "0.5160486", "0.5134441", "0.5130876", "0.5116449", "0.511315", "0.507904", "0.5068172", "0.5058622", "0.5053462", "0.50359917", "0.5028619", "0.5027316", "0.5019366", "0.5016543", "0.5011262", "0.50091773", "0.50091773", "0.49953046", "0.49881896", "0.4981809", "0.49699166", "0.4968817", "0.4963354", "0.4962585", "0.49553445", "0.49193838", "0.49185842", "0.49148834", "0.49072146", "0.490594", "0.49037567", "0.4897655", "0.4888978", "0.48648727", "0.48642585", "0.48627973", "0.48618975", "0.48610306", "0.48522356", "0.485156", "0.4848057", "0.484786", "0.48469657", "0.48440316", "0.48437476", "0.4840259", "0.4835065", "0.48333046", "0.4831068", "0.48211455", "0.48204935", "0.48167455", "0.48165515", "0.48137403", "0.48008436", "0.47965863", "0.47926024", "0.47681955", "0.47622392", "0.47611126", "0.4759747", "0.4758941", "0.47574437", "0.47566015", "0.47525534", "0.4749995", "0.47485965", "0.4748222", "0.47473595", "0.473198", "0.4729856", "0.47222328", "0.4720516", "0.4716124", "0.47108397", "0.47080582", "0.47034898", "0.4694127", "0.46909073", "0.4686067", "0.46850955", "0.4685058", "0.46829534", "0.46742007", "0.4669487", "0.4668928", "0.466791", "0.46653432", "0.46544272", "0.46538058", "0.46482292" ]
0.0
-1
def name Person.find(donor_id) end Permissions
def create_permitted? acting_user.administrator? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def donor_username\n d = object.donor \n d.username\n end", "def name\n person_name\n end", "def donor\n user\n end", "def get_permission_name(permission)\n case permission\n when Footprint32::PRIVATE\n return \"Private\"\n when Footprint32::FRIENDS\n return \"Friends\"\n else\n return \"Public\"\n end\n end", "def organ_donors\n \nend", "def owners_name\n if self.owner.is_a?(Person) && self.owner.user\n self.owner.user.login\n elsif self.owner.respond_to?(:name)\n self.owner.name\n else\n \"disclosed\".t\n end\n end", "def contact_name \n User.find(Membership.find(self.owner_id).user_id).name\n end", "def name\n object.user.name\n end", "def name\n object.user.name\n end", "def donour_user\n Donour.find(donour_id)\n end", "def viable_organ_donors\n\nend", "def organ_donors\n Patient.where(is_organ_donor: true)\nend", "def person_type\n \"Member\"\n end", "def owner\n self.person\n end", "def show\n @donor = Donor.find(params[:id])\n end", "def show\n \t@person = Person.find(params[:id])\n \t@is_admin = false\n \tactive_person = Person.find(session[:user_id])\n \troles = active_person.roles.collect {|role| role.name}\n if roles == [\"DirectCareProvider\"] && session[:user_id] != params[:id]\n flash[:notice] = \"You can only access your own profile.\"\n @person = active_person\n elsif roles.member?(\"Supervisor\") || roles.member?(\"Administrator\")\n \t@is_admin = true\n end\n end", "def person\n Person.where(:person_id => @person_id).first\n end", "def person\n Person.find_by_id( owner, @client )\n end", "def permission(name)\n permissions.detect { |p| p.name == name }\n end", "def owner_name\n \"#{firstname} #{lastname}\"\n end", "def name\n if person\n person.name\n else\n \"\"\n end\n end", "def attribution\n case self.flickr_license\n when 0\n rights = '(c)'\n when nil\n rights = '(c)'\n when 7\n rights = '(o)'\n else\n rights = '(cc)'\n end\n \n if !self.flickr_realname.blank?\n name = self.flickr_realname\n elsif !self.flickr_username.blank?\n name = self.flickr_username\n elsif !self.observations.empty?\n name = self.observations.first.user.login\n else\n name = \"anonymous Flickr user\"\n end\n\n \"#{rights} #{name}\"\n end", "def name\n 'occupant'\n end", "def get_patient(id)\n current_resource_owner.viewable_patients.find_by(id: id)\n end", "def campus_patron_permissions\n anonymous_permissions\n end", "def campus_patron_permissions\n anonymous_permissions\n end", "def accessible_name; end", "def p_id(controller, action)\r\n Permission.find_by_controller_and_action(controller.to_s,action.to_s).id\r\nend", "def read_persons(pid)\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n doc = permissions_doc(pid)\n rp = edit_persons(pid) | ((doc == nil || doc.fetch(read_individual_field,nil) == nil) ? [] : doc.fetch(read_individual_field,nil))\n logger.debug(\"[CANCAN] read_persons: #{rp.inspect}\")\n return rp\n end", "def show?\n @current_user.permission('Donor', :guest)\n end", "def display_resource(ability)\n ability.name\n end", "def name\n \n end", "def name\n\t self.username\n end", "def name\n d= Doctor.find_by(email: email)\n if d \n d.d_name\n else\n email\n end\n end", "def name\n @owner\n end", "def get\n @person\n end", "def owner_fname\n \towner.profile.fname\n end", "def name\n\n end", "def who_assigned_this_todo\n assigner = User.find_by_id(self.added_by)\n return assigner.name\n end", "def format_permission\n self.name = self.name.squish.titleize.gsub('_', ' ')\n end", "def user_name\n object.user.name\n end", "def one_donor_setup\n @donors = Donor.all.sort { |a,b| a.full_name_id <=> b.full_name_id }\n end", "def find_patient_by_name(patient_name)\n \nend", "def guard_name(p)\n [p.first_name, p.last_name, p.relation].join(' ')\n end", "def the_doctor; end", "def name\n profile.user.name\n end", "def authorize?(person)\n person.is_admin?\n end", "def resourceType\n 'Person'\n end", "def person\n self\n end", "def name\n\t\tself.rsuser.display_name\n\tend", "def person(id)\n record \"/contacts/person/#{id}\"\n end", "def person(id)\n record \"/contacts/person/#{id}\"\n end", "def pundit_user\n current_person\n end", "def real_name\n name\nend", "def fullname\n name\n end", "def assigned_to_name\n if self.assigned_to_user_id\n assigned_to_user.full_name\n elsif self.assigned_to_matter_people_id\n assigned_to_matter_people.get_name\n end\n end", "def personal_name\n data[:personal_name]\n end", "def title\n object.user.full_name\n end", "def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end", "def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end", "def name\n \n end", "def username\n name\n end", "def best_friend_name\n # what is self? self is a pet instance ===> self.owner\n # what is self.owner? an user instance ===> so i can use User instance methods\n # self.owner.name\n # PROCESS!!!! what is the thing you have access to? What methods can you call? which will be useful here? \n if self.owner\n self.owner.name\n else\n nil\n end\n # tech debt - if owner is nil this will throw an error! \n end", "def set_donor\n @donor = Donor.find(params[:id])\n end", "def name\n end", "def name\n end", "def name\n end", "def name\n end", "def name\n userName\n end", "def display_name \n username\n end", "def member\n Member.find(@member.name)\n end", "def name\n nome\n end", "def proper_name\n Employee.find(self.employee_id).proper_name\n end", "def authenticate_donor?(donor)\n current_donor.id == donor.id \n end", "def what_is_name\n @name\n end", "def edit\n @donor = Donor.find(params[:id])\n end", "def name\n relation.name\n end", "def get_patient(id)\n if has_role?(:enroller)\n enrolled_patients.find_by_id(id)\n elsif has_role?(:public_health)\n viewable_patients.find_by_id(id)\n elsif has_role?(:public_health_enroller)\n viewable_patients.find_by_id(id)\n elsif has_role?(:admin)\n nil\n end\n end", "def display_name\n username\n end", "def current_person\n current_user\n end", "def set_person\n @person = Person.find(params[:id])\n authorize @person\n end", "def user_name\n \"someone\"\n end", "def read_persons\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_individual_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_individual_field,nil))\n logger.debug(\"read_persons: #{rp.inspect}\")\n return rp\n end", "def find_member\n @trello.find_member_by_username(users[@selected_commander][:trello_name])\n end", "def index(person)\n end", "def name\n full_name\n end", "def show\n @user = @person.user\n can_manage_user!\n\n redirect_to new_person_user_path(@person) unless @user\n end", "def identify\n 'name'\n end", "def identify\n 'name'\n end", "def identify\n 'name'\n end", "def identify\n 'name'\n end", "def name\n end", "def permissions = {}", "def rollbar_anonymized_person_method\n anonymized_identifier = LogAnonymizer.new.educator_identifier(request)\n AnonymizedPersonForRollbar.new(anonymized_identifier)\n end", "def contributor_details\n logger.debug(\"Role contributor_details\")\n @role = Role.find(params[:id])\n #@role.updated_by= get_user.login_id\n \n @person = @role.person\n @organisation = @role.organisation\n #if [email protected]_contributor?\n # flash[:notice] = 'Please make this person a contributor before editing contributor information'\n # redirect_to :action => 'edit', :id => @person\n # return\n #end\n setup_contributor\n end", "def custom_advisor(advisor)\n advisor.employee.person.name\n end", "def user_name\n User.find(self.user_id).name\n end", "def name\n name = PersonName.where(person_id: patient.id)\\\n .order(:date_created)\\\n .first\n\n given_name = na\n\n \"#{name.given_name} #{name.family_name}\"\n end", "def creator\n \"Pat Allan\"\n end", "def accessible_people\n if self.role_names.include?('admin')\n Person\n elsif self.role_names.include?('executive') or self.role_names.include?('manager')\n self.authorized_employees\n elsif self.role_name.include?('user')\n self.person\n end\n end", "def donour_user\n if donour_id then # This is to fix a bug where some entries have been coming in WITHOUT a donor_id. Its 0 in the table. No idea why.\n Donour.find(donour_id)\n else\n Donour.new\n end\n end" ]
[ "0.6904968", "0.6593578", "0.6542392", "0.6394369", "0.63738436", "0.6243499", "0.6239394", "0.62022823", "0.62022823", "0.6181635", "0.6130399", "0.6120799", "0.60875773", "0.60605955", "0.6059484", "0.6024886", "0.60199606", "0.5956698", "0.5941235", "0.59390235", "0.5928983", "0.58997166", "0.5899314", "0.5889688", "0.58687407", "0.58687407", "0.58607316", "0.58458257", "0.5822389", "0.5815875", "0.58054674", "0.57932746", "0.5793247", "0.57822114", "0.57720494", "0.5771002", "0.5753527", "0.5751116", "0.57434624", "0.5738134", "0.5732604", "0.5721223", "0.57200485", "0.5717785", "0.5710109", "0.57087183", "0.57085884", "0.5706741", "0.56968844", "0.56921315", "0.5678705", "0.5678705", "0.56743187", "0.56644386", "0.5658709", "0.5655286", "0.565524", "0.56511194", "0.5650243", "0.5650008", "0.56473", "0.5647172", "0.56471235", "0.56465304", "0.5644449", "0.5644449", "0.5644449", "0.5644449", "0.5643183", "0.5641986", "0.5637946", "0.56354505", "0.5635109", "0.56322384", "0.563038", "0.5629442", "0.5629276", "0.5623842", "0.5621969", "0.56219053", "0.5621846", "0.561348", "0.5613309", "0.56106967", "0.56100106", "0.55978924", "0.5597164", "0.5593869", "0.5593869", "0.5593869", "0.5593869", "0.559381", "0.5593719", "0.5593218", "0.5592552", "0.5587293", "0.5586898", "0.5578998", "0.5575579", "0.55728704", "0.5572748" ]
0.0
-1
projecteuler::problem4 A palindromic number reads teh same both ways. The largest palindrome made from teh product of two 2digit numbers is 9009 = 91 x 99. Find the largest palindrome made from the product of the 3digit numbers.
def is_palindrome?(x) x.to_s == x.to_s.reverse ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_4\n num1 = 999\n largest_pal = 0\n\n while num1 > 99\n num2 = num1 - 1\n while num2 > 99\n product = num1 * num2\n if is_palindrome?(product) && product > largest_pal\n largest_pal = product\n end\n num2 -= 1\n end\n num1 -= 1\n end\n\n return largest_pal\nend", "def largest_palindrome_product\n # palindromes = palindromes.reverse\n integer = 999\n n = 0\n while palindromes.reverse[n] % integer != 0\n while palindromes.reverse[n] % integer != 0 && integer > 99\n integer -= 1 \n end\n n += 1\n end\n palindromes.reverse[n]\nend", "def largest_palindrome_product\n palindromes = []\n\n 999.downto(100) do |x|\n 999.downto(100).each do |y|\n if (x * y).to_s == (x * y).to_s.reverse\n palindromes << x * y\n end\n end\n end\n palindromes.max\nend", "def pallindromic(digits)\n\n\tarray1 = []\n\tarray2 = [] \n\txout = []\n\tyout = []\n\touts =[]\n\tresult = percentage = number_of_digits = 0\n\n\tnumber_of_digits = Math.log10(digits).to_i + 1 \t\n dlength = (10**digits.to_s.length)-1 \n\tpercentage = (0.85*dlength).to_i\n\t\n\tarray1 =* (percentage..dlength)\n\tarray2 = array1\n\tarray1.each do |x|\n\t\tarray2.each do |y|\n\t\t\t test = x*y\n\t\t\t if test.to_s === test.to_s.reverse\n\t\t\t outs << test\n\t\t\t xout << x\n\t\t\t yout << y\n\t\t\t end\n\t\tend\n\tend\n \t\n puts \"The largest palindrome made from the product of two #{number_of_digits}-digit numbers is #{outs.last.to_s} = #{xout[-1]} x #{yout[-1]}\" \nend", "def p004(number_of_digits = 3)\n # Method without lots of stored results:\n # 1. Find the largest product of two X-digit numbers, i.e. 999 * 999\n # 2. Iterate through palindromes in descending order\n # 3. If a palindrome is the product of two X-digit numbers then return it\n #\n # Notes:\n # - This does not currently support palindromic numbers with an odd number of digits\n # - To figure out if a number is the product of two X-digit numbers, an iterative bounding method makes sense\n current_palindrome = Palindrome.round_down(largest(number_of_digits)**2)\n smallest_palindrome = Palindrome.round_up(smallest(number_of_digits)**2)\n\n while current_palindrome >= smallest_palindrome\n # Is there an X-digit divisor with no remainder and X-digit result?\n divisor_pair = find_divisor(current_palindrome, number_of_digits)\n return current_palindrome.to_i if divisor_pair\n\n # There isn't, let's try the next palindrome down\n current_palindrome.decrement!\n end\nend", "def four \n max = 0\n for i in 100..999\n for j in 100..999\n if isPalindrome?(x = i*j)\n if x > max\n max = x\n end\n end\n end\n end\n return max\nend", "def largest_palindrome_product\n palindromes = []\n for i in (900..999) do\n for j in (900..999) do\n palindromes << i*j if ((i*j).to_s == (i*j).to_s.reverse)\n end\n end\n palindromes.max\nend", "def problem_four\n max = 0\n\n 100.upto(999).each do |a|\n a.upto(999).each do |b|\n max = a * b if palindrome?(a * b) && (a * b) > max\n end\n end\n\n max\n end", "def pal_num(num)\n largest_palindrome = 0\n num_one = num\n num_two = num\n while num_two > 0\n while num_one > 0\n if (num_one * num_two == (num_one * num_two).to_s.reverse.to_i) && (num_one * num_two > largest_palindrome)\n largest_palindrome = num_one * num_two\n end\n num_one -= 1\n end\n num_one = num\n num_two -= 1\n end\n p largest_palindrome\nend", "def largest_palindrome(num_of_digits)\r\n\tmax_number_string = \"\"\r\n\tnum_of_digits.times { max_number_string += \"9\"}\r\n\tmax_product = max_number_string.to_i ** 2\t\t# e.g: 999* 999 = 998001\r\n\t\r\n\tsub_string = (max_product.to_s)[0..(max_product.to_s).length/2 - 1]\r\n\tsub_string_number = sub_string.to_i \r\n\t\r\n\tdelta = 1\r\n\tdelta.upto(sub_string_number) { |x|\r\n\t\tpalindrome = ((sub_string_number - x).to_s + (sub_string_number - x).to_s.reverse).to_i\r\n\t\t\r\n\t\tfactor = sub_string_number\r\n\t\tfactor.downto(10**(num_of_digits - 1)) { |div|\r\n\t\t\treturn div, (palindrome/div) if (palindrome % div == 0) and (palindrome/div).to_s.length == num_of_digits\r\n\t\t}\r\n\t}\r\nend", "def largest_palindrome_product\n largest_palindrome = 0\n\n 999.downto(100) do |i|\n i.downto(100) do |j|\n result = i * j\n largest_palindrome = result if result > largest_palindrome && result.to_s == result.to_s.reverse\n break if result <= largest_palindrome\n end\n end\n largest_palindrome\nend", "def solution4\n palindrome = 1000\n (900..999).each do |num1| # checks between 900-999, likely solutions are probably here\n (900..999).each do |num2|\n product = num1 * num2\n palindrome = product if palindrome?(product) && product > palindrome\n end\n end\n palindrome\nend", "def largestPalindromicNumber(n_digits)\n # palindromes = []\n startPoint = (10**n_digits-1)**2\n endPoint = (10**(n_digits-1))**2\n i = startPoint\n while i >= endPoint do\n if isAPalindrome(i) && isNumAProductOfTwoNDigitNumbers(i, n_digits)\n puts i\n return i\n end\n i -= 1\n end\n p 'no product/palindromes found'\nend", "def getLargestPalindrome()\n\tlargestPalindrome = 1\n\tx = 1\n\twhile x <= 999\n\t\ty = 1\n\t\twhile y <= 999\n\t\t\tproduct = x * y\n\t\t\tif product.to_s == product.to_s.reverse!\n\t\t\t\tlargestPalindrome = product\n\t\t\tend\n\t\t\ty = y + 1\n\t\tend\n\t\tx = x + 1\n\tend\n\treturn largestPalindrome\nend", "def largest_palindrome_for_even_digits(n)\n max_val = 0\n multiplier_x = get_multiplier_x(n)\n n.downto(100) { |y|\n multiplier_x.each { |x|\n product = x * y\n if product.to_s == product.to_s.reverse\n max_val = [max_val, product].max\n end\n }\n }\n max_val\nend", "def largest_palindrome(digits)\n\tnumbers = []\n\tx = (\"9\"*digits).to_i\n\ty = (\"9\"*digits).to_i\n\tlimit = ((\"9\"*(digits-1)).to_i)\n\twhile x > limit\n\t\ty.downto(limit+1) do |i|\n\t\t\tx*i == (x*i).to_s.reverse.to_i ? numbers << x*i : \"\"\n\t\tend\n\t\tx -= 1\n\tend\n\treturn numbers.sort.last\nend", "def largest_palindrome_product\n start = Time.now\n palindromes = []\n 999.downto(900) do |i|\n 999.downto(i) do |j|\n n = i * j \n palindromes << n if palindrome?(n)\n end\n end\n finish = Time.now\n \"largest palindrom is: #{palindromes.max}, calculated in #{(finish - start) * 1000 } ms.\"\nend", "def max_palidrome_product(min, max)\r\n lrg_pal = 0\r\n max.downto(min) do |i|\r\n i.downto(min) do |j|\r\n product = i * j\r\n if product > lrg_pal && product.to_s == product.to_s.reverse #it's a palindrome\r\n # puts \"i = #{i}\"\r\n # puts \"j = #{j}\"\r\n lrg_pal = product\r\n end\r\n end\r\n end\r\n lrg_pal\r\nend", "def largest_palindrome_product\n 998001.downto(10000) do |num|\n (return num) if (is_palindrome?(num) && !Prime.prime?(num))\n end\n nil\nend", "def doAction\n largest = 0\n for value1 in 100..999\n for value2 in 100..999\n product = value1 * value2\n if (palindrome?(product))\n print(\"#{ value1 } * #{ value2 } is #{ product }\\n\")\n if (product > largest)\n largest = product\n end\n end\n end\n end\n print(\"The largest palindrome made from multiplying two 3-digit numbers was #{ largest }\\n\")\nend", "def three_figure_palindrome\n # Two iterators that will increment with each iteration\n # One for the left hand side of the equation, and one for the right\n 100.upto(999) do |left_side|\n 100.upto(999) do |right_side|\n \n # Find the product of all three digit numbers and store in variable\n possible_palindrome = left_side * right_side\n\n # Checks to see if the product of the two numbers is a palindrome or not\n if (is_palindrome? possible_palindrome) && (possible_palindrome > @max)\n # Stores the current highest valued palindrome in the instance variable\n @max = possible_palindrome\n end\n end\n end\n # Returns the instance variable as the result of the method\n @max\n end", "def p4\n\tarray = (800..999).to_a\n\tarray = array.map{|x| array.map{|y| x * y}}.flatten.uniq\n\tarray = array.select{|x| palindrome?(x)}\n\tarray.max\nend", "def largest_palindrome_product(max_factor, min_factor)\n max_num = max_factor ** 2\n min_num = min_factor ** 2\n max_num.downto(min_num) do |num|\n if is_palindrome?(num) && has_three_digit_factors?(num, min_factor, max_factor)\n puts \"FOUND ONE!\"\n puts num\n return num\n end\n end\nend", "def get_input\n print \"Program to find largest palindrome product of two numbers in the same digits range. \\n\" \n print \"See http://projecteuler.net/problem=4 for complete problem statement. \\n\"\n print \"Largest palindrome number of x digit numbers: \"\n digits = gets.to_i\nend", "def compute\n ans = 0 \n for a in 100..999\n for b in 100..999\n ab = a * b \n ans = ab if palindrome? ab and ab > ans \n end\n end\n ans\nend", "def palindromes\n max, min = (@max_factor**2).to_s, min = @min_factor.to_s\n result = (min..max).select { |elm| elm == elm.reverse }\n result.map { |num| num.to_i }\n end", "def GetLargestPalindromic\r\n @product = 0\r\n \r\n @size.downto(1) { |i|\r\n @size.downto(1) { |j|\r\n @product = i * j\r\n \r\n if IsPalindromic(@product)\r\n puts \"Largest Palindromic = #{@product}\"\r\n return\r\n end\r\n }\r\n }\r\n\r\n puts \"Largest Palindromicaa = #{@product}\"\r\n end", "def palindrome(maxnum, minnum)\n\n for i in (maxnum*maxnum).downto(minnum*minnum)\n if i.to_s == i.to_s.reverse\n divisor = maxnum\n while (i / divisor <= maxnum)\n if i % divisor == 0\n return \"Palindrome is #{i}, and is the product of #{divisor} * #{i / divisor}\"\n else\n divisor -= 1\n end\n end\n end\n end\n \nend", "def largest_palindrome_product(n) \r\n array = []\r\n beginning = (\"1\" + (\"0\" * (n - 1))).to_i\r\n ending = (\"9\" + (\"9\" * (n - 1))).to_i\r\n x = (beginning..ending).to_a\r\n y = (beginning..ending).to_a\r\n x.each do |num1|\r\n y.each do |num2|\r\n product = num1 * num2\r\n if product.to_s == product.to_s.reverse \r\n array << product\r\n end \r\n end \r\n end \r\n array.sort.last\r\nend", "def palindrome_product\n\tpalindrome_array = []\n\tfirst = 1\n\twhile first <= 999\n\t\tsecond = 1 \n\t\twhile second <= 999\n\t\t\tpalindrome = first * second\n\t\t\tif palindrome.to_s == palindrome.to_s.reverse\n\t\t\t\tpalindrome_array << palindrome\n\t\t\tend\n\t\t\tsecond+=1\n\t\tend\n\t\tfirst+=1\n\tend\n\tp palindrome_array.sort.last\nend", "def pals\n sum = 0\n\n 1.upto(1000000) do |num|\n n_array = num.to_s.split(\"\")\n \n next unless n_array == n_array.reverse\n\n b_array = num.to_s(2).split(\"\")\n\n next unless b_array == b_array.reverse\n\n puts \"#{num} is double base palindrome\"\n\n sum += num\n end\n sum\nend", "def find_highest_drome_mapping\n low = 100\n high = 999\n dromes = high.downto(low).map do |num_one|\n num_one.downto(low).map do |num_two|\n num_one * num_two if (num_one * num_two).to_s == (num_one * num_two).to_s.reverse\n end\n end\n dromes.flatten.compact.max\nend", "def largest_palidrome_product(size)\n\traise \"Size must be greater that zero\" if size < 1\n\tpalindrome_product = 0;\n\tupper_limit_arry = Array.new(size, 10)\n\tlower_limit_arry = Array.new(size-1 , 10)\n\tupper_limit = upper_limit_arry.inject(:*) - 1\n\tlower_limit = lower_limit_arry.inject(:*)\n\tupper_limit.downto(lower_limit).each do | num |\n\t\tnum.downto(lower_limit).each do | x |\n\t\tpalindrome_product = x * num if is_palindrome?(x * num) && palindrome_product < x * num\n\t\tend\n\tend\n\tpalindrome_product\nend", "def get_highest_palindrome(high, low)\n highest = 0\n high.downto low do |i|\n high.downto low do |j|\n product = i * j\n # No point searching when the result is less than the current winner\n break if product <= highest\n highest = product if product.to_s == product.to_s.reverse\n end\n end\n highest\nend", "def palindromic(num)\n # lazy = (1..Float::INFINITY).lazy.select(&:odd?).drop(10).take_while\n # { |i| i < (Float::INFINITY) }\n Prime.lazy.select { |a| a.to_s == a.to_s.reverse }.first(num)\nend", "def recursive_palindrome(num1,num2=num1)\n product = num1 * num2\n return product if product.to_s == product.to_s.reverse\n if num2 > 900\n num2 -= 1\n else\n num1 -= 1\n num2 = num1 # avoids multiplying same numbers again\n end\n recursive_palindrome(num1, num2)\nend", "def longest_palindrome(s)\n max = \"\"\n 0.upto(s.size - 1).each { |i|\n odd = palindrome(s, i, i)\n even = palindrome(s, i, i + 1)\n \n return s if odd.size == s.size || even.size == s.size\n max = odd if odd.size > max.size\n max = even if even.size > max.size\n }\n\n max \nend", "def testRange(num, highestPal)\n #Since it's only the LARGEST palindrome, any numbers which would give a product less\n #than the current highest palindrome doesn't need to be tested\n minRange=highestPal/num\n if minRange>999\n return 0\n end\n #Question specifically asks about multiplying 3 digit numbers. If it's less than 3 digist,\n #then fix that.\n if minRange<100\n minRange=100\n end\n #Goes from highest to lowest, so the first palindrome found will always be the highest.\n (num-1).downto(minRange){ |i|\n if palTest(i*num)\n return i*num\n end\n }\n #If nothing is found, return a 0 by default.\n return 0\nend", "def double_base(max)\n (1..max).select{|num| is_palindrome?(num)}.reduce(:+)\nend", "def solve\n max = nil\n\n # Start with the longest possible and work down. \n 9.downto( 1 ) do |i|\n max = Array.new( i ) {|j| 1 + j}.permutation.to_a.map! {|j| j.join.to_i}.select {|j| j.prime? }.max\n break if max\n end\n \n max\n end", "def largest_palindrome(string)\n palindromes(string).max {|a, b| a.size <=> b.size }\nend", "def solve( n = 3 )\n min = 10**(n - 1)\n max = (10 * min) - 1\n\n max.downto( min ).each do |i|\n # Create the next palindromic number.\n p = (i.to_s + i.to_s.reverse).to_i\n\n # Factors must be min <= f <= sqrt(p). The quotient of p and f <= max.\n # Find the first number with a factor satisfying these constraints.\n a = Math.sqrt( p ).to_i.downto( min ).select {|f| max >= p / f && 0 == p % f}\n return p if 0 < a.length #puts \"%d x %d = %d\" % [a[0], p / a[0], p]\n end\n end", "def largest_palindrome value\n array = generate_multi_array value\n select_palindromic array\nend", "def palindromic_number?(num)\n num.to_s.chars.join(\"\").reverse.to_i == num\nend", "def solution(digits)\n\tlargest = (digits[0]+digits[1]+digits[2]+digits[3]+digits[4]).to_i\n\ti = 4\n\twhile i < digits.length\n\t\ttester = (digits[i-4]+digits[i-3]+digits[i-2]+digits[i-1]+digits[i]).to_i\n\t\tif tester > largest\n\t\t\tlargest = tester\n\t\tend \n\t\ti += 1\n\tend \n\tlargest\nend", "def is_palindrome(num)\n if num.to_s.size % 2 == 0 #A palindrome must be made up of at least 2 digits\n split1 = num.to_s\n split1 = split1[0..(((split1.size)/2)-1)] #the first half of the string\n split2 = num.to_s\n split2 = split2[((split2.size)/2)..split2.size] #the second half of the string\n split2 = split2.reverse\n if split1 == split2\n #print \"*** \",num,\" is a palindrome! ***\\n\"\n #print \"product: \",num,\"\\n\"\n #print \"split 1: \",split1,\"\\n\"\n #print \"split 2: \",split2.reverse,\"\\n\"\n #print \"a is: \",(@max-@iter1),\"\\n\"\n #print \"b is: \",(@max-@iter2),\"\\n\"\n if num.to_s.size == 6\n @palindromes << num\n #p @palindromes\n end\n else\n #print num,\" is not a palindrome!\\n\"\n end\n end\nend", "def larg_palin_product\n max_product = 1\n (100...1000).each do |x|\n (100...1000).each do |y|\n max_product = x*y if (isPalindome x*y) && (x*y > max_product)\n end\n end\n max_product\nend", "def longest_palindrome(s)\n result = ''\n \n for i in (0..s.length-1) do\n for j in (i..s.length-1) do \n result = s[i..j] if s[i..j].length > result.length && s[i..j] == s[i..j].reverse\n end\n end\n \n result\nend", "def is_palindrome(number)\n return false if number == nil || number < 0\n\n k = 0\n clone_number = number\n\n until clone_number == 0\n clone_number /= 10\n k += 1\n end\n\n return true if k == 1\n\n i = 1\n\n until i > k / 2\n a = number % 10 ** (k + 1 - i) / 10 ** (k - i)\n b = (number / 10 ** (i - 1)) % 10\n return false if a != b\n i += 1\n end\n\n return true\nend", "def palindromic?(number)\n num = number.to_s.split('')\n (1..(num.size/2)).all? do |index|\n num[index-1] == num[index*(-1)]\n end\nend", "def longest_palindrome(str)\r\n pal = \"\"\r\n (0..str.size).each do |x|\r\n i = 1\r\n while (i < (str.size-x)) do\r\n\t if str[x,i].reverse == str[x,i]\r\n\t pal = str[x,i] if pal.size < str[x,i].size\r\n\t end\r\n\t i+= 1\r\n\tend\r\n end\r\n pal\r\nend", "def longest_palindrom(str)\n return str if str.length <= 1\n\n result = ''\n (0...str.length - 1).each do |i|\n ((i + 1)...str.length).each do |j|\n substr = str[i, j]\n result = substr if is_palindrom?(substr) && (result.length < substr.length)\n end\n end\n result\nend", "def palindromic_number?(number)\n index = -1\n rev_array = Array.new(\"#{number}\".length)\n \"#{number}\".chars.each do |char|\n rev_array[index] = char.to_i\n index -= 1\n end\n number == rev_array.join.to_i\nend", "def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend", "def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend", "def is_palindrome?(num)\n\tdigit_array = num.to_s.chars.map(&:to_i)\n\tlength = digit_array.length\n\teach_half = digit_array.each_slice(length/2).map(&:to_a)\n\treturn each_half[0] == each_half[1].reverse\nend", "def palindromic_number?(number)\n number.to_s.reverse.to_i\nend", "def is_palindrome(number)\n return false if !number || number < 0\n length = 1\n until number / (10 ** length) == 0\n length += 1\n end\n (length / 2).times do |i|\n return false if (number / (10 ** (length - i - 1))) % 10 != (number % (10 ** (i + 1))) / (10 ** i)\n end\n return true\nend", "def first_million\r\n\tpalindromes = []\r\n\t(1..999999).each do |x|\r\n\t\trev = x.to_s.reverse\r\n\t\tif x.to_s == rev\r\n\t\t\tpalindromes << x\r\n\t\tend\r\n\tend\r\n\tpalindromes\r\nend", "def longestPalSubstr(str)\n maxLength = 1\n start = 0\n length = str.size\n low = 0\n high = 0\n \n # One by one consider every character as center point of \n # even and length palindromes\n for i in 1..length\n # Find the longest even length palindrome with center\n # points as i-1 and i.\n low = i - 1\n high = i\n while (low >= 0) and (high < length) and (str[low] == str[high]) do\n if high - low + 1 > maxLength then\n start = low\n maxLength = high - low + 1\n end\n low -= 1\n high += 1\n end\n \n # Find the longest odd length palindrome with center \n # point as i\n low = i - 1\n high = i + 1\n while (low >= 0) and (high < length) and (str[low] == str[high]) do\n if (high - low + 1) > maxLength then\n start = low\n maxLength = high - low + 1\n end\n low -= 1\n high += 1\n end\n end\n \n # puts \"Longest palindrome substring is: start: #{start} maxLength: #{maxLength}\"\n # puts str[start, maxLength]\n \n return str[start, maxLength]\n end", "def longest_palindrome(string)\n string.length.downto(3) do |length|\n string.chars.each_cons(length) do |substr_arr|\n return substr_arr.length if palindrome?(substr_arr.join)\n end\n end\n false\nend", "def euler038\n (9213..9876)\n .map{ |x| x.to_s + (x*2).to_s }\n .select{ |f| f.chars.sort.join == \"123456789\" }\n .map{ |f| f.to_i }\n .max\nend", "def is_palindrome_num(x)\n return false if x < 0\n return true if x == 0\n\n digits = (Math.log(x) / Math.log(10)).floor + 1\n\n (digits / 2).times do |i|\n return false unless (x % 10) == x / (10 ** (digits - 2*i - 1)) % 10\n x /= 10\n end\n\n true\n\nend", "def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend", "def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend", "def palindromic_number?(num)\n\tstr = num.to_s\n\n\tnum == str.reverse.to_i\nend", "def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend", "def generate_palindromes(ceiling)\n palindromes = []\n i = 1\n continue = true\n \n if ceiling < 10\n (1..ceiling).each { |x| palindromes.push(x) }\n return palindromes\n else\n (1..9).each { |x| palindromes.push(x) }\n end \n\n while continue\n continue = false\n\n if (\"#{i}#{i.to_s.reverse}\").to_i < ceiling\n palindromes.push((\"#{i}#{i.to_s.reverse}\").to_i)\n continue = true\n else\n continue = false\n end\n\n (0..9).each do |d|\n s = i.to_s << d.to_s << i.to_s.reverse\n if s.to_i < ceiling\n palindromes.push(s.to_i)\n end\n end\n i += 1\n end\n\n palindromes\n\nend", "def palindromic_number?(n)\n n.to_s == n.to_s.reverse\nend", "def is_palindrome? number\n num_string = number.to_s\n counter = num_string.length / 2\n\n palindromic = true\n counter.times {|n| palindromic &&= ( num_string[n] == num_string[-n-1])}\n\n palindromic\nend", "def shortest_palindrome_3(s)\n idx = 0\n front = 0\n back = 0\n pow = 1\n (0...s.size).each { |i|\n dijit = s[i].ord - 'a'.ord\n front = front * 27 + dijit\n back = back + dijit * pow\n pow *= 27\n idx = [idx, i].max if front == back\n }\n\n (s[idx + 1..-1] || \"\").reverse + s\nend", "def longest_palindrome(string)\n largest = ''\n (0...string.length).each do |i|\n (i + 1...string.length).each do |j|\n sub_str = string[i..j]\n if sub_str == sub_str.reverse\n if sub_str.length > largest.length\n largest = sub_str\n end\n end\n end\n end \n largest\nend", "def palindromic_number?(num)\n num.to_s \nend", "def palindromic_number?(num)\n string = num.to_s\n string == string.reverse\nend", "def palindromic(num) \n if num.to_s.split(\"\") == num.to_s.split(\"\").reverse\n true \n else \n false \n end \nend", "def palindrome(num)\n return \"Not valid\" if num.is_a?(String) || num < 0\n return \"Not valid\" if num.is_a?(Float)\n\tarr = []\n \tnum.to_s.chars.each_index do |current_idx|\n \tnum.to_s.chars.each_index do |following_idx|\n \t\tnext if current_idx == following_idx\n \t\tarr << num.to_s[current_idx..following_idx]\n \tend\n \tend\n arr.reject(&:empty?).select { |num| num if (num == num.reverse) && (num.length != 1) }.length >= 1\nend", "def palindromic_number?(num)\n palindrome?(num.to_s)\nend", "def greatest_product(digits)\r\n\t# Get Number in one string. Can probably do this with greater optimization\r\n\tnumber = \"73167176531330624919225119674426574742355349194934\"\r\n number += \"96983520312774506326239578318016984801869478851843\"\r\n\tnumber += \"85861560789112949495459501737958331952853208805511\"\r\n\tnumber += \"12540698747158523863050715693290963295227443043557\"\r\n\tnumber += \"66896648950445244523161731856403098711121722383113\"\r\n\tnumber += \"62229893423380308135336276614282806444486645238749\"\r\n\tnumber += \"30358907296290491560440772390713810515859307960866\"\r\n\tnumber += \"70172427121883998797908792274921901699720888093776\"\r\n\tnumber += \"65727333001053367881220235421809751254540594752243\"\r\n\tnumber += \"52584907711670556013604839586446706324415722155397\"\r\n\tnumber += \"53697817977846174064955149290862569321978468622482\"\r\n\tnumber += \"83972241375657056057490261407972968652414535100474\"\r\n\tnumber += \"82166370484403199890008895243450658541227588666881\"\r\n\tnumber += \"16427171479924442928230863465674813919123162824586\"\r\n\tnumber += \"17866458359124566529476545682848912883142607690042\"\r\n\tnumber += \"24219022671055626321111109370544217506941658960408\"\r\n\tnumber += \"07198403850962455444362981230987879927244284909188\"\r\n\tnumber += \"84580156166097919133875499200524063689912560717606\"\r\n\tnumber += \"05886116467109405077541002256983155200055935729725\"\r\n\tnumber += \"71636269561882670428252483600823257530420752963450\"\r\n\t\r\n\tanswer = 0\r\n\r\n\t# Run through all possible 13 digit combinations\r\n\t(0..number.length-digits).each do |x|\r\n\t\t# Set localized product to the first digit in combo\r\n\t\tproduct = number[x].to_i\r\n\t\t# Multiply the rest of the digits in combo together\r\n\t\t((x+1)...x+digits).each do |n|\r\n\t\t\tproduct *= number[n].to_i\r\n\t\tend\r\n\t\t# If localized product is highest so far, set to answer\r\n\t\tanswer = product if product > answer\r\n\tend\r\n\tputs answer\r\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def is_palindrome(number)\n return false if number == nil || number < 0\n i = 0\n placeholder = number\n until placeholder == 0\n placeholder /= 10\n i += 1\n end\n until i <= 0\n i -= 1\n\n if number % 10 != number / 10 ** i\n return false\n end\n\n number -= (number / 10 ** i) * 10 ** i\n number /= 10\n\n i -= 1\n end\n return true\nend", "def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse!\nend", "def longest_palindrome_subseq(s)\n length = s.size\n dp = []\n\n length.times do |i|\n dp[i]= Array.new(length).fill(0);\n dp[i][i] = 1\n end\n puts \"dp #{dp}\"\n (2..length).each do |len|\n puts \"len #{len}\"\n (0..(length - len)).each do |i|\n j = i + len - 1\n # puts \"j #{j} => i:#{i} + len:#{len} - 1\"\n\n if s[i] == s[j]\n dp[i][j] = 2 + (len == 2 ? 0 : dp[i+1][j-1])\n else\n dp[i][j] = [dp[i+1][j], dp[i][j-1]].max\n end\n puts \"dp #{dp}\"\n end\n end\n\n dp[0][length - 1]\nend", "def problem8(text)\n\tdigits = text.split('').map {|x| x.to_i }\n\t\n\treturn -1 if digits.length < 5\n\ti = 0\n\tj = 4\n\t\n\tmax = 1\n\tdigits[0..4].each do |d|\n\t\tmax *= d\n\tend\n\t\n\tmaxdigits = digits[0..4]\n\t\n\tbuffernum = max\n\twhile j < (digits.length - 1)\n\n\t\t#pop left digit\n\t\tif digits[i] == 0\n\t\t\tbuffernum = 1\n\t\t\tdigits[i+1..j].each { |x| buffernum *= x}\n\t\t\tputs buffernum\n\t\telse\n\t\t\tbuffernum /= digits[i]\n\t\tend\n\t\ti += 1\n\n\t\t#push right digit\n\n\t\tj += 1\n\t\tbuffernum *= digits[j]\n\t\tif buffernum > max\n\t\t\tmax = buffernum\n\t\t\tmaxdigits = digits[i..j]\n\t\tend\n\t\t\n\n\n\tend\n\t\n puts \"Max Product : #{max}\"\n\tputs \"Max Digits : #{maxdigits}\"\n\t\n\t\nend", "def palindrome?\n n = self\n\n digit_array = n.to_s.each_char.map(&:to_i)\n digit_array.shift if n < 0\n\n start_index = 0\n end_index = digit_array.length - 1\n\n palindrome = true\n loop do\n break if end_index < start_index\n\n if digit_array[start_index] == digit_array[end_index]\n start_index += 1\n end_index -= 1\n\n break if end_index == start_index\n else\n palindrome = false\n break\n end\n end\n\n return palindrome\n end", "def check_palindrome(num)\n\tstring = num.to_s\n\tlength = string.length\n\tlast = length-1\n\tfirst = 0\n\tbegin\n\t\tis_palindrome = (string[first].to_i == string[last].to_i)\n\t\tbreak if !is_palindrome\n\t\tfirst += 1\n\t\tlast -=1\n\tend while first <= last\n\treturn is_palindrome\nend", "def palindrome(num, s)\n return 'Not valid' if num.class == String || s.class == String || num < 0 || s < 0\n result = []\n until result.length == s\n result << num if num == num.to_s.reverse.to_i && num > 9\n num += 1\n end\n result\nend", "def longest_parlindrom_substring string\n return string if string.length < 2\n\n length = string.length\n memo = {}\n\n 1.upto(length) do |sub_length|\n 0.upto(length - sub_length) do |start_i|\n\n last_i = start_i + sub_length - 1\n indice = [start_i, last_i]\n\n next unless string[start_i] == string[last_i]\n\n memo[indice] = 1 if start_i == last_i\n memo[indice] = 2 if start_i + 1 == last_i\n\n indice_of_sub_substring = [start_i+1, last_i-1]\n \n if memo.has_key?(indice_of_sub_substring)\n memo[indice] = 2 + memo[indice_of_sub_substring]\n end\n end\n end\n indice = memo.key(memo.values.max)\n string[indice[0]..indice[1]]\nend", "def findLargestProduct\n \n solution = 0\n last = 4\n n = \"73167176531330624919225119674426574742355349194934969835203127745063262395783180169\n 8480186947885184385861560789112949495459501737958331952853208805511125406987471585238630\n 5071569329096329522744304355766896648950445244523161731856403098711121722383113622298934\n 2338030813533627661428280644448664523874930358907296290491560440772390713810515859307960\n 8667017242712188399879790879227492190169972088809377665727333001053367881220235421809751\n 2545405947522435258490771167055601360483958644670632441572215539753697817977846174064955\n 1492908625693219784686224828397224137565705605749026140797296865241453510047482166370484\n 4031998900088952434506585412275886668811642717147992444292823086346567481391912316282458\n 6178664583591245665294765456828489128831426076900422421902267105562632111110937054421750\n 6941658960408071984038509624554443629812309878799272442849091888458015616609791913387549\n 9200524063689912560717606058861164671094050775410022569831552000559357297257163626956188\n 2670428252483600823257530420752963450\"\n dataArray = n.chars.map(&:to_i)\n\n (0..995).each do |start| \n possible_sol = dataArray[start..last].inject(:*)\n \tsolution = possible_sol if possible_sol > solution \n \tlast += 1\n end\n\n solution\n\nend", "def palindromic_number?(int)\n arr = int.to_s\n if arr == arr.reverse\n p true\n else\n p false\n end\n\nend", "def euler(num)\n thousand = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\n largest = 0\n working_ary = []\n thousand.to_s.split(\"\").each_cons(num) { |ary| working_ary << ary }\n working_ary.uniq!\n working_ary.each do |ary|\n if ary.reduce { |product, n| (product.to_i) * (n.to_i) } > largest\n largest = ary.reduce { |product, n| (product.to_i) * (n.to_i) }\n end\n end\n largest\nend", "def is_palindrome(number)\n return false if !number\n return false if number < 0\n return true if number < 10\n modulo = 10\n divide = 10\n digets = 2\n until number / divide < 10\n divide *= 10\n digets += 1\n end\n (digets / 2).times do\n return true if number == 0\n return false if number % modulo != number / divide\n first_num = number / divide\n number = (number % (first_num * divide)) / modulo\n divide /= 100\n end\n return true\nend", "def palindrome?(number)\n number_array = number.abs.to_s.split(\"\")\n index = number_array.size-1\n (0..number_array.size/2).each do |index|\n if number_array.at(index) != number_array.at(number_array.size-(index+1))\n return false\n end\n end\n return true\nend", "def longest_palindrome(str)\n return 0 if str.empty?\n\n arr = str.chars\n substrings = []\n length = 1\n loop do\n arr.each_cons(length) { |set| substrings << set }\n length += 1\n break if length > arr.length\n end\n substrings.select { |set| set == set.reverse }.max_by(&:length).length\n p substrings\nend", "def palindromic_number?(number)\n palindrome?(number.to_s)\nend", "def is_palindrome(number)\n return false if number == nil || number < 0\n return true if number < 10\n d = 0\n \n number_copy = number\n while number_copy > 9 \n number_copy /= 10\n d += 1 \n end \n\n while number > 9\n if (number / 10**d)%10 != number%10\n return false\n else\n # remove first and last digit from number\n number = (number % 10**d) / 10\n d -= 2\n end\n end\n\n # i = 0\n # while d > 0\n # if (number / 10**d)%10 != (number/10**i) % 10\n # return false\n # else\n # i += 1\n # d -= 1\n # end\n # end\n return true\nend", "def palindromic_number?(int)\r\n int.to_s == int.to_s.reverse\r\nend", "def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend", "def palindrome(x)\n y = x\n product = 0\n\n while x > 900\n product = x * y\n if product.to_s == product.to_s.reverse\n print \"From method 2 using a while loop => #{product}\"\n puts \"\\n--------------\" \n print \"Out of curiosity the two numbers are x = #{x} and y = #{y}\"\n break\n elsif y > 900\n y -= 1\n elsif \n x -= 1\n y = x\n end\n end\nend", "def longest_palindrome(string)\n\n palindromes = []\n\n (0...string.length).each do |i|\n (i+1...string.length).each do |j|\n sub = string[i..j]\n palindromes << sub if sub == sub.reverse\n end\n end\n\n palindromes.sort_by(&:length).last \n\nend", "def longest_palindrome(s)\n hash = {}\n output = 0\n odd = false\n \n s.each_char do |letter|\n hash[letter] = hash[letter] ? hash[letter] + 1 : 1\n end\n \n hash.each do |key, val|\n if val % 2 == 0\n output += val\n else\n output += val - 1 if val > 1\n odd = true\n end\n end\n output += 1 if odd\n output\nend", "def palindromic_number?(int)\n int.to_s == int.to_s.reverse\nend" ]
[ "0.842651", "0.83863574", "0.82265794", "0.8226439", "0.8223764", "0.8211778", "0.81758034", "0.8162218", "0.8140379", "0.813723", "0.80869967", "0.8075961", "0.8046546", "0.7993986", "0.79265016", "0.7920063", "0.78999317", "0.78678054", "0.78632396", "0.78426534", "0.77911776", "0.7740934", "0.7737098", "0.7705981", "0.7673423", "0.76610804", "0.7625909", "0.7602425", "0.7587091", "0.74735427", "0.74614334", "0.7347059", "0.73260134", "0.7273716", "0.709716", "0.70631975", "0.70385295", "0.6984511", "0.6930498", "0.6880683", "0.68781114", "0.68775237", "0.6866061", "0.68425834", "0.6833478", "0.68190086", "0.6813158", "0.67877406", "0.6779267", "0.6738856", "0.67370075", "0.67359424", "0.6707076", "0.6703254", "0.6703254", "0.6688088", "0.6674064", "0.6658487", "0.66495997", "0.6645663", "0.6609525", "0.65978354", "0.65942675", "0.6584872", "0.6584872", "0.6582096", "0.65768176", "0.6573381", "0.65670335", "0.6543341", "0.65422004", "0.653138", "0.65243405", "0.65228546", "0.65223044", "0.65157694", "0.6513701", "0.6511254", "0.64995223", "0.6497858", "0.64977086", "0.6492692", "0.6490193", "0.6481794", "0.6480774", "0.64771414", "0.64730877", "0.6468146", "0.6467488", "0.64671", "0.6465789", "0.6462442", "0.645162", "0.6446386", "0.64443463", "0.6442233", "0.6441816", "0.64400786", "0.6429451", "0.6421867", "0.6421595" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_dbedt_upload @dbedt_upload = DbedtUpload.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def dbedt_upload_params params.require(:dbedt_upload).permit(:filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Applies the mutation, :update points first then :re_apply points. Accepts an option, nil means apply all, :update means apply only update mutations points, :re_apply means apply on re_apply points, :force_update means apply all but turn re_apply points into update points.
def apply(option=nil) updates, re_applies = @points.partition { |pt| pt.type == :update } points = updates + re_applies points.each { |pt| pt.apply(@dboard, option) } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @points = args[:points] if args.key?(:points)\n end", "def points_update\n command = Goal::GoalPointsUpdateCommand.new(params)\n run(command)\n end", "def update!(**args)\n @point_indices = args[:point_indices] if args.key?(:point_indices)\n @points = args[:points] if args.key?(:points)\n end", "def update!(**args)\n @transformations = args[:transformations] if args.key?(:transformations)\n end", "def update!(*options)\n update(*options)\n save\n end", "def update!(**args)\n @enforced = args[:enforced] if args.key?(:enforced)\n end", "def update_or_check(**opts, &b)\n\t\t\t\tupdate(**opts)\n\t\t\tend", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def apply!\n return if @already_applied\n pointcuts.each do |pc| pc.apply! end\n @already_applied = true\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @ordered_ranking = args[:ordered_ranking] if args.key?(:ordered_ranking)\n @possible_values = args[:possible_values] if args.key?(:possible_values)\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @ordered_ranking = args[:ordered_ranking] if args.key?(:ordered_ranking)\n @possible_values = args[:possible_values] if args.key?(:possible_values)\n end", "def apply_changes(options = {})\n raise \"No changes can be applied because there are errors.\" if log.errors? and not options[:force]\n log.apply_pending_actions\n @derivative_builds.each { |updater| updater.apply_changes(options.merge(:no_lockfile => true)) }\n @log.clear\n @derivative_builds.clear\n end", "def update!(**args)\n @correct_answers = args[:correct_answers] if args.key?(:correct_answers)\n @general_feedback = args[:general_feedback] if args.key?(:general_feedback)\n @point_value = args[:point_value] if args.key?(:point_value)\n @when_right = args[:when_right] if args.key?(:when_right)\n @when_wrong = args[:when_wrong] if args.key?(:when_wrong)\n end", "def update!(**args)\n @datapoint = args[:datapoint] if args.key?(:datapoint)\n @distance = args[:distance] if args.key?(:distance)\n end", "def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n @local = args[:local] if args.key?(:local)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @candidates = args[:candidates] if args.key?(:candidates)\n @query = args[:query] if args.key?(:query)\n @weight = args[:weight] if args.key?(:weight)\n end", "def update!(**args)\n @apply_all = args[:apply_all] if args.key?(:apply_all)\n @node_ids = args[:node_ids] if args.key?(:node_ids)\n end", "def update_point_activities_and_earned_points(new_points, force=false)\n # if new_points is lower than current earned_points then raise error unless we are forcing the update.\n # NOTE: you should check to ensure points haven't been redeemed before forcing!\n if new_points < self.earned_points && force == false\n raise \"New Points: #{new_points} is less than current Points: #{self.earned_points}, cannot reduce points without 'force' flag\"\n else\n self.point_activities.where(activity_type: 'recognition_recipient').update_all(amount: new_points)\n update_earned_points\n self.user_recipients.map(&:update_all_points!)\n end\n end", "def update!(**args)\n @supports_partial_fulfillment = args[:supports_partial_fulfillment] if args.key?(:supports_partial_fulfillment)\n @supports_synchronous_execution = args[:supports_synchronous_execution] if args.key?(:supports_synchronous_execution)\n end", "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_update = args[:can_update] if args.key?(:can_update)\n @has_pending_edits = args[:has_pending_edits] if args.key?(:has_pending_edits)\n @has_pending_verification = args[:has_pending_verification] if args.key?(:has_pending_verification)\n @is_disabled = args[:is_disabled] if args.key?(:is_disabled)\n @is_disconnected = args[:is_disconnected] if args.key?(:is_disconnected)\n @is_duplicate = args[:is_duplicate] if args.key?(:is_duplicate)\n @is_google_updated = args[:is_google_updated] if args.key?(:is_google_updated)\n @is_local_post_api_disabled = args[:is_local_post_api_disabled] if args.key?(:is_local_post_api_disabled)\n @is_pending_review = args[:is_pending_review] if args.key?(:is_pending_review)\n @is_published = args[:is_published] if args.key?(:is_published)\n @is_suspended = args[:is_suspended] if args.key?(:is_suspended)\n @is_verified = args[:is_verified] if args.key?(:is_verified)\n @needs_reverification = args[:needs_reverification] if args.key?(:needs_reverification)\n end", "def update!(**args)\n @bounds = args[:bounds] if args.key?(:bounds)\n @point = args[:point] if args.key?(:point)\n @point_source = args[:point_source] if args.key?(:point_source)\n end", "def update!(**args)\n @end_point = args[:end_point] if args.key?(:end_point)\n @start_point = args[:start_point] if args.key?(:start_point)\n @weight = args[:weight] if args.key?(:weight)\n @word = args[:word] if args.key?(:word)\n end", "def update!(**args)\n @points = args[:points] if args.key?(:points)\n @timeseries_desc = args[:timeseries_desc] if args.key?(:timeseries_desc)\n end", "def update!(**args)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n @unfulfillable = args[:unfulfillable] if args.key?(:unfulfillable)\n end", "def update!(**args)\n @pred = args[:pred] if args.key?(:pred)\n @value = args[:value] if args.key?(:value)\n end", "def update_auto_apply(conditions, opts = {})\n update_auto_apply_with_http_info(conditions, opts)\n nil\n end", "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_have_business_calls = args[:can_have_business_calls] if args.key?(:can_have_business_calls)\n @can_have_food_menus = args[:can_have_food_menus] if args.key?(:can_have_food_menus)\n @can_modify_service_list = args[:can_modify_service_list] if args.key?(:can_modify_service_list)\n @can_operate_health_data = args[:can_operate_health_data] if args.key?(:can_operate_health_data)\n @can_operate_local_post = args[:can_operate_local_post] if args.key?(:can_operate_local_post)\n @can_operate_lodging_data = args[:can_operate_lodging_data] if args.key?(:can_operate_lodging_data)\n @duplicate_location = args[:duplicate_location] if args.key?(:duplicate_location)\n @has_google_updated = args[:has_google_updated] if args.key?(:has_google_updated)\n @has_pending_edits = args[:has_pending_edits] if args.key?(:has_pending_edits)\n @has_voice_of_merchant = args[:has_voice_of_merchant] if args.key?(:has_voice_of_merchant)\n @maps_uri = args[:maps_uri] if args.key?(:maps_uri)\n @new_review_uri = args[:new_review_uri] if args.key?(:new_review_uri)\n @place_id = args[:place_id] if args.key?(:place_id)\n end", "def update(*points)\n if points[0].is_a?(Array)\n # Cover the least exhaustive, and most likely, nested array check first\n points = points.length == 1 ? points[0] : points.flatten\n elsif points.any? { |p| p.is_a?(Array) }\n points = points.flatten\n end\n return if points.empty? || points.length % 2 != 0\n\n # TODO lock the file\n if points.length == 2\n update_one(points[1], points[0])\n else\n update_many(points)\n end\n end", "def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end", "def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end", "def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end", "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_update = args[:can_update] if args.key?(:can_update)\n @has_pending_verification = args[:has_pending_verification] if args.key?(:has_pending_verification)\n @is_disabled = args[:is_disabled] if args.key?(:is_disabled)\n @is_disconnected = args[:is_disconnected] if args.key?(:is_disconnected)\n @is_duplicate = args[:is_duplicate] if args.key?(:is_duplicate)\n @is_google_updated = args[:is_google_updated] if args.key?(:is_google_updated)\n @is_local_post_api_disabled = args[:is_local_post_api_disabled] if args.key?(:is_local_post_api_disabled)\n @is_pending_review = args[:is_pending_review] if args.key?(:is_pending_review)\n @is_published = args[:is_published] if args.key?(:is_published)\n @is_suspended = args[:is_suspended] if args.key?(:is_suspended)\n @is_verified = args[:is_verified] if args.key?(:is_verified)\n @needs_reverification = args[:needs_reverification] if args.key?(:needs_reverification)\n end", "def apply!(options={})\n should_ignore_conflict = options.fetch(:ignore_conflict, false)\n should_save = options.fetch(:save, true)\n if !should_ignore_conflict\n return false unless applyable?\n end\n apply(options)\n if should_save\n # Maybe too much responsibility?\n # Or, this should be a transaction. Feels bloated.\n development.save if self.save\n end\n end", "def update!(**args)\n @can_enter = args[:can_enter] if args.key?(:can_enter)\n @can_exit = args[:can_exit] if args.key?(:can_exit)\n @feature_id = args[:feature_id] if args.key?(:feature_id)\n @feature_type = args[:feature_type] if args.key?(:feature_type)\n @level_feature_id = args[:level_feature_id] if args.key?(:level_feature_id)\n @metadata = args[:metadata] if args.key?(:metadata)\n @point = args[:point] if args.key?(:point)\n @point_off_segment = args[:point_off_segment] if args.key?(:point_off_segment)\n @point_on_segment = args[:point_on_segment] if args.key?(:point_on_segment)\n @priority = args[:priority] if args.key?(:priority)\n @segment_position = args[:segment_position] if args.key?(:segment_position)\n @unsuitable_travel_mode = args[:unsuitable_travel_mode] if args.key?(:unsuitable_travel_mode)\n end", "def update!(**args)\n @policy_delta = args[:policy_delta] if args.key?(:policy_delta)\n end", "def update!(**args)\n @policy_delta = args[:policy_delta] if args.key?(:policy_delta)\n end", "def update!(**args)\n @update = args[:update] unless args[:update].nil?\n end", "def update!(**args)\n @aggregated_score = args[:aggregated_score] if args.key?(:aggregated_score)\n @is_preferred_direction = args[:is_preferred_direction] if args.key?(:is_preferred_direction)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @retrieval_importance = args[:retrieval_importance] if args.key?(:retrieval_importance)\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @retrieval_importance = args[:retrieval_importance] if args.key?(:retrieval_importance)\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @retrieval_importance = args[:retrieval_importance] if args.key?(:retrieval_importance)\n end", "def update!(**args)\n @operator_options = args[:operator_options] if args.key?(:operator_options)\n @retrieval_importance = args[:retrieval_importance] if args.key?(:retrieval_importance)\n end", "def update_account_points_balance!\n if operation.mechanism == '+'\n account.points = (account.points + self.points)\n elsif operation.mechanism == '-'\n account.points = (account.points - self.points)\n else\n account.points = self.points\n end\n account.save unless account.new_record?\n end", "def update!(**args)\n @allow_all = args[:allow_all] if args.key?(:allow_all)\n @condition = args[:condition] if args.key?(:condition)\n @deny_all = args[:deny_all] if args.key?(:deny_all)\n @enforce = args[:enforce] if args.key?(:enforce)\n @values = args[:values] if args.key?(:values)\n end", "def update!(**args)\n @can_apply = args[:can_apply] if args.key?(:can_apply)\n @can_read = args[:can_read] if args.key?(:can_read)\n @can_remove = args[:can_remove] if args.key?(:can_remove)\n end", "def update!(**args)\n @operations = args[:operations] unless args[:operations].nil?\n end", "def update!(**args)\n @bucketed_final_score = args[:bucketed_final_score] if args.key?(:bucketed_final_score)\n @final_score = args[:final_score] if args.key?(:final_score)\n @policy_applied = args[:policy_applied] if args.key?(:policy_applied)\n @should_prune = args[:should_prune] if args.key?(:should_prune)\n end", "def update!(**args)\n @max_supported_alarms = args[:max_supported_alarms] if args.key?(:max_supported_alarms)\n @restrict_alarms_to_next_day = args[:restrict_alarms_to_next_day] if args.key?(:restrict_alarms_to_next_day)\n @supports_generic_mutations = args[:supports_generic_mutations] if args.key?(:supports_generic_mutations)\n @supports_stop_action = args[:supports_stop_action] if args.key?(:supports_stop_action)\n end", "def update!(**args)\n @goal = args[:goal] if args.key?(:goal)\n @metric_id = args[:metric_id] if args.key?(:metric_id)\n @safety_config = args[:safety_config] if args.key?(:safety_config)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @enforce = args[:enforce] if args.key?(:enforce)\n @validate = args[:validate] if args.key?(:validate)\n end", "def update!(**args)\n @point = args[:point] if args.key?(:point)\n @timeseries_desc = args[:timeseries_desc] if args.key?(:timeseries_desc)\n end", "def update!(**args)\n @enforcement_state = args[:enforcement_state] if args.key?(:enforcement_state)\n @provider = args[:provider] if args.key?(:provider)\n end", "def apply_promotions!\n raise PromotionApplyError unless pending_promotions.empty?\n @promotion_results = Promotion.active.apply!(self)\n apply_adjustments!\n\n # Convert all the applied promotions into an array of decorated\n # promotions.\n @pending_promotions = applied_promotions.map {|p| ::Promotions::Decorator.new(p.promotion)}\n\n # If no promotions have been added to the order, they're all new.\n # Otherwise generate a new collection which is the difference between the\n # existing ones and the new ones.\n if previous_promotion_ids.empty?\n @new_promotions = pending_promotions\n else\n @new_promotions = pending_promotions.reject {|p| previous_promotion_ids.include?(p.id)}\n @existing_promotions = pending_promotions.select {|p| previous_promotion_ids.include?(p.id)}\n end\n\n pending_promotions\n end", "def update!(**args)\n @enforcement_mode = args[:enforcement_mode] if args.key?(:enforcement_mode)\n @evaluation_mode = args[:evaluation_mode] if args.key?(:evaluation_mode)\n @require_attestations_by = args[:require_attestations_by] if args.key?(:require_attestations_by)\n end", "def update!(**args)\n @distance = args[:distance] if args.key?(:distance)\n @explicitness = args[:explicitness] if args.key?(:explicitness)\n @info = args[:info] if args.key?(:info)\n @phrase = args[:phrase] if args.key?(:phrase)\n @prominence = args[:prominence] if args.key?(:prominence)\n @role = args[:role] if args.key?(:role)\n @token = args[:token] if args.key?(:token)\n end", "def update!(**args)\n @objs = args[:objs] if args.key?(:objs)\n @pred = args[:pred] if args.key?(:pred)\n end", "def update!(**args)\n @propagate_only = args[:propagate_only] if args.key?(:propagate_only)\n end", "def update(opts); end", "def update!(**args)\n @fetched = args[:fetched] if args.key?(:fetched)\n @metadata = args[:metadata] if args.key?(:metadata)\n @modifier = args[:modifier] if args.key?(:modifier)\n @shifted = args[:shifted] if args.key?(:shifted)\n end", "def update!(**args)\n @enable_dynamic_position = args[:enable_dynamic_position] if args.key?(:enable_dynamic_position)\n @excluded_filter_keys = args[:excluded_filter_keys] if args.key?(:excluded_filter_keys)\n @facet_key = args[:facet_key] if args.key?(:facet_key)\n @limit = args[:limit] if args.key?(:limit)\n end", "def resolve_update(args)\n ret_val = args.any? ? update(args) : update\n if ret_val == :no_update\n raise NoUpdateError\n else\n ret_val\n end\n end", "def update_user_points(user)\n user.update_attributes(:points => User.update_points(user.id))\n end", "def update!(**args)\n @is_negation = args[:is_negation] if args.key?(:is_negation)\n @obj = args[:obj] if args.key?(:obj)\n @pred = args[:pred] if args.key?(:pred)\n @provenance = args[:provenance] if args.key?(:provenance)\n @qualifier_sets = args[:qualifier_sets] if args.key?(:qualifier_sets)\n @sub = args[:sub] if args.key?(:sub)\n end", "def update!(**args)\n @interval_duration = args[:interval_duration] if args.key?(:interval_duration)\n @points = args[:points] if args.key?(:points)\n end", "def update!(**args)\n @datapoints = args[:datapoints] if args.key?(:datapoints)\n end", "def update!(**args)\n @datapoints = args[:datapoints] if args.key?(:datapoints)\n end", "def update!(**args)\n @argument = args[:argument] if args.key?(:argument)\n @operand = args[:operand] if args.key?(:operand)\n @operator = args[:operator] if args.key?(:operator)\n end", "def update!(**args)\n @absolute_impressions = args[:absolute_impressions] if args.key?(:absolute_impressions)\n @bad_clicks = args[:bad_clicks] if args.key?(:bad_clicks)\n @clicks = args[:clicks] if args.key?(:clicks)\n @good_clicks = args[:good_clicks] if args.key?(:good_clicks)\n @impressions = args[:impressions] if args.key?(:impressions)\n @last_longest_clicks = args[:last_longest_clicks] if args.key?(:last_longest_clicks)\n @unicorn_clicks = args[:unicorn_clicks] if args.key?(:unicorn_clicks)\n @unsquashed_clicks = args[:unsquashed_clicks] if args.key?(:unsquashed_clicks)\n @unsquashed_impressions = args[:unsquashed_impressions] if args.key?(:unsquashed_impressions)\n @unsquashed_last_longest_clicks = args[:unsquashed_last_longest_clicks] if args.key?(:unsquashed_last_longest_clicks)\n end", "def update_and_commit!(docs, options = {})\n update!(docs, options) && commit!\n end", "def update!(**args)\n @allows = args[:allows] if args.key?(:allows)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @allowed = args[:allowed] if args.key?(:allowed)\n @interaction = args[:interaction] if args.key?(:interaction)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def update!(**args)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @is_implied = args[:is_implied] if args.key?(:is_implied)\n @kg_verified = args[:kg_verified] if args.key?(:kg_verified)\n @mentions = args[:mentions] if args.key?(:mentions)\n @pred_mid = args[:pred_mid] if args.key?(:pred_mid)\n @stuff = args[:stuff] if args.key?(:stuff)\n @triple = args[:triple] if args.key?(:triple)\n end", "def update!(**args)\n @deploy_parameters = args[:deploy_parameters] if args.key?(:deploy_parameters)\n @profiles = args[:profiles] if args.key?(:profiles)\n @strategy = args[:strategy] if args.key?(:strategy)\n @target_id = args[:target_id] if args.key?(:target_id)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @pred_mention = args[:pred_mention] if args.key?(:pred_mention)\n @scope_begin = args[:scope_begin] if args.key?(:scope_begin)\n @scope_end = args[:scope_end] if args.key?(:scope_end)\n @scope_fprint = args[:scope_fprint] if args.key?(:scope_fprint)\n @stuff = args[:stuff] if args.key?(:stuff)\n @sub_mention = args[:sub_mention] if args.key?(:sub_mention)\n @value_mention = args[:value_mention] if args.key?(:value_mention)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end" ]
[ "0.59140414", "0.59044755", "0.5802166", "0.562154", "0.5605067", "0.5558084", "0.5539476", "0.5529141", "0.5529141", "0.5529141", "0.5513493", "0.54353195", "0.54353195", "0.5409568", "0.5402883", "0.53843534", "0.5347074", "0.53333074", "0.53333074", "0.53333074", "0.53333074", "0.5330086", "0.53130007", "0.5307158", "0.5302598", "0.5290058", "0.5278027", "0.52650493", "0.5262988", "0.5260812", "0.52236503", "0.5207015", "0.5204924", "0.5201805", "0.5192074", "0.5192074", "0.5192074", "0.5191645", "0.5181897", "0.51740175", "0.5173938", "0.5173938", "0.5169282", "0.5166109", "0.516324", "0.516324", "0.516324", "0.516324", "0.5154128", "0.5145082", "0.51295245", "0.5129403", "0.51270676", "0.51259017", "0.5125814", "0.51255393", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5125318", "0.5119203", "0.51189345", "0.5116144", "0.5113554", "0.51125634", "0.51108885", "0.5109234", "0.51088893", "0.51065165", "0.5089517", "0.50810444", "0.5077105", "0.5073958", "0.50630105", "0.50613755", "0.50606525", "0.50606525", "0.5059918", "0.50488836", "0.5042151", "0.50277865", "0.5027717", "0.50248367", "0.5014202", "0.50097895", "0.5008956", "0.5008216", "0.5008216", "0.5008216", "0.5008216", "0.5008216" ]
0.7238692
0
Look for mutation points in an expression and its children.
def walk(fexp, tree) ftree = Ruote.compact_tree(@ps.current_tree(fexp)) if ftree[0] != tree[0] || ftree[1] != tree[1] # # if there is anything different between the current tree and the # desired tree, let's force a re-apply register(MutationPoint.new(fexp.fei, tree, :re_apply)) elsif ftree[2] == tree[2] # # else, if the tree children are the same, exit, there is nothing to do return else register(MutationPoint.new(fexp.fei, tree, :update)) # # NOTE: maybe a switch for this mutation not to be added would # be necessary... if fexp.is_concurrent? # # concurrent expressions follow a different heuristic walk_concurrence(fexp, ftree, tree) else # # all other expressions are considered sequence-like walk_sequence(fexp, ftree, tree) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_sequence(fexp, ftree, tree)\n\n i = fexp.child_ids.first\n\n ehead = ftree[2].take(i)\n ecurrent = ftree[2][i]\n etail = ftree[2].drop(i + 1)\n head = tree[2].take(i)\n current = tree[2][i]\n tail = tree[2].drop(i + 1)\n\n if ehead != head\n #\n # if the name and/or attributes of the exp are supposed to change\n # then we have to reapply it\n #\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n return\n end\n\n if ecurrent != current\n #\n # if the child currently applied is supposed to change, let's walk\n # it down\n #\n walk(@ps.fexp(fexp.children.first), current)\n end\n\n #if etail != tail\n # #\n # # if elements are added at the end of the sequence, let's register\n # # a mutation that simply changes the tree (no need to re-apply)\n # #\n # register(MutationPoint.new(fexp.fei, tree, :update))\n #end\n end", "def process_sexp pt\n filter_sexp(pt).deep_each do |node|\n next :skip if node.none? { |sub| Sexp === sub }\n next :skip if node.mass < self.mass_threshold\n\n self.hashes[node.structural_hash] << node\n\n process_fuzzy node, option[:fuzzy] if option[:fuzzy]\n end\n end", "def walk_concurrence(fexp, ftree, tree)\n\n if ftree[2].size != tree[2].size\n #\n # that's lazy, but why not?\n #\n # we could add/apply a new child...\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n\n else\n #\n # if there is a least one child that replied and whose\n # tree must be changes, then re-apply the whole concurrence\n #\n # else try to re-apply only the necessary branch (walk them)\n\n branches = ftree[2].zip(tree[2]).each_with_object([]) { |(ft, t), a|\n #\n # match child expressions (if not yet replied) with current tree (ft)\n # and desired tree (t)\n #\n cfei = fexp.children[a.size]\n cexp = cfei ? @ps.fexp(cfei) : nil\n a << [ cexp, ft, t ]\n #\n }.select { |cexp, ft, t|\n #\n # only keep diverging branches\n #\n ft != t\n }\n\n branches.each do |cexp, ft, t|\n\n next if cexp\n\n # there is at least one branch that replied,\n # this forces re-apply for the whole concurrence\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n return\n end\n\n branches.each do |cexp, ft, t|\n #\n # we're left with divering branches that haven't yet replied,\n # let's walk to register the mutation point deep into it\n\n walk(cexp, t)\n end\n end\n end", "def find_candidates\n scout(exp: expression, depth: 0)\n end", "def mutate_child(index, mutator = Mutator, &block)\n block ||= ->(_node) { true }\n child = children.at(index)\n mutator.each(child, self) do |mutation|\n next unless block.call(mutation)\n emit_child_update(index, mutation)\n end\n end", "def children\n [@operand]\n end", "def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end", "def expr(path_stack, nodeset, context = T.unsafe(nil)); end", "def replace_expressions!(node2rep)\n # First recurse on the child.\n res = self.child.replace_expressions!(node2rep)\n # Is there a replacement to do?\n rep = node2rep[self.child]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.child\n # node.set_parent!(nil)\n self.set_child!(rep)\n # And register the replacement.\n res[node] = rep\n end\n return res\n end", "def expr_members\n []\n end", "def expressions; end", "def scopify(expr)\n expr = insert_b(expr)\n @i = 0\n n_expr = \"\"\n last_empty = 0\n open_b = 0\n open_p_b = 0\n open_m_b = 0\n eq = false\n stack = Array.new\n last_e = Array.new\n state = 0\n while @i < expr.size\n case expr[@i]\n # Each part between brackets is seen as a subexpression\n # and it is analyzed recoursively.\n when '('\n scp = Scp.new\n n_expr += expr[@i] + scp.scopify(extract(expr[(@i + 1)...expr.length])) \n @i += scp.count \n when /[\\*\\/]/\n # If there are open brackets of higher opertions\n # it closes them\n if open_m_b > 0\n n_expr += ')' * open_m_b\n last_empty = last_e.pop\n open_m_b = 0\n #open_b -= 1\n end\n if state == 2\n n_expr += ')' * open_p_b\n open_p_b = 0\n state = (stack.size > 0 ? stack.pop : 0)\n end\n # If it is not still analyzing a multiplication, it adds the brackets \n # following the rules\n unless state == 1\n n_expr.insert last_empty, '(' \n state = 1\n open_b += 1\n end\n n_expr += expr[@i]\n last_empty = n_expr.size # + 1\n when /[\\+\\-]/\n # higher priority operation brackets are closed\n # last_empty is shifted\n n_expr += ')' * open_p_b if open_p_b > 0\n n_expr += ')' * open_b if open_b > 0\n state = 0\n open_b = 0\n open_p_b = 0\n n_expr += expr[@i]\n last_empty = n_expr.size\n when /\\^/\n # It begins to put between brackets the operation and its exponent\n if open_m_b > 0 then\n n_expr += \")\" * open_m_b\n last_empty = last_e.pop\n #open_b -= 1\n open_m_b = 0\n end\n n_expr.insert last_empty, '(' unless state == 2\n last_empty += 1 unless state == 2\n n_expr += expr[@i] + (expr[@i+1] == '(' ? '' : '(')\n open_p_b += (expr[@i+1] == '(' ? 1 : (state == 2 ? 1:2))\n stack.push state unless state == 2\n state = 2\n when /\\=/\n # The expression at the left of `=` is put between brackets\n # and a bracket at the right is opened\n # It closes previously opened brackets\n n_expr += ')' * open_p_b if open_p_b > 0\n n_expr += ')' * open_b if open_b > 0\n n_expr += ')' * open_m_b if open_m_b >0\n open_b = 0\n open_p_b = 0\n open_m_b = 0\n n_expr = '(' + n_expr + ')' + expr[@i]\n n_expr += '('\n last_empty = n_expr.size\n state = 0\n eq = true\n when /\\>/\n n_expr += ')' * open_p_b if open_p_b > 0\n n_expr += ')' * open_b if open_b > 0\n open_b = 0\n open_p_b = 0\n n_expr = '(' + n_expr + ')' + expr[@i]\n last_empty = n_expr.size\n when /\\:/\n n_expr.insert last_empty, '('\n n_expr += expr[@i]\n last_k = n_expr[(last_empty+1)...n_expr.size]\n open_m_b += 1 if \"mx:integ:as:from:\".include? last_k\n last_e.pop if last_e.count > 0 and (last_k == \"mx:\" or last_k == \"integ:\")# or last_k == \"solve:\")\n last_e.push last_empty if last_k == \"mx:\" or last_k == \"integ:\"# or last_k == \"solve:\"\n last_empty = n_expr.size\n open_b += 1 unless \"mx:integ:as:from:\".include? last_k\n when /\\\"/\n n_expr += expr[@i]\n @i += 1\n n_expr += discard(expr)\n last_empty = n_expr.length\n when /\\~/\n n_expr += ')' * open_p_b if open_p_b > 0\n n_expr += ')' * (open_b - 1 ) if open_b - 1 > 0\n open_p_b = 0\n open_b = 1\n state = (stack.size > 0 ? stack.pop : 0)\n n_expr += expr[@i]\n last_empty = n_expr.size \n else\n n_expr += expr[@i]\n end\n @i += 1\n end\n # it closes all the opened brackets\n n_expr += ')' * open_m_b if open_m_b > 0\n n_expr += ')' * open_p_b if open_p_b > 0\n n_expr += ')' * open_b if open_b > 0\n n_expr += ')' if eq\n return n_expr\n end", "def prune_exp_children(children, mode, swap:)\n seen = MODE_NONE\n filtered_children = []\n children.each do |child|\n child_exp, child_seen = prune_exp(child, mode, :swap => swap)\n seen |= child_seen\n filtered_children << child_exp if child_exp\n end\n [filtered_children, seen]\n end", "def check_children(ast)\n check_has_only_assoc_children ast\n ast.children.each do |child_ast|\n check_assoc_child_has_two_children child_ast\n end\n end", "def parse_expression_statement\n expr = parse_expression\n stmt = node(:expression_statement, expression: expr)\n stmt = expect_statement_modifier(stmt) if statement_modifier?\n expect_terminator # NOTE: maybe it should be dropped?\n stmt\n end", "def element_match(tree, exp, bindings); end", "def test_2WheresExpression\n \n assert_nothing_thrown(\"Creating AST objects\") { \n \n # Set debug log level\n Common::Logger.setLogLevel(Common::VAR_DEBUG)\n \n var_AST = AST.new(\"sampledata/data.xml\")\n \n #((emp.address) where number==50).(street) \n expression = WhereExpression.new(\n DotExpression.new( \n NameExpression.new(\"emp\"), \n NameExpression.new(\"address\")), \n EqualExpression.new(\n NameExpression.new(\"number\"), \n IntegerTerminal.new(50)))\n \n expression.execute(var_AST)\n \n assert_equal(\"SBA35\", var_AST.VAR_QRES().pop().dereference(var_AST.VAR_STORE()).VAR_ID())\n \n expression = WhereExpression.new(\n DotExpression.new( \n NameExpression.new(\"emp\"), \n NameExpression.new(\"address\")), \n GreatherExpression.new(\n NameExpression.new(\"number\"), \n IntegerTerminal.new(48)))\n \n expression.execute(var_AST)\n \n result = var_AST.VAR_QRES().pop()\n \n assert_equal(\"SBA49\", result.pop().dereference(var_AST.VAR_STORE()).VAR_ID())\n assert_equal(\"SBA35\", result.pop().dereference(var_AST.VAR_STORE()).VAR_ID())\n }\n end", "def calculated_siblings_position\n self.self_and_siblings.where('position < ?', self.position).count\n end", "def accept(evaluator)\n evaluator.exprs(self)\n end", "def update_position\n xsub = find{ |n| n.respond_to?(:position) }\n position = xsub.position if xsub\n end", "def generate_children_coordinates(x,y)\n child_coordinates = []\n MOVEMENT_DIFF.each do |dx, dy|\n move = [x+dx, y+dy]\n child_coordinates << move if within_limits?(move)\n end\n child_coordinates\n end", "def leaves\n\n expressions.inject([]) { |a, exp|\n a.select { |e| ! exp.ancestor?(e.fei) } + [ exp ]\n }\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n return_value = ExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n member220 = nil\n assignment_op221 = nil\n expression222 = nil\n conditional223 = nil\n\n\n begin\n # at line 556:3: ( ( member assignment_op )=> member assignment_op expression | conditional )\n alt_50 = 2\n alt_50 = @dfa50.predict( @input )\n case alt_50\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 556:5: ( member assignment_op )=> member assignment_op expression\n @state.following.push( TOKENS_FOLLOWING_member_IN_expression_3699 )\n member220 = member\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, member220.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_assignment_op_IN_expression_3701 )\n assignment_op221 = assignment_op\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( assignment_op221.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_3704 )\n expression222 = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression222.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 557:5: conditional\n @state.following.push( TOKENS_FOLLOWING_conditional_IN_expression_3710 )\n conditional223 = conditional\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, conditional223.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 46 )\n\n end\n \n return return_value\n end", "def immediate_subqueries\n my_nodes_tagged(:subquery)\n end", "def immediate_subqueries\n my_nodes_tagged(:subquery)\n end", "def update( search_nodes )\n if has_target_predicate? then\n search_nodes.each do |node|\n if node.slot_filled?(@slot_name) then\n unless @target_predicate.apply(node[@slot_name].to_a).empty?\n yield( node )\n end \n end\n end\n else\n search_nodes.each do |node|\n yield( node )\n end\n end\n end", "def expr_subst!(new_members)\n self\n end", "def root_expressions\n\n roots = @expressions.select { |e| e.h.parent_id == nil }\n\n roots = roots.each_with_object({}) { |e, h|\n h[\"#{e.h.fei['expid']}__#{e.h.fei['subid']}\"] = e\n }\n\n roots.keys.sort.collect { |k| roots[k] }\n end", "def get_sexp ast, only_structure\n sexp = ''\n if ast.call? and not only_structure\n sexp = '( ' + ast.method_name.source + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n elsif ast.loop?\n sexp = '( iter' + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n elsif ast.condition?\n sexp = '( cond' + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n else\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n end\n sexp\nend", "def no_diffs\n mutations.select { |mutation| mutation.source.eql?(example.source) }\n end", "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "def positions(passes) = passes.map { find_position(_1) }", "def test_expression_clone_named_group\n root = RP.parse('^(?<somename>a)+bc$')\n copy = root.clone\n\n root_1 = root.expressions[1]\n copy_1 = copy.expressions[1]\n\n # The names are equal but their objects are not.\n assert_equal copy_1.name, root_1.name\n refute_equal copy_1.name.object_id, root_1.name.object_id\n\n # Verify super: text objects should be different.\n assert_equal copy_1.text, root_1.text\n\n # Verify super: expressions arrays are not equal.\n refute_equal copy_1.expressions.object_id,\n root_1.expressions.object_id\n\n # Verify super: expressions in the arrays are not equal.\n copy_1.expressions.each_with_index do |exp, index|\n refute_equal exp.object_id,\n root_1.expressions[index].object_id\n end\n end", "def def_mutation_method(*meths)\n meths.each do |meth|\n instance_eval(\"def #{meth}!(*args, &block); mutation_method(:#{meth}, *args, &block) end\")\n end\n end", "def variables\n\n @root_expression && @root_expression.variables\n end", "def expr_subst(new_members)\n self\n end", "def process_inside_interp exp\n exp.map! do |e|\n if node_type? e, :evstr\n e.value = process_interp_output e.value\n e\n else\n e\n end\n end\n\n exp\n end", "def map_expressions!(&ruby_block)\n @expressions.map! do |expression|\n expression = ruby_block.call(expression)\n expression.parent = self unless expression.parent\n expression\n end\n end", "def pointers\n lambda {|branch| branch.full[/->/]}\n end", "def split_equatation_into_expressions equatation\n expressions = []\n\n expression = []\n\n equatation.each do |value|\n if value == '='\n expressions.push expression\n\n expression = []\n else\n expression.push value\n end\n end\n\n expressions.push expression\n\n expressions\nend", "def context_node_neighbours(contextual_ast, depth=1)\n # TODO depth can be root\n target_node_sibling = contextual_ast.context_nodes[depth]\n node_to_be_searched = contextual_ast.context_nodes[depth - 1]\n previous_children = []\n node_to_be_searched.children.map do |child|\n break if child == target_node_sibling\n previous_children << child\n end\n previous_children\n end", "def check_deductions(node)\n return if @explored_nodes.include? node\n\n all_neighbors_known = node.cartesian_neighbors.map do |neighbor|\n voter.known?(node, neighbor)\n end.inject(:&)\n\n if all_neighbors_known\n @deduced_nodes << node\n end\n end", "def rewrite_exp(t); rewrite(t.children[0]); end", "def check_expr(expr)\n stack = []\n\n expr.each do |e|\n if e.is_a? Fixnum\n stack.push e\n else\n b = stack.pop\n a = stack.pop\n\n case e\n when '+' then stack.push(a + b)\n when '*' then stack.push(a * b)\n when '-' then\n return false if b > a\n stack.push(a - b)\n else\n return false if b == 0 or a % b != 0\n stack.push(a / b)\n end\n end\n end\n\n stack.pop == @hand.target_card\n end", "def get_statement(ast, count=1)\n result = []\n n = -1\n iters = Array.new(count) {|e| n += 2 }\n iters.each do |i|\n result << ast.children[i]\n end\n result.each {|n| n.remove_from_parent! }\n result\nend", "def spot_opcall_for_name\n nd_recv, op, nd_arg = @node.children\n fetch_line(nd_recv.last_lineno)\n if nd_arg\n # binary operator\n if @snippet.match(/\\G[\\s)]*(#{ Regexp.quote(op) })/, nd_recv.last_column)\n @beg_column = $~.begin(1)\n @end_column = $~.end(1)\n end\n else\n # unary operator\n if @snippet[...nd_recv.first_column].match(/(#{ Regexp.quote(op.to_s.sub(/@\\z/, \"\")) })\\s*\\(?\\s*\\z/)\n @beg_column = $~.begin(1)\n @end_column = $~.end(1)\n end\n end\n end", "def replace_expressions!(node2rep)\n # First recurse on the children.\n res = self.value.replace_expressions!\n # Is there a replacement to do on the value?\n rep = node2rep[self.value]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.value\n # node.set_parent!(nil)\n self.set_value!(rep)\n # And register the replacement.\n res[node] = rep\n end\n\n return res\n end", "def get_child_positions\n @children.map { |x| x.idx }\n end", "def process_call exp\n target = get_target exp.target\n method = exp.method\n\n process_call_args exp\n\n if match(@find_targets, target) and match(@find_methods, method)\n\n if @current_template\n @calls << Sexp.new(:result, @current_template, exp).line(exp.line)\n else\n @calls << Sexp.new(:result, @current_module, @current_class, @current_method, exp).line(exp.line)\n end\n\n end\n\n # Normally FindCall won't match a method invocation that is the target of\n # another call, such as:\n #\n # User.find(:first, :conditions => \"user = '#{params['user']}').name\n #\n # A search for User.find will not match this unless @in_depth is true.\n if @in_depth and call? exp.target\n process exp.target\n end\n\n exp\n end", "def elaborating_theorems_for(expr)\n subexpressions = (subexpressions_for(expr)).uniq\n tautologies_for(subexpressions)\n end", "def traverse_sexp(sexp, original_sexp)\n if sexp.is_a? Sexp and sexp[0] != :stmts\n \n if sexp[0] == :block\n @event_manager.fire_event(:block_opened, nil)\n end\n\n sexp.each { |a| traverse_sexp(a, original_sexp) }\n\n if sexp[0] == :block\n @event_manager.fire_event(:block_closed, nil)\n end\n\n @event_manager.fire_event(\"#{sexp[0]}_translated\".to_sym,\n EventStruct.new(sexp, original_sexp)) \n end \n end", "def expression_parts\n find_related_frbr_objects( :contains, :which_expressions?) \n end", "def check_parens(expr_arr)\n # set up\n nest = [] # Will hold the brackets from expr_arr. Form [[bracket, i, j, match j]]\n # where i is index in nest, j is index in expr_arr\n stack = [] # array used like stack\n nest_index = 0 # used to track our position in nest. I would use nest.shift,\n # but I need to preserve nest because it has the info I want to return\n count = 0 # used to set i from above\n\n # put brackets from expression into nest\n expr_arr.each_index do |j|\n if PAIRS.key?(expr_arr[j]) or PAIRS.value?(expr_arr[j])\n nest.push([expr_arr[j], count, j, nil])\n count += 1\n end\n end\n\n # if there are no brackets, return\n if nest.length == 0\n return nest\n end\n\n # initialize stack\n stack.push(nest[nest_index])\n nest_index += 1\n\n # This loop checks if current bracket in nest matches top of stack. deletes them\n # if yes, adds bracket from nest to stack if no\n until nest_index == nest.length do\n # If stack is empty, init again\n if stack.empty?\n stack.push(nest[nest_index])\n nest_index += 1\n end\n\n # if match found, save index and pop stack\n # remember: [0] is bracket, [1] is index in nest, [2] is index in expr_arr\n # and [3] is index of match in expr_arr\n if PAIRS[stack.last[0]] == nest[nest_index][0]\n nest[stack.last[1]][3] = nest[nest_index][2]\n nest[nest_index][3] = stack.last[2]\n nest_index += 1\n stack.pop\n else\n stack.push(nest[nest_index])\n nest_index += 1\n end\n end\n\n # if stack empty after getting to end of nest, nest is valid\n if stack.empty?\n return nest\n else\n return nil\n end\nend", "def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end", "def safe_column_exprs leaves, use_table_name = nil\n leaves.map{|leaf| safe_column_expr(leaf, table_prefix(leaf, use_table_name))}\n end", "def verify!(current_node, previous_node)\n if moving_after_alias?(current_node, previous_node)\n ignore_node(current_node)\n raise_warning!(current_node.method_name, previous_node.method_name)\n end\n if moving_after_alias?(previous_node, current_node)\n ignore_node(previous_node)\n raise_warning!(previous_node.method_name, current_node.method_name)\n end\n end", "def replace_expressions!(node2rep)\n # First recurse on the children.\n res = {}\n self.each_node do |node|\n res.merge!(node.replace_expressions!(node2rep))\n end\n # Is there a replacement to do on the value?\n rep = node2rep[self.match]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.match\n # node.set_parent!(nil)\n self.set_match!(rep)\n # And register the replacement.\n res[node] = rep\n end\n\n return res\n end", "def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end", "def match_children(visitor, nodes)\n # the parent nodes\n p1, p2 = nodes\n # this visitor's children\n c1 = visitor.node_children(p1)\n c2 = p2 ? visitor.node_children(p2) : []\n \n # Apply the matcher block on each of this visitor's children and the other children.\n # If no block is given, then group the children by index, which is the transpose of the array of\n # children arrays.\n if block_given? then\n # Match each item in the first children array to an item from the second children array using\n # then given block.\n matches = yield(c1, c2)\n c1.map { |c| [c, matches[c]] }\n else\n # Ensure that both children arrays are the same size.\n others = c2.size <= c1.size ? c2.fill(nil, c2.size...c1.size) : c2[0, c1.size]\n # The children grouped by index is the transpose of the array of children arrays.\n [c1, others].transpose\n end\n end", "def eliminate_negated_parent_child_additions_and_removals!\n (parents_to_add & parents_to_remove).tap do |negated_parents|\n parents_to_add.reject! { |dobj| negated_parents.include?(dobj) }\n parents_to_remove.reject! { |dobj| negated_parents.include?(dobj) }\n end\n (children_to_add & children_to_remove).tap do |negated_children|\n children_to_add.reject! { |dobj| negated_children.include?(dobj) }\n children_to_remove.reject! { |dobj| negated_children.include?(dobj) }\n end\n end", "def each_subexp(include_root = true, &block)\n yield self if include_root\n each do |child|\n if child.is_a?(Sexp)\n child.each_subexp(&block)\n end\n end\n end", "def preprocess_statement(statement)\n #add_debug {\"preprocess: #{statement.inspect}\"}\n return unless statement.context == graph_name\n bump_reference(statement.subject)\n bump_reference(statement.object)\n @subjects[statement.subject] = true\n get_curie(statement.subject)\n get_curie(statement.predicate)\n get_curie(statement.object)\n get_curie(statement.object.datatype) if statement.object.literal? && statement.object.has_datatype?\n end", "def first_position_from_expression(node)\n expression = node.loc.expression\n if node.parent && node.parent.loc.expression.line != expression.line\n expression.begin_pos - expression.column\n else\n expression.begin_pos\n end\n end", "def within_interpolation?(node, child)\n parse_tree_child_loc = child.expression\n\n interpolation_locs(node).any? { |il| il.overlaps?(parse_tree_child_loc) }\n end", "def within_interpolation?(node, child)\n parse_tree_child_loc = child.expression\n\n interpolation_locs(node).any? { |il| il.overlaps?(parse_tree_child_loc) }\n end", "def collect_variables\n @expression.collect_variables.uniq\n end", "def step3_when_ok ref, idx_in_union, concat, decision, token\n # pop stolen off of root, pop onto concat where reference once was\n if ! ref.parent? || ref.parent != concat\n no('sukland')\n end\n stolen = remove_child root_union, idx_in_union, :signed_by => concat\n idx_in_concat = ref.index_in_parent_assert\n refo = replace_child concat, idx_in_concat, stolen\n no('no') if refo.object_id != ref.object_id\n refo.parent_id = concat.parse_id\n refo.to_tombstone!\n root_union.prune!(:signed_by => concat)\n refo = nil\n\n # find all of the children for the union symbol that are left\n # recursive children, and add them to this union\n children_productions = root_union.production.children\n # we need to fake it so that the recursive hook is triggered\n root_union.production._building_this_parser = root_union\n idxs_added = []\n children_productions.each_with_index do |prod,idx|\n if ! prod.has_children? then next\n elsif left_recursive_concat_production?(prod)\n new_ref = nil\n cparse = prod.build_parse(\n root_union.parse_context,\n root_union,\n :recursive_hook => lambda do |_prod, _ctxt, _kls, _opts|\n new_ref = Reference.new _prod.building_this_parser\n new_ref\n end\n )\n new_ref.parent_id = cparse.parse_id # dangerous as all getout\n cparse.parent_clear! # dumb\n ridiculous_new_left_recursive_cparse cparse, new_ref\n idxs_added << add_child(root_union, cparse)\n else\n no(\"we have never dealt with this kind of grammar before\")\n end\n end\n root_union.production._building_this_parser = nil\n root_union.hook_once_after_union_take! do |up, take_decision, token|\n # this makes some assumptions about the beginning state of\n # the new concat\n # just to get it in the running\n take_decision.idxs_open.concat(idxs_added)\n end\n end", "def exp_remove_tokens(exp)\n if exp.kind_of?(Array) # Is this and AND or OR\n exp.each do |e| # yes, check each array item\n exp_remove_tokens(e) # Remove tokens from children\n end\n else\n exp.delete(:token) # Remove :token key from any expression hash\n\n # Chase down any other tokens in child expressions\n if exp[\"not\"]\n exp_remove_tokens(exp[\"not\"])\n elsif exp[\"and\"]\n exp_remove_tokens(exp[\"and\"])\n elsif exp[\"or\"]\n exp_remove_tokens(exp[\"or\"])\n end\n\n end\n end", "def calls(sexp)\n visit_tree sexp,\n lambdacall: ->(x) { puts x.inspect },\n tailcall: ->(x) { puts x.inspect }\nend", "def build_current_children_and_evaluate! opts={}\n these_asserts\n @current.clear\n if (@start_offset > final_offset) # see :note3\n @done = true\n evaluate_ok!\n return nil\n end\n @ok = nil\n @done = false\n @children_productions = production.children\n @ctxt = parse_context\n ([email protected]).each do |idx|\n @current.push idx\n break unless build_this_child_and_keep_going?(idx, opts)\n end\n @children_productions = nil\n @ctxt = nil\n evaluate_ok!\n nil\n end", "def spot_opcall_for_args\n _nd_recv, _op, nd_arg = @node.children\n if nd_arg && nd_arg.first_lineno == nd_arg.last_lineno\n # binary operator\n fetch_line(nd_arg.first_lineno)\n @beg_column = nd_arg.first_column\n @end_column = nd_arg.last_column\n end\n end", "def each_sexp\n self.each do |sexp|\n next unless Sexp === sexp\n\n yield sexp\n end\n end", "def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end", "def extract_declares!\n # Recurse on the statement.\n return self.statement.extract_declares!\n end", "def extract_declares!\n # Recurse on the statement.\n return self.statement.extract_declares!\n end", "def replace_expressions!(node2rep)\n # First recurse on the children.\n res = self.left.replace_expressions!(node2rep)\n res.merge!(self.right.replace_expressions!(node2rep))\n # Is there a replacement to do on the left?\n rep = node2rep[self.left]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.left\n # node.set_parent!(nil)\n self.set_left!(rep)\n # And register the replacement.\n res[node] = rep\n end\n # Is there a replacement to do on the right?\n rep = node2rep[self.right]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.right\n # node.set_parent!(nil)\n self.set_right!(rep)\n # And register the replacement.\n res[node] = rep\n end\n\n return res\n end", "def replace_expressions!(node2rep)\n # First recurse on the children.\n res = self.left.replace_expressions!(node2rep)\n res.merge!(self.right.replace_expressions!(node2rep))\n # Is there a replacement to do on the left?\n rep = node2rep[self.left]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.left\n # node.set_parent!(nil)\n self.set_left!(rep)\n # And register the replacement.\n res[node] = rep\n end\n # Is there a replacement to do on the right?\n rep = node2rep[self.right]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.right\n # node.set_parent!(nil)\n self.set_right!(rep)\n # And register the replacement.\n res[node] = rep\n end\n\n return res\n end", "def expression_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = ExpressionStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n expression_list37 = nil\n statement_end38 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 315:5: expression_list statement_end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_expression_statement_2099 )\n expression_list37 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list37.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_end_IN_expression_statement_2101 )\n statement_end38 = statement_end\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return return_value\n end", "def visit_call_expr(expr)\n callee = evaluate expr.callee\n\n # Apply the block to each item in expr.arguments\n # and construct a new list from the results.\n # Ruby:\n # https://ruby-doc.org/core-2.7.0/Enumerable.html#method-i-map\n # https://ruby-doc.org/core-2.7.0/Array.html#method-i-map\n # Java 8 streams:\n # https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#map-java.util.function.Function-\n arguments = expr.arguments.map do |argument|\n evaluate argument\n end\n\n unless callee.is_a?(LoxCallable)\n raise LoxRuntimeError.new(expr.paren, \"Can only call functions and classes.\")\n end\n\n function = callee\n if arguments.size == function.arity\n function.call self, arguments\n else\n message = \"Expected #{function.arity} arguments but got #{arguments.size}.\"\n raise LoxRuntimeError.new(expr.paren, message)\n end\n end", "def examine_context(ctx)\n exp, depth = *find_deepest_iterator(ctx)\n\n if depth && depth > value(MAX_ALLOWED_NESTING_KEY, ctx, DEFAULT_MAX_ALLOWED_NESTING)\n smell = SmellWarning.new(SMELL_CLASS, ctx.full_name, [exp.line],\n \"contains iterators nested #{depth} deep\",\n @source, SMELL_SUBCLASS,\n {NESTING_DEPTH_KEY => depth})\n [smell]\n else\n []\n end\n # BUG: no longer reports nesting outside methods (eg. in Optparse)\n end", "def emit_when_branch_presence_mutations\n return if one?\n when_branches.each_index do |index|\n dup_branches = dup_when_branches\n dup_branches.delete_at(index)\n emit_self(receiver, dup_branches, else_branch)\n end\n end", "def evaluate_tree ast\n n1, op, n2 = ast\n n1 = n1.is_a?(Array) ? evaluate_tree(n1) : n1\n n2 = n2.is_a?(Array) ? evaluate_tree(n2) : n2\n n1.send(op.to_sym, n2)\n end", "def reduce_assertion_sub_pattern(_production, aRange, theTokens, theChildren)\n return_first_child(aRange, theTokens, theChildren)\n end", "def match(statement1, statement2=nil, noisy = false)\n if (ss = [statement1, statement2].compact.size) != @antecedents.size\n if noisy\n return [nil, \"antecedent size (#{@antecedents.size}) doesn't match the arguments size #{ss}\"]\n else\n return nil\n end\n end\n\n if @antecedents.size == 1\n antecedent = @antecedents.first\n pattern, assignments, slots = antecedent.to_hash, {}, {}\n \n pattern.each {|k,v| slots[k] = pattern.delete(k) if PLACEHOLDERS.include?(v) }\n \n [:subject, :object, :predicate].select {|k| pattern[k].nil?}.each {|k| \n msv = slots[k]\n assignments[msv] = statement1.send(k)\n }\n\n pattern = Statement.new(pattern)\n ad_hoc_repo = RDF::Repository.new.insert(statement1)\n if ad_hoc_repo.query(pattern).empty?\n if noisy\n return [nil, \"pattern was #{pattern.inspect} and did not match #{statement1.inspect}\"]\n else\n return nil\n end\n end\n return consequents_from(assignments)\n else\n pattern1, pattern2 = @antecedents.collect(&:to_hash)\n slots, assignments, statement1_assignments, statement2_assignments = {}, {}, {}, {}\n \n pattern1.each {|k,v| (slots.merge!({\"#{k}_1\" => pattern1.delete(k)})) if PLACEHOLDERS.include?(v) }\n pattern2.each {|k,v| (slots.merge!({\"#{k}_2\" => pattern2.delete(k)})) if PLACEHOLDERS.include?(v) }\n \n pattern1, pattern2 = Statement.new(pattern1), Statement.new(pattern2)\n if (pattern1 === statement1) && (pattern2 === statement2)\n\n [:subject, :object, :predicate].select {|k| pattern1.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_1\"]\n assignments[msv] = statement1.send k\n }\n \n [:subject, :object, :predicate].select {|k| pattern2.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_2\"]\n assignments[msv] = statement2.send k\n }\n return consequents_from(assignments) \n elsif (pattern1 === statement2) && (pattern2 === statement1)\n \n [:subject, :object, :predicate].select {|k| pattern1.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_1\"]\n assignments[msv] = statement2.send(k)\n }\n \n [:subject, :object, :predicate].select {|k| pattern2.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_2\"]\n assignments[msv] = statement1.send(k)\n }\n return consequents_from(assignments)\n else\n if noisy\n return [nil, \"pattern was #{pattern.inspect} and did not match #{[statement1, statement2].inspect}\"]\n else\n return nil\n end\n end\n end\n end", "def replace_expressions!(node2rep)\n # First recurse on the ref.\n res = self.ref.replace_expressions!(node2rep)\n # And and the range.\n res = self.range.first.replace_expressions!(node2rep)\n res = self.range.last.replace_expressions!(node2rep)\n \n # Is there a replacement to on the ref?\n rep = node2rep[self.ref]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.ref\n # node.set_parent!(nil)\n self.set_ref!(rep)\n # And register the replacement.\n res[node] = rep\n end\n # Is there a replacement to on the range first?\n range = self.range\n rep = node2rep[range.first]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = range.first\n # node.set_parent!(nil)\n range.first = rep\n # And register the replacement.\n res[node] = rep\n end\n rep = node2rep[range.last]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = range.last\n # node.set_parent!(nil)\n range.last = rep\n # And register the replacement.\n res[node] = rep\n end\n self.set_range!(range)\n return res\n end", "def update_child_moderation\n if self.changed.include?('moderation_flag') and self.content.has_children?\n self.content.children.each do |child|\n similiar_submissions = Submission.where(content_id: child.id, feed_id: self.feed_id, moderation_flag: self.moderation_flag_was)\n similiar_submissions.each do |child_submission|\n child_submission.update_attributes({moderation_flag: self.moderation_flag, moderator_id: self.moderator_id})\n end\n end\n end\n end", "def positions_not_to_check\n @positions_not_to_check ||= begin\n positions = []\n positions.concat(do_not_check_block_arg_pipes)\n positions.concat(do_not_check_param_default)\n positions.concat(do_not_check_class_lshift_self)\n positions.concat(do_not_check_def_things)\n positions.concat(do_not_check_singleton_operator_defs)\n positions\n end\n end", "def cleanup_phi_nodes\n nodes.dup.each do |node| # dup because we're mutating\n next unless node.is_a?(PhiNode)\n\n if node.inputs.size == 1\n # Remove phi nodes with a single input.\n connect_over(node)\n remove(node)\n elsif node.inputs.map(&:from).uniq.size == 1\n # Remove phi nodes where all inputs are the same.\n producer_edge = node.inputs.first\n consumer_edge = node.outputs.find { |e| !e.to.is_a?(MergeNode) }\n connect(\n producer_edge.from,\n consumer_edge.to,\n :data,\n consumer_edge.label\n )\n remove(node)\n end\n end\n end", "def replace_expressions!(node2rep)\n # First recurse on the children.\n res = {}\n self.each_node do |node|\n res.merge!(node.replace_expressions!(node2rep))\n end\n # Is there a replacement to do on the select?\n rep = node2rep[self.select]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.select\n # node.set_parent!(nil)\n self.set_select!(rep)\n # And register the replacement.\n res[node] = rep\n end\n # Is there a replacement of on a choice.\n self.map_choices! do |choice|\n rep = node2rep[choice]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = choice\n # node.set_parent!(nil)\n # And register the replacement.\n res[node] = rep\n rep\n else\n choice\n end\n end\n return res\n end", "def tree\n @flow_expression.tree\n end", "def parExp_Handler(expr)\n\treturn expression_Handler(expr.expr)\nend", "def parExp_Handler(expr)\n\treturn expression_Handler(expr.expr)\nend", "def expression\n if is_addop($lookahead)\n emitln \"xor %eax, %eax\"\n else\n term\n end\n\n while is_addop($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"+\"\n add\n when \"-\"\n subtract\n else\n expected \"Addop\"\n end\n end\nend", "def find_push_target exp\n if sexp? exp\n if exp.node_type == :lvar and (exp.value == :_buf or exp.value == :_erbout)\n return nil\n elsif exp.node_type == :ivar and exp.value == :@output_buffer\n return nil\n elsif exp.node_type == :call and call? exp.target and\n exp.target.method == :_hamlout and exp.method == :buffer\n\n return nil\n end\n end\n\n super\n end", "def replace_expressions!(node2rep)\n # First recurse on the ref.\n res = self.ref.replace_expressions!(node2rep)\n # And and the index.\n res = self.index.replace_expressions!(node2rep)\n \n # Is there a replacement to on the ref?\n rep = node2rep[self.ref]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.ref\n # node.set_parent!(nil)\n self.set_ref!(rep)\n # And register the replacement.\n res[node] = rep\n end\n # Is there a replacement to on the index?\n rep = node2rep[self.index]\n if rep then\n # Yes, do it.\n rep = rep.clone\n node = self.index\n # node.set_parent!(nil)\n self.set_index!(rep)\n # And register the replacement.\n res[node] = rep\n end\n return res\n end", "def emit_when_branch_mutations\n when_branches.each_with_index do |branch, index|\n Mutator.each(branch) do |mutant|\n branches = dup_when_branches\n branches[index]=mutant\n emit_self(receiver, branches, else_branch)\n end\n end\n end", "def find_examples(node)\n return [] if scope_change?(node)\n\n if example?(node)\n [node]\n else\n examples_in_scope(node)\n end\n end", "def check_disjunctive_assignment(node); end", "def examine_context(ctx)\n exp, depth = *find_deepest_iterator(ctx)\n\n if depth && depth > value(MAX_ALLOWED_NESTING_KEY, ctx, DEFAULT_MAX_ALLOWED_NESTING)\n [SmellWarning.new(self,\n context: ctx.full_name,\n lines: [exp.line],\n message: \"contains iterators nested #{depth} deep\",\n parameters: { count: depth })]\n else\n []\n end\n # BUG: no longer reports nesting outside methods (eg. in Optparse)\n end", "def check_frag_concentrations()\n frag_ops = operations.select {|op| op.input_array(INPUT).samples.map {|s| s.sample_type.name}.uniq.first == 'Fragment'}\n check_concentration frag_ops, input_name = INPUT # From Cloning Libs/Cloning\n end" ]
[ "0.5028328", "0.49640143", "0.48538098", "0.47838336", "0.46897966", "0.4638811", "0.45218676", "0.44956675", "0.4485954", "0.44776696", "0.44717583", "0.44601083", "0.44572666", "0.44524154", "0.44496927", "0.44210798", "0.4416428", "0.4397993", "0.43959162", "0.43831673", "0.4361706", "0.43437767", "0.43382084", "0.43358955", "0.43358955", "0.43193883", "0.4304349", "0.43033278", "0.43019617", "0.4300803", "0.42993793", "0.4278513", "0.42756423", "0.4270838", "0.42578915", "0.42537472", "0.42482367", "0.4219447", "0.4216518", "0.42100823", "0.4206402", "0.4201079", "0.41962713", "0.4190295", "0.4185623", "0.4184152", "0.41804898", "0.41755992", "0.41721776", "0.4170575", "0.4170268", "0.416783", "0.41639948", "0.41535172", "0.41492203", "0.41470793", "0.414693", "0.41450644", "0.41449013", "0.41426066", "0.41425264", "0.41420034", "0.4138356", "0.41376826", "0.41376826", "0.4136495", "0.41363034", "0.4133971", "0.41309977", "0.41307986", "0.41299707", "0.4126574", "0.41214636", "0.41200525", "0.41200525", "0.41192964", "0.41192964", "0.41181943", "0.41115528", "0.4111225", "0.41084215", "0.410013", "0.40968123", "0.40907314", "0.4090653", "0.40906003", "0.40898275", "0.4083353", "0.40808514", "0.40795663", "0.40746117", "0.40746117", "0.4070478", "0.4067419", "0.40656188", "0.40604955", "0.4060168", "0.4053874", "0.40511832", "0.40505686" ]
0.58861315
0
Look for mutation points in a concurrent expression (concurrence or concurrentiterator).
def walk_concurrence(fexp, ftree, tree) if ftree[2].size != tree[2].size # # that's lazy, but why not? # # we could add/apply a new child... register(MutationPoint.new(fexp.fei, tree, :re_apply)) else # # if there is a least one child that replied and whose # tree must be changes, then re-apply the whole concurrence # # else try to re-apply only the necessary branch (walk them) branches = ftree[2].zip(tree[2]).each_with_object([]) { |(ft, t), a| # # match child expressions (if not yet replied) with current tree (ft) # and desired tree (t) # cfei = fexp.children[a.size] cexp = cfei ? @ps.fexp(cfei) : nil a << [ cexp, ft, t ] # }.select { |cexp, ft, t| # # only keep diverging branches # ft != t } branches.each do |cexp, ft, t| next if cexp # there is at least one branch that replied, # this forces re-apply for the whole concurrence register(MutationPoint.new(fexp.fei, tree, :re_apply)) return end branches.each do |cexp, ft, t| # # we're left with divering branches that haven't yet replied, # let's walk to register the mutation point deep into it walk(cexp, t) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findIntersectedPositions(moves)\n moves.inject([[0,0,'N'], [[0,0]].to_set, []]) do |acc, m|\n p = moveToNextPosition acc[0], m\n puts \"p = \" + p.to_s\n newPosition = [p[0], p[1]]\n visitedPositions = acc[1]\n puts \"vp = \" + visitedPositions.size.to_s\n crossedPositions = acc[2]\n if (visitedPositions & newPosition).size > 0\n puts \"contains: \" + newPosition.to_s\n c = crossedPositions + [newPosition]\n else\n c = crossedPositions\n end\n\n pathPositions = allPointsBetween acc[0], newPosition\n [p, visitedPositions + pathPositions, c]\n end\nend", "def check_for_changes_affecting_cached_coverage\n overlap = %w(branching_logic position) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :coverage_cache_busted_at\n end", "def hasDeadlock c\n c.each_index do |i|\n nil while c[i].each{|n| c[i] |= c[n] }.size != c[i].size\n return true if c[i].include? i\n end\n false\nend", "def walk(fexp, tree)\n\n ftree = Ruote.compact_tree(@ps.current_tree(fexp))\n\n if ftree[0] != tree[0] || ftree[1] != tree[1]\n #\n # if there is anything different between the current tree and the\n # desired tree, let's force a re-apply\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n\n elsif ftree[2] == tree[2]\n #\n # else, if the tree children are the same, exit, there is nothing to do\n\n return\n\n else\n\n register(MutationPoint.new(fexp.fei, tree, :update))\n #\n # NOTE: maybe a switch for this mutation not to be added would\n # be necessary...\n\n if fexp.is_concurrent?\n #\n # concurrent expressions follow a different heuristic\n\n walk_concurrence(fexp, ftree, tree)\n\n else\n #\n # all other expressions are considered sequence-like\n\n walk_sequence(fexp, ftree, tree)\n end\n end\n end", "def find_candidates\n scout(exp: expression, depth: 0)\n end", "def testComprehension\n=begin\n yin = proc do |x|\n Transcript.cr\n x\n end.call(Continuation.current)\n\n yang = proc do |x|\n Transcript.nextPut('*')\n x\n end.call(Continuation.current)\n\n yin.call(yang)\n=end\n end", "def watch_for_set; end", "def multiple_thread_eval(expression); end", "def included_in_closures(epsilon_closures, concatenated)\n\t(0..epsilon_closures.length-1).each do |closure_index|\n\t arrayA = epsilon_closures[closure_index].sub\n arrayB = concatenated\n\t # Does an array subtraction either way to identify if there is equality between the arrays\n\t if ((arrayA-arrayB) + (arrayB-arrayA)).empty?\n\t\t#return the index for this equality\n\t\treturn closure_index\n\t end\n\tend\n\treturn -1\n end", "def separate_thread_eval(expression); end", "def live_on(live_cells)\n Set.new(live_cells.select { |p| \n stay_alive?(live_neighbor_count(p, live_cells)) })\nend", "def checkmate(k,a)\n # Checkmate test where king may be: k_attacks - used - king_attaks - cells_behind_the_king\n all = all_position\n p used = [k,a]\n k_attacks = king_position(k).uniq \n a_attacks = (amazon_postion(a) - free_cells(k,a)).uniq\n stand_positions = a_attacks - k_attacks - used\n safe_squares = (all - k_attacks - a_attacks - used).uniq\n ans = stand_positions.reduce([]){ |acc,x| \n if (safe_squares & king_position(x)).empty?\n p x\n acc.push(x) \n end\n acc\n }\n p ans\n ans.size\n \nend", "def compile\n queue = all_members\n while queue.count > 0\n found_strands = queue.shift.cluster_maps.map do |obj|\n obj.strand(false)\n end\n found_strands.reject! { |s| @strands.include?(s) }\n @strands += found_strands\n queue += found_strands.map(&:members).flatten\n end\n evaluate\n end", "def same_committer\n lambda do |es|\n es.each_cons(2)\n .count {|b,a| a.method_length < b.method_length && a.committer != b.committer }\n end\nend", "def process_changes\n GC.start\n add_new_expressions\n process_changed_metadata\n puts 'Done.'\n end", "def split_consonant_cluster\n coda = consonant_queue.clone\n onset = []\n while POSSIBLE_ONSETS.include?([coda.last.try(:symbol)] + onset.map {|phoneme| phoneme.symbol}) do\n onset.unshift coda.pop\n end\n [coda, onset]\n end", "def chart_complexity_tolerance committer, events\n chart_turbulence(events.select {|e| e.committer == committer })\nend", "def mutation( orig, track )\n mutant = orig.clone\n filtered_track = track.find_all { |node| @grammar[ node.symbol ].sn_altering == filter }\n return mutant if filtered_track.empty?\n where = @random.rand( filtered_track.size )\n index = ( filtered_track[where].from + @offset ).divmod( mutant.size ).last\n mutant[ index ] = get_codon_value( mutant, index )\n mutant\n end", "def reconcile_members(source, target)\n [\n source - target,\n target - source,\n source & target\n ]\nend", "def calculate_future_moves(coord)\n possible_transitions = [[2, 1], [2, -1], [1, 2], [-1, 2], \n [-2, 1], [-2, -1], [-1, -2], [1, -2]]\n actual_transitions = []\n possible_transitions.each do |transition|\n new_position = [coord[0]+transition[0], coord[1]+transition[1]]\n if valid_coordinate?(new_position) && [email protected]?(new_position)\n actual_transitions << new_position\n end\n end\n actual_transitions\n end", "def test_extract_preconditions_from_restrictions_ends_concurrent_with\n restrictions = [{ type: \"ECW\", target_id: \"af419470-8365-4dd4-8ab0-8245de8ada73\", negation: false }]\n preconditions = HQMF::PreconditionExtractor.extract_preconditions_from_restrictions(restrictions, @data_criteria_converter_stub)\n preconditions.length.must_equal 1\n preconditions.first.operator.category.must_equal \"TEMPORAL\"\n preconditions.first.operator.type.must_equal \"ECWS\"\n end", "def other_offense_in_same_range?(node); end", "def mutate_individuals\n m = @chromosomes.size\n (0...m).each do |x|\n r = rand(0.0..1.0)\n next if r > @mut_rate\n\n new_chrom = mutate @chromosomes[x].clone\n evaluate_chromosome new_chrom\n @chromosomes << new_chrom\n end\n end", "def check_blocking_pieces(positions) # works fucking brilliantly love it and testing in pry is so fucking great fucking love your workflow\n positions.each_with_index do |move, index| # omg this is using each perfectly, because if it doesn't return inside this helper method it'll just return what was passed to it as is that's what .each is good for - either doing some random action for each enumeration or even more ideally just returning a different value if something inside is different or returning the whole thing if not fucking incredible\n piece = @board.grid[move[0]][move[1]]\n if !piece.is_a?(NullPiece) # only get the moves before the first blocking piece is found, immediately return once/if a non NullPiece is found in the path # if the current position is not a null piece, then return this with a truncated version of the array\n piece.color == self.color ? (return positions.slice(0...index)) : (return positions.slice(0..index)) # check if the piece is of the same color or not - if it is of the same color, then don't include it in possible moves, if not of the same color, include it in the possible moves since you can capture it. Normally you use @color vs self.color but in this case it does seem to be more readable and make more sense to run self.color since you already have an attr_getter for it why not. And perfect use case for a protected method if you didn't need the color anywhere else let's see :) you might not let's do it just because protected methods are so cool # GOD THIS SHIT WORKS SO FUCKING GOOD AHHHHHHH\n end\n end\nend", "def mutations_effect(a_anno, a_gen)\n\n if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length\n $cdna.pos = $locus[a_anno[10]]\n transcript = original()\n exon_starts = a_gen[9].split(',')\n exon_ends = a_gen[10].split(',')\n mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_starts,exon_ends,a_gen[6],a_gen[7])\n a_anno[12] = \"exon#{exon_num}\"\n start_triplet = (mutation_position/3 * 3) - 1\n if start_triplet >= 0\n code = transcript[start_triplet..start_triplet+2]\n pos_in_triplet = mutation_position%3\n original_aa = $codes[code]\n code[pos_in_triplet] = a_anno[4]\n mutated_aa = $codes[code[0..2]]\n if original_aa != mutated_aa\n a_anno[13] = pos_in_triplet + 1\n a_anno[14] = original_aa[:name]\n a_anno[15] = mutated_aa[:name]\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"same_AA\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n else\n if $locus_non_coding[a_anno[10]]\n a_anno[13] = \"ncrna\"\n STDERR.puts a_anno.join(\"\\t\")\n else\n if (a_anno[3].length > a_anno[4].length || a_anno[3].length < a_anno[4].length)\n a_anno[13] = \"indel\"\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"?\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n end\n\nend", "def visit_Arel_Nodes_Lock o, a = nil\n do_visit o.expr, a\n end", "def is_concurrent?\n\n false\n end", "def walk_sequence(fexp, ftree, tree)\n\n i = fexp.child_ids.first\n\n ehead = ftree[2].take(i)\n ecurrent = ftree[2][i]\n etail = ftree[2].drop(i + 1)\n head = tree[2].take(i)\n current = tree[2][i]\n tail = tree[2].drop(i + 1)\n\n if ehead != head\n #\n # if the name and/or attributes of the exp are supposed to change\n # then we have to reapply it\n #\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n return\n end\n\n if ecurrent != current\n #\n # if the child currently applied is supposed to change, let's walk\n # it down\n #\n walk(@ps.fexp(fexp.children.first), current)\n end\n\n #if etail != tail\n # #\n # # if elements are added at the end of the sequence, let's register\n # # a mutation that simply changes the tree (no need to re-apply)\n # #\n # register(MutationPoint.new(fexp.fei, tree, :update))\n #end\n end", "def visit_Arel_Nodes_Lock(o, collector)\n collector\n end", "def compute_cache\n\n\t\t# cache of equality will be stored on @equals\n\t\t# we store if a number if equal to the successor\n\t\t@equals = Array.new( @sequence.size )\n\n\t\t# for every number on the list\n\t\ti = 0\n\t\[email protected] do |left,right|\n\n\t\t\t# We compute and store the equality\n\t\t\t@equals[i] = ( left === right )\n\n\t\t\t# next number!!!\n\t\t\ti += 1\n\n\t\t\t# we return right to continue the reduce\n\t\t\tright\n\t\tend\n\n\t\t# The last number is NOT equal to the successor\n\t\t@equals[ i ] = false\n\tend", "def new_life(live_cells)\n Set.new(nearby_dead_cells(live_cells).select { |p| \n come_alive?(live_neighbor_count(p, live_cells)) })\nend", "def check_frag_concentrations()\n frag_ops = operations.select {|op| op.input_array(INPUT).samples.map {|s| s.sample_type.name}.uniq.first == 'Fragment'}\n check_concentration frag_ops, input_name = INPUT # From Cloning Libs/Cloning\n end", "def enable_mutation_tracking\n @track_mutations = true\n end", "def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end", "def execute *args\n @counter ||= 0\n if @counter == @execution_points.first\n result = @method.call(*args)\n @execution_points.delete_at(0)\n end\n if @counter == @executions\n @counter = nil\n generate_occurances\n else\n @counter += 1\n end\n result\n end", "def closure item_set\n\t\tresult = item_set\n\t\ttemp = nil\n\t\t#continue adding to closure set until it doesn't change\n\t\tuntil temp == result\n\t\t\t#create deep copy of temp\n\t\t\ttemp = Marshal.load(Marshal.dump(result))\n\t\t\ttemp.keys.each do |lhs|\n\t\t\t\ttemp[lhs].each do |rhs|\n\t\t\t\t\tif rhs.index(@marker)\n\t\t\t\t\t\tnext_val = rhs[rhs.index(@marker)+1]\n\t\t\t\t\t\tif non_terminals.include?(next_val)\n\t\t\t\t\t\t\t@production_rules[next_val].each do |rhs|\n\t\t\t\t\t\t\t\t#create temporary rhs so we don't modify the production rules with unshift\n\t\t\t\t\t\t\t\tt_rhs = rhs.clone\n\t\t\t\t\t\t\t\tt_rhs = t_rhs.unshift(@marker)\n\t\t\t\t\t\t\t\tif result[next_val]\n\t\t\t\t\t\t\t\t\tdup = false\n\t\t\t\t\t\t\t\t\tresult[next_val].each do |r|\n\t\t\t\t\t\t\t\t\t\tif r.eql?(t_rhs)\n\t\t\t\t\t\t\t\t\t\t\tdup = true\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tif !dup\n\t\t\t\t\t\t\t\t\t\tresult[next_val].push(t_rhs)\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tresult[next_val] = [t_rhs]\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn result\n\tend", "def valid_move_chain(start_coords, end_coords)\n valid_move_chain = []\n piece = @board[start_coords[0]][start_coords[1]]\n\n if piece.is_a?(Pawn)\n all_potential_moves = piece.theoretical_moves(start_coords[0], start_coords[1], @board)\n else\n all_potential_moves = piece.theoretical_moves(start_coords[0], start_coords[1])\n end\n\n intersecting_move_chain = all_potential_moves.select { |move_chain| move_chain.include?(end_coords) }.first\n return [] if intersecting_move_chain.nil?\n\n #otherwise, step through the move chain looking for obstacles or other issues\n intersecting_move_chain.each do |tile_coords|\n tile = @board[tile_coords[0]][tile_coords[1]]\n if tile_coords == end_coords && ( tile.nil? || tile.color != piece.color )\n valid_move_chain << tile_coords\n return valid_move_chain\n elsif tile.nil?\n valid_move_chain << tile_coords\n else\n return []\n end\n end\n end", "def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end", "def local_producers(point, price)\n @local.participants.dispatchables.select do |producer|\n (producer.cost_strategy.sortable_cost(point) < price) &&\n (producer.max_load_at(point) > producer.load_curve.get(point))\n end\n end", "def reachable_set(entry)\n reachable = Set.new\n todo = [entry]\n while !todo.empty?\n item = todo.pop\n next if reachable.include?(item)\n reachable.add(item)\n successors = yield item\n successors.each do |succ|\n todo.push(succ)\n end\n end\n reachable\n end", "def no_diffs\n mutations.select { |mutation| mutation.source.eql?(example.source) }\n end", "def get_possible_pawn_capture_moves(piece, position)\n position = board.chess_notation_to_coordinates(position)\n\n possible_moves = piece.capture_moves[0..-1] #duplicate piece move list\n possible_moves.map! { |y,x| [y+position[0], x+position[1]] }\n possible_moves.select! { |coordinates| valid_move?(coordinates) }\n\n possible_moves.map { |coordinates| board.coordinates_to_chess_notation(coordinates) }\n end", "def possible_positions?(already_passed = [])\n possible_positions = []\n Knight::VALID_MOVES.each do |move|\n possible_position = already_passed.last.change(move)\n if possible_position.valid? and\n not already_passed.include?(possible_position) and\n not @forbidden_positions.include?(possible_position)\n possible_positions << possible_position\n end\n end\n possible_positions\n end", "def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend", "def mark_assignments_as_referenced_in_loop(node); end", "def cache_ids_xy_no_etp(x,y)\n es = @events\n r = cache_ids_xy(x,y).inject([]) do |a,id| e = es[id]\n a.push(id) if !e.erased && !e.through #&& !e.tb_prod\n end\n r.nil? ? [] : r\n end", "def possible_moves_in_board(position)\n POSSIBLE_MOVES.select do |move|\n x = position[0] + move[0]\n y = position[1] + move[1]\n\n within_board?(x, y)\n end\n end", "def process_sexp pt\n filter_sexp(pt).deep_each do |node|\n next :skip if node.none? { |sub| Sexp === sub }\n next :skip if node.mass < self.mass_threshold\n\n self.hashes[node.structural_hash] << node\n\n process_fuzzy node, option[:fuzzy] if option[:fuzzy]\n end\n end", "def matchingCandidates(token)\n candidates(@currentNode, token)\n end", "def watch_for_set=(_arg0); end", "def plus(reg)\n return lambda do |pos|\n statelist = reg.call(pos)\n curpos = pos + statelist.size\n endstate = { '' => Set.new( [pos, curpos + 1] ) }\n statelist << endstate\n return statelist\n end\nend", "def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end", "def paths_with_complexity_increase\n path_complexity_history.select do |_, complexity_history|\n _, head_complexity = complexity_history.first\n _, previous_complexity = complexity_history.first(2).last\n\n head_complexity > previous_complexity\n end\n end", "def different_committers\n lambda do |es|\n es.each_cons(2)\n .count {|b,a| a.method_length < b.method_length && a.committer == b.committer }\n end\nend", "def comp_let_statements\n # array boolean\n arr = false\n @i += 1 # let\n # variable name for popping value to at end of statement\n var_token = @tokens[@i]\n @i += 1 # var_name\n if @tokens[@i].val == '['\n arr_base = @tokens[@i - 1]\n arr = true\n @i += 1 # [\n comp_expression\n @i += 1 # ]\n # add adresss of array to evaluated expression\n $cw.push_variable(arr_base)\n $cw.push_operator('+')\n $cw.write_operator\n end\n @i += 1 # =\n comp_expression\n @i += 1 # ;\n if arr\n $cw.pop_array\n else\n $cw.pop_variable(var_token)\n end\n nil\n end", "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end", "def find_curious\n z = generate.zip simplify_all\n z.reject! {|x| x.last == nil }\n z.select { |tuple| simplest_form(tuple.first) == simplest_form(tuple.last) && !trivial(tuple.first) }\nend", "def opt(reg)\n return lambda do |pos|\n startstate = { '' => Set.new( [pos + 1] ) }\n\n statelist = [startstate]\n curpos = pos + statelist.size\n\n statelist += reg.call(curpos)\n curpos = pos + statelist.size\n\n startstate[''] << curpos\n\n return statelist\n end\nend", "def compact_mutations!\n used_clevels = {} # hash that lists the consistency levels seen in the batch array. key is the clevel, value is true\n by_key = Hash.new{|h,k | h[k] = {}}\n # @batch is an array of mutation_ops.\n # A mutation op is a 2-item array containing [mutationmap, consistency_number]\n # a mutation map is a hash, by key (string) that has a hash by CF name, containing a list of column_mutations)\n @batch.each do |mutation_op|\n # A single mutation op looks like:\n # For an insert/update\n #[ { key1 => \n # { CF1 => [several of CassThrift:Mutation(colname,value,TS,ttl)]\n # CF2 => [several mutations]\n # },\n # key2 => {...} # Not sure if they can come batched like this...so there might only be a single key (and CF)\n # }, # [0]\n # consistency # [1] \n #]\n mmap = mutation_op[0] # :remove OR a hash like {\"key\"=> {\"CF\"=>[mutationclass1,...] } }\n used_clevels[mutation_op[1]] = true #save the clevel required for this operation\n\n mmap.keys.each do |k|\n mmap[k].keys.each do |cf| # For each CF in that key\n by_key[k][cf] ||= []\n by_key[k][cf].concat(mmap[k][cf]) # Append the list of mutations for that key and CF\n end\n end\n end\n # Returns the batch mutations map, and an array with the consistency levels 'seen' in the batch\n [by_key, used_clevels.keys]\n end", "def watch_comment_by_user_ids\n user_ids = watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n user_ids += repository.watch_by_user_ids\n user_ids.uniq!\n\n user_ids - unwatch_comment_by_user_ids\n end", "def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end", "def closure_of(node_label)\r\n closure = [node_label].flatten\r\n changed = true\r\n while (changed == true)\r\n changed = false\r\n closure.each do |node|\r\n # if there is m not already in C and n->lambda->m then add m to c\r\n if(!@graph_hash[node].nil? && !@graph_hash[node][LAMBDA].nil?)\r\n lambda_reachables = [@graph_hash[node][LAMBDA]].flatten\r\n lambda_reachables.each do |l_node|\r\n if !closure.include?(l_node)\r\n closure << l_node\r\n changed = true\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n return closure #.flatten\r\n end", "def check_deductions(node)\n return if @explored_nodes.include? node\n\n all_neighbors_known = node.cartesian_neighbors.map do |neighbor|\n voter.known?(node, neighbor)\n end.inject(:&)\n\n if all_neighbors_known\n @deduced_nodes << node\n end\n end", "def tt_current\n tt_intersect()\n end", "def find_duplicate(nums)\n intersection = find_first_meeting(nums)\n find_cycle_start(nums,intersection)\nend", "def successors\n return @successors if @successors\n @successors = (data['successors']||[]).map { |s| function.blocks.by_name(s) }.uniq.freeze\n end", "def wait_adding(expr, list_expr)\r\n \r\n if expr.is_a? Nagios::MkLiveStatus::Wait::Object or expr.is_a? Nagios::MkLiveStatus::Wait::Trigger or expr.is_a? Nagios::MkLiveStatus::Wait::Timeout\r\n list_expr.each do |tmp|\r\n if tmp.kind_of? expr.class\r\n raise QueryException.new(\"Only one of each non-wait condition must be set.\")\r\n end\r\n end\r\n end\r\n \r\n list_expr.push expr\r\n \r\n if not @before_wait and not @after_wait and @before_wait.length > 0 and @after_wait.length > 0 \r\n list_expr.pop\r\n raise QueryException.new(\"Wait expression can be set only before OR after filter.\")\r\n end\r\n end", "def check_collisions!\n 1000.times do\n @particles.values.map(&:tick)\n position_groups = @particles.values.group_by(&:position)\n collisions = position_groups.select { |pos, particles| particles.size > 1 }\n collisions.values.flatten.collect(&:num).map { |num| @particles.delete(num) }\n end\n @particles\n end", "def unfinished\n unext = LINE_CONTINUER.match(@chunk) || UNFINISHED_EXPRESSIONS.include?(tag)\n return unext unless prev = @tokens[-1]\n uprev = prev[1].to_s.match(LINE_CONTINUER) || UNFINISHED_EXPRESSIONS.include?(prev[0])\n unext || uprev\n end", "def positions_not_to_check\n @positions_not_to_check ||= begin\n positions = []\n positions.concat(do_not_check_block_arg_pipes)\n positions.concat(do_not_check_param_default)\n positions.concat(do_not_check_class_lshift_self)\n positions.concat(do_not_check_def_things)\n positions.concat(do_not_check_singleton_operator_defs)\n positions\n end\n end", "def calculate_changes(grid, empty_if_greater, occupied_counter)\n grid.points.keys.each_with_object({}) do |coordinate, changes|\n seat_state = grid.at(coordinate)[:state]\n if seat_state != State::FLOOR\n occupied_count = occupied_counter.call(grid, coordinate)\n changes[coordinate] = State::OCCUPIED if occupied_count == 0 && seat_state == State::EMPTY\n changes[coordinate] = State::EMPTY if occupied_count >= empty_if_greater && seat_state == State::OCCUPIED\n end\n end\nend", "def verifyCicle\n $nodos.each { \n |node|\n if(node.entradas.length > 0)\n if(findCicle(node, node.operationId ,Array.new))\n return true\n end\n end\n }\n return false\nend", "def newly_cov_pat gene, cov_pat\n new_cov = Set.new\n return new_cov unless $genes.has_key? gene\n $genes[gene].each { |pat| new_cov << pat unless cov_pat.include? pat }\n new_cov \nend", "def grid_operation_checker(candidate)\n candidate.node_type == :call and\n candidate.sons.first.node_type == :lval and\n (candidate.grid_objects.map {|g_obj| g_obj.name}).include? candidate.sons.first.name\n end", "def collect_all_active_occurences(entity)\n results = []\n queue = []\n entity_transformation = (entity.respond_to?(:transformation)) ? # Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image\n entity.transformation :\n IDENTITY\n queue.push([[entity], entity_transformation])\n until queue.empty?\n path, transformation = *queue.shift\n outer = path.first\n # If the outermost container is already the model, end the search.\n if outer.parent.is_a?(Sketchup::Model) || outer.parent.nil?\n # Check if this occurence of entity is below the active path,\n # that means whether the entity's path contains the active path.\n # Note: Sketchup::Model#active_path returns nil instead of empty array when in global context.\n if entity.model.active_path.nil? || (entity.model.active_path - path).empty?\n # Active path: entity's path is equal or deeper than active path\n results << transformation\n end\n # Otherwise look if it has siblings, ie. the parent has instances with the same entity.\n else\n instances = (outer.is_a?(Sketchup::ComponentDefinition)) ?\n outer.instances :\n (outer.respond_to?(:parent) && outer.parent.respond_to?(:instances)) ? # Sketchup::Drawingelement\n outer.parent.instances :\n [] # Sketchup::Model\n instances.each{ |instance|\n queue.push([[instance].concat(path), instance.transformation * transformation])\n }\n end\n end\n return results\n end", "def encircle(points, debug = false)\n solver = Solver.new(debug)\n points.each { |p| solver.add_point(p) }\n puts \"SOLVED: mec: #{solver.mec}\" if debug\n return solver.mec\nend", "def update_candidates_from(impossible_candidates, backtrack_mode = false)\n prev_cand_count = @candidates.count\n\n if backtrack_mode\n @dirty = true\n if @once\n @backuped_candidates = @candidates\n @once = false\n end\n end\n\n @candidates = (Set.new(@candidates) - Set.new(impossible_candidates)).to_a\n\n\n\n @candidates.count != prev_cand_count\n end", "def watch_until!(value, &block)\n computation = proc do |comp|\n # First fetch the value\n result = call\n\n if result == value\n # Values match\n\n # call the block\n Volt::Computation.run_without_tracking do\n block.call\n end\n\n # stop the computation\n comp.stop\n end\n end.watch!\n\n computation\n end", "def condicion_exp\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n return_value = CondicionExpReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_LOG111__ = nil\n condicion110 = nil\n condicion112 = nil\n\n\n tree_for_OP_LOG111 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 119:4: condicion ( OP_LOG condicion )*\n @state.following.push( TOKENS_FOLLOWING_condicion_IN_condicion_exp_527 )\n condicion110 = condicion\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, condicion110.tree )\n end\n\n # at line 119:14: ( OP_LOG condicion )*\n while true # decision 14\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == OP_LOG )\n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 119:15: OP_LOG condicion\n __OP_LOG111__ = match( OP_LOG, TOKENS_FOLLOWING_OP_LOG_IN_condicion_exp_530 )\n if @state.backtracking == 0\n tree_for_OP_LOG111 = @adaptor.create_with_payload( __OP_LOG111__ )\n @adaptor.add_child( root_0, tree_for_OP_LOG111 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_condicion_IN_condicion_exp_532 )\n condicion112 = condicion\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, condicion112.tree )\n end\n\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n\n end\n\n return return_value\n end", "def blockPoint(forks)\n # this keeps track of the tiles that each fork has in common\n # the most frequent and unoccupied index will be returned\n commonIndicies = forks[0] # initializing\n # intersect each of the forks to find a the tile they all depend on\n for i in 1 ... forks.size\n commonIndicies &= forks[i]\n end\n validPositions = commonIndicies.select {|i| !position_taken?(i)}\n # finds the most frequent index\n return validPositions.max_by {|i| validPositions.count(i)}\n end", "def excise connected_components, gses, gsms\n excisions = 0\n connected_components.each { |c|\n print \"Connected component with #{c.length} GSEs:\\n\"\n c.each { |gse1|\n c.each { |gse2|\n next if (gse1 == gse2) or\n (gsms[gse1].length < gsms[gse2].length) or\n ! gsms[gse1].intersect?( gsms[gse2] )\n\n diff = gsms[gse1] - gsms[gse2]\n if diff.length >= @options.minimum # default: there must be at least 3 samples left\n inter = (gsms[gse1] & gsms[gse2])\n if @excisions\n if @excised[gse1] \n @excised[gse1] = (@excised[gse1] + inter)\n else\n @excised[gse1] = inter\n end\n end\n print \"gsms[#{gse1}]: #{gsms[gse1].length} -> #{diff.length}\\n\"\n if @options.verbose and @options.dictionary\n printf \"removing these GSMs from #{gse1}:\\n\"\n stringify_gsms inter\n end\n gsms[gse1] = diff\n excisions += 1\n end\n }\n }\n }\n\n print \"Number of excisions: #{excisions}\\n\"\n \n print \"\\nPairwise overlaps after excision:\\n\"\n overlapping = overlaps(gses.to_a, gsms, true)\n print \" total overlaps: #{overlapping[0]}\\n\"\n print \" nontrivial overlaps: #{overlapping[1]}\\n\"\n overlapping[1]\nend", "def optimize_every; end", "def points_possible_on_set(set,args)\n c = {}\n [true,false].each { |online|\n [true,false].each { |extra_credit|\n c[[online,extra_credit]] = 0\n set.each { |stream_group|\n stream_group.each { |flag_group|\n flags,probs = flag_group\n is_online = (flags.has_key?(\"o\"))\n is_extra_credit = (flags.has_key?(\"*\")) || flags_contain_letter_in_string(flags,args['ec_if'])\n excluded = flags_contain_letter_in_string(flags,args['exclude_if'])\n if is_online==online && is_extra_credit==extra_credit && !excluded then\n probs.each { |g| # g is individualization group\n c[[online,extra_credit]] += 1 unless $has_solution[[g[0][0],g[0][1]]]\n }\n end\n }\n } # end loop over stream groups\n }\n }\n return c\nend", "def captured_points(range = $capture_distance)\n\t\tchecked_set = []\n\t\tcurrent_set = [@hunter.coords]\n\n\t\tdistance = 0\n\t\t# This collects every nonblocked point next to the current set of points (including diagonals) up to a certain number of moves\n\t\tuntil distance > range || current_set.empty?\n\t\t\tfound_set = ((current_set.map{|c| collect_adjacent_points(c)}.flatten - checked_set) - current_set)\n\t\t\tchecked_set += current_set\n\t\t\tcurrent_set = found_set\n\t\t\tdistance += 1\n\t\tend\n\t\t#\tTake out any points that are outside the CAPTURE DISTANCE in euclidean distance from the hunter, and return the remaining set\n\t\tfinal_set = (checked_set + current_set).reject{|p| distance(@hunter.coords,p) > range}\n\tend", "def eClosure(ss)\nvisited = []\ndiscovered = [ss]\nwhile discovered != []\nn = discovered.pop\nif !(visited.include?(n))\nvisited.push(n)\nsuccessor = get_transition(n, \"\")\nif successor != nil\nsuccessor.each{|s|\nif !(visited.include?(s))\ndiscovered.push(s)\nend\n}\nend\nend\nend\nvisited\nend", "def contributions_with_outstanding_cois\n self.contributions.reject {|c| c.latest_committed_manuscript_coi_form }\n end", "def locked_candidates_2_from_col col, number\n\t\tcol_cells = get_col_cells col\n\t\tcol_cells_with_number = col_cells.select { |i| @candidates[i].include?(number) }\n\t\tif col_cells_with_number.empty?\n\t\t\treturn false\n\t\tend\n\n\t\tcol_cell_blocks = col_cells_with_number.map { |i| get_block i }\n\n\t\tonly_in_block = col_cell_blocks.count(col_cell_blocks[0]) == col_cell_blocks.length ? true : false\n\n\t\tif only_in_block\n\t\t\tnumber_of_deleted_items = 0\n\t\t\tget_block_cells(col_cell_blocks[0]).select { |i| !col_cells_with_number.include?(i) }.each do |i|\n\t\t\t\tdeleted_item = @candidates[i].delete number\n\t\t\t\tnumber_of_deleted_items += 1 if !deleted_item.nil?\n\t\t\tend\n\t\t\treturn true if number_of_deleted_items > 0\n\t\tend\n\n\t\treturn false\n\tend", "def step_2_look_again union, frozen_decision, union_decision, idx, token\n my_parent_concat = self.parent\n no('no') unless self.root_union == union\n @cached_decisions[root_union.parse_context.tic] = frozen_decision\n\n concat_decision = my_parent_concat.look_decision token\n union_decision.add_response! concat_decision.response, idx\n\n if ! my_parent_concat.has_any_hook_once_when_becomes_ok\n size = frozen_decision.idxs_satisfied.size\n if size == 0\n # absolutely nothing!?\n elsif size == 1\n idx_in_union = frozen_decision.idxs_satisfied.last\n my_parent_concat.hook_once_when_becomes_ok do |*args|\n step3_when_ok self, idx_in_union, *args\n end\n else\n no(\"can't collapse recursive reference -- need exactly \"<<\n \"1 and had #{size} winning candidate nodes\")\n end\n end\n nil\n end", "def test_Queue\n queue_alpha = Queue.new('Alpha')\n queue_beta = Queue.new('Beta')\n proc_observer = Proc.new do |queue, operation, item|\n puts \"Proc object observing operation '#{ operation }'\" \\\n \" on queue '#{ queue.name }' with item #{ item }.\"\n end\n queue_alpha.add_observer do |queue, operation, item|\n puts \"Block observing operation '#{ operation }'\" \\\n \" on queue '#{ queue.name }' with item #{ item }.\"\n end\n queue_alpha.add_observer(&proc_observer)\n queue_alpha.add_observer { puts \"Just a casual block observer.\" }\n queue_beta.add_observer(&proc_observer)\n assert_same queue_alpha, queue_alpha.insert(1).insert(2).insert(3)\n assert_same queue_beta, queue_beta.insert(3).insert(4)\n assert_equal 1, queue_alpha.remove\n assert_equal 2, queue_alpha.remove\n assert_equal 3, queue_beta.remove\n assert_equal 4, queue_beta.remove\n assert_equal \\\n \"Block observing operation 'insert' on queue 'Alpha' with item 1.\\n\" \\\n \"Proc object observing operation 'insert' on queue 'Alpha' with item 1.\\n\" \\\n \"Just a casual block observer.\\n\" \\\n \"Block observing operation 'insert' on queue 'Alpha' with item 2.\\n\" \\\n \"Proc object observing operation 'insert' on queue 'Alpha' with item 2.\\n\" \\\n \"Just a casual block observer.\\n\" \\\n \"Block observing operation 'insert' on queue 'Alpha' with item 3.\\n\" \\\n \"Proc object observing operation 'insert' on queue 'Alpha' with item 3.\\n\" \\\n \"Just a casual block observer.\\n\" \\\n \"Proc object observing operation 'insert' on queue 'Beta' with item 3.\\n\" \\\n \"Proc object observing operation 'insert' on queue 'Beta' with item 4.\\n\" \\\n \"Block observing operation 'remove' on queue 'Alpha' with item 1.\\n\" \\\n \"Proc object observing operation 'remove' on queue 'Alpha' with item 1.\\n\" \\\n \"Just a casual block observer.\\n\" \\\n \"Block observing operation 'remove' on queue 'Alpha' with item 2.\\n\" \\\n \"Proc object observing operation 'remove' on queue 'Alpha' with item 2.\\n\" \\\n \"Just a casual block observer.\\n\" \\\n \"Proc object observing operation 'remove' on queue 'Beta' with item 3.\\n\" \\\n \"Proc object observing operation 'remove' on queue 'Beta' with item 4.\\n\", \\\n @out.string\n end", "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end", "def prevent_comp_cell_duplicates\n \n operations.each do |op| \n op.associate :original_item_number, \"The item number that was assigned in designer before the redistribution is #{op.input(\"Parent\").item.id}\"\n end\n \n # arr that stores operations that take an unavailable comp cell\n errored_op_arr = []\n \n # group all operations by item \n item_group = operations.group_by{ |op| op.input(\"Parent\").sample }\n \n # go through each operation and change it to an item within that sample\n item_group.each do |sample, op_arr|\n # find items where the sample is the same and container is a comp cell\n sample_list = Item.where(sample_id: Sample.find_by(name: sample.name)).where(object_type_id: ObjectType.find_by(name: 'Yeast Competent Cell')).where.not(location: 'deleted').to_a\n # get the available comp cells and replace them in the operatoin\n first_in_sample_list = sample_list.first\n op_arr.each do |op|\n if op.input(\"Parent\").item != first_in_sample_list\n sample_list.delete(op.input(\"Parent\").item)\n \n end\n end\n op_arr.each do |op|\n if (op.input(\"Parent\").item == first_in_sample_list)\n # get comp cells starting from oldest to newest\n next_item = sample_list.shift()\n # if there are more operations using a sample than there are items using a sample\n if next_item.nil?\n op.error :not_enough_items, \"There are not enough items with this sample to evenly distribute between all operations\"\n errored_op_arr.push(op)\n end\n op.input(\"Parent\").set item: next_item\n end\n end\n end\n \n # if there are errored ops, tell technician about em\n if errored_op_arr.length > 0 \n show do\n title \"Errored operations due to not enough items to distribute\"\n warning \"These operations were errored out because there were not enough items with this sample to evenly distribute\"\n warning \"Notify a lab manager about this situation\"\n errored_op_arr.each do |op|\n note \"Operation id: #{op.id}\"\n end\n end\n end\n end", "def check_for_changes_affecting_cached_pdfs\n overlap = %w(branching_logic position requirement) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :pdf_cache_busted_at\n end", "def precondition(_op)\n range = (50...100)\n _op = Operation.find(_op.id)\n valid_conc?(_op, range)\nend", "def process_scope exp\n # NOPE?\n end", "def same_curriculum_and_mandatory\n @problem.avoid(1, :name => \"same_curriculum_and_mandatory\") {\n conjunct{[\n Timetable::Entry.asp(:course_component_id => \"C1\", :weekday_id => \"WD\", :timeframe_id => \"TF\"),\n Timetable::Entry.asp(:course_component_id => \"C2\", :weekday_id => \"WD\", :timeframe_id => \"TF\"),\n CurriculumModuleAssignment.asp(:course_component_id => \"C1\", :curriculum_id => \"Cu\"),\n CurriculumModuleAssignment.asp(:course_component_id => \"C2\", :curriculum_id => \"Cu\"),\n \"C1 != C2\" ]}\n}\n end", "def get_and_update(data)\n results = []\n new_data = []\n dirty = false\n\n (data || []).each do |pos|\n unless @pred.call(pos)\n new_data.push(pos)\n next\n end\n\n case yield(pos)\n in [:clean, result, _]\n results.push(result)\n new_data.push(pos)\n in [:dirty, result, new_value]\n results.push(result)\n new_data.push(new_value)\n dirty = true\n in :pop\n results.push(pos)\n dirty = true\n end\n end\n\n if dirty\n [:dirty, results, new_data]\n else\n [:clean, results, data]\n end\n end", "def sync\n return if @in_sync\n\n code = compile_loop_advance(\"= #{compile_cur_index}\")\n @in_sync = true\n yield code\n end", "def on_volatile(node)\n results << node\n end", "def with_candidates &b\n # Multiple assignment reduces (s)teps while debugging\n outermost, @candidates, @on_admission = @candidates.nil?, (@candidates || []), (@on_admission || [])\n begin\n b.call\n rescue Exception\n # Do not accept any of these candidates, there was a problem:\n @candidates = [] if outermost\n raise\n ensure\n if outermost\n while @candidates\n # Index the accepted instances in the constellation:\n candidates = @candidates\n on_admission = @on_admission\n @candidates = nil\n @on_admission = nil\n candidates.each do |instance|\n instance.class.index_instance(self, instance)\n loggers.each{|l| l.call(:assert, instance.class, instance.identifying_role_values)}\n end\n on_admission.each do |b|\n b.call\n end\n end\n end\n end\n end", "def track_use_of_syntactic_predicates(g)\n end" ]
[ "0.4975293", "0.4906038", "0.47372845", "0.4634953", "0.45757815", "0.45754692", "0.4554886", "0.4543445", "0.45216128", "0.45161575", "0.45077872", "0.44626227", "0.44606608", "0.43842688", "0.43796545", "0.43765974", "0.4356536", "0.43546215", "0.4345447", "0.43407696", "0.43399498", "0.43123743", "0.43037537", "0.43032667", "0.43030682", "0.43024376", "0.42980084", "0.42827618", "0.42825094", "0.42771196", "0.42751497", "0.42732117", "0.4258596", "0.42557126", "0.4250785", "0.42491493", "0.42403612", "0.42366984", "0.42321092", "0.42182454", "0.42145485", "0.42138314", "0.42075503", "0.42063642", "0.42061374", "0.42035803", "0.41924238", "0.41792253", "0.41753936", "0.41738468", "0.4164082", "0.4159073", "0.41550452", "0.4144807", "0.41440618", "0.4136722", "0.41305968", "0.41214812", "0.41203877", "0.41186053", "0.41140068", "0.41054007", "0.41042525", "0.41009542", "0.40991938", "0.40946037", "0.4091514", "0.40911615", "0.4086943", "0.40836188", "0.4083253", "0.407869", "0.40760183", "0.4066433", "0.40613174", "0.4058904", "0.4057903", "0.4056633", "0.40552986", "0.40536907", "0.40467042", "0.4045124", "0.40448898", "0.4043971", "0.40414402", "0.4040201", "0.40361753", "0.40345255", "0.40344626", "0.40306988", "0.4026727", "0.4026615", "0.40247545", "0.40223858", "0.40209427", "0.40199155", "0.40153003", "0.40128663", "0.4011377", "0.40104634" ]
0.535477
0
Look for mutation points in any nonconcurrent expression.
def walk_sequence(fexp, ftree, tree) i = fexp.child_ids.first ehead = ftree[2].take(i) ecurrent = ftree[2][i] etail = ftree[2].drop(i + 1) head = tree[2].take(i) current = tree[2][i] tail = tree[2].drop(i + 1) if ehead != head # # if the name and/or attributes of the exp are supposed to change # then we have to reapply it # register(MutationPoint.new(fexp.fei, tree, :re_apply)) return end if ecurrent != current # # if the child currently applied is supposed to change, let's walk # it down # walk(@ps.fexp(fexp.children.first), current) end #if etail != tail # # # # if elements are added at the end of the sequence, let's register # # a mutation that simply changes the tree (no need to re-apply) # # # register(MutationPoint.new(fexp.fei, tree, :update)) #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_diffs\n mutations.select { |mutation| mutation.source.eql?(example.source) }\n end", "def positions_not_to_check\n @positions_not_to_check ||= begin\n positions = []\n positions.concat(do_not_check_block_arg_pipes)\n positions.concat(do_not_check_param_default)\n positions.concat(do_not_check_class_lshift_self)\n positions.concat(do_not_check_def_things)\n positions.concat(do_not_check_singleton_operator_defs)\n positions\n end\n end", "def enable_mutation_tracking\n @track_mutations = true\n end", "def disable_mutation_tracking\n @track_mutations = false\n end", "def walk(fexp, tree)\n\n ftree = Ruote.compact_tree(@ps.current_tree(fexp))\n\n if ftree[0] != tree[0] || ftree[1] != tree[1]\n #\n # if there is anything different between the current tree and the\n # desired tree, let's force a re-apply\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n\n elsif ftree[2] == tree[2]\n #\n # else, if the tree children are the same, exit, there is nothing to do\n\n return\n\n else\n\n register(MutationPoint.new(fexp.fei, tree, :update))\n #\n # NOTE: maybe a switch for this mutation not to be added would\n # be necessary...\n\n if fexp.is_concurrent?\n #\n # concurrent expressions follow a different heuristic\n\n walk_concurrence(fexp, ftree, tree)\n\n else\n #\n # all other expressions are considered sequence-like\n\n walk_sequence(fexp, ftree, tree)\n end\n end\n end", "def check_deductions(node)\n return if @explored_nodes.include? node\n\n all_neighbors_known = node.cartesian_neighbors.map do |neighbor|\n voter.known?(node, neighbor)\n end.inject(:&)\n\n if all_neighbors_known\n @deduced_nodes << node\n end\n end", "def no_diff_report\n no_diffs.map do |mutation|\n {\n 'node' => mutation.node.inspect,\n 'source' => mutation.source\n }\n end\n end", "def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end", "def unassigned_evaluate_proposals\n self.evaluate_proposal.unassigned # use a StonePath provided named scopes\n end", "def verify\n insns[0...-1].each { |insn| raise unless insn.branch_targets.empty? }\n end", "def find_curious\n z = generate.zip simplify_all\n z.reject! {|x| x.last == nil }\n z.select { |tuple| simplest_form(tuple.first) == simplest_form(tuple.last) && !trivial(tuple.first) }\nend", "def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend", "def cache_ids_xy_no_etp(x,y)\n es = @events\n r = cache_ids_xy(x,y).inject([]) do |a,id| e = es[id]\n a.push(id) if !e.erased && !e.through #&& !e.tb_prod\n end\n r.nil? ? [] : r\n end", "def possible_positions?(already_passed = [])\n possible_positions = []\n Knight::VALID_MOVES.each do |move|\n possible_position = already_passed.last.change(move)\n if possible_position.valid? and\n not already_passed.include?(possible_position) and\n not @forbidden_positions.include?(possible_position)\n possible_positions << possible_position\n end\n end\n possible_positions\n end", "def process_sexp pt\n filter_sexp(pt).deep_each do |node|\n next :skip if node.none? { |sub| Sexp === sub }\n next :skip if node.mass < self.mass_threshold\n\n self.hashes[node.structural_hash] << node\n\n process_fuzzy node, option[:fuzzy] if option[:fuzzy]\n end\n end", "def process_scope exp\n # NOPE?\n end", "def observe_call(sexp)\n super(sexp)\n check_suspicious_finder(sexp)\n end", "def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end", "def check_frag_concentrations()\n frag_ops = operations.select {|op| op.input_array(INPUT).samples.map {|s| s.sample_type.name}.uniq.first == 'Fragment'}\n check_concentration frag_ops, input_name = INPUT # From Cloning Libs/Cloning\n end", "def check_disjunctive_assignment(node); end", "def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end", "def not_reset_scope?(node); end", "def possible_worker_positions(world)\n relative_locations.reject { |loc| world.out_of_bounds?(*loc) }\n end", "def checkmate(k,a)\n # Checkmate test where king may be: k_attacks - used - king_attaks - cells_behind_the_king\n all = all_position\n p used = [k,a]\n k_attacks = king_position(k).uniq \n a_attacks = (amazon_postion(a) - free_cells(k,a)).uniq\n stand_positions = a_attacks - k_attacks - used\n safe_squares = (all - k_attacks - a_attacks - used).uniq\n ans = stand_positions.reduce([]){ |acc,x| \n if (safe_squares & king_position(x)).empty?\n p x\n acc.push(x) \n end\n acc\n }\n p ans\n ans.size\n \nend", "def check_for_changes_affecting_cached_coverage\n overlap = %w(branching_logic position) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :coverage_cache_busted_at\n end", "def mutation( orig, track )\n mutant = orig.clone\n filtered_track = track.find_all { |node| @grammar[ node.symbol ].sn_altering == filter }\n return mutant if filtered_track.empty?\n where = @random.rand( filtered_track.size )\n index = ( filtered_track[where].from + @offset ).divmod( mutant.size ).last\n mutant[ index ] = get_codon_value( mutant, index )\n mutant\n end", "def find_candidates\n scout(exp: expression, depth: 0)\n end", "def any_mines_detonated?\n false\n end", "def any_mines_detonated?\n false\n end", "def recheck?(indexed_exprs)\n query_exprs = eq_exprs.keys.to_set + neq_exprs.keys.to_set\n remaining_exprs = query_exprs - indexed_exprs.map(&:expr)\n remaining_exprs.size > 0\n end", "def walk_concurrence(fexp, ftree, tree)\n\n if ftree[2].size != tree[2].size\n #\n # that's lazy, but why not?\n #\n # we could add/apply a new child...\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n\n else\n #\n # if there is a least one child that replied and whose\n # tree must be changes, then re-apply the whole concurrence\n #\n # else try to re-apply only the necessary branch (walk them)\n\n branches = ftree[2].zip(tree[2]).each_with_object([]) { |(ft, t), a|\n #\n # match child expressions (if not yet replied) with current tree (ft)\n # and desired tree (t)\n #\n cfei = fexp.children[a.size]\n cexp = cfei ? @ps.fexp(cfei) : nil\n a << [ cexp, ft, t ]\n #\n }.select { |cexp, ft, t|\n #\n # only keep diverging branches\n #\n ft != t\n }\n\n branches.each do |cexp, ft, t|\n\n next if cexp\n\n # there is at least one branch that replied,\n # this forces re-apply for the whole concurrence\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n return\n end\n\n branches.each do |cexp, ft, t|\n #\n # we're left with divering branches that haven't yet replied,\n # let's walk to register the mutation point deep into it\n\n walk(cexp, t)\n end\n end\n end", "def double_threat_analysis\n\n attacker = next_to_move?\n defender = attacker == 'x' ? 'o' : 'x'\n\n all_attacker_moves_loose = true\n generate_legal_moves?.each do |attackers_move|\n\n # Once the attacker has proved that he has at least one move\n # that does not loose immediately, we can skip all his\n # non-connected moves because they are unlikely to create\n # a double threat.\n unless all_attacker_moves_loose\n next if get_neighbor_squares(attackers_move).all? do |sq|\n @squares[sq[:row]][sq[:column]] != attacker\n end\n end\n\n begin\n make_move(attackers_move)\n if winner?\n raise RuntimeError, \"board=#{self.to_s}\" unless @winner == attacker\n return attacker\n end\n\n defender_wins = generate_legal_moves?.any? { |m| is_win?(m, defender) }\n unless defender_wins\n all_attacker_moves_loose = false\n get_empty_connected_squares(attackers_move).each do |m|\n if is_win?(m, attacker)\n double_thread_found = get_empty_connected_squares(m).any? do |m2|\n is_win?(m2, attacker)\n end\n if double_thread_found\n return attacker\n else\n next\n end\n end\n end\n end\n ensure\n undo_move\n end\n end\n\n return all_attacker_moves_loose ? defender : nil\n end", "def check_for_implication_loops\n # actually this is tricky\n end", "def invalid_syntax\n mutations.reject do |mutation|\n ::Parser::CurrentRuby.parse(mutation.source)\n rescue ::Parser::SyntaxError # rubocop:disable Lint/HandleExceptions\n end\n end", "def emit_when_branch_presence_mutations\n return if one?\n when_branches.each_index do |index|\n dup_branches = dup_when_branches\n dup_branches.delete_at(index)\n emit_self(receiver, dup_branches, else_branch)\n end\n end", "def check_ahead\n block_movement unless valid_coordinates?(*coords_ahead)\n end", "def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end", "def track_use_of_syntactic_predicates(g)\n end", "def legal(coords)\n offsets = [ [1, 2], [-1, 2], [1, -2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1] ]\n moves = []\n offsets.each do |offset|\n move = [@row+offset[0], @column+offset[1]]\n moves << move\n end\n #loop through possible moves\n moves.each do |move|\n #if chosen coords = moves array coords check if occupied\n if coords === move\n return occupied?(coords)\n end\n end\n return false \n end", "def disallow_phi\n raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given?\n\n __phi_stack.push({\n phi_access_allowed: false\n })\n\n yield if block_given?\n\n __phi_stack.pop\n end", "def performPathologyTests_biopsy_unnecessary(patient)\n yield [] if @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == C1 and terms[3] == patient and state(PATIENT, patient) and state(PHYSICIAN, terms[2])}\nend", "def emit_send_remove_mutation\n array = node.arguments.array\n return unless array.length == 1\n emit(array.first)\n end", "def has_previously_unspent_outputs_for_any_tx(block)\n # Intentionally ignores current_block because the txs to test against are coming from it already.\n # No use for a partial cache here because the usual\n # It's allowed to exist in non-main branch blocks; this includes current block.\n block.tx.each{|tx|\n tx.out.each_with_index{|out,i|\n output = self.output_from_model_cache(tx.binary_hash, i)\n next if !output || output.spent || !output.is_on_main_chain?\n logger.debug{ \"BIP30 violation, output: #{output.hsh}:#{output.position}, branch: #{output.branch}\" }\n return true\n }\n }\n false\n end", "def allowed_moves(board, force_recalc = false)\n mypos = board.index(self) \n unless force_recalc || Board.memoize_moves==false\n already_allowed = board.allowed_moves[mypos]\n return already_allowed if already_allowed \n end\n \n board.allowed_moves[mypos] = Board.all_positions.select do |sq|\n allowed_move?( sq - mypos, mypos.rank ) && !obstructed?( board, mypos, sq - mypos )\n end\n end", "def live_on(live_cells)\n Set.new(live_cells.select { |p| \n stay_alive?(live_neighbor_count(p, live_cells)) })\nend", "def calculate_future_moves(coord)\n possible_transitions = [[2, 1], [2, -1], [1, 2], [-1, 2], \n [-2, 1], [-2, -1], [-1, -2], [1, -2]]\n actual_transitions = []\n possible_transitions.each do |transition|\n new_position = [coord[0]+transition[0], coord[1]+transition[1]]\n if valid_coordinate?(new_position) && [email protected]?(new_position)\n actual_transitions << new_position\n end\n end\n actual_transitions\n end", "def mutations_effect(a_anno, a_gen)\n\n if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length\n $cdna.pos = $locus[a_anno[10]]\n transcript = original()\n exon_starts = a_gen[9].split(',')\n exon_ends = a_gen[10].split(',')\n mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_starts,exon_ends,a_gen[6],a_gen[7])\n a_anno[12] = \"exon#{exon_num}\"\n start_triplet = (mutation_position/3 * 3) - 1\n if start_triplet >= 0\n code = transcript[start_triplet..start_triplet+2]\n pos_in_triplet = mutation_position%3\n original_aa = $codes[code]\n code[pos_in_triplet] = a_anno[4]\n mutated_aa = $codes[code[0..2]]\n if original_aa != mutated_aa\n a_anno[13] = pos_in_triplet + 1\n a_anno[14] = original_aa[:name]\n a_anno[15] = mutated_aa[:name]\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"same_AA\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n else\n if $locus_non_coding[a_anno[10]]\n a_anno[13] = \"ncrna\"\n STDERR.puts a_anno.join(\"\\t\")\n else\n if (a_anno[3].length > a_anno[4].length || a_anno[3].length < a_anno[4].length)\n a_anno[13] = \"indel\"\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"?\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n end\n\nend", "def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend", "def not_set\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n return_value = NotSetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal112 = nil\n not_terminal113 = nil\n element_options114 = nil\n block115 = nil\n element_options116 = nil\n\n tree_for_char_literal112 = nil\n stream_T__87 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__87\" )\n stream_not_terminal = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule not_terminal\" )\n stream_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule block\" )\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule element_options\" )\n begin\n # at line 261:4: '~' ( not_terminal ( element_options )? -> ^( '~' not_terminal ( element_options )? ) | block ( element_options )? -> ^( '~' block ( element_options )? ) )\n char_literal112 = match( T__87, TOKENS_FOLLOWING_T__87_IN_not_set_1864 )\n if @state.backtracking == 0\n stream_T__87.add( char_literal112 )\n end\n # at line 262:3: ( not_terminal ( element_options )? -> ^( '~' not_terminal ( element_options )? ) | block ( element_options )? -> ^( '~' block ( element_options )? ) )\n alt_57 = 2\n look_57_0 = @input.peek( 1 )\n\n if ( look_57_0.between?( TOKEN_REF, CHAR_LITERAL ) )\n alt_57 = 1\n elsif ( look_57_0 == T__81 )\n alt_57 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 57, 0 )\n end\n case alt_57\n when 1\n # at line 262:5: not_terminal ( element_options )?\n @state.following.push( TOKENS_FOLLOWING_not_terminal_IN_not_set_1870 )\n not_terminal113 = not_terminal\n @state.following.pop\n if @state.backtracking == 0\n stream_not_terminal.add( not_terminal113.tree )\n end\n # at line 262:18: ( element_options )?\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == T__88 )\n alt_55 = 1\n end\n case alt_55\n when 1\n # at line 262:18: element_options\n @state.following.push( TOKENS_FOLLOWING_element_options_IN_not_set_1872 )\n element_options114 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add( element_options114.tree )\n end\n\n end\n # AST Rewrite\n # elements: T__87, element_options, not_terminal\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 262:35: -> ^( '~' not_terminal ( element_options )? )\n # at line 262:38: ^( '~' not_terminal ( element_options )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_T__87.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_not_terminal.next_tree )\n # at line 262:57: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child( root_1, stream_element_options.next_tree )\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 263:5: block ( element_options )?\n @state.following.push( TOKENS_FOLLOWING_block_IN_not_set_1890 )\n block115 = block\n @state.following.pop\n if @state.backtracking == 0\n stream_block.add( block115.tree )\n end\n # at line 263:11: ( element_options )?\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == T__88 )\n alt_56 = 1\n end\n case alt_56\n when 1\n # at line 263:11: element_options\n @state.following.push( TOKENS_FOLLOWING_element_options_IN_not_set_1892 )\n element_options116 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add( element_options116.tree )\n end\n\n end\n # AST Rewrite\n # elements: T__87, element_options, block\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 263:29: -> ^( '~' block ( element_options )? )\n # at line 263:32: ^( '~' block ( element_options )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_T__87.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_block.next_tree )\n # at line 263:44: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child( root_1, stream_element_options.next_tree )\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n end\n \n return return_value\n end", "def new_life(live_cells)\n Set.new(nearby_dead_cells(live_cells).select { |p| \n come_alive?(live_neighbor_count(p, live_cells)) })\nend", "def assert_no_change(expressions, message = nil, &block)\n expressions = Array(expressions)\n\n exps = expressions.map { |e|\n e.respond_to?(:call) ? e : lambda { eval(e, block.binding) }\n }\n before = exps.map { |e| e.call }\n\n yield\n\n expressions.zip(exps).each_with_index do |(code, e), i|\n error = \"#{code.inspect} didn't change\"\n error = \"#{message}.\\n#{error}\" if message\n assert_equal(before[i], e.call, error)\n end\n end", "def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end", "def valid_moves\n moves.reject { |end_pos| move_into_check?(end_pos) }\n end", "def allows_not_action\n @statements.select { |statement| !statement.not_actions.empty? && statement.effect == 'Allow' }\n end", "def mark_unreachable_symbols\n # Mark all non-terminals as unreachable\n start_vertex_for.each_value do |a_vertex|\n a_vertex.non_terminal.unreachable = true\n end\n\n # Now traverse graph from start vertex of graph\n # and mark all visited non-terminals as reachable\n traverse_df(start_vertex) do |a_vertex|\n # print_vertex(' Visiting', a_vertex)\n if a_vertex.kind_of?(StartVertex)\n a_vertex.non_terminal.unreachable = false\n end\n end\n end", "def valid_moves\n @pad.cells.select { |c| self.can_move?(*c.pos) }\n end", "def irreducible?\n all? { |qnt, exp| qnt.irreducible? }\n end", "def collect_variables\n @expression.collect_variables.uniq\n end", "def not_set\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 23)\n return_value = NotSetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal112 = nil\n not_terminal113 = nil\n element_options114 = nil\n block115 = nil\n element_options116 = nil\n\n tree_for_char_literal112 = nil\n stream_T__87 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__87\")\n stream_not_terminal = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule not_terminal\")\n stream_block = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule block\")\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule element_options\")\n begin\n # at line 270:4: '~' ( not_terminal ( element_options )? -> ^( '~' not_terminal ( element_options )? ) | block ( element_options )? -> ^( '~' block ( element_options )? ) )\n char_literal112 = match(T__87, TOKENS_FOLLOWING_T__87_IN_not_set_1869) \n if @state.backtracking == 0\n stream_T__87.add(char_literal112)\n end\n # at line 271:3: ( not_terminal ( element_options )? -> ^( '~' not_terminal ( element_options )? ) | block ( element_options )? -> ^( '~' block ( element_options )? ) )\n alt_57 = 2\n look_57_0 = @input.peek(1)\n\n if (look_57_0.between?(TOKEN_REF, CHAR_LITERAL)) \n alt_57 = 1\n elsif (look_57_0 == T__81) \n alt_57 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 57, 0)\n raise nvae\n end\n case alt_57\n when 1\n # at line 271:5: not_terminal ( element_options )?\n @state.following.push(TOKENS_FOLLOWING_not_terminal_IN_not_set_1875)\n not_terminal113 = not_terminal\n @state.following.pop\n if @state.backtracking == 0\n stream_not_terminal.add(not_terminal113.tree)\n end\n # at line 271:18: ( element_options )?\n alt_55 = 2\n look_55_0 = @input.peek(1)\n\n if (look_55_0 == T__88) \n alt_55 = 1\n end\n case alt_55\n when 1\n # at line 271:18: element_options\n @state.following.push(TOKENS_FOLLOWING_element_options_IN_not_set_1877)\n element_options114 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add(element_options114.tree)\n end\n\n end\n # AST Rewrite\n # elements: not_terminal, T__87, element_options\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 271:35: -> ^( '~' not_terminal ( element_options )? )\n # at line 271:38: ^( '~' not_terminal ( element_options )? )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_T__87.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_not_terminal.next_tree)\n # at line 271:57: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child(root_1, stream_element_options.next_tree)\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 272:5: block ( element_options )?\n @state.following.push(TOKENS_FOLLOWING_block_IN_not_set_1895)\n block115 = block\n @state.following.pop\n if @state.backtracking == 0\n stream_block.add(block115.tree)\n end\n # at line 272:11: ( element_options )?\n alt_56 = 2\n look_56_0 = @input.peek(1)\n\n if (look_56_0 == T__88) \n alt_56 = 1\n end\n case alt_56\n when 1\n # at line 272:11: element_options\n @state.following.push(TOKENS_FOLLOWING_element_options_IN_not_set_1897)\n element_options116 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add(element_options116.tree)\n end\n\n end\n # AST Rewrite\n # elements: block, element_options, T__87\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 272:29: -> ^( '~' block ( element_options )? )\n # at line 272:32: ^( '~' block ( element_options )? )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_T__87.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_block.next_tree)\n # at line 272:44: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child(root_1, stream_element_options.next_tree)\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 23)\n\n end\n \n return return_value\n end", "def findIntersectedPositions(moves)\n moves.inject([[0,0,'N'], [[0,0]].to_set, []]) do |acc, m|\n p = moveToNextPosition acc[0], m\n puts \"p = \" + p.to_s\n newPosition = [p[0], p[1]]\n visitedPositions = acc[1]\n puts \"vp = \" + visitedPositions.size.to_s\n crossedPositions = acc[2]\n if (visitedPositions & newPosition).size > 0\n puts \"contains: \" + newPosition.to_s\n c = crossedPositions + [newPosition]\n else\n c = crossedPositions\n end\n\n pathPositions = allPointsBetween acc[0], newPosition\n [p, visitedPositions + pathPositions, c]\n end\nend", "def check_collisions!\n 1000.times do\n @particles.values.map(&:tick)\n position_groups = @particles.values.group_by(&:position)\n collisions = position_groups.select { |pos, particles| particles.size > 1 }\n collisions.values.flatten.collect(&:num).map { |num| @particles.delete(num) }\n end\n @particles\n end", "def assert_not_cache_fragments(*names)\n \n fragment_cache_store.clear\n \n yield *names\n \n # if there is no variable @controller, then we haven't done any request\n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n names.each do |name|\n assert_block(\"#{name.inspect} is cached after executing block\") do\n !fragment_cache_store.written?(@controller.fragment_cache_key(name))\n end\n end\n \n fragment_cache_store.clear\n\n end", "def unfinished\n unext = LINE_CONTINUER.match(@chunk) || UNFINISHED_EXPRESSIONS.include?(tag)\n return unext unless prev = @tokens[-1]\n uprev = prev[1].to_s.match(LINE_CONTINUER) || UNFINISHED_EXPRESSIONS.include?(prev[0])\n unext || uprev\n end", "def without_individual_blocks(options)\n piece = options[:piece]\n game = options[:game]\n board = game.board\n\n collection = clone\n\n collection.coordinates.reject! do |coordinate|\n at_position = board.at_square(coordinate.square_name) \n piece.ally?(at_position) \n end\n\n collection\n end", "def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end", "def eqs_for_free_points(p)\n return [] if p.free?\n q, r = first_point, second_point\n eqs = []\n uv = [:x,:y,:z] # uv stands for unused vars\n %w{x y z}.map(&:to_sym).each do |v|\n if 0 == (q.send(v).to_f - r.send(v).to_f)\n eqs << p.send(v.to_s+\"_to\", q) # <-- A bit different equation\n uv.delete(v)\n end\n end\n if uv.size == 3\n eq_for_non_free_points(p) # The equations are the same as the\n # non-free-points options\n elsif uv.size == 2\n eqs << eq_for_coordinates(p, *uv)\n end\n eqs\n end", "def check_not_applied\n LOCK.synchronize do\n ( hooks.keys - applied ).each do |rkey|\n calls = hooks[ rkey ].map { |blk, clr| clr }\n yield( rkey, calls )\n end\n end\n end", "def statements\n graph.statements.reject { |stmt| predicate_blacklist.include?(stmt.predicate) || missing_object?(stmt) }\n end", "def unclustered_points\n points.select {|point| not point.clustered? }\n end", "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end", "def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end", "def add_non_transformable_endpoints\n return unless @grape_transformations_non_transformable_endpoints.is_a? Proc\n @grape_transformations_non_transformable_endpoints.call\n end", "def def_mutation_method(*meths)\n meths.each do |meth|\n instance_eval(\"def #{meth}!(*args, &block); mutation_method(:#{meth}, *args, &block) end\")\n end\n end", "def infinite_loops\n reachable_sets = @nodes.group_by(&:forward)\n reachable_sets.each do |reachable,nodes|\n yield reachable if reachable == nodes.to_set\n end\n end", "def possible_moves_in_board(position)\n POSSIBLE_MOVES.select do |move|\n x = position[0] + move[0]\n y = position[1] + move[1]\n\n within_board?(x, y)\n end\n end", "def valid_moves(from)\n\tpossible_moves(from).select { |move| valid_position?(move) }\nend", "def expr_members\n []\n end", "def uninstantiated_variables\n @variables.select {|v| not v.instantiated?}\n end", "def verify!(current_node, previous_node)\n if moving_after_alias?(current_node, previous_node)\n ignore_node(current_node)\n raise_warning!(current_node.method_name, previous_node.method_name)\n end\n if moving_after_alias?(previous_node, current_node)\n ignore_node(previous_node)\n raise_warning!(previous_node.method_name, current_node.method_name)\n end\n end", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def apply(operators, methods, predicates, state, tasks, goal_pos, goal_not, debug = false, repetitions = 1)\n puts 'Dummy'.center(50,'-'), \"Repetitions: #{repetitions}\" if debug\n return if goal_pos.empty? and goal_not.empty?\n # Tasks are unordered\n tasks[0] = false\n # Invisible operators are rejected from search\n visible_operators = operators.reject {|op,| op.start_with?('invisible_')}\n # Each goal generates a task and a set of methods\n goal_pos.each {|pre|\n tasks << [name = \"perform_goal_#{pre.join('_')}\"]\n generate_methods(visible_operators, methods, name, [pre], [], repetitions)\n }\n goal_not.each {|pre|\n tasks << [name = \"perform_goal_not_#{pre.join('_')}\"]\n generate_methods(visible_operators, methods, name, [], [pre], repetitions)\n }\n # Visible operators are visited to avoid infinite repetition\n visible_operators.each {|name,param|\n visit = \"#{VISIT}_#{name}\"\n 1.upto(repetitions) {|i|\n predicates[visited = \"visited_#{name}_#{i}\".freeze] = true\n operators.push(\n [\"invisible_#{visit}_#{i}\", param,\n # Positive preconditions\n [],\n # Negative preconditions\n [[visited, *param]],\n # Add effect\n [[visited, *param]],\n # Del effect\n []\n ],\n [\"invisible_un#{visit}_#{i}\", param,\n # Positive preconditions\n [],\n # Negative preconditions\n [],\n # Add effect\n [],\n # Del effect\n [[visited, *param]]\n ]\n )\n }\n }\n end", "def neqq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n\n type = NEQQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 181:8: '!=='\n match( \"!==\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n\n end", "def emit_finish_mutations\n finish = node.finish\n #emit_self(negative_infinity, finish)\n emit_self(nan, finish)\n end", "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end", "def non_terminals(ast, expr = @expr)\n ([:alt, :diff].include?(expr.first) ? expr[1..-1] : expr[1,1]).map do |sym|\n case sym\n when Symbol\n r = ast.detect {|r| r.sym == sym}\n r if r && r.rule?\n when Array\n non_terminals(ast, sym)\n else\n nil\n end\n end.flatten.compact.uniq\n end", "def test_chk_mv_pawn\n e = RulesEngine.new\n\n # cannot move a \"pawn\" from an empty square\n assert_equal(e.chk_mv(Coord.from_alg('e3'), Coord.from_alg('e4')), false)\n\n # can move one square forward\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e3')), true)\n\n # cannot move one square forward if blocked\n e.place_piece(Coord.from_alg('e3'), Chess::Piece.new(Colour::WHITE, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e3')), false)\n\n # cannot move two squares forward if blocked\n assert(!e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e4')))\n\n # cannot move diagonally if not a capture\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), false)\n\n # can move diagonally if a capture\n e.place_piece(Coord.from_alg('d3'), Chess::Piece.new(Colour::BLACK, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), true)\n\n # cannot capture the same colored piece\n e.place_piece(Coord.from_alg('d3'), Chess::Piece.new(Colour::WHITE, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), false)\n\n # make sure it works both ways\n e.place_piece(Coord.from_alg('d6'), Chess::Piece.new(Colour::BLACK, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e7'), Coord.from_alg('f6')), false)\n end", "def hasDeadlock c\n c.each_index do |i|\n nil while c[i].each{|n| c[i] |= c[n] }.size != c[i].size\n return true if c[i].include? i\n end\n false\nend", "def valid_moves(pos)\n valid_moves =[]\n DELTAS.each do |delta_pair|\n valid_moves << [delta_pair[0] + pos[0], delta_pair[1] + pos[1]]\n end\n valid_moves.reject! { |coord| coord.any? { |x| x < 0 || x > 8} }\n end", "def match(statement1, statement2=nil, noisy = false)\n if (ss = [statement1, statement2].compact.size) != @antecedents.size\n if noisy\n return [nil, \"antecedent size (#{@antecedents.size}) doesn't match the arguments size #{ss}\"]\n else\n return nil\n end\n end\n\n if @antecedents.size == 1\n antecedent = @antecedents.first\n pattern, assignments, slots = antecedent.to_hash, {}, {}\n \n pattern.each {|k,v| slots[k] = pattern.delete(k) if PLACEHOLDERS.include?(v) }\n \n [:subject, :object, :predicate].select {|k| pattern[k].nil?}.each {|k| \n msv = slots[k]\n assignments[msv] = statement1.send(k)\n }\n\n pattern = Statement.new(pattern)\n ad_hoc_repo = RDF::Repository.new.insert(statement1)\n if ad_hoc_repo.query(pattern).empty?\n if noisy\n return [nil, \"pattern was #{pattern.inspect} and did not match #{statement1.inspect}\"]\n else\n return nil\n end\n end\n return consequents_from(assignments)\n else\n pattern1, pattern2 = @antecedents.collect(&:to_hash)\n slots, assignments, statement1_assignments, statement2_assignments = {}, {}, {}, {}\n \n pattern1.each {|k,v| (slots.merge!({\"#{k}_1\" => pattern1.delete(k)})) if PLACEHOLDERS.include?(v) }\n pattern2.each {|k,v| (slots.merge!({\"#{k}_2\" => pattern2.delete(k)})) if PLACEHOLDERS.include?(v) }\n \n pattern1, pattern2 = Statement.new(pattern1), Statement.new(pattern2)\n if (pattern1 === statement1) && (pattern2 === statement2)\n\n [:subject, :object, :predicate].select {|k| pattern1.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_1\"]\n assignments[msv] = statement1.send k\n }\n \n [:subject, :object, :predicate].select {|k| pattern2.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_2\"]\n assignments[msv] = statement2.send k\n }\n return consequents_from(assignments) \n elsif (pattern1 === statement2) && (pattern2 === statement1)\n \n [:subject, :object, :predicate].select {|k| pattern1.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_1\"]\n assignments[msv] = statement2.send(k)\n }\n \n [:subject, :object, :predicate].select {|k| pattern2.to_hash[k].nil?}.each {|k| \n msv = slots[\"#{k.to_s}_2\"]\n assignments[msv] = statement1.send(k)\n }\n return consequents_from(assignments)\n else\n if noisy\n return [nil, \"pattern was #{pattern.inspect} and did not match #{[statement1, statement2].inspect}\"]\n else\n return nil\n end\n end\n end\n end", "def positions(passes) = passes.map { find_position(_1) }", "def without_blocks(options)\n game = options[:game]\n piece = options[:piece]\n\n board = game.board\n \n coordinates.each_with_index do |coordinate, index|\n at_position = board.at_square(coordinate.square_name)\n \n # Blocked by an opponent. Include this space.\n if piece.opponent?(at_position)\n return set_including_index(index)\n # Blocked by an ally. Do not include this space.\n elsif piece.ally?(at_position)\n return set_before_index(index)\n end\n end\n\n clone\n end", "def sniff\n variables = context.local_nodes(:ivasgn, [:or_asgn]).map(&:name)\n count = variables.uniq.size\n return [] if count <= max_allowed_ivars\n\n [smell_warning(\n lines: [source_line],\n message: \"has at least #{count} instance variables\",\n parameters: { count: count })]\n end", "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end", "def handle_ast(ctx, ast)\n false\n end", "def hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end", "def any_mines_detonated?(state = false)\n state\n end", "def find_possible_moves diffs\n [].tap do |possible_moves|\n diffs.each do |row|\n possible_moves << [self.pos[0] + row[1], self.pos[1] + row[0]]\n end\n end \n end", "def valid_moves\n moves.reject {|move| move_into_check?(move)}\n end", "def valid_moves # do this method with the board#dup and all that and check if in check. Hah, it is indeed very straightforward lol\n all_moves = moves\n all_moves.reject { |move| move_into_check?(move) } # damn code is easy to write when it's good this should just check if a move leaves you in check and if so reject all the moves for which this is true\n end", "def move_pos_evaluate\n @move_pos_value = 0\n for bat in subject.opponents\n if @other_bat_attack[bat] and (@other_bat_attack[bat] & battler.positions(*move_pos) != [])\n @move_pos_value += 1\n end\n end\n end" ]
[ "0.5755983", "0.53273314", "0.50230354", "0.49841377", "0.4904098", "0.48797786", "0.4826175", "0.47587332", "0.47541755", "0.471018", "0.47002035", "0.46677542", "0.46179837", "0.46113363", "0.46088618", "0.45980018", "0.45906025", "0.4566664", "0.45606157", "0.45577773", "0.45477268", "0.45463273", "0.45379373", "0.4533356", "0.45291618", "0.4504447", "0.44981748", "0.44915625", "0.44915625", "0.44860995", "0.44654903", "0.4461704", "0.44602787", "0.44490588", "0.44455662", "0.44410756", "0.44160217", "0.44131842", "0.4408587", "0.44008252", "0.44002572", "0.43999907", "0.43994775", "0.4397728", "0.43948093", "0.43916953", "0.43902037", "0.43769127", "0.4376569", "0.43728995", "0.4371446", "0.43540114", "0.43510237", "0.43461972", "0.43457854", "0.4345533", "0.4339094", "0.43388978", "0.43375427", "0.43361732", "0.43339166", "0.43290094", "0.4326687", "0.4325114", "0.43232083", "0.43210357", "0.4312758", "0.4309826", "0.43025038", "0.42920268", "0.42772537", "0.42740855", "0.4268703", "0.4268378", "0.42550254", "0.42545685", "0.42528704", "0.42512456", "0.42506656", "0.4243445", "0.4243339", "0.42413196", "0.42391366", "0.42388156", "0.4233294", "0.42313558", "0.42198324", "0.42190692", "0.42176273", "0.4216539", "0.42123172", "0.4206774", "0.42062163", "0.42011625", "0.42007512", "0.42003396", "0.41983598", "0.4197627", "0.41944337", "0.4194073", "0.41929892" ]
0.0
-1
Metodo para calcular el determinante de una matriz
def det if (@nFil == @mCol) det = @matriz[0][0] aux = Matriz.new(@matriz) for k in 0...@nFil do l = k+1 for i in l...@mCol do for j in l...@mCol do aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k][k] end end det = det * aux.matriz[k][k] end else det = "ERROR, la matriz no es cuadrada" end det end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def det\n if (@nFil == @mCol)\n det = @matriz[0][0]\n aux = MatrizDensa.new(@matriz)\n for k in 0...@nFil do\n l = k+1\n for i in l...@mCol do\n for j in l...@mCol do\n aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k][k]\n end\n end\n det = det * aux.matriz[k][k]\n end\n else\n det = \"ERROR, la matriz no es cuadrada\"\n end\n det\n end", "def determinant\n Matrix.Raise ErrDimensionMismatch unless square?\n \n rsz = row_size \n if rsz == 0\n return 1\n end\n size = rsz - 1\n a = to_a\n \n det = 1\n k = 0\n begin \n if (akk = a[k][k]) == 0\n i = k\n begin\n return 0 if (i += 1) > size\n end while a[i][k] == 0\n a[i], a[k] = a[k], a[i]\n akk = a[k][k]\n det *= -1\n end\n # (k + 1).upto(size) do\n i = k + 1\n while i <= size\n q = a[i][k] / akk # with mathn , #/ produces Rationals, etc, otherwise truncates ...\n # (k + 1).upto(size) do\n j = k + 1\n while j <= size\n a[i][j] -= a[k][j] * q\n j += 1\n end\n i += 1\n end\n det *= akk\n end while (k += 1) <= size\n det\n end", "def matz; end", "def determinant(matrix)\n return matrix[0][0] if matrix.count == 1\n # sum = 0\n matrix[0].map.with_index do |elem, index|\n (-1) ** (index) * elem * determinant( minor(matrix, index) )\n end.reduce(&:+)\n # sum\nend", "def general_determinant\n Matrix[[sum(x_in_degree_n(4)), sum(x_in_degree_n(3)), sum(x_in_degree_n)],\n [sum(x_in_degree_n(5)), sum(x_in_degree_n(4)), sum(x_in_degree_n(3))],\n [sum(x_in_degree_n(6)), sum(x_in_degree_n(5)), sum(x_in_degree_n(4))]].det\n end", "def -(mat)\n if (mat.f == @f && mat.c == @c)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n nElementos += 1\n elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n aux.matriz[i][j] = - mat.matriz[i][j]\n nElementos += 1\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end", "def determinant(matrix)\n return matrix[0][0] if matrix.size == 1\n first_row = matrix[0]\n\n first_row.each_with_index.inject(0) do |r, (x, j)|\n minor_det = determinant(minor(j, matrix))\n sign = ( -1 ) ** j\n r += sign * x * minor_det\n end\nend", "def test_determinant\n f = YaleSparseMatrixFactory.new()\n c = f.Create([1,2,3,4,5],[0,0,2,4,5],[0,2,1,1,1],[3,4,5,9,9],[2,5,6,7,8])\n result = c.determinant()\n assert_equal(result,15)\n # assert_equal(result , )\n\n\n end", "def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end", "def determinant\n end", "def det()\n c1 = [11, 12, 13]\n c2 = [21, 22, 23]\n c3 = [31, 32, 33]\n overall_matrix = [c1, c2, c3]\n determinant_1 = c1[0] * ( (c2[1]*c3[2]) - (c2[2]*c3[1]) ) - c1[1] * (\n (c2[0]*c3[2]) - (c2[2]*c3[0] )) + c1[2] * ( (c2[0]*c3[1]) - (c2[1]*c3[0] ))\n\n determinant_2 = overall_matrix[0][0] * ( (c2[1]*c3[2]) - (c2[2]*c3[1]) ) -\n overall_matrix[0][1] * ( (c2[0]*c3[2]) - (c2[2]*c3[0] )) +\n overall_matrix[0][2] * ( (c2[0]*c3[1]) - (c2[1]*c3[0] ))\n\n p determinant_1\n p determinant_2\nend", "def determinant_by_elimination\n m = dup\n det = ground.unity\n each_j do |d|\n if i = (d...size).find{|i| !m[i, d].zero?}\n if i != d\n m.sswap_r!(d, i)\n det = -det\n end\n c = m[d, d]\n det *= c\n (d+1...size).each do |i0|\n r = m.row!(i0)\n q = ground.unity * m[i0, d] / c #this lets the entries be in ground\n (d+1...size).each do |j0|\n r[j0] -= q * m[d, j0]\n end\n end\n else\n return ground.zero\n end\n end\n det\n end", "def -(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n \n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def calc_det(indexes)\n vectors = indexes.map do |index|\n x_possible_values_vectors_temp2[index]\n end\n matrix = Matrix.columns(vectors)\n (matrix.transpose * matrix).det\n end", "def covector\n Matrix.row_vector(self)\n end", "def one_matrix_norm minus = false\n #TODO: change traversing method for sparse matrices\n number_of_columns = self.cols\n col_sums = []\n\n number_of_columns.times do |i|\n col_sums << self.col(i).inject(0) { |sum, number| sum += number.abs}\n end\n\n return col_sums.max unless minus\n return col_sums.min\n end", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def matrix\n end", "def test_b()\n mx = Itk::Maxima.new() ;\n x = [[1.0,2,3,4],[4,1,2,3],[3,1,4,2],[1,2,1,3]] ;\n pp x ;\n pp mx.determinant(x) ;\n pp mx.invert(x) ;\n end", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def lu_decompose matrix\n nrows = matrix.shape[0]\n ncols = matrix.shape[1]\n \n nrows.times do |i|\n (i...ncols).each do |j|\n if j >= i # upper\n sum = 0.0\n i.times do |k|\n sum += matrix[k,j]*matrix[i,k]\n end\n matrix[i,j] = matrix[i,j] - sum\n else # lower\n sum = 0.0\n j.times do |k|\n sum += matrix[k,j]*matrix[i,k]\n end\n matrix[i,j] = (matrix[i,j] - sum)/matrix[j,j]\n end\n end\n end\n\n matrix\nend", "def -(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def determinant_by_elimination_euclidian#_new\n m = dup\n det = ground.unity\n each_j do |d|\n if i = (d...size).find{|i| !m[i, d].zero?}\n if i != d\n m.sswap_r!(d, i)\n det = -det\n end\n (d+1...size).each do |i0|\n r = m.row!(i0)\n q = m[i0, d] / m[d, d]\n (d...size).each do |j0|; r[j0] -= q * m[d, j0]; end\n unless m[i0, d].zero?\n m.sswap_r!(d, i0)\n det = -det\n redo\n end\n end\n det *= m[d, d]\n else\n return ground.zero\n end\n end\n det\n end", "def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end", "def nrm2 incx=1, n=nil\n self.twoDMat.getFrobeniusNorm()\n end", "def execute(m,row,col)\n for i in 0..m.size-1\n aux = m[i][col] \n if aux != 0\n for j in 1..m[0].size-1\n if i != row \n m[i][j] -= (aux * m[row][j]).to_f\n m[i][j] = 0 if m[i][j] > -0.001 && m[i][j] < 0.001\n end \n end\n if i != row \n print \"L#{i} = L#{i}-#{aux<0 ? '('+aux.to_s+')': aux}L#{row} \\n\".italic.blue\n #print_matrix(m,row,col, i)\n end \n end\n end\n m\nend", "def det(a)\n lu, piv, = Lapack.call(:getrf, a)\n idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))\n m = piv.eq(idx).count_false(axis:-1) % 2\n sign = m * -2 + 1\n lu.diagonal.prod(axis:-1) * sign\n end", "def determinant(matrix)\n form = \"determinant(#{matrix2maxima(matrix)});\" ;\n reply = call(form) ;\n scan(reply) ;\n end", "def solve\r\n\t\t\traise MatrixSizeError unless @height + 1 == @width\r\n\r\n\t\t\tinverse = []\r\n\t\t\tm = self.to_a\r\n\t\t\tn = @height\r\n\r\n\t\t\tn.times do |j|\r\n\t\t\t\t# Find non-zero entry\r\n\t\t\t\trow = nil\r\n\t\t\t\tj.upto(n - 1) do |i|\r\n\t\t\t\t\tunless m[i][j].zero?\r\n\t\t\t\t\t\trow = i\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\treturn nil unless row\r\n\r\n\t\t\t\t# Swap?\r\n\t\t\t\tif j < row\r\n\t\t\t\t\tm[row], m[j] = m[j], m[row]\r\n\t\t\t\tend\r\n\r\n\t\t\t\t# Eliminate\r\n\t\t\t\tinverse[j] = m[j][j].inverse\r\n\t\t\t\t(j + 1).upto(n - 1) do |i|\r\n\t\t\t\t\tc = m[i][j] * inverse[j]\r\n\r\n\t\t\t\t\t(j + 1).upto(n) do |j2|\r\n\t\t\t\t\t\tm[i][j2] -= m[j][j2] * c\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\t# Solve triangular system\r\n\t\t\tx = []\r\n\t\t\t(n - 1).downto(0) do |i|\r\n\t\t\t\ttemp = m[i][n]\r\n\t\t\t\t(i + 1).upto(n - 1) do |j|\r\n\t\t\t\t\ttemp -= m[i][j] * x[j]\r\n\t\t\t\tend\r\n\t\t\t\tx[i] = temp * inverse[i]\r\n\t\t\tend\r\n\r\n\t\t\treturn Abst::Vector(self.class.coef_class, x)\r\n\t\tend", "def covector\n SparseMatrix.row_vector(self)\n end", "def matricula\n end", "def /(other)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j] =@A[i][j] / other.to_f\n end\n end\n return c\n end", "def compute_values \n arr = inputs_matrix.map{|e| @evaluator.call(*e)}\n matrix = NArray[arr].reshape(@width, @height)\n end", "def maxSum(matrix)\n\nend", "def calculated_determinant\n # A arrondir à digit puis à mettre sous forme fractionnelle \n @equat.determinant.round(2)\n end", "def +(mat)\n if (mat.f == @f && mat.c == @c)\n resultado = Array.new\n for i in 0...@f do\n resultado[i] = Array.new\n for j in 0...@c do\n# \t if((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((@matriz[i][j].class = Fraccion) || (mat.matriz[i][j] == Fraccion)))\n# \t resultado[i][j] = Fraccion.new(0,1)\n# \t else\n\t resultado[i][j] = 0 \n# \t end\n end\n end\n aux = Densa.new(resultado)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n\t if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n nElementos += 1\n\t elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n\t aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n\t elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n\t aux.matriz[i][j] = mat.matriz[i][j]\n nElementos += 1\n\t end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end", "def two_matrix_norm minus = false\n\n self_cast = self.cast(:dtype => :float64)\n\n #TODO: confirm if this is the desired svd calculation\n svd = self_cast.gesvd\n return svd[1][0, 0] unless minus\n return svd[1][svd[1].rows-1, svd[1].cols-1]\n end", "def Matrix3dDeterminant(arg0)\n ret = _invoke(1610743907, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def inf_matrix_norm minus = false\n number_of_rows = self.rows\n row_sums = []\n\n number_of_rows.times do |i|\n row_sums << self.row(i).inject(0) { |sum, number| sum += number.abs}\n end\n\n return row_sums.max unless minus\n return row_sums.min\n end", "def diag_abs(mat)\n\tdiag1 = 0\n\tdiag2 = 0\n\t(0..mat.size-1).each do |i|\n \tdiag1 += mat[i][i].to_i\n \tdiag2 += mat[i][mat.size-i-1].to_i\n\tend\n\t(diag1-diag2).abs\nend", "def generate_matrix\n generator = Rubystats::NormalDistribution.new(0, 3)\n numbers = (MATRIX_DIMENSION * (MATRIX_DIMENSION + 1))\n .times\n .map { Rational(generator.rng.to_i) }\n .each_slice(MATRIX_DIMENSION)\n .to_a\n\n matrix = numbers[0...-1]\n answer = numbers[-1]\n\n vector = solve_equation(matrix, answer)\n\n [matrix, vector]\nend", "def igual (mat)\n end", "def determinant_zero(matrix)\n puts 'We calculate the matrix determinant to see if it is singular or not'\n det = Matrix[*matrix].determinant\n\n if det.zero?\n puts 'As the determinant is zero, this matrix is singular, so it has infinite solutions'\n else\n puts \"As the determinant is #{det.denominator == 1 ? det.numerator.to_s.split('').join(' ') : det}\" \\\n ', the matrix is NOT singular, so we can procceed'\n end\n print_separator\n\n det.zero?\nend", "def decompose\n @count = 0 \n for k in 0..@n\n for j in (k+1)..@n\n @matrix[j,k]=@matrix[j,k]/@matrix[k,k]\n @count += 1\n for i in (k+1)..@n\n @matrix[j,i]=@matrix[j,i]-@matrix[j,k]*@matrix[k,i]\n @count += 1\n end\n end\n end \n for k in 0..@n\n for j in k..@n\n @U[k,j]=@matrix[k,j]\n end\n @L[k,k]=1.0\n for j in 0..(k-1)\n @L[k,j]=@matrix[k,j]\n end\n end\n end", "def get_diagonal_difference(\n matrix:\n )\n primary_dia, secondary_dia = 0, 0\n array_length = matrix[0].length - 1\n # Calculate diagonal sum\n (0...matrix[0].length).each do |index|\n \tprimary_dia += matrix[index][index]\n \tsecondary_dia += matrix[index][array_length]\n \tarray_length -= 1\n end\n # Return absolute value of the difference between to diagonals\n (primary_dia - secondary_dia).abs\nend", "def inverse\n return self if identity_matrix?\n raise 'not invertible' unless invertible?\n\n Matrix.new(size) do |result|\n det = determinant\n each_row_col do |row, col|\n result[col, row] = cofactor(row, col) / det\n end\n end\n end", "def get(i,j)\n if( !(i.is_a? Fixnum) or i < 0 or i >=@fil or !(j.is_a? Fixnum) or j < 0 or j >= @col)\n return nil\n end\n \n return @matrix[i][j]\n end", "def exercise_1113 (matrix)\n end", "def matrix_convert_to_0(matrix)\n\nend", "def similarity_matrix\n multiply_self(normalize)\n end", "def zero_matrix(matrix)\n\nend", "def fro_matrix_norm\n #float64 has to be used in any case, since nrm2 will not yield correct result for float32\n self_cast = self.cast(:dtype => :float64)\n\n column_vector = self_cast.reshape([self.size, 1])\n\n return column_vector.nrm2\n end", "def calcularDiagonalPrincipal (indice, valor)\n\t valores = Array.new\n\t indices = Array.new\n\t \t \n\t indicefor = indice\n\t valorfor = valor\n\t\t\n\t\t##Se calculan los valores diagonales hacia adelante\n\t\twhile (indicefor <= (@tamano-1) && valorfor <= (@tamano-1)) do\n\t\t\tindices << indicefor\n\t\t\tvalores << valorfor\n\t\t\tindicefor +=1\n\t\t\tvalorfor +=1\n\t\t\t\n\t\tend\n\t\t\n\t\t##Se calculan los valores diagonales hacia atras\n\t\tindicesnew = Array.new\n\t\tvaloresnew = Array.new\n\t\tindicefor = indice-1\n\t\tvalorfor = valor-1\n\t\twhile (indicefor >= 0 && valorfor >= 0) do\n\t\t\tindicesnew << indicefor\n\t\t\tvaloresnew << valorfor\n\t\t\tindicefor -=1\n\t\t\tvalorfor -=1\n\t\t\t\n\t\tend\n\t\t\n\t\tmatriz = Matrix[indicesnew.reverse + indices, valoresnew.reverse + valores]\n\t\t\t\t\n\t\t# matris [filas (0 para indices- 1 para valores) , columnas son valores(valor inicial...valor final)]\n\t\t# ejemplo : puts matriz[0,5]\n\t\treturn matriz\n \n \n end", "def test_c()\n mx = Itk::Maxima.new() ;\n x = [[1.0,2,3,4],[4,1,2,3],[3,1,4,2],[1,2,1,3]] ;\n pp x ;\n# pp mx.eigenvalues(x) ;\n pp mx.trace(x) ;\n end", "def calcularDiagonalSecundaria (indice, valor)\n\t indices = Array.new\n\t valores = Array.new\n\t \n\t indicefor = indice\n\t valorfor = valor\n\t\t\n\t\t##Se calculan los valores diagonales hacia adelante\n\t\twhile (indicefor <= (@tamano-1) && valorfor >= 0) do\n\t\t\t\n\t\t\tindices << indicefor\n\t\t\tvalores << valorfor\n\t\t\tindicefor +=1\n\t\t\tvalorfor -=1\n\t\t\t\n\t\tend\n\t\t\n\t\t##Se calculan los valores diagonales hacia atras\n\t\tvaloresnew = Array.new\n\t\tindicesnew = Array.new\n\t\tindicefor = indice-1\n\t\tvalorfor = valor+1\n\t\twhile (indicefor >= 0 && valorfor <= (@tamano-1)) do\n\t\t\t\n\t\t\tindicesnew << indicefor\n\t\t\tvaloresnew << valorfor\n\t\t\tindicefor -=1\n\t\t\tvalorfor +=1\n\t\t\t\n\t\tend\n\t\tmatriz = Matrix[indicesnew.reverse + indices, valoresnew.reverse + valores]\n\t\treturn matriz\n end", "def determinant(ref, a, b)\n (a.y - ref.y) * (b.x - a.x) - (b.y - a.y) * (a.x - ref.x) <=> 0\n end", "def max\n\t\tm = self.mat[0][0]\n\t\tfor i in ([email protected]_i)\n\t\t\t#for j in ([email protected]_i)\n\t\t\[email protected]_i.times do |j| \n\t\t\t\t\t\t\t\n\t\t\t\tif (self.mat[i][j] > m)\n\t\t\t\t\tm = self.mat[i][j]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def determinant_by_elimination_old\n m = dup\n inv, k = m.left_eliminate!\n s = ground.unity\n (0...size).each do |i|\n s *= m[i, i]\n end\n s / k\n end", "def [](i,j) \n @matriz[i][j]\nend", "def solve!\n mapping = [4, 7, 9]\n @matrix[0..2].each { |row| mapping.each { |idx| raise 'invalid equations system' unless (1 - row.fetch(idx)).zero_eps? }}\n\n first = @matrix.fetch(0)\n second = @matrix.fetch(1)\n third = @matrix.fetch(2)\n\n @matrix[1..2].each { |row| row.subtract!(first) }\n second.normalize_term!(2)\n third.normalize_term!(2).subtract!(second) unless third.fetch(2).zero_eps?\n third.normalize_term!(3)\n second.normalize_term!(3).subtract!(third).normalize_term!(2) unless second.fetch(3).zero_eps?\n\n mapping = [4, 1, 0]\n {1 => 7, 2 => 9}.each do |ri, ci|\n row = @matrix.fetch(ri)\n mapping.zip(sum_square(row.fetch(1), row.fetch(0))).each do |idx, val|\n first[idx] += val\n end\n first[ci] -= 1.0\n end\n\n first.normalize_term!(2).subtract!(second) unless first.fetch(2).zero_eps?\n first.normalize_term!(3).subtract!(third) unless first.fetch(3).zero_eps?\n first.normalize_term!(4)\n\n coefs = mapping.map { |idx| first.fetch(idx) }\n mapping = Set.new(mapping)\n first.each_with_index { |val, idx| raise 'calculating error' unless mapping.include?(idx) || val.zero_eps? }\n delta = coefs[1] ** 2 - 4 * coefs[0] * coefs[2]\n raise 'negative or zero discriminant' if delta <= 0 || delta.zero_eps?\n delta = Math.sqrt(delta)\n\n root_x = ->(delta_sqrt) { (delta_sqrt - coefs[1]) / (2 * coefs[0]) }\n root_yz = ->(x, row) { -(row.fetch(0) + x * row.fetch(1)) }\n @roots = [delta, -delta].map do |x|\n x = root_x.call(x)\n [x, root_yz.call(x, second), root_yz.call(x, third)]\n end\n end", "def /(o)\n\n suma = Array.new(matriz.size - 1)\n for i in 0...matriz.size\n suma[i] = Array.new(matriz[i].size - 1)\n for j in 0...matriz[i].size\n\t\t\t\n\t\t\t\tsuma[i][j] = matriz[i][j]\n\t\t\t\t\t\n\t\t\t\t# comprobamos el hash\n\t if (o.matriz[i] != nil)\n\t\t\t\t\t\n\t\t\t\t\t# hay datos en el has para la columna\n\t\t\t\t\tif o.matriz[i].has_key?(j)\t\t\t\t\t\t\n \t\tsuma[i][j] = matriz[i][j] + o.matriz[i][j]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\n end\n end\n MatrizDensa.new(suma)\n\n end", "def reflection\n i = self.copy\n n = self.normalized\n r = ( 2 * ((i*(-1.0)).dot(n)) * (n) ) + ( n )\n r = Vector.new(r.a)\n end", "def max_sum_kadane(matrix)\n rows = matrix.length\n return 0 if rows < 1\n cols = matrix[0].length\n return 0 if cols < 1\n\n ans = -Float::MAX\n cols.times do |l|\n dp = Array.new(rows, 0)\n l.upto(cols - 1) do |c|\n tsum = 0\n rows.times do |r|\n tsum = 0 if tsum < 0\n tsum += matrix[r][c]\n tsum += dp[r]\n ans = [ans, tsum].max\n dp[r] += matrix[r][c]\n end\n end\n end\n\n ans\nend", "def to_i\n if rows != 1 || cols != 1\n raise IncorrectMatrixDimensions, \"to_i should only be called on 1x1 matricies\"\n end\n return value_at(0, 0)\n end", "def adj_matrix n\n Matrix.zero n\nend", "def distance_members(matrix, i, j)\n distances = []\n distances[0] = matrix[i][j] / 2.to_f + (get_sum(matrix, i) - get_sum(matrix, j)) / (2.to_f * ($r - 2))\n distances[1] = matrix[i][j] - distances[0]\n distances\nend", "def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] * m\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif m._kind_of?( Vector )\n m = matrix_cls.column_vector(m)\n r = self * m\n return r.column(0)\n elsif m._kind_of?( matrix_cls )\n # Matrix.Raise ErrDimensionMismatch if column_size != m.row_size\n # rows = (0 .. row_size - 1).collect { |i|\n # (0 .. m.column_size - 1).collect { |j|\n # vij = 0\n # 0.upto(column_size - 1) { |k| vij += self[i, k] * m[k, j] }\n # vij\n # }\n # }\n my_column_size = self.column_size\n other_column_size = m.column_size\n matrix_cls.Raise ErrDimensionMismatch if my_column_size != m.row_size\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n res_row = array_cls.new(other_column_size)\n for j in 0..other_column_size-1 do\n vij = 0\n for k in 0..my_column_size-1 do\n vij += self[i, k] * m[k, j]\t\n end\n vij\n res_row[j] = vij\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n else\n cr = m.coerce(self)\n return cr[0] * cr[1]\n end\n end", "def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend", "def cost_of_transformation(magic_square, non_magic_square)\n cost = 0\n (0..2).each do |row|\n (0..2).each do |column|\n magic = magic_square[row][column]\n non_magic = non_magic_square[row][column]\n cost += (non_magic - magic).abs\n end\n end\n return cost\nend", "def diagonalDifference(arr)\n n = arr.length\n sum1 = 0\n sum2 = 0\n arr.each_with_index do |row, i|\n sum1 += arr[i][i]\n sum2 += arr[(n-1)-i][i]\n end\n result = sum1 - sum2\n result.abs\nend", "def d; Matrix.new(RAtlas.vec2diag(@storage)); end", "def mat_index\n mat_index_vein or stone_layer.mat_index\n end", "def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end", "def density\n @colt_property.density(@colt_matrix)\n end", "def orthogonal_with?(a); self.dot(a) == 0; end", "def menor\n min = 0\n for i in 0...@f do\n for j in 0...@c do\n\tif((!@matriz[i].nil?) && (!@matriz[i][j].nil?))\n\t if (min > @matriz[i][j])\n\t min = @matriz[i][j]\n\t end\n\tend\n end\n end\n end", "def sustitucion_regresiva(n, a, b)\n n = n - 1\n\n x = Array.new(n + 1)\n x[n] = b[n].fdiv(a[n][n])\n\n (0..n - 1).reverse_each do |i|\n sumatoria = (i + 1..n).inject(0) { |sum, k| sum + a[i][k] * x[k] }\n x[i] = (b[i] - sumatoria).fdiv(a[i][i])\n end\n\n puts \"Una solucion aproximada del sistema es X = #{x}\"\n return x\nend", "def diagonalDifference(a)\n diff = right_diagonal_sum(a) - left_diagonal_sum(a)\n return diff.abs\nend", "def t\n return Matrix.new(@rows, @cols) {|i,j| self[j,i]}\n end", "def diagonalSum(matrix)\n # case Matrix[*matrix].column_size\n # when Matrix[*matrix].row_size\n x=0\n y=0\n p matrix.class\n while x<matrix.flatten.size do \n y=y+matrix.flatten[x]\n x=x+matrix.size+1 \n # print \"x= #{x}, y = #{y}, \"\n end\n y\nend", "def -(other)\n raise ArgumentError, \"Las matrices no son cuadradas.\" unless @nfil == other.nfil && @ncol == other.ncol\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil \n for j in 0...ncol\n\t m[i][j] = mat[i][j]- other.mat[i][j]\n end\n end\n return Matriz.new(other.nfil,other.ncol,m) \n end", "def * (other)\n i=0\n m_aux = Array.new(@fila) {Array.new(other.columna,0)}\n while i < @fila\n j = 0\n while j < other.columna\n m_aux[i][j] = 0\n k = 0\n while k < @columna\n m_aux[i][j] += matriz[i][k] * other.matriz[k][j]\n k += 1\n end\n j +=1\n end\n i +=1\n end\n Matriz.new(m_aux)\n end", "def maximo\r\n\t\t\r\n\t\tmax = @matrix[0][0]\r\n\t\t\r\n\t\ti = 0\t\t\t\t\t\t\t\t\r\n\t\t\r\n#\t\twhile i < @fil\t\t\t\t\t\t\r\n\t\t(@fil).times do\t\t\t\r\n\t\t\tj = 0\r\n\t\t\t\r\n#\t\t\twhile j < @col\t\t\t\t\t\r\n\t\t\t(@col).times do\t\t\t\t\r\n\t\t\t\tif(@matrix[i][j] > max)\r\n\t\t\t\t\t\r\n\t\t\t\t\tmax = @matrix[i][j]\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tj += 1\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\t\t\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"maximo: #{max}\"\r\n\t\t\r\n\t\treturn max\r\n\t\t\r\n\tend", "def t\n return Matrix.new(@cols, @rows) {|i,j| self[j,i]}\n end", "def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def eliminacion_gaussianda(n, a)\n n = n - 1\n\n for j in (0..n - 1)\n k = (j..n).select { |i| !a[i][j].zero? }.first\n\n if k.nil?\n puts \"El sistema no tiene solucion unica.\"\n return\n end\n\n if !k.eql?(j)\n a[k], a[j] = a[j], a[k]\n end\n\n for i in (j + 1..n)\n m = a[i][j].fdiv(a[j][j])\n resta = a[i].map.with_index { |x, index| x - m * a[j][index] }\n a[i].replace(resta)\n end\n end\n\n if a[n][n].zero?\n puts \"El sistema no tiene solucion unica.\"\n return\n end\n\n x = Array.new(n + 1)\n x[n] = a[n][n + 1].fdiv(a[n][n])\n\n (0..n - 1).reverse_each do |i|\n sumatoria = (i + 1..n).inject(0) { |sum, k| sum + a[i][k] * x[k] }\n x[i] = (a[i][n + 1] - sumatoria).fdiv(a[i][i])\n end\n\n puts \"Una solucion aproximada del sistema es X = #{x}\"\n return x\nend", "def estimated_variance_covariance_matrix\n #mse_p=mse\n columns=[]\n @ds_valid.vectors.each{|k|\n v = @ds_valid[k]\n columns.push(v.to_a) unless k == @y_var\n }\n columns.unshift([1.0]*@valid_cases)\n x=::Matrix.columns(columns)\n matrix=((x.t*x)).inverse * mse\n matrix.collect {|i| Math::sqrt(i) if i>=0 }\n end", "def similarity_matrix(comparison, corpora, stats)\n\n cov = []\n corpora.length.times{|i| cov[i] = [] }\n\n corpora.length.times{|i|\n corpora.length.times{|j|\n if not comparison.symmetric? or (i >= j) then\n cov[i][j] = comparison.compare(corpora[i], stats[i], corpora[j], stats[j])\n\n\n # cov[i][j] = covariance(corpora[i], stats[i], corpora[j], stats[j])\n # cor[i][j] = cov[i][j] / (stats[i][:sd] * stats[j][:sd])\n\n # puts \"COV(#{i},#{j}) = #{covariance(corpora[i], stats[i], corpora[j], stats[j])}\"\n # puts \"PMCC(#{i},#{j}) = #{(covariance(corpora[i], stats[i], corpora[j], stats[j])) / (stats[i][:sd] * stats[j][:sd])}\"\n end\n }\n }\n\n return cov\nend", "def cols\n\t\treturn self[0].length if(self.matrix? && self.length>0)\n\tend", "def vector?\n self.effective_dim == 1\n end", "def diagonalSum(matrix)\ntotal = 0\n (0...matrix.length).each {|sub| total += matrix[sub][sub]}\nreturn total\nend", "def -(other)\n i=0\n \tm_aux = @matriz\n while i < @fila\n j=0\n \twhile j < @columna\n \t m_aux[i][j] = m_aux[i][j] - other.matriz[i][j]\n \t j += 1\n \tend\n i += 1\n end\n Matriz.new(m_aux)\n end", "def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(matrizc.matriz.size,0)\n\n\t\t\tfor col in 0...matrizc.matriz.size\n\n\t\t\t\tfor pos in 0...matriz.size\n\n\t\t\t\t\tprod = matriz[fil][pos] * matrizc.matriz[pos][col]\n\t\t\t\t\tmatRes[fil][col] = matRes[fil][col] + prod\n\n\t\t\t\tend\n\n\t\t\tend\n\n \t\tend\n\n \t\tMatriz.new(matRes)\n\n \tend", "def *(o)\n\t if(self.col == o.row)\n \t\t matres = self.class.new(self.row,self.col)\n# \t\t\t for i in 0...self.row\n# \t\t\t for j in 0...o.col\n# \t\t for k in 0...self.col\n\n\t\t\t i = 0\n \t\t\t (0..(self.row - 1)).collect {\n \t\t\t 0.upto(o.col - 1) do |j|\n\t\t\t k = 0\n \t\t (self.col - 1).times {\n \t\t\tmatres[i,j] += self[i,k] * o[k,j]\n\t\t\t k += 1\n\t\t\t }\n\t\t\t end\n# \t\t end\n# end\n# end\n\n\t\t\ti += 1\n\t\t\t}\n matres\n end\n end", "def cur_normal_matrix\n MSPhysics::Newton::CurvySlider.get_cur_normal_matrix(@address)\n end", "def right_to_diagonal_left_approach\n largest_prod = 0\n\n for each_row in (0..15)\n for col in (0..19)\n each_col = 19 - col\n a = $grid_of_numbers[each_row][each_col]\n b = $grid_of_numbers[each_row+1][each_col-1]\n c = $grid_of_numbers[each_row+2][each_col-2]\n d = $grid_of_numbers[each_row+3][each_col-3]\n #puts \"#{a} #{b} #{c} #{d}\"\n curr_prod = a*b*c*d\n if curr_prod > largest_prod\n largest_prod = curr_prod\n end\n end\n end\n \n return largest_prod\nend", "def det\n\t\t\t@frecuencias['determinantes']\n\t\tend", "def -(m)\n matrix_cls = Matrix\n if m._isNumeric\n matrix_cls.Raise ErrOperationNotDefined, \"-\"\n elsif m._kind_of?(matrix_cls)\n # no coercion\n elsif m._kind_of?(Vector)\n m = matrix_cls.column_vector(m)\n else\n cr = m.coerce(self)\n return cr[0] - cr[1]\n end\n\n my_rows = @rows\n my_rows_size = my_rows.size\n my_column_size = self.column_size\n \n matrix_cls.Raise ErrDimensionMismatch unless my_rows_size == m.row_size and my_column_size == m.column_size\n \n #rows = (0 .. row_size - 1).collect { |i|\n # (0 .. column_size - 1).collect { |j|\n # self[i, j] - m[i, j]\n # }\n #}\n array_cls = Array\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n a_row = array_cls.new(my_column_size)\n for j in 0..my_column_size-1 do\n a_row[j] = self[i, j] - m[i, j]\n end\n rows[i] = a_row\n end\n matrix_cls.rows(rows, false)\n end", "def solution \n row_search \n columns_search \n diagonal_search\n end", "def sigCalc(matrix)\n\n d = 0\n mutsRemaining = matrix.rowSums.sum\n bitsRemaining = matrix.numRows * matrix.numCols\n geneSums = Array.new(matrix.rowSums)\n\n #look at one sample at a time\n matrix.colHeader.each_index{|sampIndex|\n sample = matrix.getColByIndex(sampIndex)\n foundOne = false\n sampSum = sample.sumNum\n\n #now, look at each bit in that sample\n sample.each_index{|geneIndex|\n bit = sample[geneIndex]\n\n # We have already seen a one, and are betting the XOR pattern,\n # or we know there are no more mutations here due to the sums\n if foundOne == true || mutsRemaining == 0\n d += calcD(probNull(bit),probA0(bit))\n\n else #estimate the mutation probability\n d += calcD(probNull(bit),probA1(bit, geneSums[geneIndex], (matrix.numCols-sampIndex), sampSum, sample.length-geneIndex, mutsRemaining,bitsRemaining))\n end\n\n if bit == 1\n foundOne = true\n geneSums[geneIndex] -= 1\n sampSum -= 1\n\tmutsRemaining -= 1\n end\n bitsRemaining -=1\n }\n }\n return d\nend" ]
[ "0.70764804", "0.6891471", "0.66725844", "0.6642275", "0.65906614", "0.652938", "0.64234287", "0.6359657", "0.62518805", "0.6232034", "0.6208302", "0.6081332", "0.6030435", "0.59678113", "0.5953506", "0.5925404", "0.5899323", "0.58752614", "0.5862235", "0.58551264", "0.58402497", "0.5793094", "0.5738246", "0.56957036", "0.5682606", "0.5677436", "0.56758034", "0.56573755", "0.5630646", "0.56100404", "0.55897886", "0.55788374", "0.55777603", "0.5573203", "0.5571299", "0.55443996", "0.5522271", "0.5512931", "0.5502784", "0.5499329", "0.54819465", "0.5465571", "0.546555", "0.54318845", "0.54304534", "0.5420511", "0.5418271", "0.54142225", "0.5413204", "0.53966016", "0.53889793", "0.53866726", "0.53804106", "0.53781205", "0.5374653", "0.53736675", "0.53129625", "0.53099966", "0.5303936", "0.5294242", "0.52514285", "0.52177525", "0.5215048", "0.52140796", "0.52021825", "0.52010304", "0.5199947", "0.5188894", "0.5180923", "0.51670766", "0.51619667", "0.5155041", "0.51548415", "0.5152611", "0.51018035", "0.50991", "0.50990903", "0.5095765", "0.5083138", "0.5073589", "0.5072494", "0.50651294", "0.50552636", "0.5054631", "0.50490934", "0.5045461", "0.50385416", "0.5029625", "0.5027526", "0.50158936", "0.5012702", "0.5011769", "0.50100535", "0.5007666", "0.50056624", "0.50050056", "0.5003362", "0.4997267", "0.49697042", "0.49568644" ]
0.71308255
0
Metodo para multiplicar una matriz por un escalar
def x(escalar) maux=Array.new(@nFil) { Array.new(@mCol) } (@nFil).times do |i| (@mCol).times do |j| maux[i][j] = @matriz[i][j] end end aux = Matriz.new(maux) for i in 0...@nFil do for j in 0...@mCol do aux.matriz[i][j] = @matriz[i][j] * escalar end end aux end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end", "def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(matrizc.matriz.size,0)\n\n\t\t\tfor col in 0...matrizc.matriz.size\n\n\t\t\t\tfor pos in 0...matriz.size\n\n\t\t\t\t\tprod = matriz[fil][pos] * matrizc.matriz[pos][col]\n\t\t\t\t\tmatRes[fil][col] = matRes[fil][col] + prod\n\n\t\t\t\tend\n\n\t\t\tend\n\n \t\tend\n\n \t\tMatriz.new(matRes)\n\n \tend", "def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end", "def *(other)\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil do\n for j in 0...other.ncol do \n for k in 0...ncol do\n m[i][j] = m[i][j] + self.mat[i][k] * other.mat[k][j]\n end\n end\n end\n return Matriz.new(self.nfil,other.ncol,m) \n end", "def *(other)\n\t if(@alt==other.alt && @anc=other.anc)\n\t\tif(other.is_a? Matriz_Dispersa)\n\t\t self.to_densa.*(other.to_densa)\n\t\telse\n\t\t self.to_densa.*(other)\n\t\tend\n\t else\n\t\tputs \"no se puede realizar la multiplicacion\"\n\t end\n\t end", "def __mul_matrix(other)\n\t\tm = Memory.new(other.column_count) { |j|\n\t\t\t__inner_product(other.column(j))\n\t\t}\n\t\treturn MemoryVector.__new__(m)\n\tend", "def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] * m\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif m._kind_of?( Vector )\n m = matrix_cls.column_vector(m)\n r = self * m\n return r.column(0)\n elsif m._kind_of?( matrix_cls )\n # Matrix.Raise ErrDimensionMismatch if column_size != m.row_size\n # rows = (0 .. row_size - 1).collect { |i|\n # (0 .. m.column_size - 1).collect { |j|\n # vij = 0\n # 0.upto(column_size - 1) { |k| vij += self[i, k] * m[k, j] }\n # vij\n # }\n # }\n my_column_size = self.column_size\n other_column_size = m.column_size\n matrix_cls.Raise ErrDimensionMismatch if my_column_size != m.row_size\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n res_row = array_cls.new(other_column_size)\n for j in 0..other_column_size-1 do\n vij = 0\n for k in 0..my_column_size-1 do\n vij += self[i, k] * m[k, j]\t\n end\n vij\n res_row[j] = vij\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n else\n cr = m.coerce(self)\n return cr[0] * cr[1]\n end\n end", "def matmul(a, b)\n m = a.length\n n = a[0].length\n p = b[0].length\n\n # transpose\n b2 = Array.new(n) { Array.new(p) { 0 } }\n n.times do |i|\n p.times do |j|\n b2[j][i] = b[i][j]\n end\n end\n\n # multiplication\n c = Array.new(m) { Array.new(p) { 0 } }\n m.times do |i|\n p.times do |j|\n s = 0\n ai, b2j = a[i], b2[j]\n n.times do |k|\n s += ai[k] * b2j[k]\n end\n c[i][j] = s\n end\n end\n c\nend", "def *(x)\n if x._isNumeric\n # els = @elements.collect{|e| e * x} \n my_elems = @elements\n e_size = my_elems.size\n els = Array.new(e_size)\n for i in 0..e_size-1 do\n els[i] = my_elems[i] * x\n end\n\n Vector.elements(els, false)\n else\n matrix_cls = Matrix\n if x._kind_of?( matrix_cls )\n matrix_cls.column_vector(self) * x\n else\n cr = x.coerce(self)\n cr[0] * cr[1]\n end\n end\n end", "def *(a)\n if a.class == Vector # inner product\n product = 0\n self.each_index{|k| product += self[k]*a[k]}\n else\n product = Vector.new # scalar product\n self.each_index{|k| product[k] = self[k]*a}\n end\n product\n end", "def matmul(a, b)\n\tm = a.length\n\tn = a[0].length\n\tp = b[0].length\n\t# transpose\n\tb2 = Array.new(n) { Array.new(p) { 0 } }\n\tfor i in 0 .. n-1\n\t\tfor j in 0 .. p-1\n\t\t\tb2[j][i] = b[i][j]\n\t\tend\n\tend\n\t# multiplication\n \tc = Array.new(m) { Array.new(p) { 0 } }\n\tfor i in 0 .. m-1\n\t\tfor j in 0 .. p-1\n\t\t\ts = 0\n\t\t\tai, b2j = a[i], b2[j]\n\t\t\tfor k in 0 .. n-1\n\t\t\t\ts += ai[k] * b2j[k]\n\t\t\tend\n\t\t\tc[i][j] = s\n\t\tend\n\tend\n\treturn c\nend", "def *(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Densa\") && (@fil == @col) && (other.fil == other.col) && (@fil == other.fil))\r\n\t\t\t\r\n\t\t\tmatrizMult = Array.new(@fil) {Array.new(@col)}\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t(0..(@fil - 1)).collect {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t0.upto(@col - 1) do |j|\r\n\t\t\t\t\t\r\n\t\t\t\t\tmatrizMult[i][j] = 0\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tk = 0\t\t\t\t\t\r\n\t\t\t\t\t(@col - 1).times {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tmatrizMult[i][j] = matrizMult[i][j] + (@matrix[i][k] * other.matrix[k][j])\r\n\t\t\t\t\t\tk += 1\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\ti += 1\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t#puts \"#{matrizMult}\"\r\n\t\t\treturn matrizMult\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Numero distinto de filas y columnas\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def * (other)\n i=0\n m_aux = Array.new(@fila) {Array.new(other.columna,0)}\n while i < @fila\n j = 0\n while j < other.columna\n m_aux[i][j] = 0\n k = 0\n while k < @columna\n m_aux[i][j] += matriz[i][k] * other.matriz[k][j]\n k += 1\n end\n j +=1\n end\n i +=1\n end\n Matriz.new(m_aux)\n end", "def ScalarMultiplication( scalaire ) \n i = @i * scalaire\n j = @j * scalaire\n \n pt = Point2D.new(i, j)\n vectorMultiSca = Vector2D.new( 0, 0 )\n vectorMultiSca.initializeWithPoint( pt )\n \n return vectorMultiSca \n end", "def multiply(*multiplicands)\n multiplicands.flatten.inject(1, :*)\n end", "def *(other) \n ms = Hash.new(0)\n h = Hash.new(0)\n @mul = 0\n @matrix.keys.count.times do |k|\n @k = matrix.keys[k]\n for j in 0..other.hash.keys.count do\n @matrix[@k].keys.count.times do |i|\n @i = @matrix[@k].keys[i]\n if other.hash[@i][j] != 0 then\n @mul += @matrix[@k][@i] * other.hash[@i][j]\n end\n end\n h[j] = @mul unless @mul == 0\n @mul = 0\n end\n ms[@k] = h.clone unless h.empty?\n h.clear\n end\n ms2 = Matriz_dispersa.new(ms)\n end", "def *(o)\n\t if(self.col == o.row)\n \t\t matres = self.class.new(self.row,self.col)\n# \t\t\t for i in 0...self.row\n# \t\t\t for j in 0...o.col\n# \t\t for k in 0...self.col\n\n\t\t\t i = 0\n \t\t\t (0..(self.row - 1)).collect {\n \t\t\t 0.upto(o.col - 1) do |j|\n\t\t\t k = 0\n \t\t (self.col - 1).times {\n \t\t\tmatres[i,j] += self[i,k] * o[k,j]\n\t\t\t k += 1\n\t\t\t }\n\t\t\t end\n# \t\t end\n# end\n# end\n\n\t\t\ti += 1\n\t\t\t}\n matres\n end\n end", "def mul(a, b)\n res = []\n res << a[0]*b[0] + a[1]*b[2]\n res << a[0]*b[1] + a[1]*b[3]\n res << a[2]*b[0] + a[3]*b[2]\n res << a[2]*b[1] + a[3]*b[3]\n res\nend", "def multiply(*input)\n\t\tinput.flatten.inject(:*)\n\tend", "def mul!(*args)\n dotop!(RAtlas::method(:mul!), RAtlas::method(:mmul!),\n *args)\n end", "def mult(array)\n array.map { |arr|\n xt = mat[0][0] * arr.x + mat[0][1] * arr.y + mat[0][2] * arr.z + mat[0][3] * 1\n yt = mat[1][0] * arr.x + mat[1][1] * arr.y + mat[1][2] * arr.z + mat[1][3] * 1\n zt = mat[2][0] * arr.x + mat[2][1] * arr.y + mat[2][2] * arr.z + mat[2][3] * 1\n Vec3D.new(xt, yt, zt)\n }\n end", "def multiply!(m)\n super().flip!\n end", "def multiply(nums)\r\n nums.reduce(:*)\r\nend", "def *(other)\r\n\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizProd = Array.new(@fil) {Array.new(@col) {0}}\t\t\t\r\n\r\n\t\t\t0.upto(other.numElementos - 1) do |i|\r\n\r\n\t\t\t\tif (other.filM[i] = @colM[i])\r\n\t\t\t\t\tmatrizProd[@filM[i]][@colM[i]] += @eleM[i] * other.eleM[i]\r\n\t\t\t\tend\r\n\r\n\t\t\tend\t\t\t\r\n\t\t\t\r\n\t\t\t#puts \"prod = #{matrizProd}\"\r\n\t\t\treturn matrizProd\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend", "def dmul!(arg)\n case arg\n when RNum::Matrix\n RAtlas::damul!(arg.storage, @storage)\n return arg\n else\n raise ArgumentError, \"Expected Matrix.\"\n end\n end", "def mult(*args)\n\tprod = 1\n\targs.each do |arg|\n\t\tprod *= arg\n\tend\n\tprod\nend", "def multiply(first_matrix, second_matrix)\n x = first_matrix[0][0] * second_matrix[0][0] + first_matrix[0][1] * second_matrix[1][0]; \n y = first_matrix[0][0] * second_matrix[0][1] + first_matrix[0][1] * second_matrix[1][1]; \n z = first_matrix[1][0] * second_matrix[0][0] + first_matrix[1][1] * second_matrix[1][0]; \n w = first_matrix[1][0] * second_matrix[0][1] + first_matrix[1][1] * second_matrix[1][1]; \n \n first_matrix[0][0] = x; \n first_matrix[0][1] = y; \n first_matrix[1][0] = z; \n first_matrix[1][1] = w; \n end", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def multiply(array)\n array.inject(:*)\nend", "def square_matrix_multiply_recursive(a, b)\n n = a.size\n c = n.times.map { |x| [] }\n if n == 1\n c[0] << a[0][0]*b[0][0]\n else\n a11, a12, a21, a22 = matrix_partitioner(a)\n b11, b12, b21, b22 = matrix_partitioner(b)\n\n c11 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b11),\n square_matrix_multiply_recursive(a12, b21))\n\n c12 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b12),\n square_matrix_multiply_recursive(a12, b22))\n\n c21 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b11),\n square_matrix_multiply_recursive(a22, b21))\n\n c22 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b12),\n square_matrix_multiply_recursive(a22, b22))\n c = assemble_matrix([c11, c12, c21, c22])\n end\n c\n end", "def multi(a, b) #=> funkcja wykonujaca mnozenie\n\n\tc = a * b\n\nend", "def multiply(m)\n t = super(m)\n t.flip!\n end", "def multiply *array\n puts array.inspect\n array.flatten.inject(:*)\n end", "def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def *(other)\n raise ArgumentError , 'Parametro invalido' unless other.is_a? Numeric or other.is_a? Matriz\n\n if(other.is_a? Numeric)\n c = Matriz_Densa.new(@N, @M)\n \n (@N).times do |i|\n (@M).times do |j|\n c.set(i, j, get(i,j)*other)\n end\n end\n else # Matriz * Matriz\n raise ArgumentError , 'Matriz no compatible (A.N == B.M)' unless @M == other.N\n c = Matriz_Densa.new(@N, other.M)\n (@N).times do |i|\n (other.M).times do |j|\n buffer = (0...@M).inject(0) { |acc, k| get(i, k) * other.get(k,j) + acc }\n c.set(i, j, buffer)\n end\n end\n end\n\n if (c.null_percent > 0.6)\n return Matrixlpp::Matriz_Dispersa.copy(c)\n else\n return c\n end\n end", "def elementMult(other)\n # pre-conditions and invariants\n assert((other.respond_to? :[]), \"pre-condition\")\n _invariants\n assert_equal(self.row_size,other.row_size, \"pre-condition\")\n assert_equal(self.column_size,other.row_size, \"pre-condition\")\n\n result = self.clone\n self.each_with_index {|index,val|\n result.put(index, val * other[index] )\n }\n\n # post-conditions and invariants\n _invariants\n assert_equal(result.toBaseMatrix,Matrix.build(self.row_size,self.column_size) {|x,y| self[x,y] * other[x,y]}, \"post-condition\")\n\n return result\n end", "def square_matrix_multiply_recursive(a, b)\n n = a.size\n c = n.times.map { |x| [] }\n if n == 1\n c[0] << a[0][0]*b[0][0]\n else\n a11, a12, a21, a22 = matrix_partitioner(a)\n b11, b12, b21, b22 = matrix_partitioner(b)\n\n c11 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b11),\n square_matrix_multiply_recursive(a12, b21))\n\n c12 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b12),\n square_matrix_multiply_recursive(a12, b22))\n\n c21 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b11),\n square_matrix_multiply_recursive(a22, b21))\n\n c22 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b12),\n square_matrix_multiply_recursive(a22, b22))\n c = assemble_matrix([c11, c12, c21, c22])\n end\n c\nend", "def multiply(*nums)\n return nums.reduce(:*)\nend", "def x(escalar)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end", "def multiply(*args) # multiple arguments\n array = args.to_a #convert to array\n array.reduce(:*)\nend", "def *(other)\n c = Matriz_Densa.new(@filas, other.columnas)\n 0.upto(@filas-1) do |i|\n 0.upto(@columnas-1) do |j|\n 0.upto(@columnas-1) do |k|\n c.set(i, j, get(i, k) * other.get(k,j) + c.get(i,j))\n end \n end \n end\n c\n end", "def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend", "def multiply_list(arr1, arr2)\n [arr1, arr2].transpose.map do |pair|\n pair.reduce(:*)\n end\nend", "def mult(arr)\n\t\t# 1 space between every cell row added to row and column width\n\t\twidth = 1+ (arr.count * arr.count).to_s.length \n\t\t(arr).each do |x|\n\t\t\t(arr).each do |y|\n\t\t\t\tresult =(x * y).to_s\n\t\t# for aesthtics \n\t\t\tpadding = \" \" * (width - result.length)\n\t\t\tprint padding + result\n\t\t\tend \n\t\tprint(\"\\n\")\n\t\tend\n\tend", "def multiply_els\n\t\tself.my_inject(:*, self[0])\n\tend", "def strassen_matrix_multiplication(a, b)\n if a.length > 1\n a_splited = split_matrix(a, a.length)\n b_splited = split_matrix(b, a.length)\n else\n a_splited = a.map {|item| item[0]}\n b_splited = b.map {|item| item[0]}\n end\n\n p1 = calculate_p1(a_splited, b_splited)\n p2 = calculate_p2(a_splited, b_splited)\n p3 = calculate_p3(a_splited, b_splited)\n p4 = calculate_p4(a_splited, b_splited)\n p5 = calculate_p5(a_splited, b_splited)\n p6 = calculate_p6(a_splited, b_splited)\n p7 = calculate_p7(a_splited, b_splited)\n\n build_new_matrix(p1, p2, p3, p4, p5, p6, p7)\n end", "def *(a)\n if a.is_a? Numeric then\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] * a}\n end\n\n if not a.is_a? Matrix then\n raise ArgumentError, \"a must be Matrix or Numeric\"\n end\n\n raise ArugmentError, \"self.cols those not match other.rows\" if @cols != a.rows\n\n return Matrix.new(@rows, a.cols) { |i,j|\n r = 0\n for k in 0...@cols\n r += self[i,k] * a[k,j]\n end\n return r\n }\n end", "def similarity_matrix\n multiply_self(normalize)\n end", "def matz; end", "def multiply(*nums)\n nums.reduce(1, :*)\nend", "def *(other)\n raise ArgumentError , 'El argumento debe ser una matriz' unless other.is_a? Numeric or other.is_a? Matriz\n \n #Si el argumento es un numero\n if(other.is_a? Numeric)\n c = Matriz_Densa.new(@fil, @col)\n i = 0\n while(i < @N)\n j = 0\n while(j < @M)\n c.matrix = @matrix[i][j] * other\n j += 1\n end\n i += 1\n end\n #Si el arguumento es una matriz\n else\n raise ArgumentError , 'Matriz no compatible (A.fil == B.col)' unless @col == other.fil\n \n c = Matriz_Densa.new(@fil, other.col)\n i = 0\n while(i < @fil)\n j = 0\n while(j < other.col)\n k = 0\n c.matrix[i][j] = 0\n while(k < @col)\n c.matrix[i][j] += @matrix[i][k] * other.get(k,j)\n k += 1\n end\n j += 1\n end\n i += 1\n end\n end\n \n c\n end", "def mul(factors)\n view.update_many(\"$mul\" => collect_operations(factors))\n end", "def add_mul\n\t\tpos = 0\n\t\twhile pos < @instructions.length - 6\n\t\t\tsix = @instructions[pos, 6]\n\t\t\tif six.map { |instr| instr[:type] } == CONST_MULT &&\n\t\t\t\t\t[six[0][1], six[0][2], six[1][1], six[4][1]].uniq.length == 4 &&\n\t\t\t\t\t[six[0][2], six[2][1], six[2][1]].uniq.length == 1 &&\n\t\t\t\t\tsix[4][1] == six[5][1] &&\n\t\t\t\t\tsix[3][2] == -2 && six[5][2] == -5\n\t\t\t\t@instructions[pos] = {:type => :mul, 1 => six[0][1], 2 => six[4][1], 3 => six[1][1]}\n\t\t\t\t@instructions[pos + 1] = {:type => :cpy, 1 => 0, 2 => six[2][1]}\n\t\t\t\t@instructions[pos + 2] = {:type => :cpy, 1 => 0, 2 => six[4][1]}\n\t\t\t\t((pos + 3)..(pos + 5)).each do |i|\n\t\t\t\t\t@instructions[i] = {:type => :none}\n\t\t\t\tend\n\t\t\tend\n\t\t\tpos += 1\n\t\tend\n\tend", "def *(mat)\n end", "def multiply\n inject(1) { |p,x| p * x }\n end", "def *(a)\n if a.is_a? Numeric then\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] * a}\n end\n\n if not a.is_a? Matrix then\n raise ArgumentError, \"a must be Matrix or Numeric\"\n end\n\n raise ArugmentError, \"self.cols those not match other.rows\" if @cols != a.rows\n\n return Matrix.new(@rows, a.cols) { |i,j|\n r = 0\n for k in 0...@cols\n r += self[i,k] * a[k,j]\n end\n r\n }\n end", "def * other\n mul(other)\n end", "def multiplies (*args)\n multi=1\n args.each do |item|\n multi *=item\n end\n multi\nend", "def rec_matrix_multiplication(a, b)\n return a[0] * b[0] if a.length == 1\n\n a_splited = split_matrix(a, a.length)\n b_splited = split_matrix(b, a.length)\n\n a_b_1 = [matrix_sum(rec_matrix_multiplication(a_splited[0], b_splited[0]), rec_matrix_multiplication(a_splited[1], b_splited[2]))].flatten\n a_b_2 = [matrix_sum(rec_matrix_multiplication(a_splited[0], b_splited[1]), rec_matrix_multiplication(a_splited[1], b_splited[3]))].flatten\n a_b_3 = [matrix_sum(rec_matrix_multiplication(a_splited[2], b_splited[0]), rec_matrix_multiplication(a_splited[3], b_splited[2]))].flatten\n a_b_4 = [matrix_sum(rec_matrix_multiplication(a_splited[2], b_splited[1]), rec_matrix_multiplication(a_splited[3], b_splited[3]))].flatten\n\n row_length = a_b_1.count\n\n if row_length == 1\n result = [[a_b_1[0], a_b_2[0], a_b_3[0] , a_b_4[0]]]\n else\n result = \n [\n a_b_1[0..(row_length / 2) - 1] + a_b_2[0..(row_length / 2) - 1] +\n a_b_1[(row_length / 2).. - 1] + a_b_2[(row_length / 2).. - 1] +\n a_b_3[0..(row_length / 2) - 1] + a_b_4[0..(row_length / 2) - 1] +\n a_b_3[(row_length / 2).. - 1] + a_b_4[(row_length / 2).. - 1]\n ]\n end\n\n build(result[0], result[0].length)\nend", "def mult(x,y)\n\tx * y\nend", "def product\n reduce(1, &:*)\n end", "def *(other)\n \n aux=Matriz.new(@col,@fil)\n i=0\n while i < @fil\n\tj = 0\n\twhile j < other.col\n\t k = 0\n\t while k < @col\n\t aux.valor[i][j] = aux.valor[i][j] + (self.get(i,k)*other.get(k,j))\n\t k=k+1\n\t end\n\t j=j+1\n\tend\n\ti=i+1\n end\n aux\n end", "def kron_prod(mat)\n unless self.dimensions==2 and mat.dimensions==2\n raise ShapeError, \"Implemented for 2D NMatrix objects only.\"\n end\n\n # compute the shape [n,m] of the product matrix\n n, m = self.shape[0]*mat.shape[0], self.shape[1]*mat.shape[1]\n # compute the entries of the product matrix\n kron_prod_array = []\n if self.yale?\n # +:yale+ requires to get the row by copy in order to apply +#transpose+ to it\n self.each_row(getby=:copy) do |selfr|\n mat.each_row do |matr|\n kron_prod_array += (selfr.transpose.dot matr).to_flat_a\n end\n end\n else\n self.each_row do |selfr|\n mat.each_row do |matr|\n kron_prod_array += (selfr.transpose.dot matr).to_flat_a\n end\n end\n end\n\n NMatrix.new([n,m], kron_prod_array)\n end", "def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| result << element}}\n result\nend", "def multiply_c!(j, c)\n @body.multiply_c!(j, c)\n @right.multiply_c!(j, c)\n self\n end", "def multiply(*numbers)\n numbers.reduce(1, :*)\n end", "def *(b)\n Check.ensure_symbolic b\n Check.matrix_product self, b\n case b \n when Array\n __column_vector_prod(b) \n when Matrix \n __matrix_prod(b)\n else\n map { |v| v * b}\n end\n end", "def mult(iva,ivb)\n multiplication([iva,ivb])\n end", "def multiply(other)\n clone.multiply! other\n end", "def multiply (array)\n\tarray.inject(1) do |result, element|\n\t\tresult * element\n\tend\nend", "def multiply(arr_in)\n\treturn nil if arr_in.empty?\n\ttotal = arr_in.first\n\tarr_in.delete_at(0)\n\tarr_in.each { |elem| total *= elem }\n\ttotal\nend", "def ** (other)\n if other._isInteger\n x = self\n if other <= 0\n x = self.inverse\n return Matrix.identity(self.column_size) if other == 0\n other = -other\n end\n z = x\n n = other - 1\n while n != 0\n while (div, mod = n.divmod(2)\n mod == 0)\n x = x * x\n n = div\n end\n z *= x\n n -= 1\n end\n z\n elsif other._isFloat || defined?(Rational) && other._kind_of?(Rational)\n Matrix.Raise ErrOperationNotDefined, \"**\"\n else\n Matrix.Raise ErrOperationNotDefined, \"**\"\n end\n end", "def multiply_matrix_and_term(matrix, term)\n\n\tresult_rows = []\n\tmatrix.values.each { |row|\n\t\tresult_row = []\n\t\trow.each { |elem|\n\n\t\t\tcase elem\n\t\t\tin Term\n\t\t\t\tproduct = multiply_two_terms(term, elem)\n\t\t\tin TermList\n\t\t\t\tproduct = multiply_term_and_term_list(term, elem)\n\t\t\tin Fraction\n\t\t\t\tproduct = multiply_fraction_and_term(elem, term)\n\t\t\telse\n\t\t\t\tthrow_error(\"Matrix does not contain only Terms, TermLists, and Fractions.\", matrix, []) # TODO: Add stack trace (make a global)\n\t\t\tend\n\t\t\tresult_row.append(product)\n\t\t}\n\t\tresult_rows.append(result_row)\n\t}\n\treturn Matrix.new(matrix.line, matrix.col, result_rows)\nend", "def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end", "def multiply(*arr)\n\tproduct, i = 1, 0\n\n while i < arr.length\n \tproduct *= arr[i]\n \ti += 1\n end\n\n # could also just use reduce, just keeping fundamentals sharp\n product\nend", "def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def *(value)\n mul(value) ;\n end", "def mult_inputs\n array_element_mult(@input_weights, @input_layer.neuron).inject(1) {|product,n| product*n}\n end", "def multiplication(matrix_1, matrix_2)\n \n matrix_one_array = 0\n matrix_two_array = 0\n element = 0\n new_array = []\n \n until matrix_one_array == matrix_1.length\n \n temp_arr = []\n \n until element == matrix_2[0].length\n \n matrix_1[matrix_one_array].each do |var|\n temp_arr << var * matrix_2[matrix_two_array][element]\n matrix_two_array += 1\n end\n \n matrix_two_array = 0\n element += 1\n \n new_array << temp_arr\n temp_arr = []\n \n end\n \n element = 0\n matrix_one_array += 1\n \n end\n \n return new_array\n \n end", "def *(other)\n\t\tcase other\n\t\twhen Numeric\n\t\t\treturn __mul_numeric(other)\n\t\twhen Matrix\n\t\t\tif size != other.row_count\n\t\t\t\traise ArgumentError.new(\"incompatible: 1x#{size} * #{other.row_count}x#{other.column_count}\")\n\t\t\tend\n\t\t\treturn __mul_matrix(other)\n\t\telse\n\t\t\traise TypeError.new\n\t\tend\n\tend", "def product_method(array)\n array.reduce(:*)\nend", "def multiplication(tab)\n mini = 1\n maxi = 1\n for i in 0..tab.length-1\n if tab[i].is_a?(IntVar)\n mini*=tab[i].domain.first\n maxi*=tab[i].domain.last\n elsif tab[i].is_a?(Integer)\n mini*= tab[i]\n maxi*= tab[i]\n tab[i] = IntVarStat.new(\"DuMmyINT\"+tab[i].to_s,[tab[i]],self)\n end\n end\n var_returned = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n var_returned.depend=true\n @dummyNameNb+=1\n var_in_const = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n @dummyNameNb+=1\n post(eq(var_returned,var_in_const))\n \n post(ContrainteMul.new([var_in_const]+tab))\n \n return var_returned\n \n end", "def custom_multiply(array,number)\n new_array = []\n number.times {new_array+=array}\n return new_array\nend", "def Multiply(val)\n self.value *= val\n end", "def multiply(first, second)\n first.send(:*, second)\nend", "def tensor_product_of_two_matrices(mat1, mat2)\n\n\tresult_rows = []\n\tmat1.values.each { |mat1_row| \n\t\tmat2.values.each { |mat2_row| \n\t\t\t\n\t\t\tresult_row = []\n\t\t\tmat1_row.each { |mat1_elem|\n\n\t\t\t\tmat2_row.each { |mat2_elem|\n\t\t\t\t\tcase [mat1_elem, mat2_elem]\n\t\t\t\t\tin [Term, Term]\n\t\t\t\t\t\tproduct = multiply_two_terms(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, TermList]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [TermList, Term]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, TermList]\n\t\t\t\t\t\tproduct = multiply_term_list_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, Term]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_fraction(mat1_elem, mat2_elem)\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow_error(\"Matrix tensor products with matrices that don't contain only Terms, TermLists, and Fractions.\", mat1, []) # TODO: Add stack trace (make a global)\n\t\t\t\t\tend\n\n\t\t\t\t\tresult_row.append(product)\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult_rows.append(result_row)\n\t\t}\n\t}\n\treturn Matrix.new(mat1.line, mat2.col, result_rows)\nend", "def multiply(a, b)\r\n a * b\r\n end", "def mult(a, b)\n a * b\nend", "def multiply_list(arr1, arr2)\n new_arr = []\n arr1.size.times do |ind|\n new_arr << arr1[ind] * arr2[ind]\n end\n new_arr\nend", "def multiply(array,mult)\n array.map{|num| num*mult}\nend", "def /(other)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j] =@A[i][j] / other.to_f\n end\n end\n return c\n end", "def multPorEscalar(n)\n\t\tif n.class != Fixnum && n.class != Bignum && n.class != Float && n.class == nil\n\t\t\treturn \"El escalar no es valido\"\n\t\t\texit\n\t\telse\n\t\t\ta2 = @r * n\n\t\t\tb2 = @i * n\n\t\tend\n\t\treturn NumCom.new(a2,b2)\n\tend", "def multiply(nums)\n\treturn 0 if nums == []\n\tnums.reduce(:*)\nend", "def square!\n\t\tself.each_with_index do |elem, i|\n\t\t\tself[i] = elem * elem\n\t\tend\n\tend", "def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end", "def multiply(arr)\n\tans=1\n\tarr.each{|i|ans=ans*i}\n\treturn ans\nend", "def basis(v)\n self * self.inner_product(v)\n end", "def custom_multiply(array, number)\n # Return a new array with the array that's passed in\n # as an argument multiplied by the number argument\n result = []\n number.times { array.each { |elem| result << elem } }\n result\nend" ]
[ "0.77362204", "0.7654004", "0.7490298", "0.6893661", "0.6885476", "0.6879959", "0.6867468", "0.68557864", "0.6813482", "0.67841315", "0.6760968", "0.67546684", "0.6738139", "0.6718631", "0.669704", "0.66790015", "0.66705775", "0.66678435", "0.6666401", "0.66619354", "0.66566116", "0.6627374", "0.66219515", "0.66056347", "0.6562167", "0.6509499", "0.6502165", "0.64737666", "0.6467037", "0.6433843", "0.6431492", "0.6425813", "0.64141166", "0.640325", "0.64026463", "0.63990927", "0.63937527", "0.63936913", "0.63715667", "0.63642764", "0.6347914", "0.63288236", "0.6319111", "0.630448", "0.62840813", "0.6262074", "0.6260757", "0.6260606", "0.6255379", "0.62538016", "0.62533766", "0.62484217", "0.62450916", "0.62432927", "0.62385744", "0.6236117", "0.62269", "0.6224899", "0.6221605", "0.6200251", "0.61950713", "0.6179425", "0.61620325", "0.6161274", "0.61505723", "0.6137986", "0.61378765", "0.61359596", "0.6121777", "0.6104791", "0.61030746", "0.60741484", "0.6044158", "0.60388005", "0.6033423", "0.60333294", "0.6031174", "0.60223097", "0.6017929", "0.60169065", "0.6015385", "0.60141665", "0.6003578", "0.6002608", "0.5995814", "0.5977062", "0.5976854", "0.5975898", "0.59662145", "0.5965433", "0.5963775", "0.5952102", "0.59483904", "0.594491", "0.5934348", "0.59274375", "0.59230846", "0.59120613", "0.5910926", "0.5906321" ]
0.67623985
10
Metodo para sumar dos matrices
def +(mat) if (mat.nFil == @nFil && mat.mCol == @mCol) maux=Array.new(@nFil) { Array.new(@mCol) } (@nFil).times do |i| (@mCol).times do |j| maux[i][j] = @matriz[i][j] end end aux = Matriz.new(maux) (@nFil).times do |i| (@mCol).times do |j| aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j] end end else aux = 0 end aux end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_addition_reloaded(*matrices)\n height = matrices[0].size\n width = matrices[0][0].size\n return nil if matrices.select {|m| m.size == height && m[0].size == width}.count != matrices.count\n \n sum = Array.new(height) {|i| Array.new(width, 0)}\n\n (0...height).each do |h|\n (0...width).each do |w|\n matrices.each {|m| sum[h][w] += m[h][w]}\n end\n end\n sum\nend", "def sumar (matrizb)\n\t\tsum = []\n\t\tx,y =0,0\n\t\twhile x < row\n\t\t\twhile y < col\n\t\t\t\tif y == 0\n\t\t\t\t\tsum << [matriz[x][y] + matrizb.matriz[x][y]]\n\t\t\t\telse\n\t\t\t\t\tsum[x] << matriz[x][y] + matrizb.matriz[x][y]\n\t\t\t\tend\n\t\t\t\ty= y+1\t\t\t\n\t\t\tend\n\t\t\tx=x+1\n\t\t\ty=0\n\t\tend\n\t\tMatriz.new (sum)\n\n\tend", "def matrix_addition(m1, m2)\n rows = m1.length\n cols = m1[0].length\n result = Array.new(rows) { Array.new(cols, 0)}\n (0...rows).each do |row|\n (0...cols).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n \n result\nend", "def matrix_addition_reloaded(*matrices)\n\n length = matrices.first.length\n if (matrices.all? { |ele| ele.length == length})\n else\n return nil\n end\n\n matrices.inject do |acc, ele|\n # p acc\n i = 0\n sum_matrix = []\n while i < acc.length\n row_arr = []\n j = 0\n while j < acc.first.length\n # print acc[i][j]\n sum = acc[i][j]+ele[i][j]\n row_arr << sum\n j+= 1\n end\n sum_matrix << row_arr\n i += 1\n end\n sum_matrix\n end\nend", "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "def matrix_addition(m1, m2)\n height = m1.length\n width = m1[0].length\n result = Array.new(height) { [0] * width }\n\n (0...height).each do |row|\n (0...width).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n\n result\nend", "def +(matrizb)\r\n\t\t\r\n\t\t#sumita={}\r\n\t\t#for r in @m_Matrix.keys do \r\n\t\t#\tsum = {}\r\n\t\t#\tif matrizb.m_Matrix.keys.include? r\r\n\t\t#\t\tfor j in @m_Matrix[r].vector.keys do \r\n\t\t#\t\t\tsum[j] = @m_Matrix[r].vector[j]+matrizb[r].vector[j]\t\r\n\t\t#\t\t\tsumita[r] = {j=>sum[j]}\r\n\t\t#\t\tend\r\n\t\t#\telse\r\n\t\t#\t\tsum[r]=@m_Matrix[r]\r\n\t\t#\tend\r\n\t\t#end\r\n\t\t#SparseMatrix.new(sumita)\r\n\r\n\t\tfor r in @m_Matrix.keys do \r\n\t\t\tfor j in @m_Matrix[r].vector.keys do \r\n\t\t\t\tmatrizb[r][j]= @m_Matrix[r][j]+matrizb[r][j]\r\n\t\t\tend\r\n\t\tend\t\r\n\tmatrizb\r\n\tend", "def matrix_addition_reloaded(*matrixs)\n # matrixs.each { |matrix| return nil if matrixs.first.length != matrix.length}\n # first_matrix = matrixs.first\n # matrix_sum = []\n # i = 0\n\n # while matrix_sum.length < first_matrix.length do \n # sum = 0 \n # sum += matrixs[i][i][i]\n # matrix_sum << sum\n\n # end\n # matrix_sum\n\n matrix = matrixs.first\n height = matrix.length\n width = matrix[0].length\n matrix_sum = Array.new(height) { [0] * width}\n\n matrixs.inject(matrix_sum) do |m1, m2|\n return nil if m2.length != height || m2[0].length != width\n matrix_addition(m1, m2)\n\n end\nend", "def +(m)\n\t\t\t\tif(m.instance_of? Matriz_dispersa)\n\t\t\t\t\treturn m + self \n \n else\n\t\t\t\t\traise IndexError unless ((self.fil == m.fil) && (self.col == m.col)) #Las dimensiones tienes que ser iguales\n\t\n\t\t\t\t\n\t\t\t\t\tsuma = Matriz.new(self.fil, self.col)\n\n\t\t\t\t\tfor i in (0...self.fil)\n for j in (0...self.col)\n\t\t\t\t\t\t\tsuma[i][j] = self[i][j] + m[i][j]\n end\n\t\t\t\t\tend \n\n return suma \n\t\t\t\tend\n end", "def matrix_addition(matrix_a, matrix_b)\n addition = Array.new(matrix_a.length) {Array.new(matrix_a[0].length)}\n\n matrix_a.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n addition[row_i][col_i] = matrix_a[row_i][col_i] + matrix_b[row_i][col_i]\n end\n end\n \n addition\nend", "def matrix_addition(matrix_1, matrix_2)\n new_matrix = Array.new(matrix_1.length) {Array.new(matrix_1.first.length)}\n new_matrix.each_with_index do |array, i1|\n array.each_with_index do |el, i2|\n new_matrix[i1][i2] = matrix_1[i1][i2] + matrix_2[i1][i2]\n end\n end\n new_matrix\nend", "def matrixAddition(a, b)\n c = [] << a << b\n c.transpose.map{ |i| i.transpose }.map{ |s|\n s.map{ |p| p.reduce(&:+)}}\nend", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.length) { Array.new(matrix1[0].length) }\n\n (0...matrix1.length).each do |i|\n (0...matrix1[i].length).each do |j|\n new_matrix[i][j] = matrix1[i][j] + matrix2[i][j]\n end\n end\n\n new_matrix\nend", "def sum(dim=0)\n reduce_along_dim(dim, 0.0) do |sum, sub_mat|\n sum + sub_mat\n end\n end", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.size) { [] }\n\n matrix1.each_index do |i|\n matrix1[i].each_index do |j|\n new_matrix[i] << matrix1[i][j] + matrix2[i][j]\n end\n end\n new_matrix\nend", "def matrix_addition(matrix_1 , matrix_2)\n i = 0\n sum = []\n\n while sum.length < matrix_1.length\n arr_1 = matrix_1[i]\n arr_2 = matrix_2[i]\n\n sum << matrix_plus(arr_1, arr_2)\n\n i += 1\n\n end\n sum\nend", "def m_add(other)\n # Ensure proper dimensions\n if (other.num_rows != self.num_rows || other.num_cols != self.num_cols)\n raise \"Matrix dimensions must match\"\n end\n\n sum_matrix = MutableMatrix.new\n \n self.each_index do |row| # For reach row\n sum_matrix[row] = Array.new(self.num_cols, 0)\n self[row].each_index do |col| # For each col\n sum_matrix[row][col] = self[row][col] + other[row][col]\n end\n end\n return sum_matrix\n end", "def matrix_addition(matrix1, matrix2)\n sum_matrix = []\n i = 0\n while i < matrix1.length\n j = 0\n row = []\n while j < matrix1[i].length\n row << matrix1[i][j] + matrix2[i][j]\n j += 1\n end\n sum_matrix << row\n i += 1\n end\n sum_matrix\nend", "def matrix_addition_reloaded(*matrices)\n return matrices[0] if matrices.length == 1\n \n sum_mat = nil\n\n # debugger\n\n (0...matrices.length-1).each do |n|\n temp = nil\n if sum_mat.nil?\n temp = matrices[n]\n else\n temp = sum_mat\n end\n if check_rowcol?(temp, matrices[n+1])\n neigbhor_sum = matrix_addition(temp, matrices[n+1])\n sum_mat = neigbhor_sum\n else\n return nil\n end\n end\n\n return sum_mat\nend", "def +(other)\n\t\t\tif ((@nfil != other.nfil) || (@ncol != other.ncol))\n\t\t\t\tputs \"No se pueden sumar las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...filas\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...colum\n\t\t\t\t\t\tfila << pos[i][j] + other.pos[i][j]\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def matrixElementsSum(matrix)\r\n(0..matrix.length-2).each do |floor_number|\r\n\r\n (0..matrix[floor_number].length-1).each do |column_number|\r\n if matrix[floor_number][column_number] == 0\r\n matrix[floor_number+1].delete_at(column_number)\r\n matrix[floor_number+1].insert(column_number, 0)\r\n end\r\n end\r\n \r\nend\r\n\r\nreturn matrix.flatten.inject(:+)\r\n\r\nend", "def +(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizSuma = Array.new(@fil) {Array.new(@col) {0}}\r\n\t\t\t\r\n\t\t\t0.upto(@numElementos - 1) do |i|\r\n\r\n\t\t\t\tmatrizSuma[@filM[i]][@colM[i]] = @eleM[i]\r\n\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t0.upto(other.numElementos - 1) do |i|\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tmatrizSuma[other.filM[i]][other.colM[i]] += other.eleM[i]\r\n\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t#puts \"suma = #{matrizSuma}\"\r\n\t\t\treturn matrizSuma\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\tend", "def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def matrixAddition(a, b)\n n = a.length\n c = Array.new\n 0.upto(n-1) do |x|\n # reinitialize the sum_array otherwise values from previous iteration carry over\n sum_array = Array.new \n 0.upto(n-1) do |y|\n sum_array = sum_array.push(a[x][y] + b[x][y])\n end\n c[x] = sum_array\n end \n return c\nend", "def matrix_addition (arr1, arr2)\n new_arr = []\n arr1.each.with_index do|subarr1, idx1|\n new_sub = []\n subarr1.each.with_index do |num1, idx2|\n new_sub << arr1[idx1][idx2] + arr2[idx1][idx2]\n end\n new_arr << new_sub\n end\n\n new_arr\nend", "def matrix_addition_reloaded(*arr)\n return nil if !arr.all? { |x| arr[0].length == x.length }\n sum = arr[0]\n 1.upto(arr.length - 1).each do |i|\n sum = matrix_addition(sum, arr[i])\n end\n sum\nend", "def matrix_addition(matrix_1, matrix_2)\n height = matrix_1.length\n width = matrix_1.first.length\n (0...height).map do |col|\n (0...width).map do |row|\n matrix_1[col][row] + matrix_2[col][row]\n end\n end\nend", "def diagonalSum(matrix)\n sum = 0\n\n matrix.each_with_index do |current_arr, idx|\n sum += current_arr[idx]\n end\n\n sum\nend", "def diagonalSum(matrix)\n (0...matrix.size).map { |i| matrix[i][i] }.reduce(&:+)\nend", "def +(other)\n raise ArgumentError, \"Las matrices no son cuadradas.\" unless @nfil == other.nfil && @ncol == other.ncol\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil \n for j in 0...ncol\n m[i][j] = self.mat[i][j]+ other.mat[i][j]\n end\n end\n return Matriz.new(other.nfil,other.ncol,m) \n end", "def diagonalSum(matrix)\ntotal = 0\n (0...matrix.length).each {|sub| total += matrix[sub][sub]}\nreturn total\nend", "def get_sum(matrix, i)\n sum_ = 0\n for k in 1...matrix.length\n sum_ += matrix[i][k]\n end\n sum_\nend", "def matrix_addition(matrix1, matrix2)\nadded = []\ni = 0\n matrix1.length.times do\n k = 0\n pair = []\n while k < matrix1[0].length\n pair << matrix1[i][k] + matrix2[i][k]\n k += 1\n end\n added << pair\n i += 1\n end\n added\nend", "def diagonalSum(matrix)\n # case Matrix[*matrix].column_size\n # when Matrix[*matrix].row_size\n x=0\n y=0\n p matrix.class\n while x<matrix.flatten.size do \n y=y+matrix.flatten[x]\n x=x+matrix.size+1 \n # print \"x= #{x}, y = #{y}, \"\n end\n y\nend", "def +(other)\n raise ArgumentError, \"Las dimensiones de las matrices no coinciden\" unless @filas == other.filas && @columnas == other.columnas\n new_mat = Array.new\n @filas.times do |i|\n fila = Array.new\n @columnas.times do |j|\n fila << @elementos[i][j] + other.at(i, j)\n end\n new_mat << fila\n end\n Matriz.new(new_mat)\n end", "def matrix_addition_reloaded(*matrices)\n first_m = matrices.first\n height = first_m.length\n width = first_m[0].length\n res = Array.new(height) {Array.new(width, 0)}\n \n matrices.inject(res) do |m1, m2|\n return nil if m1.length != m2.length || m1[0].length != m2[0].length\n matrix_addition(m1, m2)\n end\nend", "def +(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Densa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t0.upto(@fil - 1) do |i| \r\n\r\n\t\t\t\tj = 0\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t(@col - 1).times do\r\n\t\t\t\t\t\r\n\t\t\t\t\t@matrix[i][j] = @matrix[i][j] + other.matrix[i][j]\r\n\t\t\t\t\tj += 1\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#puts \"#{@matrix}\"\r\n\t\t\treturn @matrix\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\tend", "def multi_dimensional_sum(array)\n array.flatten.sum\nend", "def multi_dimensional_sum(array)\n array.flatten.sum\nend", "def +(mat)\n end", "def matrix_check_sum(matrix)\n return false if (matrix.length) != (matrix[0].length)\n (matrix.length).times do |i|\n rows = 0\n columns = 0\n (matrix[0].length).times do |j|\n rows += matrix[i][j]\n columns += matrix[j][i]\n end\n if rows != columns\n return false\n end\nend\nreturn true\nend", "def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend", "def multi_dimensional_sum(arr)\n arr.flatten.sum\nend", "def matrixAddition(a1, a2)\n t = a1.zip(a2)\n t.map { |e1,e2| (e1.is_a? Array) ? matrixAddition(e1,e2) : e1+e2 }\nend", "def matrixElementsSum(matrix)\n total = 0\n\n for i in 0..(matrix[0].to_a.count - 1)\n for j in 0..(matrix.count - 1)\n total += matrix[j].to_a[i]\n if matrix[j].to_a[i] == 0\n break\n end\n end\n end\n total\nend", "def sum\n flatten.compact.inject(:+)\n end", "def matrix_addition_reloaded(*matricies)\n addition = matricies[0]\n \n i = 1\n while i < matricies.length\n return nil if matricies[i].length != addition.length\n addition = matrix_addition(addition, matricies[i])\n \n i += 1\n end\n \n addition\nend", "def matrix_check_sum(matrix)\n puts \"NOT IMPLEMENTED\"\nend", "def matrix_addition(a1, a2)\n t = a1.zip(a2)\n t.map { |e1,e2| (e1.is_a? Array) ? matrix_addition(e1,e2) : e1+e2 }\nend", "def sum; end", "def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\nend", "def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend", "def +(mat)\n if (mat.f == @f && mat.c == @c)\n resultado = Array.new\n for i in 0...@f do\n resultado[i] = Array.new\n for j in 0...@c do\n# \t if((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((@matriz[i][j].class = Fraccion) || (mat.matriz[i][j] == Fraccion)))\n# \t resultado[i][j] = Fraccion.new(0,1)\n# \t else\n\t resultado[i][j] = 0 \n# \t end\n end\n end\n aux = Densa.new(resultado)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n\t if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n nElementos += 1\n\t elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n\t aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n\t elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n\t aux.matriz[i][j] = mat.matriz[i][j]\n nElementos += 1\n\t end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end", "def sum\n [@r,@g,@b].inject(:+)\n end", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n sum = 0\n (top_left_coords[0]..bottom_right_coords[0]).each do |row|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col|\n sum += matrix[row][col]\n end\n end\n\n sum\nend", "def sum_of_sums(array)\r\nend", "def matrix_addition(m1, m2)\n matrix_addition_reloaded(m1, m2)\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\n x1, y1 = top_left_coords\n x2, y2 = bottom_right_coords\n sum = 0\n (x1..x2).each do |x|\n (y1..y2).each do |y|\n puts matrix[x][y]\n sum += matrix[x][y]\n end\n end\n sum\n\nend", "def +(other)\n i=0\n \tm_aux = @matriz\n while i < @fila\n j=0\n \twhile j < @columna\n \t m_aux[i][j] = m_aux[i][j] + other.matriz[i][j]\n \t j += 1\n \tend\n i += 1\n end\n Matriz.new(m_aux)\n end", "def matrix_addition_reloaded(*matrices)\n\nend", "def matrix_check_sum(matrix)\n\n row_array = []\n column_array = []\n\n matrix.each do |row|\n row_sum = 0\n row.each do |element|\n row_sum += element\n end\n row_array << row_sum\n end\n\n column_length = matrix[0].length\n j = 0\n until j == column_length\n column_sum = 0\n matrix.each do |row|\n column_sum += row[j]\n end\n j += 1\n column_array << column_sum\n end\n\n if row_array == column_array\n return true\n else\n return false\n end\n\nend", "def matrix_check_sum(matrix)\n num_of_rows = matrix.length\n\n sum_rows = []\n num_of_rows.times do |i|\n sum = 0\n num_of_rows.times do |j|\n sum += matrix[i][j]\n end\n sum_rows << sum\n end\n\n sum_cols = []\n num_of_rows.times do |i|\n sum = 0\n num_of_rows.times do |j|\n sum += matrix[j][i]\n end\n sum_cols << sum\n end\n\n if sum_rows == sum_cols\n return true\n else\n return false\n end\nend", "def multi_dimensional_sum(array)\n array.flatten\nend", "def maxSum(matrix)\n\nend", "def +(m)\n matrix_cls = Matrix\n if m._isNumeric\n matrix_cls.Raise ErrOperationNotDefined, \"+\"\n elsif m._kind_of?(matrix_cls)\n # no coercion\n elsif m._kind_of?(Vector)\n m = matrix_cls.column_vector(m)\n else\n cr = m.coerce(self)\n return cr[0] | cr[1]\n end\n \n my_rows = @rows\n my_rows_size = my_rows.size\n my_column_size = self.column_size\n\n matrix_cls.Raise ErrDimensionMismatch unless my_rows_size == m.row_size and my_column_size == m.column_size\n #rows = (0 .. row_size - 1).collect { |i|\n # (0 .. column_size - 1).collect { |j|\n # self[i, j] + m[i, j]\n # }\n array_cls = Array\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n a_row = array_cls.new(my_column_size)\n for j in 0..my_column_size-1 do\n a_row[j] = self[i, j] + m[i, j]\n end\n rows[i] = a_row\n end\n matrix_cls.rows(rows, false)\n end", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n total_sum = 0\n\n (top_left_coords[0]..bottom_right_coords[0]).each do |row_idx|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col_idx|\n total_sum += matrix[row_idx][col_idx]\n end\n end\n\n total_sum\nend", "def matrix_check_sum(matrix)\n rows = matrix.length\n columns = matrix[0].length\n \n sum_rows = []\n matrix.each do |row|\n sum_rows.push(row.sum)\n end\n\n sum_columns = []\n columns.times do |i|\n sum = 0\n rows.times do |j|\n sum = sum + matrix[j][i]\n end\n sum_columns.push(sum)\n end\n \n rows.times do |i|\n columns.times do |j|\n if sum_rows[i] != sum_columns[j]\n return false\n end\n end\n end\n\n return true\nend", "def sum_prod_diags(matrix)\n\n require 'matrix'\n \n # ability to rotate nested array 90 degrees (for right - to left calc)\n def rotate(matrix)\n newMatrix, finalMatrix, i = [], [], 0\n (matrix.length > matrix[0].length ? matrix.length : matrix[0].length).times do\n matrix.map { |row| row[i] != nil ? newMatrix << row[i] : nil }\n i+=1\n end\n newMatrix.each_slice(matrix.length).to_a.reverse\n end\n \n # get the diagonal and all lower diagonals\n def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end\n\n # run for left to right calc\n d_sum = diags_sum_array(Matrix[*matrix])\n \n # run for right to left calc (using rotate array method)\n a_sum = diags_sum_array(Matrix[*rotate(matrix)])\n\n # add each result, return the difference in the two\n return d_sum.inject(:+) - a_sum.inject(:+)\n \nend", "def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end", "def simpleArraySum(ar)\n ar.sum\nend", "def sum(dimen=0)\n inject_rank(dimen, 0.0) do |sum, sub_mat|\n sum + sub_mat\n end\n end", "def sum arr\n if !arr.empty?\n soma = 0\n arr.each do |elt| ; soma += elt ; end\n return soma\n end\n return 0 \nend", "def matrix_check_sum(matrix)\n i = 0\n\n matrix.length.times do\n sum = 0\n\n matrix.each do |array|\n sum += array[i]\n end\n\n if sum != matrix[i].reduce(:+)\n return false\n end\n\n i += 1\n end\n\n return true\nend", "def matrix_check_sum(matrix)\n rows = matrix.length\n cols = matrix[0].length\n\n rows.times do |row|\n row_sum = 0\n col_sum = 0\n cols.times do |col|\n row_sum += matrix[row][col]\n col_sum += matrix[col][row]\n end\n return false if row_sum != col_sum\n end\n return true\nend", "def +(other)\n raise ArgumentError , 'El argumento debe ser una matriz' unless other.is_a? Matriz\n raise ArgumentError , 'Las matrices deben ser del mismo tamano' unless @fil == other.fil and @col == other.col\n \n c = Matriz_Densa.new(@fil, @col)\n i = 0\n while(i < @fil)\n j = 0\n while(j < @col)\n c.matrix[i][j] = @matrix[i][j] + other.get(i,j)\n j += 1\n end \n i += 1\n end\n c\n end", "def +(other) \n \n aux=Matriz.new(@col,@fil)\n i=0\n self.fil.times do |i|\n\t j=0\n\t self.col.times do |j|\n\t aux[i][j]= valor[i][j] + other.get(i,j)\n\t j=j+1\n\t end\n\ti=i+1\n\tend\n aux\n end", "def +(other)\n\t if (other.is_a? Matriz_Dispersa)\n\t\tif(@alt==other.alt && @anc=other.anc)\n\t\t\tsuma=Matriz_Dispersa.new(@alt+1,@anc+1, [],[],[], (@n_elem+other.n_elem))\n\t\t\tm = 0\n\t\t\t0.upto(suma.n_elem-1) do |i|\n\t\t\t if(other.elem[i].is_a? Fixnum)\n\t\t\t suma.elem[i]=0\n\t\t\t end\n\t\t\t if(other.elem[i].is_a? Fraccion)\n\t\t\t suma.elem[i]=Fraccion.new(0,1)\n\t\t\t end\n\t\t\tend\n\t\t\t0.upto(@alt) do |i|\n\t\t\t 0.upto(@anc) do |j|\n\t\t\t 0.upto(@n_elem-1) do |h|\n\t\t\t if(i==@alto[h])\n\t\t\t\t0.upto(@n_elem-1) do |t|\n\t\t\t\t if(j == @alto[t] && h==t)\n\t\t\t\t suma.elem[m]=@elem[t]\n\t\t\t\t suma.alto[m]=@alto[t]\n\t\t\t\t suma.ancho[m]=@ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\t 0.upto(other.n_elem-1) do |l|\n\t\t\t\tif(i==other.alto[l])\n\t\t\t\t 0.upto(other.n_elem-1) do |t|\n\t\t\t\t if(j==other.alto[t] && l==t)\n\t\t\t\t suma.elem[m]=(suma.elem[m]+other.elem[t])\n\t\t\t\t suma.alto[m]=other.alto[t]\n\t\t\t\t suma.ancho[m]=other.ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\tend\n\t\t\tsuma\n\t\telse\n\t\t puts \"no se puede realizar la suma\"\n\t\tend\n\t else\n\t if(other.is_a? Matriz_Densa)\n\t if(@alt==other.alt && @anc=other.anc)\n\t\tother.+(self.to_densa)\n\t else\n\t\tputs \"no se puede realizar la suma\"\n\t end\n\t end\n\t end\n\tend", "def sum_arr(arr_1, arr_2)\n [arr_1,arr_2].transpose.map { |el| el.reduce(&:+) }\nend", "def simpleArraySum(ar)\n ar.sum\nend", "def +(m)\n raise ArgumentError, \"m must be Matrix\" if not m.is_a? Matrix\n raise ArgumentError, \"m must have same size\" if m.cols != @cols || m.rows != @rows\n\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] + m[i,j]}\n end", "def sum_probability_matrices(*args)\r\n result = Array.new(@length) { Array.new(@teams, 0) }\r\n (0..@length - 1).each do |x|\r\n (0..@teams - 1).each do |y|\r\n (0..args.size - 1).each do |z|\r\n result[x][y] += args[z][x][y]\r\n end\r\n end\r\n end\r\n result\r\n end", "def matrix_check_sum(matrix)\n # raise NotImplementedError\n row_count = matrix.length\n row_sums = []\n col_sums = []\n\n #sum up each row\n row = 0 #col index\n col = 0 #row index\n row_count.times do #for each row\n sum = 0 #sum of each row\n row_count.times do #for each column\n sum += matrix[col][row] #for the each index of the row\n row += 1 #increase row index by one\n end\n row_sums << sum #shovel sum to row_sums array\n row = 0\n col += 1\n end\n\n col = 0 #reset col to 0\n\n row_count.times do #for each row\n sum = 0 #sum of each row\n row_count.times do #for each column\n sum += matrix[col][row] #for the each index of the row\n col += 1 #increase col index by one\n end\n col_sums << sum #shovel sum to col_sums array\n col = 0 #revert col to 0\n row += 1\n end\n\n return col_sums == row_sums\n #sum up\n\nend", "def addRows(matrixPassed)\n rowSum = 0\n rowLen = 0\n rowIndex = 0\n matrixPassed.each do |sub|\n sub.each do |elements|\n rowSum = rowSum + elements\n rowLen = rowLen + 1\n end\n rowAvg = rowSum/rowLen\n puts \"Row# #{rowIndex+1} rowSum = #{rowSum}, rowLen = #{rowLen}, rowAvg = #{rowAvg}\"\n rowSum = 0\n rowLen = 0\n rowIndex = rowIndex + 1\n end\nend", "def matrix_addition_reloaded(*matrixes)\n return nil if !(matrixes.all? {|pair| matrixes[0].length == pair.length})\n # return matrixes if matrixes.length < 2\n \n matrixes.inject do |acc, el|\n matrix_addition(acc, el)\n end\n\nend", "def /(o)\n\n suma = Array.new(matriz.size - 1)\n for i in 0...matriz.size\n suma[i] = Array.new(matriz[i].size - 1)\n for j in 0...matriz[i].size\n\t\t\t\n\t\t\t\tsuma[i][j] = matriz[i][j]\n\t\t\t\t\t\n\t\t\t\t# comprobamos el hash\n\t if (o.matriz[i] != nil)\n\t\t\t\t\t\n\t\t\t\t\t# hay datos en el has para la columna\n\t\t\t\t\tif o.matriz[i].has_key?(j)\t\t\t\t\t\t\n \t\tsuma[i][j] = matriz[i][j] + o.matriz[i][j]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\n end\n end\n MatrizDensa.new(suma)\n\n end", "def +(m)\n raise ArgumentError, \"m must be Matrix\" if not m.is_a? Matrix\n raise ArgumentError, \"m must have same size\" if m.size() != self.size()\n\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] + m[i,j]}\n end", "def multi_dimensional_sum(array)\n array.flatten! #convert 2d array into 1d array [[4,3,1][8,1][2]] -> [4,3,1,8,1,2]\n sum = 0\n i = 0\n while i < array.length\n sum+=array[i] #add and store array numbers into sum\n i+=1\n end\n return sum\nend", "def matrix_check_sum(matrix)\n\n dim = matrix.length\n\n dim.times do |i|\n row_sum = matrix[i].sum\n col_sum = sum_column(matrix, i)\n return false if row_sum != col_sum\n end\n\n return true\n\nend", "def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend", "def sum(sums)\r\n if sums.empty?\r\n 0\r\n else\r\n sums.reduce(:+)\r\n end\r\nend", "def matrix_check_sum(matrix)\n i = 0\n\n while matrix[i] != nil\n j = 0\n row = 0\n column = 0\n\n while matrix[j] != nil\n row += matrix[i][j]\n column += matrix[j][i]\n j += 1\n end\n\n return false if row != column\n i += 1\n end\n return true\nend", "def multi_dimensional_sum(array)\n while !array.all? { |el| el.is_a?(Numeric) }\n array = unpack(array)\n end\n return array.sum\nend", "def sum\n\t\treturn self.reduce(:+)\n\tend", "def + (other)\n if (other.is_a?SparseMatrix)\n hash_aux = self.hash.merge(other.hash){|key, val1, val2| val1.merge(val2){|key2, val1_2, val2_2|val2_2 + val1_2}}\n mr = SparseMatrix.new(self.m, self.n)\n mr.rellenar(hash_aux)\n return (mr)\n \n else\n aux = Array.new(@m){Array.new(@n){0}}\n\tfor i in 0...@m do\n\t for j in 0...@n do\n\t aux[i][j] = self.matrixD[i][j] + other.matrixD[i][j]\n\t end\n\tend\n mr = MatrixDens.new(other.m, other.n)\n mr.rellenar(aux)\n return (mr)\n end\n end", "def sum(array)\n\t\tsum = 0 #initialise 0 \n\t\tif array.empty? # si tableau vide = rien \n\t\treturn 0 # renvoie 0\n\t\telse # sinon\n\t\tarray.each{|x| sum = sum + x} # tous les elements du tableaux / incremente le code sum\n \t\treturn sum\n\t\tend\n\tend", "def matrix\n end", "def matrix_check_sum(matrix)\n row_sum = 0\n column_sum = 0\n index = 0\n\n while matrix[index] != nil do\n j = 0\n while matrix[index][j] != nil do\n row_sum += matrix[index][j]\n j += 1\n end\n\n k = 0\n while matrix[k] != nil do\n column_sum += matrix[k][index]\n k += 1\n end\n\n return false if row_sum != column_sum\n\n index += 1\n end\n\n return true\nend", "def suma_arreglo(array)\n array.reduce(:+)\nend", "def rowsum a,row\n sum=0\n 0.upto(4){|i| sum+=a[row][i]}\n return sum.to_f\nend" ]
[ "0.761791", "0.7463322", "0.7446287", "0.7377676", "0.7311686", "0.72755665", "0.72681737", "0.7220712", "0.7137369", "0.7127241", "0.71159106", "0.7095725", "0.7092067", "0.7090543", "0.7035081", "0.7025463", "0.7017542", "0.69905937", "0.6963541", "0.69531006", "0.694126", "0.69065595", "0.6904436", "0.6857465", "0.68553686", "0.68437684", "0.68353254", "0.6812259", "0.6800952", "0.67936695", "0.67321455", "0.67165333", "0.6693521", "0.66660446", "0.6657328", "0.66488564", "0.6640119", "0.6608467", "0.6608467", "0.65915984", "0.6550191", "0.6529844", "0.65262073", "0.6518475", "0.65074766", "0.64869076", "0.6464411", "0.6453162", "0.64514565", "0.6450521", "0.6429688", "0.6411389", "0.64092356", "0.640613", "0.63828135", "0.63790584", "0.63784206", "0.6367682", "0.63614154", "0.63302416", "0.63145125", "0.63072187", "0.62980187", "0.6280469", "0.6278074", "0.6239574", "0.6224622", "0.6214069", "0.6202774", "0.61981875", "0.619538", "0.61770815", "0.6174027", "0.61656684", "0.6157578", "0.61558217", "0.61456543", "0.6128023", "0.61278564", "0.61261743", "0.6118635", "0.6118477", "0.6101238", "0.60984564", "0.6082272", "0.60821754", "0.60819423", "0.6080768", "0.6075264", "0.6070478", "0.6058564", "0.6053296", "0.6030273", "0.60216904", "0.6018725", "0.6016896", "0.60158795", "0.60156125", "0.6013416", "0.60126746" ]
0.7033361
15
Metodo para restar dos matrices
def -(mat) if (mat.nFil == @nFil && mat.mCol == @mCol) maux=Array.new(@nFil) { Array.new(@mCol) } (@nFil).times do |i| (@mCol).times do |j| maux[i][j] = @matriz[i][j] end end aux = Matriz.new(maux) (@nFil).times do |i| (@mCol).times do |j| aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j] end end else aux = 0 end aux end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix\n end", "def matrix_addition_reloaded(*matrices)\n\nend", "def matrix_addition_reloaded(*matricies)\n addition = matricies[0]\n \n i = 1\n while i < matricies.length\n return nil if matricies[i].length != addition.length\n addition = matrix_addition(addition, matricies[i])\n \n i += 1\n end\n \n addition\nend", "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "def exercise_1113 (matrix)\n end", "def matz; end", "def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend", "def matrix_addition_reloaded(*matrices)\n height = matrices[0].size\n width = matrices[0][0].size\n return nil if matrices.select {|m| m.size == height && m[0].size == width}.count != matrices.count\n \n sum = Array.new(height) {|i| Array.new(width, 0)}\n\n (0...height).each do |h|\n (0...width).each do |w|\n matrices.each {|m| sum[h][w] += m[h][w]}\n end\n end\n sum\nend", "def matrix_addition_reloaded(*matrixs)\n # matrixs.each { |matrix| return nil if matrixs.first.length != matrix.length}\n # first_matrix = matrixs.first\n # matrix_sum = []\n # i = 0\n\n # while matrix_sum.length < first_matrix.length do \n # sum = 0 \n # sum += matrixs[i][i][i]\n # matrix_sum << sum\n\n # end\n # matrix_sum\n\n matrix = matrixs.first\n height = matrix.length\n width = matrix[0].length\n matrix_sum = Array.new(height) { [0] * width}\n\n matrixs.inject(matrix_sum) do |m1, m2|\n return nil if m2.length != height || m2[0].length != width\n matrix_addition(m1, m2)\n\n end\nend", "def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend", "def matrix_addition_reloaded(*matrices)\n first_m = matrices.first\n height = first_m.length\n width = first_m[0].length\n res = Array.new(height) {Array.new(width, 0)}\n \n matrices.inject(res) do |m1, m2|\n return nil if m1.length != m2.length || m1[0].length != m2[0].length\n matrix_addition(m1, m2)\n end\nend", "def matrix_addition_reloaded(*matrices)\n size = matrices.first.size\n return if matrices.any? { |m| m.size != size }\n\n new_matrix = matrices[0].dup\n matrices[1..-1].each do |mat2|\n new_matrix = matrix_addition(new_matrix, mat2)\n end\n new_matrix\nend", "def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend", "def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend", "def zero_matrix(matrix)\n\nend", "def createMatrix()\n #matriks = Matrix.new\n @matriks_data = Matrix.zero(@jumlah_node)\n for i in 0..@jumlah_node-1\n for j in 0..@jumlah_node-1\n @matriks_data[i,j] = @file_data[i*@jumlah_node+ j]\n end\n end\n end", "def matrix_addition_reloaded(*matrices)\n\n length = matrices.first.length\n if (matrices.all? { |ele| ele.length == length})\n else\n return nil\n end\n\n matrices.inject do |acc, ele|\n # p acc\n i = 0\n sum_matrix = []\n while i < acc.length\n row_arr = []\n j = 0\n while j < acc.first.length\n # print acc[i][j]\n sum = acc[i][j]+ele[i][j]\n row_arr << sum\n j+= 1\n end\n sum_matrix << row_arr\n i += 1\n end\n sum_matrix\n end\nend", "def matrix_addition_reloaded(*matrices)\n return matrices[0] if matrices.length == 1\n \n sum_mat = nil\n\n # debugger\n\n (0...matrices.length-1).each do |n|\n temp = nil\n if sum_mat.nil?\n temp = matrices[n]\n else\n temp = sum_mat\n end\n if check_rowcol?(temp, matrices[n+1])\n neigbhor_sum = matrix_addition(temp, matrices[n+1])\n sum_mat = neigbhor_sum\n else\n return nil\n end\n end\n\n return sum_mat\nend", "def trasponer\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\tfila << pos[j][i]\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@ncol, @nfil, elemento)\n\t\tend", "def *(mat)\n end", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end", "def redesign\n x = @mat[0].length\n y = @mat.size\n (1..y-2).each do |i|\n (1..x-2).each do |j|\n @mat[i][j] = \"0\"\n end\n end\n\n divide(1,x-2,1,y-2)\n end", "def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend", "def matrix_addition(m1, m2)\n matrix_addition_reloaded(m1, m2)\nend", "def +(mat)\n if (mat.f == @f && mat.c == @c)\n resultado = Array.new\n for i in 0...@f do\n resultado[i] = Array.new\n for j in 0...@c do\n# \t if((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((@matriz[i][j].class = Fraccion) || (mat.matriz[i][j] == Fraccion)))\n# \t resultado[i][j] = Fraccion.new(0,1)\n# \t else\n\t resultado[i][j] = 0 \n# \t end\n end\n end\n aux = Densa.new(resultado)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n\t if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n nElementos += 1\n\t elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n\t aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n\t elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n\t aux.matriz[i][j] = mat.matriz[i][j]\n nElementos += 1\n\t end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end", "def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def -(mat)\n end", "def x(escalar)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end", "def matrix_addition_reloaded(*arr)\n return nil if !arr.all? { |x| arr[0].length == x.length }\n sum = arr[0]\n 1.upto(arr.length - 1).each do |i|\n sum = matrix_addition(sum, arr[i])\n end\n sum\nend", "def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end", "def * (other)\n i=0\n m_aux = Array.new(@fila) {Array.new(other.columna,0)}\n while i < @fila\n j = 0\n while j < other.columna\n m_aux[i][j] = 0\n k = 0\n while k < @columna\n m_aux[i][j] += matriz[i][k] * other.matriz[k][j]\n k += 1\n end\n j +=1\n end\n i +=1\n end\n Matriz.new(m_aux)\n end", "def rotate_matrix(arr)\n\nend", "def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def matricula\n end", "def por(other)\n\t\t\tif ((@nfil != other.ncol) || (@ncol != other.nfil))\n\t\t\t\tputs \"No se pueden multiplicarr las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...nfil\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...other.ncol\n\t\t\t\t\t\taux = 0\n\t\t\t\t\t\tfor k in 0...ncol\n\t\t\t\t\t\t\taux += pos[i][k] * other.pos[k][j]\n\t\t\t\t\t\tend\n\t\t\t\t\t\tfila << aux\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, other.ncol, elemento)\n\t\tend", "def matriz_clave\n @m_clave=Array.new(4){Array.new()}\n i,j,contador=0,0,0\n @k.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_clave[i][j] = x\n i+=1\n contador+=1\n end\n @m_clave\n end", "def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end", "def features_simple_real_modular(A=matrix)\n \n\nend", "def redesign\n reset_mat\n recur_divide(0, 0, m, n, cut_dir(c, r))\n end", "def +(other)\n raise ArgumentError, \"Las matrices no son cuadradas.\" unless @nfil == other.nfil && @ncol == other.ncol\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil \n for j in 0...ncol\n m[i][j] = self.mat[i][j]+ other.mat[i][j]\n end\n end\n return Matriz.new(other.nfil,other.ncol,m) \n end", "def +(matrizb)\r\n\t\t\r\n\t\t#sumita={}\r\n\t\t#for r in @m_Matrix.keys do \r\n\t\t#\tsum = {}\r\n\t\t#\tif matrizb.m_Matrix.keys.include? r\r\n\t\t#\t\tfor j in @m_Matrix[r].vector.keys do \r\n\t\t#\t\t\tsum[j] = @m_Matrix[r].vector[j]+matrizb[r].vector[j]\t\r\n\t\t#\t\t\tsumita[r] = {j=>sum[j]}\r\n\t\t#\t\tend\r\n\t\t#\telse\r\n\t\t#\t\tsum[r]=@m_Matrix[r]\r\n\t\t#\tend\r\n\t\t#end\r\n\t\t#SparseMatrix.new(sumita)\r\n\r\n\t\tfor r in @m_Matrix.keys do \r\n\t\t\tfor j in @m_Matrix[r].vector.keys do \r\n\t\t\t\tmatrizb[r][j]= @m_Matrix[r][j]+matrizb[r][j]\r\n\t\t\tend\r\n\t\tend\t\r\n\tmatrizb\r\n\tend", "def -(other)\n\t\t\tif ((@nfil != other.nfil) || (@ncol != other.ncol))\n\t\t\t\tputs \"No se pueden restar las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...filas\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...colum\n\t\t\t\t\t\tfila << pos[i][j] - other.pos[i][j]\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def fifteen \n size_x = 10 \n size_y = 10\n row = []\n for i in 1..size_x\n row.push(0)\n end\n\n @@mat = []\n\n for i in 1..size_y\n @@mat.push(row.clone)\n end\n \n move(0,0)\n\n return @@mat[size_x-1][size_y-1]\n\nend", "def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end", "def -(other)\n raise ArgumentError, \"Las matrices no son cuadradas.\" unless @nfil == other.nfil && @ncol == other.ncol\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil \n for j in 0...ncol\n\t m[i][j] = mat[i][j]- other.mat[i][j]\n end\n end\n return Matriz.new(other.nfil,other.ncol,m) \n end", "def rotate_matrix(array)\n\n\nend", "def porf(other)\n\t\t\tif ((@nfil != other.ncol) || (@ncol != other.nfil))\n\t\t\t\tputs \"No se pueden multiplicarr las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...nfil\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...other.ncol\n\t\t\t\t\t\taux = Fraccion.new(1,1)\n\t\t\t\t\t\taux = aux - aux\n\t\t\t\t\t\tfor k in 0...ncol\n\t\t\t\t\t\t\taux += pos[i][k] * other.pos[k][j]\n\t\t\t\t\t\tend\n\t\t\t\t\t\tfila << aux\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, other.ncol, elemento)\n\t\tend", "def *(other)\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil do\n for j in 0...other.ncol do \n for k in 0...ncol do\n m[i][j] = m[i][j] + self.mat[i][k] * other.mat[k][j]\n end\n end\n end\n return Matriz.new(self.nfil,other.ncol,m) \n end", "def -(mat)\n if (mat.f == @f && mat.c == @c)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n nElementos += 1\n elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n aux.matriz[i][j] = - mat.matriz[i][j]\n nElementos += 1\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end", "def matrix(arg); return Matrix::new(arg); end", "def RotateMatrix (squareImg)\n r = squareImg.size - 1\n c = squareImg[0].size - 1\n\n (0..r/2).each do |row|\n (0..c/2).each do |col|\n\nsquareImg[row][col], squareImg[r - row][col], squareImg[r-row][c-col], squareImg[row][c-col] = squareImg[r - row][col], squareImg[r-row][c-col], squareImg[row][c-col], squareImg[row][col]\n\n\n end\n end\nsquareImg\nend", "def -(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizResta = Array.new(@fil) {Array.new(@col) {0}}\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t\r\n\t\t\t(other.numElementos - 1).times {\r\n\t\t\t\t\r\n\t\t\t\tmatrizResta[other.filM[i]][other.colM[i]] = 0 - other.eleM[i]\r\n\t\t\t\t\r\n\t\t\t\ti += 1\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t\r\n\t\t\t(@numElementos - 1).times {\r\n\t\t\t\t\r\n\t\t\t\tmatrizResta[@filM[i]][@colM[i]] += @eleM[i] \r\n\t\t\t\t\r\n\t\t\t\ti += 1\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\t#puts \"resta = #{matrizResta}\"\r\n\t\t\treturn matrizResta\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\tend", "def test_creac\n #Matriz densa\n assert_equal(@m1.rows, 2)\n assert_equal(@m1.cols, 2)\n \n #Matriz dispersa\n assert_equal(@m4.rows, 2)\n assert_equal(@m4.cols, 2)\n \n #Creacion\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,@m2.to_s)\n assert_equal(Matriz.nula.to_s,@m3.to_s)\n end", "def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 ) * 2 ) +\n column\n\n final_matrix[row] << mat_list[offset]\n end\n end\nfinal_matrix\nend", "def clone\n Matrix.rows(@rows)\n end", "def +(m)\n\t\t\t\tif(m.instance_of? Matriz_dispersa)\n\t\t\t\t\treturn m + self \n \n else\n\t\t\t\t\traise IndexError unless ((self.fil == m.fil) && (self.col == m.col)) #Las dimensiones tienes que ser iguales\n\t\n\t\t\t\t\n\t\t\t\t\tsuma = Matriz.new(self.fil, self.col)\n\n\t\t\t\t\tfor i in (0...self.fil)\n for j in (0...self.col)\n\t\t\t\t\t\t\tsuma[i][j] = self[i][j] + m[i][j]\n end\n\t\t\t\t\tend \n\n return suma \n\t\t\t\tend\n end", "def +(mat)\n end", "def +(other)\t \n\t\tif(self.fil == other.fil and self.col == other.col)\n\t\t\t# SELF Matrices densas\n\t\t\tif self.instance_of?MatrizDensa\n\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\tif other.instance_of?MatrizDensa\n\t\t\t\t\t\n\t\t\t\t\t#for i in ([email protected]_i)\n\t\t\t\t\[email protected]_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in ([email protected]_i)\n\t\t\t\t\t\[email protected]_i.times do |j|\n\t\t\t\t\t\t\ttemp.mat[i][j] = (@mat[i][j]) + (other.mat[i][j])\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\t#for i in ([email protected]_i)\n\t\t\t\t\[email protected]_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in ([email protected]_i)\n\t\t\t\t\t\[email protected]_i.times do |j| \n\t\t\t\t\t\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...other.posx.size)\n\t\t\t\t\t\t\tother.posx.size.times do |k| \n\t\t\t\t\t\t\t\tif (i==other.posx[k] and j==other.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (self.mat[i][j]) + (other.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = self.mat[i][j]\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# SELF Matriz Dispersa\n\t\t\tif self.instance_of?MatrizDispersa\n\t\t\t\tif other.instance_of?MatrizDensa\n\t\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\t\t#for i in ([email protected]_i)\n\t\t\t\t\t\[email protected]_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\tfor j in ([email protected]_i)\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (i==self.posx[k] and j==self.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (other.mat[i][j]) + (self.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = other.mat[i][j]\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\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\ttemp = MatrizDispersa.new(self.fil,self.col,[],[],[])\n\t\t\t\t\ttemp.valor = self.valor\n\t\t\t\t\ttemp.posx = self.posx\n\t\t\t\t\ttemp.posy = self.posy\n\n\t\t\t\t\t#for j in (0...other.posx.size.to_i)\n\t\t\t\t\tother.posx.size.to_i.times do |j| \n\t\t\t\t\t\n\t\t\t\t\t\tencontrado = false\n\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(other.posx[j] == temp.posx[k] and other.posy[j] == temp.posy[k])\n\t\t\t\t\t\t\t\ttemp.valor[k] = temp.valor[k] + other.valor[j]\n\t\t\t\t\t\t\t\tencontrado = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif (encontrado == false)\n\t\t\t\t\t\t\ttemp.posx << other.posx[j]\n\t\t\t\t\t\t\ttemp.posy << other.posy[j]\n\t\t\t\t\t\t\ttemp.valor << other.valor[j]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t\treturn temp\n\t\telse \n\t\t\treturn nil\n\t\tend\n\tend", "def imprimir_Matriz\n\t\tx,y = 0,0\n\t\t\n\t\twhile x < row\n\t\t\twhile y < col\n\t\t\t\tprint(\"#{matriz[x][y]} \\t\")\n\t\t\t\tprint(\"\") \n\t\t\t\ty= y + 1\t\t\t\n\t\t\tend\n\t\t\tputs\n \t\t\tx = x + 1\n \t\t\ty = 0\n\t\tend\n\t\tputs \n\tend", "def x(escalar)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end", "def sumar (matrizb)\n\t\tsum = []\n\t\tx,y =0,0\n\t\twhile x < row\n\t\t\twhile y < col\n\t\t\t\tif y == 0\n\t\t\t\t\tsum << [matriz[x][y] + matrizb.matriz[x][y]]\n\t\t\t\telse\n\t\t\t\t\tsum[x] << matriz[x][y] + matrizb.matriz[x][y]\n\t\t\t\tend\n\t\t\t\ty= y+1\t\t\t\n\t\t\tend\n\t\t\tx=x+1\n\t\t\ty=0\n\t\tend\n\t\tMatriz.new (sum)\n\n\tend", "def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] * m\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif m._kind_of?( Vector )\n m = matrix_cls.column_vector(m)\n r = self * m\n return r.column(0)\n elsif m._kind_of?( matrix_cls )\n # Matrix.Raise ErrDimensionMismatch if column_size != m.row_size\n # rows = (0 .. row_size - 1).collect { |i|\n # (0 .. m.column_size - 1).collect { |j|\n # vij = 0\n # 0.upto(column_size - 1) { |k| vij += self[i, k] * m[k, j] }\n # vij\n # }\n # }\n my_column_size = self.column_size\n other_column_size = m.column_size\n matrix_cls.Raise ErrDimensionMismatch if my_column_size != m.row_size\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n res_row = array_cls.new(other_column_size)\n for j in 0..other_column_size-1 do\n vij = 0\n for k in 0..my_column_size-1 do\n vij += self[i, k] * m[k, j]\t\n end\n vij\n res_row[j] = vij\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n else\n cr = m.coerce(self)\n return cr[0] * cr[1]\n end\n end", "def +(other)\n raise ArgumentError, \"Las dimensiones de las matrices no coinciden\" unless @filas == other.filas && @columnas == other.columnas\n new_mat = Array.new\n @filas.times do |i|\n fila = Array.new\n @columnas.times do |j|\n fila << @elementos[i][j] + other.at(i, j)\n end\n new_mat << fila\n end\n Matriz.new(new_mat)\n end", "def *(other)\r\n\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizProd = Array.new(@fil) {Array.new(@col) {0}}\t\t\t\r\n\r\n\t\t\t0.upto(other.numElementos - 1) do |i|\r\n\r\n\t\t\t\tif (other.filM[i] = @colM[i])\r\n\t\t\t\t\tmatrizProd[@filM[i]][@colM[i]] += @eleM[i] * other.eleM[i]\r\n\t\t\t\tend\r\n\r\n\t\t\tend\t\t\t\r\n\t\t\t\r\n\t\t\t#puts \"prod = #{matrizProd}\"\r\n\t\t\treturn matrizProd\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend", "def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(matrizc.matriz.size,0)\n\n\t\t\tfor col in 0...matrizc.matriz.size\n\n\t\t\t\tfor pos in 0...matriz.size\n\n\t\t\t\t\tprod = matriz[fil][pos] * matrizc.matriz[pos][col]\n\t\t\t\t\tmatRes[fil][col] = matRes[fil][col] + prod\n\n\t\t\t\tend\n\n\t\t\tend\n\n \t\tend\n\n \t\tMatriz.new(matRes)\n\n \tend", "def *(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Densa\") && (@fil == @col) && (other.fil == other.col) && (@fil == other.fil))\r\n\t\t\t\r\n\t\t\tmatrizMult = Array.new(@fil) {Array.new(@col)}\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t(0..(@fil - 1)).collect {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t0.upto(@col - 1) do |j|\r\n\t\t\t\t\t\r\n\t\t\t\t\tmatrizMult[i][j] = 0\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tk = 0\t\t\t\t\t\r\n\t\t\t\t\t(@col - 1).times {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tmatrizMult[i][j] = matrizMult[i][j] + (@matrix[i][k] * other.matrix[k][j])\r\n\t\t\t\t\t\tk += 1\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\ti += 1\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t#puts \"#{matrizMult}\"\r\n\t\t\treturn matrizMult\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Numero distinto de filas y columnas\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def populate1(matrix)\n\t(0..5).each do |x|\n\t\t(0..5).each do |y|\n\t\t\tmatrix[x][y] = (@cols[y] & @rows[x]).sample\n\t\t\t@cols[y].delete(matrix[x][y])\n\t\t\t@rows[x].delete(matrix[x][y])\n\t\tend\n\tend\n\n# \tp z = matrix.flatten\n# \tif z.include?(nil)!=true\n# \t\treturn matrix\n# \telse\n# \t\tp \"has nil(s)\"\n# \tend\nend", "def matrix_clone\n @matrix_clone ||= matrix.map { |row| row.clone }\n end", "def test_cont\n @m4[0,0]=1\n @m1[0,0]=1\n #insercion\n assert_equal(@m4.to_s,'[[1,0],[0,5]]')\n assert_equal(@m1.to_s,'[[1,1],[1,0]]')\n #obtencion\n assert_equal(@m4[1,1],5)\n assert_equal(@m1[0,0],1)\n end", "def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \[email protected]{ |i|\n \t\[email protected]{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend", "def vconcat(*matrices)\n concat(*matrices, :row)\n end", "def set_matrix\n @matrix = Matrix.find(params[:id])\n end", "def matrix_addition_reloaded(*matrixes)\n return nil if !(matrixes.all? {|pair| matrixes[0].length == pair.length})\n # return matrixes if matrixes.length < 2\n \n matrixes.inject do |acc, el|\n matrix_addition(acc, el)\n end\n\nend", "def printmatrices\n count = 0;\n @matrices.each do |matrix|\n puts \"Matrix \" + count.to_s\n count += 1\n for i in 0..3\n for o in 0..3\n print matrix[i][o]\n print \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end\nend", "def matrix_addition(matrix_1, matrix_2)\n new_matrix = Array.new(matrix_1.length) {Array.new(matrix_1.first.length)}\n new_matrix.each_with_index do |array, i1|\n array.each_with_index do |el, i2|\n new_matrix[i1][i2] = matrix_1[i1][i2] + matrix_2[i1][i2]\n end\n end\n new_matrix\nend", "def *(o)\n\t if(self.col == o.row)\n \t\t matres = self.class.new(self.row,self.col)\n# \t\t\t for i in 0...self.row\n# \t\t\t for j in 0...o.col\n# \t\t for k in 0...self.col\n\n\t\t\t i = 0\n \t\t\t (0..(self.row - 1)).collect {\n \t\t\t 0.upto(o.col - 1) do |j|\n\t\t\t k = 0\n \t\t (self.col - 1).times {\n \t\t\tmatres[i,j] += self[i,k] * o[k,j]\n\t\t\t k += 1\n\t\t\t }\n\t\t\t end\n# \t\t end\n# end\n# end\n\n\t\t\ti += 1\n\t\t\t}\n matres\n end\n end", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.length) { Array.new(matrix1[0].length) }\n\n (0...matrix1.length).each do |i|\n (0...matrix1[i].length).each do |j|\n new_matrix[i][j] = matrix1[i][j] + matrix2[i][j]\n end\n end\n\n new_matrix\nend", "def -(other)\n raise ArgumentError, \"Las dimensiones de las matrices no coinciden\" unless @filas == other.filas && @columnas == other.columnas\n new_mat = Array.new\n @filas.times do |i|\n fila = Array.new\n @columnas.times do |j|\n fila << @elementos[i][j] - other.at(i, j)\n end\n new_mat << fila\n end\n Matriz.new(new_mat)\n end", "def add_rows! *rows\r\n matrix_new = add_rows *rows\r\n @rows = matrix_new.to_a\r\n end", "def matrix(x, y, z)\n sub_array = []\n y.times do\n sub_array.push(z);\n end\n #sub_array\n array = [];\n x.times do\n array.push(sub_array)\n end\n array\nend", "def matrix_addition(m1, m2)\n rows = m1.length\n cols = m1[0].length\n result = Array.new(rows) { Array.new(cols, 0)}\n (0...rows).each do |row|\n (0...cols).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n \n result\nend", "def +(other)\n\t\t\tif ((@nfil != other.nfil) || (@ncol != other.ncol))\n\t\t\t\tputs \"No se pueden sumar las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...filas\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...colum\n\t\t\t\t\t\tfila << pos[i][j] + other.pos[i][j]\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end", "def render_matrix\n Matrix.rows render_rows\n end", "def initialize(nfil,ncol,mat) \n @nfil = nfil # inicializo numero de filas\n @ncol = ncol # inicializo numero de columnas \n @mat = Array.new(mat) #inicializo la matriz pasando como parametro un objeto de tipo matriz \n end", "def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end", "def matrix_of(parse_result)\n\t\tif parse_result.nil? || parse_result.empty?\n\t\t\treturn Matrix.I(3)\n\t\tend\n\t\t\n#\t\tp parse_result # debug\n\t\t\n\t\tmatrix = (parse_result.map { |key_values|\n\t\t\t@_matrix_factory.create(key_values)\n\t\t}).reduce(:*)\n\t\t\n#\t\tp matrix # debug\n\t\t\n\t\tmatrix\n\tend", "def mostrar_matriz(matriz, fila_letra, oculto)\n# recibe fila_letra como punto de inicio de las letras\n# para las filas '@' para comenzar desde 'A' y 'J'\n# para comenzar desde 'K'\n espacios=\" \"*20\n\n if oculto == true\n imprimir_leyenda_1\n puts \" *Has hundido #{contar_algo(matriz,Barco_Hundido)} de los barcos enemigos,\"\n puts \" hay todavía al menos #{contar_algo(matriz,Barco )}\"\n end\n\n print_cintillo_numerico(matriz.length)\n for i in 0..matriz.length-1\n print \"#{espacios}#{fila_letra=fila_letra.next}\"\n print \"|\"\n for x in 0..matriz[0].length-1\n if oculto== true\n print \"#{ocultar_informacion(matriz[i][x])}|\"\n else\n print \"#{mostrar_informacion(matriz[i][x])}|\"\n end\n end\n print fila_letra\n puts\n\n\n end\n print_cintillo_numerico(matriz.length)\n\n if oculto == false\n imprimir_leyenda_2\n puts \" *El enemigo ha hundido #{contar_algo(matriz,Barco_Hundido)} de tus barcos,\"\n puts \" aun cuentas con #{contar_algo(matriz,Barco)} de ellos. \"\n end\nend", "def expansionclave(iteracion)\n t_mclave=@m_clave\n aux=Array.new(4){Array.new(4)}\n #operacion del rotword (rotando la ultima columna de la matriz de las claves)\n aux[0][3],aux[1][3],aux[2][3],aux[3][3]=t_mclave[1][3],t_mclave[2][3],t_mclave[3][3],t_mclave[0][3]\n\n #relleno la matriz completa con los demas elementos de la matrz de la clave\n for i in 0...4\n for j in 0...3\n aux[i][j]=t_mclave[i][j]\n end\n end\n #se busca en la sbox los valores de la matriz\n aux[0][3],aux[1][3],aux[2][3],aux[3][3]=get_sbox(aux[0][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[1][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[2][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[3][3].to_i(16)).to_s(16).rjust(2,'0')\n #se realiza la operación de principal de la epansion de claves\n aux[0][0]=(@m_clave[0][0].to_i(16)^aux[0][3].to_i(16)^Rcon[0][iteracion]).to_s(16).rjust(2,'0')\n aux[1][0]=(@m_clave[1][0].to_i(16)^aux[1][3].to_i(16)^Rcon[1][iteracion]).to_s(16).rjust(2,'0')\n aux[2][0]=(@m_clave[2][0].to_i(16)^aux[2][3].to_i(16)^Rcon[2][iteracion]).to_s(16).rjust(2,'0')\n aux[3][0]=(@m_clave[3][0].to_i(16)^aux[3][3].to_i(16)^Rcon[3][iteracion]).to_s(16).rjust(2,'0')\n for i in 0...4\n for j in 1...4\n aux[i][j]=(@m_clave[i][j].to_i(16)^aux[i][j-1].to_i(16)).to_s(16).rjust(2,'0')\n end\n end\n\n @m_clave=aux\n end", "def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end", "def set_matrix\n @matrix = Matrix.find(params[:id])\n end", "def matrix_addition(matrix_a, matrix_b)\n addition = Array.new(matrix_a.length) {Array.new(matrix_a[0].length)}\n\n matrix_a.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n addition[row_i][col_i] = matrix_a[row_i][col_i] + matrix_b[row_i][col_i]\n end\n end\n \n addition\nend", "def clearcolumns\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\tend", "def matrix_convert_to_0(matrix)\n\nend", "def generate_submatrices\n @hilbert_basis.find.to_a.combination(VERTICES).collect{ \n |x|Matrix.rows(x)}\n end", "def reduce_matrix(distance_matrix, i, j)\n distance_matrix[i] = nil\n distance_matrix[j] = nil\n distance_matrix.compact!\n distance_matrix.map{ |q| q[i] = nil if q }\n distance_matrix.map{ |q| q[j] = nil if q }\n distance_matrix.map{ |q| q.compact! }\n distance_matrix\nend", "def reset_mat\n for i in 1..(n-2)\n for j in 1..(m-2)\n if i % 2 == 1 and j % 2 == 0\n maze_mat[i][j] = 0\n elsif i % 2 == 0 and j % 2 == 1\n maze_mat[i][j] = 0\n end\n end\n end\n end", "def matrix_addition(m1, m2)\n height = m1.length\n width = m1[0].length\n result = Array.new(height) { [0] * width }\n\n (0...height).each do |row|\n (0...width).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n\n result\nend" ]
[ "0.7420795", "0.7144719", "0.6859957", "0.6842278", "0.68326116", "0.6832463", "0.67523926", "0.6697485", "0.661081", "0.6587723", "0.6579307", "0.65712035", "0.6562897", "0.65437424", "0.6536058", "0.64858484", "0.6476088", "0.6472412", "0.6468496", "0.6467361", "0.64430696", "0.64179975", "0.64030373", "0.6389074", "0.6371056", "0.6369804", "0.63313127", "0.62656736", "0.62576026", "0.62357473", "0.6216195", "0.61773866", "0.6173125", "0.61726296", "0.6166", "0.61367345", "0.61221236", "0.61184317", "0.6093652", "0.60805035", "0.6058818", "0.60578305", "0.6055238", "0.60454196", "0.6042314", "0.60289717", "0.6003492", "0.59960717", "0.5991901", "0.59889996", "0.5986803", "0.5965738", "0.59601194", "0.5959066", "0.5934302", "0.593061", "0.5913059", "0.591029", "0.5902196", "0.5885352", "0.5884735", "0.5871872", "0.5864212", "0.5863473", "0.5858809", "0.58548534", "0.58542484", "0.58393794", "0.5835344", "0.5832703", "0.58258307", "0.5821757", "0.57978183", "0.5797765", "0.5784954", "0.57837987", "0.57778865", "0.5776898", "0.5776294", "0.57741576", "0.5772781", "0.57689977", "0.5762867", "0.57604724", "0.5756792", "0.57565147", "0.57555646", "0.5747636", "0.57410705", "0.57383615", "0.57314724", "0.573086", "0.5729747", "0.57181334", "0.5715934", "0.5707398", "0.57027745", "0.5696997", "0.5689803", "0.5687528" ]
0.620445
31
Metodo para multiplicar dos matrices
def *(mat) if (@mCol == mat.nFil) result = Array.new (@nFil).times do |i| result[i] = Array.new (mat.mCol).times do |j| if(@matriz[i][j].class==Fraccion) result[i][j] = Fraccion.new(0,1) else result[i][j] = 0 end end end aux = Matriz.new(result) (@nFil).times do |i| (mat.mCol).times do |j| (@mCol).times do |z| aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j] end end end else aux = 0 end aux end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end", "def multiply(first_matrix, second_matrix)\n x = first_matrix[0][0] * second_matrix[0][0] + first_matrix[0][1] * second_matrix[1][0]; \n y = first_matrix[0][0] * second_matrix[0][1] + first_matrix[0][1] * second_matrix[1][1]; \n z = first_matrix[1][0] * second_matrix[0][0] + first_matrix[1][1] * second_matrix[1][0]; \n w = first_matrix[1][0] * second_matrix[0][1] + first_matrix[1][1] * second_matrix[1][1]; \n \n first_matrix[0][0] = x; \n first_matrix[0][1] = y; \n first_matrix[1][0] = z; \n first_matrix[1][1] = w; \n end", "def matmul(a, b)\n m = a.length\n n = a[0].length\n p = b[0].length\n\n # transpose\n b2 = Array.new(n) { Array.new(p) { 0 } }\n n.times do |i|\n p.times do |j|\n b2[j][i] = b[i][j]\n end\n end\n\n # multiplication\n c = Array.new(m) { Array.new(p) { 0 } }\n m.times do |i|\n p.times do |j|\n s = 0\n ai, b2j = a[i], b2[j]\n n.times do |k|\n s += ai[k] * b2j[k]\n end\n c[i][j] = s\n end\n end\n c\nend", "def __mul_matrix(other)\n\t\tm = Memory.new(other.column_count) { |j|\n\t\t\t__inner_product(other.column(j))\n\t\t}\n\t\treturn MemoryVector.__new__(m)\n\tend", "def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(matrizc.matriz.size,0)\n\n\t\t\tfor col in 0...matrizc.matriz.size\n\n\t\t\t\tfor pos in 0...matriz.size\n\n\t\t\t\t\tprod = matriz[fil][pos] * matrizc.matriz[pos][col]\n\t\t\t\t\tmatRes[fil][col] = matRes[fil][col] + prod\n\n\t\t\t\tend\n\n\t\t\tend\n\n \t\tend\n\n \t\tMatriz.new(matRes)\n\n \tend", "def matmul(a, b)\n\tm = a.length\n\tn = a[0].length\n\tp = b[0].length\n\t# transpose\n\tb2 = Array.new(n) { Array.new(p) { 0 } }\n\tfor i in 0 .. n-1\n\t\tfor j in 0 .. p-1\n\t\t\tb2[j][i] = b[i][j]\n\t\tend\n\tend\n\t# multiplication\n \tc = Array.new(m) { Array.new(p) { 0 } }\n\tfor i in 0 .. m-1\n\t\tfor j in 0 .. p-1\n\t\t\ts = 0\n\t\t\tai, b2j = a[i], b2[j]\n\t\t\tfor k in 0 .. n-1\n\t\t\t\ts += ai[k] * b2j[k]\n\t\t\tend\n\t\t\tc[i][j] = s\n\t\tend\n\tend\n\treturn c\nend", "def strassen_matrix_multiplication(a, b)\n if a.length > 1\n a_splited = split_matrix(a, a.length)\n b_splited = split_matrix(b, a.length)\n else\n a_splited = a.map {|item| item[0]}\n b_splited = b.map {|item| item[0]}\n end\n\n p1 = calculate_p1(a_splited, b_splited)\n p2 = calculate_p2(a_splited, b_splited)\n p3 = calculate_p3(a_splited, b_splited)\n p4 = calculate_p4(a_splited, b_splited)\n p5 = calculate_p5(a_splited, b_splited)\n p6 = calculate_p6(a_splited, b_splited)\n p7 = calculate_p7(a_splited, b_splited)\n\n build_new_matrix(p1, p2, p3, p4, p5, p6, p7)\n end", "def multiply(*multiplicands)\n multiplicands.flatten.inject(1, :*)\n end", "def multi(a, b) #=> funkcja wykonujaca mnozenie\n\n\tc = a * b\n\nend", "def square_matrix_multiply_recursive(a, b)\n n = a.size\n c = n.times.map { |x| [] }\n if n == 1\n c[0] << a[0][0]*b[0][0]\n else\n a11, a12, a21, a22 = matrix_partitioner(a)\n b11, b12, b21, b22 = matrix_partitioner(b)\n\n c11 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b11),\n square_matrix_multiply_recursive(a12, b21))\n\n c12 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b12),\n square_matrix_multiply_recursive(a12, b22))\n\n c21 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b11),\n square_matrix_multiply_recursive(a22, b21))\n\n c22 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b12),\n square_matrix_multiply_recursive(a22, b22))\n c = assemble_matrix([c11, c12, c21, c22])\n end\n c\nend", "def square_matrix_multiply_recursive(a, b)\n n = a.size\n c = n.times.map { |x| [] }\n if n == 1\n c[0] << a[0][0]*b[0][0]\n else\n a11, a12, a21, a22 = matrix_partitioner(a)\n b11, b12, b21, b22 = matrix_partitioner(b)\n\n c11 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b11),\n square_matrix_multiply_recursive(a12, b21))\n\n c12 = mat_add_or_subtract(square_matrix_multiply_recursive(a11, b12),\n square_matrix_multiply_recursive(a12, b22))\n\n c21 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b11),\n square_matrix_multiply_recursive(a22, b21))\n\n c22 = mat_add_or_subtract(square_matrix_multiply_recursive(a21, b12),\n square_matrix_multiply_recursive(a22, b22))\n c = assemble_matrix([c11, c12, c21, c22])\n end\n c\n end", "def mul(a, b)\n res = []\n res << a[0]*b[0] + a[1]*b[2]\n res << a[0]*b[1] + a[1]*b[3]\n res << a[2]*b[0] + a[3]*b[2]\n res << a[2]*b[1] + a[3]*b[3]\n res\nend", "def *(other)\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil do\n for j in 0...other.ncol do \n for k in 0...ncol do\n m[i][j] = m[i][j] + self.mat[i][k] * other.mat[k][j]\n end\n end\n end\n return Matriz.new(self.nfil,other.ncol,m) \n end", "def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] * m\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif m._kind_of?( Vector )\n m = matrix_cls.column_vector(m)\n r = self * m\n return r.column(0)\n elsif m._kind_of?( matrix_cls )\n # Matrix.Raise ErrDimensionMismatch if column_size != m.row_size\n # rows = (0 .. row_size - 1).collect { |i|\n # (0 .. m.column_size - 1).collect { |j|\n # vij = 0\n # 0.upto(column_size - 1) { |k| vij += self[i, k] * m[k, j] }\n # vij\n # }\n # }\n my_column_size = self.column_size\n other_column_size = m.column_size\n matrix_cls.Raise ErrDimensionMismatch if my_column_size != m.row_size\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n res_row = array_cls.new(other_column_size)\n for j in 0..other_column_size-1 do\n vij = 0\n for k in 0..my_column_size-1 do\n vij += self[i, k] * m[k, j]\t\n end\n vij\n res_row[j] = vij\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n else\n cr = m.coerce(self)\n return cr[0] * cr[1]\n end\n end", "def multiplication(matrix_1, matrix_2)\n \n matrix_one_array = 0\n matrix_two_array = 0\n element = 0\n new_array = []\n \n until matrix_one_array == matrix_1.length\n \n temp_arr = []\n \n until element == matrix_2[0].length\n \n matrix_1[matrix_one_array].each do |var|\n temp_arr << var * matrix_2[matrix_two_array][element]\n matrix_two_array += 1\n end\n \n matrix_two_array = 0\n element += 1\n \n new_array << temp_arr\n temp_arr = []\n \n end\n \n element = 0\n matrix_one_array += 1\n \n end\n \n return new_array\n \n end", "def rec_matrix_multiplication(a, b)\n return a[0] * b[0] if a.length == 1\n\n a_splited = split_matrix(a, a.length)\n b_splited = split_matrix(b, a.length)\n\n a_b_1 = [matrix_sum(rec_matrix_multiplication(a_splited[0], b_splited[0]), rec_matrix_multiplication(a_splited[1], b_splited[2]))].flatten\n a_b_2 = [matrix_sum(rec_matrix_multiplication(a_splited[0], b_splited[1]), rec_matrix_multiplication(a_splited[1], b_splited[3]))].flatten\n a_b_3 = [matrix_sum(rec_matrix_multiplication(a_splited[2], b_splited[0]), rec_matrix_multiplication(a_splited[3], b_splited[2]))].flatten\n a_b_4 = [matrix_sum(rec_matrix_multiplication(a_splited[2], b_splited[1]), rec_matrix_multiplication(a_splited[3], b_splited[3]))].flatten\n\n row_length = a_b_1.count\n\n if row_length == 1\n result = [[a_b_1[0], a_b_2[0], a_b_3[0] , a_b_4[0]]]\n else\n result = \n [\n a_b_1[0..(row_length / 2) - 1] + a_b_2[0..(row_length / 2) - 1] +\n a_b_1[(row_length / 2).. - 1] + a_b_2[(row_length / 2).. - 1] +\n a_b_3[0..(row_length / 2) - 1] + a_b_4[0..(row_length / 2) - 1] +\n a_b_3[(row_length / 2).. - 1] + a_b_4[(row_length / 2).. - 1]\n ]\n end\n\n build(result[0], result[0].length)\nend", "def mul!(*args)\n dotop!(RAtlas::method(:mul!), RAtlas::method(:mmul!),\n *args)\n end", "def multiply(*input)\n\t\tinput.flatten.inject(:*)\n\tend", "def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end", "def mult(*args)\n\tprod = 1\n\targs.each do |arg|\n\t\tprod *= arg\n\tend\n\tprod\nend", "def *(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Densa\") && (@fil == @col) && (other.fil == other.col) && (@fil == other.fil))\r\n\t\t\t\r\n\t\t\tmatrizMult = Array.new(@fil) {Array.new(@col)}\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t(0..(@fil - 1)).collect {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t0.upto(@col - 1) do |j|\r\n\t\t\t\t\t\r\n\t\t\t\t\tmatrizMult[i][j] = 0\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tk = 0\t\t\t\t\t\r\n\t\t\t\t\t(@col - 1).times {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tmatrizMult[i][j] = matrizMult[i][j] + (@matrix[i][k] * other.matrix[k][j])\r\n\t\t\t\t\t\tk += 1\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\ti += 1\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t#puts \"#{matrizMult}\"\r\n\t\t\treturn matrizMult\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Numero distinto de filas y columnas\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def tensor_product_of_two_matrices(mat1, mat2)\n\n\tresult_rows = []\n\tmat1.values.each { |mat1_row| \n\t\tmat2.values.each { |mat2_row| \n\t\t\t\n\t\t\tresult_row = []\n\t\t\tmat1_row.each { |mat1_elem|\n\n\t\t\t\tmat2_row.each { |mat2_elem|\n\t\t\t\t\tcase [mat1_elem, mat2_elem]\n\t\t\t\t\tin [Term, Term]\n\t\t\t\t\t\tproduct = multiply_two_terms(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, TermList]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [TermList, Term]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, TermList]\n\t\t\t\t\t\tproduct = multiply_term_list_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, Term]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_fraction(mat1_elem, mat2_elem)\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow_error(\"Matrix tensor products with matrices that don't contain only Terms, TermLists, and Fractions.\", mat1, []) # TODO: Add stack trace (make a global)\n\t\t\t\t\tend\n\n\t\t\t\t\tresult_row.append(product)\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult_rows.append(result_row)\n\t\t}\n\t}\n\treturn Matrix.new(mat1.line, mat2.col, result_rows)\nend", "def multiply_two_matrices(left, right)\n\t\n\tif left.cols != right.rows\n\t\tthrow_error(\"Matrix dimensions don't match when multiplying two matrices (left.cols must == right.rows).\", left, []) # TODO: Add stack trace (make a global)\n\tend\n\tright_as_cols = right.values.transpose\n\n\tnew_rows = []\n\tfor row_index in (0..left.rows - 1)\n\t\tnew_row = []\n\t\tfor col_index in (0..right.cols - 1)\n\t\t\trow = left.values[row_index]\n\t\t\tcol = right_as_cols[col_index]\n\n\t\t\tnew_elem = Term.new(-1,-1, magnitude: 0)\n\t\t\tfor position in (0..row.length-1)\n\t\t\t\trow_elem = row[position]\n\t\t\t\tcol_elem = col[position]\n\t\t\t\tcase [row_elem, col_elem]\n\t\t\t\tin [Term, Term]\n\t\t\t\t\tproduct = multiply_two_terms(row_elem, col_elem)\n\t\t\t\tin [Term, TermList]\n\t\t\t\t\tproduct = multiply_term_and_term_list(row_elem, col_elem)\n\t\t\t\tin [TermList, Term]\n\t\t\t\t\tproduct = multiply_term_and_term_list(col_elem, row_elem)\n\t\t\t\tin [TermList, TermList]\n\t\t\t\t\tproduct = multiply_term_list_and_term_list(row_elem, col_elem)\n\t\t\t\tin [Fraction, Term]\n\t\t\t\t\tproduct = multiply_fraction_and_term(row_elem, col_elem)\n\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\tproduct = multiply_fraction_and_term_list(row_elem, col_elem)\n\t\t\t\tin [Term, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_term(col_elem, row_elem)\n\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_term_list(col_elem, row_elem)\n\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_fraction(row_elem, col_elem)\n\t\t\t\telse\n\t\t\t\t\tthrow_error(\"Matrix addition with matrices that don't contain only Terms, TermLists, and Fractions.\", left, []) # TODO: Add stack trace (make a global)\n\t\t\t\tend\n\t\t\t\t# Add product to new elem\n\t\t\t\tcase [product, new_elem]\n\t\t\t\tin [Term, Term]\n\t\t\t\t\tnew_elem = add_two_terms(product, new_elem)\n\t\t\t\tin [Term, TermList]\n\t\t\t\t\tnew_elem = add_term_and_term_list(product, new_elem)\n\t\t\t\tin [TermList, Term]\n\t\t\t\t\tnew_elem = add_term_and_term_list(new_elem, product)\n\t\t\t\tin [TermList, TermList]\n\t\t\t\t\tnew_elem = add_term_list_and_term_list(product, new_elem)\n\t\t\t\tin [Fraction, Term]\n\t\t\t\t\tnew_elem = add_fraction_and_term(product, new_elem)\n\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\tnew_elem = add_fraction_and_term_list(product, new_elem)\n\t\t\t\tin [Term, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_term(new_elem, product)\n\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_term_list(new_elem, product)\n\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_fraction(product, new_elem)\n\t\t\t\telse\n\t\t\t\t\tthrow_error(\"Matrix addition with matrices that don't contain only Terms, TermLists, and Fractions.\", left, []) # TODO: Add stack trace (make a global)\n\t\t\t\tend\n\t\t\tend\n\t\t\tnew_row.append(new_elem)\n\t\tend\n\t\tnew_rows.append(new_row)\n\tend\n\treturn Matrix.new(left.line, left.col, new_rows)\n\nend", "def multiplies (*args)\n multi=1\n args.each do |item|\n multi *=item\n end\n multi\nend", "def multiply_list(arr1, arr2)\n [arr1, arr2].transpose.map do |pair|\n pair.reduce(:*)\n end\nend", "def multiply(*numbers)\n numbers.reduce(1, :*)\n end", "def *(other)\r\n\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizProd = Array.new(@fil) {Array.new(@col) {0}}\t\t\t\r\n\r\n\t\t\t0.upto(other.numElementos - 1) do |i|\r\n\r\n\t\t\t\tif (other.filM[i] = @colM[i])\r\n\t\t\t\t\tmatrizProd[@filM[i]][@colM[i]] += @eleM[i] * other.eleM[i]\r\n\t\t\t\tend\r\n\r\n\t\t\tend\t\t\t\r\n\t\t\t\r\n\t\t\t#puts \"prod = #{matrizProd}\"\r\n\t\t\treturn matrizProd\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\t\t\r\n\tend", "def multiply(nums)\r\n nums.reduce(:*)\r\nend", "def * (other)\n i=0\n m_aux = Array.new(@fila) {Array.new(other.columna,0)}\n while i < @fila\n j = 0\n while j < other.columna\n m_aux[i][j] = 0\n k = 0\n while k < @columna\n m_aux[i][j] += matriz[i][k] * other.matriz[k][j]\n k += 1\n end\n j +=1\n end\n i +=1\n end\n Matriz.new(m_aux)\n end", "def elementMult(other)\n # pre-conditions and invariants\n assert((other.respond_to? :[]), \"pre-condition\")\n _invariants\n assert_equal(self.row_size,other.row_size, \"pre-condition\")\n assert_equal(self.column_size,other.row_size, \"pre-condition\")\n\n result = self.clone\n self.each_with_index {|index,val|\n result.put(index, val * other[index] )\n }\n\n # post-conditions and invariants\n _invariants\n assert_equal(result.toBaseMatrix,Matrix.build(self.row_size,self.column_size) {|x,y| self[x,y] * other[x,y]}, \"post-condition\")\n\n return result\n end", "def multiplicationm(num_1,num_2)\n return num_1 * num_2\nend", "def *(x)\n if x._isNumeric\n # els = @elements.collect{|e| e * x} \n my_elems = @elements\n e_size = my_elems.size\n els = Array.new(e_size)\n for i in 0..e_size-1 do\n els[i] = my_elems[i] * x\n end\n\n Vector.elements(els, false)\n else\n matrix_cls = Matrix\n if x._kind_of?( matrix_cls )\n matrix_cls.column_vector(self) * x\n else\n cr = x.coerce(self)\n cr[0] * cr[1]\n end\n end\n end", "def multiply(*nums)\n return nums.reduce(:*)\nend", "def multiply_each(x, y)\n if (x.get_horizontal_size() == y.get_horizontal_size) && (x.get_vertical_size() == y.get_vertical_size())\n to_return = Map.new(horizontal: x.get_horizontal_size(),\n vertical: x.get_vertical_size(),\n default: 0)\n x_map = x.get_map()\n y_map = y.get_map()\n (0..x.get_horizontal_size()-1).each do |column|\n (0..x.get_vertical_size()-1).each do |row|\n val = x_map[column][row] * y_map[column][row]\n to_return[column][row] = val\n end\n end\n return to_return\n end\n puts \"Invalid matrices to multiply each:\\n#{x}\\n#{y}\" if Settings.debug_mode()\n return []\n end", "def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend", "def mult(x,y)\n\tx * y\nend", "def multiply(a, b)\r\n a * b\r\n end", "def mult(a, b)\n a * b\nend", "def matrix_addition_reloaded(*matrices)\n\nend", "def add_mul\n\t\tpos = 0\n\t\twhile pos < @instructions.length - 6\n\t\t\tsix = @instructions[pos, 6]\n\t\t\tif six.map { |instr| instr[:type] } == CONST_MULT &&\n\t\t\t\t\t[six[0][1], six[0][2], six[1][1], six[4][1]].uniq.length == 4 &&\n\t\t\t\t\t[six[0][2], six[2][1], six[2][1]].uniq.length == 1 &&\n\t\t\t\t\tsix[4][1] == six[5][1] &&\n\t\t\t\t\tsix[3][2] == -2 && six[5][2] == -5\n\t\t\t\t@instructions[pos] = {:type => :mul, 1 => six[0][1], 2 => six[4][1], 3 => six[1][1]}\n\t\t\t\t@instructions[pos + 1] = {:type => :cpy, 1 => 0, 2 => six[2][1]}\n\t\t\t\t@instructions[pos + 2] = {:type => :cpy, 1 => 0, 2 => six[4][1]}\n\t\t\t\t((pos + 3)..(pos + 5)).each do |i|\n\t\t\t\t\t@instructions[i] = {:type => :none}\n\t\t\t\tend\n\t\t\tend\n\t\t\tpos += 1\n\t\tend\n\tend", "def matrixAddition(a, b)\n c = [] << a << b\n c.transpose.map{ |i| i.transpose }.map{ |s|\n s.map{ |p| p.reduce(&:+)}}\nend", "def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend", "def multiply(*nums)\n nums.reduce(1, :*)\nend", "def *(other)\n\t if(@alt==other.alt && @anc=other.anc)\n\t\tif(other.is_a? Matriz_Dispersa)\n\t\t self.to_densa.*(other.to_densa)\n\t\telse\n\t\t self.to_densa.*(other)\n\t\tend\n\t else\n\t\tputs \"no se puede realizar la multiplicacion\"\n\t end\n\t end", "def multiply!(m)\n super().flip!\n end", "def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end", "def multiply(*args) # multiple arguments\n array = args.to_a #convert to array\n array.reduce(:*)\nend", "def dmul!(arg)\n case arg\n when RNum::Matrix\n RAtlas::damul!(arg.storage, @storage)\n return arg\n else\n raise ArgumentError, \"Expected Matrix.\"\n end\n end", "def *(other)\n raise ArgumentError , 'Parametro invalido' unless other.is_a? Numeric or other.is_a? Matriz\n\n if(other.is_a? Numeric)\n c = Matriz_Densa.new(@N, @M)\n \n (@N).times do |i|\n (@M).times do |j|\n c.set(i, j, get(i,j)*other)\n end\n end\n else # Matriz * Matriz\n raise ArgumentError , 'Matriz no compatible (A.N == B.M)' unless @M == other.N\n c = Matriz_Densa.new(@N, other.M)\n (@N).times do |i|\n (other.M).times do |j|\n buffer = (0...@M).inject(0) { |acc, k| get(i, k) * other.get(k,j) + acc }\n c.set(i, j, buffer)\n end\n end\n end\n\n if (c.null_percent > 0.6)\n return Matrixlpp::Matriz_Dispersa.copy(c)\n else\n return c\n end\n end", "def *(other) \n ms = Hash.new(0)\n h = Hash.new(0)\n @mul = 0\n @matrix.keys.count.times do |k|\n @k = matrix.keys[k]\n for j in 0..other.hash.keys.count do\n @matrix[@k].keys.count.times do |i|\n @i = @matrix[@k].keys[i]\n if other.hash[@i][j] != 0 then\n @mul += @matrix[@k][@i] * other.hash[@i][j]\n end\n end\n h[j] = @mul unless @mul == 0\n @mul = 0\n end\n ms[@k] = h.clone unless h.empty?\n h.clear\n end\n ms2 = Matriz_dispersa.new(ms)\n end", "def multiplication(tab)\n mini = 1\n maxi = 1\n for i in 0..tab.length-1\n if tab[i].is_a?(IntVar)\n mini*=tab[i].domain.first\n maxi*=tab[i].domain.last\n elsif tab[i].is_a?(Integer)\n mini*= tab[i]\n maxi*= tab[i]\n tab[i] = IntVarStat.new(\"DuMmyINT\"+tab[i].to_s,[tab[i]],self)\n end\n end\n var_returned = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n var_returned.depend=true\n @dummyNameNb+=1\n var_in_const = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n @dummyNameNb+=1\n post(eq(var_returned,var_in_const))\n \n post(ContrainteMul.new([var_in_const]+tab))\n \n return var_returned\n \n end", "def multiply_list(array_1, array_2)\n result = []\n array_1.size.times do |index|\n result << array_1[index] * array_2[index]\n end\n result\nend", "def multiply(a, b)\n\t\treturn a*b\n\tend", "def mult(array)\n array.map { |arr|\n xt = mat[0][0] * arr.x + mat[0][1] * arr.y + mat[0][2] * arr.z + mat[0][3] * 1\n yt = mat[1][0] * arr.x + mat[1][1] * arr.y + mat[1][2] * arr.z + mat[1][3] * 1\n zt = mat[2][0] * arr.x + mat[2][1] * arr.y + mat[2][2] * arr.z + mat[2][3] * 1\n Vec3D.new(xt, yt, zt)\n }\n end", "def multiply(a, b)\n\ta * b\nend", "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "def multiply_matrix_and_term(matrix, term)\n\n\tresult_rows = []\n\tmatrix.values.each { |row|\n\t\tresult_row = []\n\t\trow.each { |elem|\n\n\t\t\tcase elem\n\t\t\tin Term\n\t\t\t\tproduct = multiply_two_terms(term, elem)\n\t\t\tin TermList\n\t\t\t\tproduct = multiply_term_and_term_list(term, elem)\n\t\t\tin Fraction\n\t\t\t\tproduct = multiply_fraction_and_term(elem, term)\n\t\t\telse\n\t\t\t\tthrow_error(\"Matrix does not contain only Terms, TermLists, and Fractions.\", matrix, []) # TODO: Add stack trace (make a global)\n\t\t\tend\n\t\t\tresult_row.append(product)\n\t\t}\n\t\tresult_rows.append(result_row)\n\t}\n\treturn Matrix.new(matrix.line, matrix.col, result_rows)\nend", "def multiply_matrix_and_term_list(matrix, term_list)\n\t\n\tresult_rows = []\n\tmatrix.values.each { |row|\n\t\tresult_row = []\n\t\trow.each { |elem|\n\n\t\t\tcase elem\n\t\t\tin Term\n\t\t\t\tproduct = multiply_term_and_term_list(elem, term_list)\n\t\t\tin TermList\n\t\t\t\tproduct = multiply_term_list_and_term_list(term_list, elem)\n\t\t\tin Fraction\n\t\t\t\tproduct = multiply_fraction_and_term_list(elem, term_list)\n\t\t\telse\n\t\t\t\tthrow_error(\"Matrix does not contain only Terms, TermLists, and Fractions.\", matrix, []) # TODO: Add stack trace (make a global)\n\t\t\tend\n\t\t\tresult_row.append(product)\n\t\t}\n\t\tresult_rows.append(result_row)\n\t}\n\treturn Matrix.new(matrix.line, matrix.col, result_rows)\nend", "def multiply(nb1,nb2)\n\treturn nb1*nb2\nend", "def multiply(first, second)\n first.send(:*, second)\nend", "def mult_inputs\n array_element_mult(@input_weights, @input_layer.neuron).inject(1) {|product,n| product*n}\n end", "def multiply(a, b)\nend", "def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "def multiply_list(array1, array2)\n results = []\n n = 0\n\n array1.size.times do |num|\n results << array1[n]*array2[n]\n n += 1\n end\n\n results\nend", "def mult(iva,ivb)\n multiplication([iva,ivb])\n end", "def multiply_list(array1, array2)\n result = []\n array1.each_index { |index| result << array1[index] * array2[index]}\n result\nend", "def multiply(m)\n t = super(m)\n t.flip!\n end", "def *(other)\n raise ArgumentError , 'El argumento debe ser una matriz' unless other.is_a? Numeric or other.is_a? Matriz\n \n #Si el argumento es un numero\n if(other.is_a? Numeric)\n c = Matriz_Densa.new(@fil, @col)\n i = 0\n while(i < @N)\n j = 0\n while(j < @M)\n c.matrix = @matrix[i][j] * other\n j += 1\n end\n i += 1\n end\n #Si el arguumento es una matriz\n else\n raise ArgumentError , 'Matriz no compatible (A.fil == B.col)' unless @col == other.fil\n \n c = Matriz_Densa.new(@fil, other.col)\n i = 0\n while(i < @fil)\n j = 0\n while(j < other.col)\n k = 0\n c.matrix[i][j] = 0\n while(k < @col)\n c.matrix[i][j] += @matrix[i][k] * other.get(k,j)\n k += 1\n end\n j += 1\n end\n i += 1\n end\n end\n \n c\n end", "def multiply(a,b)\n\treturn a * b\nend", "def multiply *array\n puts array.inspect\n array.flatten.inject(:*)\n end", "def * other\n mul(other)\n end", "def *(o)\n\t if(self.col == o.row)\n \t\t matres = self.class.new(self.row,self.col)\n# \t\t\t for i in 0...self.row\n# \t\t\t for j in 0...o.col\n# \t\t for k in 0...self.col\n\n\t\t\t i = 0\n \t\t\t (0..(self.row - 1)).collect {\n \t\t\t 0.upto(o.col - 1) do |j|\n\t\t\t k = 0\n \t\t (self.col - 1).times {\n \t\t\tmatres[i,j] += self[i,k] * o[k,j]\n\t\t\t k += 1\n\t\t\t }\n\t\t\t end\n# \t\t end\n# end\n# end\n\n\t\t\ti += 1\n\t\t\t}\n matres\n end\n end", "def multiply\n inject(1) { |p,x| p * x }\n end", "def mult num1, num2\n num1 * num2\nend", "def matrix_addition_reloaded(*matrices)\n first_m = matrices.first\n height = first_m.length\n width = first_m[0].length\n res = Array.new(height) {Array.new(width, 0)}\n \n matrices.inject(res) do |m1, m2|\n return nil if m1.length != m2.length || m1[0].length != m2[0].length\n matrix_addition(m1, m2)\n end\nend", "def multiply(first, second)\n first * second\nend", "def multiply_list(arr1, arr2)\n new_arr = []\n arr1.size.times do |ind|\n new_arr << arr1[ind] * arr2[ind]\n end\n new_arr\nend", "def *(other)\n case other\n when Mat4 then mul_mat4(other)\n when Mat3 then mul_mat3(other)\n when Vec3 then mul_vec3(other)\n when Vec4 then mul_vec4(other)\n when Numeric then mul_scalar(other)\n else raise ArgumentError, \"Don't know how to multiply Mat4 with object: #{other.inspect}\"\n end\n end", "def *(other)\n\t\tcase other\n\t\twhen Numeric\n\t\t\treturn __mul_numeric(other)\n\t\twhen Matrix\n\t\t\tif size != other.row_count\n\t\t\t\traise ArgumentError.new(\"incompatible: 1x#{size} * #{other.row_count}x#{other.column_count}\")\n\t\t\tend\n\t\t\treturn __mul_matrix(other)\n\t\telse\n\t\t\traise TypeError.new\n\t\tend\n\tend", "def *(a)\n if a.class == Vector # inner product\n product = 0\n self.each_index{|k| product += self[k]*a[k]}\n else\n product = Vector.new # scalar product\n self.each_index{|k| product[k] = self[k]*a}\n end\n product\n end", "def *(a)\n if a.is_a? Numeric then\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] * a}\n end\n\n if not a.is_a? Matrix then\n raise ArgumentError, \"a must be Matrix or Numeric\"\n end\n\n raise ArugmentError, \"self.cols those not match other.rows\" if @cols != a.rows\n\n return Matrix.new(@rows, a.cols) { |i,j|\n r = 0\n for k in 0...@cols\n r += self[i,k] * a[k,j]\n end\n r\n }\n end", "def multiplica2(array1, array2)\n if array1.length == array2.length\n array1.each_index do |i|\n array1[i] = (array1[i] * array2[i])\n end\n puts array1\n end\nend", "def multiply_list(array1, array2)\n array1.zip(array2).map { |subarr| subarr.reduce(:*) }\nend", "def *(b)\n Check.ensure_symbolic b\n Check.matrix_product self, b\n case b \n when Array\n __column_vector_prod(b) \n when Matrix \n __matrix_prod(b)\n else\n map { |v| v * b}\n end\n end", "def multiply(array)\n array.inject(:*)\nend", "def *(a)\n if a.is_a? Numeric then\n return Matrix.new(@rows, @cols) {|i,j| self[i,j] * a}\n end\n\n if not a.is_a? Matrix then\n raise ArgumentError, \"a must be Matrix or Numeric\"\n end\n\n raise ArugmentError, \"self.cols those not match other.rows\" if @cols != a.rows\n\n return Matrix.new(@rows, a.cols) { |i,j|\n r = 0\n for k in 0...@cols\n r += self[i,k] * a[k,j]\n end\n return r\n }\n end", "def *(mat)\n end", "def multiply_list(arr, arr1)\n arr.zip(arr1).map {|a, b| a.send(:*, b)}\nend", "def multiply(numbers)\n numbers.inject { |sum, n| sum * n }\n end", "def matrix\n end", "def ScalarMultiplication( scalaire ) \n i = @i * scalaire\n j = @j * scalaire\n \n pt = Point2D.new(i, j)\n vectorMultiSca = Vector2D.new( 0, 0 )\n vectorMultiSca.initializeWithPoint( pt )\n \n return vectorMultiSca \n end", "def multiply a,b\n a*b\nend", "def bigMul(a:int[], b)\n\tc = 0\n\tfor i = 0", "def multiply_list(arr1, arr2)\r\nresult = []\r\ncounter = 0\r\n\r\narr1.length.times do |num|\r\n result << arr1[counter] * arr2[counter]\r\n counter += 1\r\nend\r\np result\r\nend", "def mult(arr)\n\t\t# 1 space between every cell row added to row and column width\n\t\twidth = 1+ (arr.count * arr.count).to_s.length \n\t\t(arr).each do |x|\n\t\t\t(arr).each do |y|\n\t\t\t\tresult =(x * y).to_s\n\t\t# for aesthtics \n\t\t\tpadding = \" \" * (width - result.length)\n\t\t\tprint padding + result\n\t\t\tend \n\t\tprint(\"\\n\")\n\t\tend\n\tend", "def multiply(number1, number2)\n number1 * number2\n end", "def multiply(x, y)\n\tx * y\nend", "def multiply (a b)\r\n a * b\r\nend", "def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend", "def multiply(num1, num2)\n num1 * num2\n end", "def mult(num1, num2)\n num1 * num2\nend" ]
[ "0.75649035", "0.72462416", "0.712182", "0.70948285", "0.7021552", "0.69874597", "0.6981093", "0.6975448", "0.6954421", "0.6935829", "0.692853", "0.6894844", "0.6871286", "0.68438876", "0.68392235", "0.68261766", "0.6769494", "0.67486763", "0.6731185", "0.6696882", "0.6679784", "0.66748303", "0.66337883", "0.6604923", "0.65884393", "0.65786016", "0.6545964", "0.6544063", "0.65236455", "0.65211755", "0.6505383", "0.64829457", "0.647289", "0.64643145", "0.6454185", "0.6452623", "0.6443046", "0.6431655", "0.6429843", "0.64272046", "0.63963044", "0.6386373", "0.6385522", "0.63845015", "0.63766426", "0.6373738", "0.63713956", "0.6346133", "0.632741", "0.6317393", "0.6308093", "0.6305107", "0.62968767", "0.6284944", "0.62842274", "0.6282525", "0.62644786", "0.6256744", "0.6238721", "0.6231054", "0.62236613", "0.62149495", "0.621304", "0.621038", "0.620745", "0.620582", "0.61987823", "0.61978227", "0.6196532", "0.6195101", "0.61944056", "0.618427", "0.6179724", "0.617849", "0.6176369", "0.6176051", "0.6174242", "0.6172182", "0.61708564", "0.6162152", "0.61563754", "0.6150954", "0.614351", "0.61368406", "0.6134949", "0.61342543", "0.612356", "0.6121575", "0.6115442", "0.6112698", "0.6109673", "0.6104177", "0.6086763", "0.6079136", "0.60777146", "0.60728675", "0.6072656", "0.6070875", "0.6069369", "0.60621506", "0.6061265" ]
0.0
-1
Metodo para comparar la igualdad de dos matrices
def ==(mat) if ((@mCol == mat.mCol)&&(@nFil == mat.nFil)) for i in 0...@nFil do for j in 0...@mCol do if ((@matriz[i][j] == mat.matriz[i][j])==false) return false end end end else return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def igual (mat)\n end", "def ==(other)\n return false unless Matrix === other\n \n other.compare_by_row_vectors(@rows)\n end", "def == (other)\n iguales = true\n @filas.times do |i|\n @columnas.times do |j|\n if @elementos[i][j] != other.at(i,j)\n iguales = false\n end\n end\n end\n \n return iguales\n end", "def verify_matrix(matrix, rows_array, columns_array)\n rows = matrix.size\n columns = matrix[0].size\n\n rows.times do |row|\n columns.times do |column|\n if (rows_array.include?(row) || columns_array.include?(column))\n if matrix[row][column] != 0\n puts \"BUG!!! matrix[#{row}][#{column}] should be 0\"\n return false\n end\n elsif matrix[row][column] != 1\n puts \"BUG!!! matrix[#{row}][#{column}] should be 1\"\n return false\n end\n end\n end\n return true\nend", "def test_equality\n fm00 = FMatrix.new(TEST_MATRIX0)\n assert_equal(@fm0, fm00)\n assert_not_equal(@fm0, @fm2)\n assert_not_equal(@fm5, @fm7)\n assert_equal(@fm7, FMatrix.new(3, 3))\n\n fmtest1 = FMatrix.new([[0, 1.5], [2, 3]])\n fmtest2 = FMatrix.new([[0, 1.5], [2.0, 3.0]])\n\n assert_equal(fmtest1, fmtest2)\n\n end", "def compare_by_row_vectors(rows)\n my_rows = @rows\n sz = my_rows.size \n return false unless sz == rows.size\n \n for i in 0..sz-1 do\n return false unless my_rows[i] == rows[i]\n end\n true\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def compare_board(board1, board2)\n b1 = board1.grids.flatten\n b2 = board2.grids.flatten\n b1.each_with_index do |grid1, i|\n return false unless compare_grid(b1[i], b2[i])\n end\n return true\n end", "def test_method\n #==\n assert_operator(@m2,'==',@m5)\n #max y min\n assert_equal(5,@m4.max)\n assert_equal(4,@m6.max)\n assert_equal(1,@m6.min)\n #Operaciones\n assert_equal(Matriz.vector(2,2,[1,2,2,1]).to_s,(@m1+@m2).to_s)\n assert_equal(Matriz.vector(2,2,[1,0,0,1]).to_s,(@m2-@m1).to_s)\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,(@m1*@m2).to_s)\n assert_equal(Matriz.vector(2,2,[2,2,2,2]).to_s,(@m2*2).to_s)\n end", "def match()\n array_rows = @tablero.row_vectors() #Obtiene un array con todas las filas del tablero\n array_cols = @tablero.column_vectors() #Obtiene un array con todas las columnas del tablero\n diagonal1 = []\n diagonal2 = []\n diagonals = []\n #Obtiene la diagonal normal\n ([email protected]_vectors.length).each do |i|\n diagonal1.push(@tablero.component(i, i))\n end\n #Obtiene la diagonal invertida\n ([email protected]_vectors.length).each do |i|\n diagonal2.push(@tablero.component(i, @tablero.row_vectors.length - i - 1))\n end\n diagonals.push(diagonal1, diagonal2) #Los arrays de las diagonales se asignan a otro array\n\n #Se pregunta si existe algun match en filas o columnas o en las diagonales, si si regresa true\n if look_for_a_match(array_rows) || self.look_for_a_match(array_cols) || self.look_for_a_match(diagonals)\n return true\n else\n return false\n end\n end", "def isMatch(selectedCard1, selectedCard2, matrix)\n\t\tpos1 = selectedCard1['x']\n\t\tpos2 = selectedCard1['y']\n\t\tpos3 = selectedCard2['x']\t\t\n\t\tpos4 = selectedCard2['y']\t\t\n\t\tprint matrix\n\t\tputs \"Position1 has the value #{matrix[pos1][pos2]} and Position2 has the value #{matrix[pos3][pos4]}\"\n\t\tif (matrix[pos1][pos2] == matrix[pos3][pos4])\n\t\t\tputs \"Match Found\"\n\t\t\treturn true\n\t\telse\n\t\t\tputs \"No Match\"\n\t\t\treturn false\n\t\tend\n\tend", "def <=> (other)\n\t\treturn nil unless other.is_a?MatrizDensa\n\t\tc1=0\n\t\tc2=0\n\t\tfor i in ([email protected]_i)\n\t\t\tfor j in ([email protected]_i)\n\t\t\t\tif(self.mat[i][j] > other.mat[i][j])\n\t\t\t\t\tc1+=1\n\t\t\t\telsif(self.mat[i][j] < other.mat[i][j])\n\t\t\t\t\tc2+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t(c1)<=>(c2)\n\tend", "def comp(array1, array2)\n return false if (array1+array2).any? {|x| x == nil }\n array1.delete(nil)\n squares = array1.map { |num| num*num }\n squares.uniq.sort == array2.uniq.sort\nend", "def ==(other)\n return false unless other.is_a? SparseMatrix\n return false unless self.internalRepItemCount == other.internalRepItemCount\n self.each_with_index {|index,val|\n return false unless other[index] == val\n }\n end", "def is_1xn_matrix?(a)\n a[0].length == 1\n end", "def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.size == 1}\n\n return true if matrix.transpose.any? { |row| row.uniq.size == 1 }\n\n false\nend", "def check_one?(matrix, row, column)\n\n matrix.size.times do |i|\n if matrix[i][column] == 0\n return false\n end\n end\n\n matrix[0].size.times do |j|\n if matrix[row][j] == 0\n return false\n end\n end\n\n return true\nend", "def ==(other)\n if (@val.length != other.length || @rows != other.rows || @cols != other.cols)\n return false\n end\n for pos in [email protected]\n if (@val[pos] != other(@f[pos],@c[pos]))\n return false\n end\n end\n true\n end", "def comp(array1, array2)\n return false if array1.nil? || array2.nil?\n\n array1.sort.map { |e| e * e } == array2.sort\nend", "def comp_2(array1, array2)\n array1.nil? || array2.nil? ? false : array1.sort.map { |e| e * e } == array2.sort\nend", "def is_outside_matrix(i, j, matrix)\n return true if i < 0 or j < 0 or i > matrix.size - 1 or j > matrix[0].size - 1\n return false \nend", "def squarocol?(matrix)\n d = matrix.length\n d.times do |i|\n return true if matrix[i].all?{ |el| el == matrix[i][0]}\n end\n\n\n \n d.times do |c|\n flag = 0\n n = matrix[0][c]\n d.times do |r|\n if !(matrix[r][c] == n)\n flag = 1\n break\n end\n end\n return true if flag == 0\n end\n false\nend", "def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.length == 1}\n return true if matrix.transpose.any? { |col| col.uniq.length == 1}\n false\nend", "def squarocol?(array)\n size = array.size\n\n #check rows\n array.each { |a| return true if a.all? {|e| e == a[0]} }\n\n #check cols\n (0...size).each do |i|\n is_same = true\n array.each do |a|\n if a[i] != array[0][i] #item is not same as the first item in column\n is_same = false\n break\n end\n end\n return true if is_same\n end\n \n return false\nend", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def ==(other)\n return false unless other.is_a? YaleSparseMatrix\n nonzero_element_count == other.nonzero_element_count &&\n elements == other.elements &&\n row_index == other.row_index &&\n index_column == other.index_column\n end", "def squarocol?(arr)\n vert_test = false\n horz_test = false\n\n arr.each do |sub_arr| # [:x, :y, :x]\n horz_test = sub_arr.all? {|el| el == sub_arr[0]}\n return true if horz_test == true\n end\n\n columns = arr.transpose\n columns.each do |sub_arr| # [:x, :y, :x]\n vert_test = sub_arr.all? {|el| el == sub_arr[0]}\n return true if vert_test == true\n end\n\n false\nend", "def rows_to_columns?(matrix_1, matrix_2)\n\n return if matrix_1.length == matrix_2.length\n\n new_arr = []\n\n if matrix_1.length == matrix_2[0].length\n temp_arr = []\n element = 0 \n\n while element != matrix_1.length \n matrix_2.each do |arr|\n temp_arr << arr[element]\n end \n new_arr << temp_arr\n temp_arr = []\n element += 1\n \n # Printing for testing purposes\n p new_arr[0] \n p new_arr[1]\n p new_arr[2]\n p new_arr[3]\n end\n\n # The check has returned false. The multiplication is not pheasable \n else\n puts \"Sorry These matrices are not naturally divisible even if transposed\" \n end \n\nend", "def compare(srcDataArray, trgtDataArray)\n\tresult = true;\n\t\n\t# first compare sizes\n\tif (srcDataArray.length() != trgtDataArray.length())\n\t\tputs(\"Data arrays are of different length. Source size: #{srcDataArray.length()}. Target size: #{trgtDataArray.length()}.\");\n\t\tresult = false;\n\t\treturn result;\n\tend\n\t\n\t# Check each element\n\tmaxSize = srcDataArray.length();\n\tfor i in 0...maxSize\n\t\t# Check each element, exit after first case where elements don't match\n\t\tif (srcDataArray[i] != trgtDataArray[i])\n\t\t\tputs(\"Elements at position #{i} are different. Source: #{srcDataArray[i]}. Target: #{trgtDataArray[i]}.\");\n\t\t\tresult = false;\n\t\t\treturn result;\n\t\tend\n\tend\nend", "def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end", "def test_cont\n @m4[0,0]=1\n @m1[0,0]=1\n #insercion\n assert_equal(@m4.to_s,'[[1,0],[0,5]]')\n assert_equal(@m1.to_s,'[[1,1],[1,0]]')\n #obtencion\n assert_equal(@m4[1,1],5)\n assert_equal(@m1[0,0],1)\n end", "def test_enteros\n #Suma\n @m3 = Matriz_Densa.new(2,2,[2,4,6,8])\n assert_equal(@m3, @m1+@m2)\n\n #Resta\n @m3 = Matriz_Densa.new(2,2,[0,0,0,0])\n assert_equal(@m3, @m1-@m2)\n\n #Multiplicación\n @m3 = Matriz_Densa.new(2,2,[2,4,6,8])\n assert_equal(@m3, @m1*@m2)\n\n #Comparación\n\t@m3 = Matriz_Densa.new(2,2,[1,2,3,4])\n assert_equal(@m3, @m1)\n\n #Mínimo\n assert_equal(@m1.min,1)\n\n #Máximo\n assert_equal(@m1.max,4)\n\n end", "def test_creac\n #Matriz densa\n assert_equal(@m1.rows, 2)\n assert_equal(@m1.cols, 2)\n \n #Matriz dispersa\n assert_equal(@m4.rows, 2)\n assert_equal(@m4.cols, 2)\n \n #Creacion\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,@m2.to_s)\n assert_equal(Matriz.nula.to_s,@m3.to_s)\n end", "def comp(array1, array2)\n return false if array1.nil? || array2.nil? || array1.length != array2.length\n a = array1.sort\n b = array2.sort\n b.each_with_index do |value, i|\n if a[i]*a[i] != value\n return false\n end\n end\n return true\nend", "def has_tied(new_board)\n new_board.each_with_index do |row,i|\n row.each_with_index do |col,j|\n return false if new_board[i][j] == '-'\n end\n end\n true\nend", "def matrix_check_sum(matrix)\n matrix.length.times do |i|\n return false if sum_row(i, matrix) != sum_column(i, matrix)\n end\n return true\nend", "def operando(other)\n \n\t\t \n if(@mat1 == nil)\n @mat1 = other\n else\n @mat2 = other\n end\n \n\t\t# Realizamos la operación\n if @mat1 != nil and @mat2 != nil\n\t ejecucion\n\t\tend\n \n end", "def ==(other)\n raise TypeError unless (other.is_a?(TridiagonalSparseMatrix))\n self.main_diagonal == other.main_diagonal\n self.lower_diagonal == other.lower_diagonal\n self.upper_diagonal == other.upper_diagonal\n self.numColumns == other.numColumns\n self.numRows == other.numRows\n end", "def check_matrix\n @matrix.each_with_index do |current_point, i|\n @edges.clear # Set up the edge buffer.\n check_triangles(current_point)\n check_edges(i)\n end\n end", "def similar_value(a, b, c)\n @board[a[0]][a[1]] == @board[b[0]][b[1]] && @board[b[0]][b[1]] == @board[c[0]][c[1]]\n end", "def won?\n for x in [email protected] - 1\n for y in 0..@matrix[x].length - 1\n return false if @matrix[x][y] == \"OO\"\n end\n end\n\n true\n end", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend", "def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend", "def check_valid(columns, row, col)\n for pre_r in 0..row-1\n pre_c = columns[pre_r]\n\n # check to see if queue in the same column\n return false if pre_c == col\n\n # check diagonals\n col_dis = (col - pre_c).abs\n row_dis = (row - pre_r).abs\n\n return false if col_dis == row_dis\n end\n true\nend", "def ==(vector2)\n end", "def squarocol?(arr)\n (0..arr.length-1).each do |i|\n row_counter = 1\n col_counter = 1\n\n (0...arr.length-1).each do |j|\n row_counter += 1 if arr[i][j] == arr[i][j + 1]\n col_counter += 1 if arr[j][i] == arr[j + 1][i]\n \n end\n\n if row_counter == arr.length || col_counter == arr.length\n return true\n end\n \n end\n false\nend", "def array_equals(array1, array2) \n # list of 2 arrays \n # array1 = [10, 20, 30, 40, 50, 60] # 6 > return true otherwise false\n # array2 = [10, 20, 30, 40, 50, 60] # 6\n\n if array1 == nil && array2 == nil\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n # if the two arrays are of different length\n if array1.length != array2.length\n return false\n end\n\n # take each element in ar1 and in ar2\n array1.each_with_index do | ar1_el, index |\n ar2_el = array2[index]\n\n # if ar1_el is not the same as ar2_el\n if ar1_el != ar2_el\n return false\n end \n end\n # otherwise return true because they all are similar\n return true\nend", "def squarocol?(square)\n #if row.all? { |val| val == row[0]} TRUE\n #OR if array.transpose ^^\n \n square.each do |row|\n return true if row.uniq.count == 1\n end\n square.transpose.each do |col|\n return true if col.uniq.count == 1\n end\n\n false\nend", "def array_equals(array1, array2)\nif array1 == nil && array2 == nil\n return true\nelsif array1 == nil || array2 == nil\n return false\nend\n\n\n\nif array1.length != array2.length\n return false\n\nend\n\n\narray1.length.times do |index|\n\n if array1[index] != array2[index]\n return false\n end\nend\n\n\n\n\nreturn true\n\nend", "def checkwinner\r\n\t\t\t\r\n\t\t\[email protected] do |row|\r\n\t\t\t\trow.join.gsub(\"|\",\"\")\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#check horizontal winners\r\n\t\t\[email protected] do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\r\n\t\t\t#check vertical winners\r\n\t\t\[email protected] do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tfor row_nr in [email protected]\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2\t\r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t#right to left\r\n\t\t\tfor row_nr in [email protected]\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix.reverse[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix.reverse[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix.reverse[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix.reverse[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2 \r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\r\n\t\t\treturn @winner\r\n\t\tend", "def eql?(other_grid)\n return @id == other_grid.id\n #return @id == other_grid.id\n #result = false\n #if other_grid.x == @x && other_grid.y == @y \n # result = true\n # for y in 0...other_grid.y do\n # for x in 0...other_grid.x do\n # unless other_grid.block(x, y) == self.block(x, y)\n#\t result = false\n#\t break\n#\t end\n#\tend\n# end\n# end\n# result\n end", "def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend", "def gridChallenge(grid)\n grid.each do |row|\n row.sort!\n end\n columns = grid.first.size\n size = grid.size\n\n \n (0..(columns - 1)).each do |col|\n list = []\n (0..(size -1)).each do |row| \n list << grid[row][col]\n end\n return 'NO' if list != list.sort\n end\n\n 'YES'\nend", "def dense_eql_sparse? m #:nodoc:\n m.each_with_indices do |v,*indices|\n return false if self[*indices] != v\n end\n\n return true\n end", "def any_mines_detonated?\n (0...row_count).to_a.each do |row|\n (0...column_count).to_a.each do |col|\n if @cleared[row][col] == true && @mines[row][col] == true\n return true\n end\n end\n end\n return false\n end", "def matrix_check_sum(matrix)\n num_of_rows = matrix.length\n\n sum_rows = []\n num_of_rows.times do |i|\n sum = 0\n num_of_rows.times do |j|\n sum += matrix[i][j]\n end\n sum_rows << sum\n end\n\n sum_cols = []\n num_of_rows.times do |i|\n sum = 0\n num_of_rows.times do |j|\n sum += matrix[j][i]\n end\n sum_cols << sum\n end\n\n if sum_rows == sum_cols\n return true\n else\n return false\n end\nend", "def matrix_check_sum(matrix)\n rows = matrix.length\n columns = matrix[0].length\n \n sum_rows = []\n matrix.each do |row|\n sum_rows.push(row.sum)\n end\n\n sum_columns = []\n columns.times do |i|\n sum = 0\n rows.times do |j|\n sum = sum + matrix[j][i]\n end\n sum_columns.push(sum)\n end\n \n rows.times do |i|\n columns.times do |j|\n if sum_rows[i] != sum_columns[j]\n return false\n end\n end\n end\n\n return true\nend", "def equals?(val)\n \n if (val.is_a? Numeric)\n @colt_property.equals(@colt_matrix, val)\n else\n @colt_property.equals(@colt_matrix, val.colt_matrix)\n end\n\n end", "def squaragonal?(matrix)\n key1 = matrix[0][0]\n key2 = matrix[0][matrix.size - 1]\n test_dr = true\n test_dl = true\n\n (0...matrix.size).each do |i|\n test_dr = false unless matrix[i][i] == key1\n end\n\n j = matrix.size - 1\n (0...matrix.size).each do |i|\n test_dl = false unless matrix[i][j] == key2\n j -= 1\n end\n\n test_dr || test_dl\nend", "def identity?\n return false unless square? #must be a square matrix\n \n for curr_row_num in 0...@rows\n for curr_col_num in 0...@cols\n return false unless ((curr_row_num == curr_col_num && get(curr_row_num, curr_col_num) == 1) || (curr_row_num != curr_col_num && get(curr_row_num, curr_col_num) == 0))\n end\n end\n \n return true\n end", "def been_to?(matrix)\n previous_states.each do |state|\n return true if matrix[0] == state[0] &&\n matrix[1] == state[1] &&\n matrix[2] == state[2]\n end\n\n false\n end", "def squaragonal?(mat)\n n = mat.length\n # check UL to BR\n f_ele = mat[0][0]\n i = 0\n j = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][i]\n i+=1\n end\n return true if all_same\n # check BL to UR\n # debugger\n f_ele = mat[n-1][0]\n j = n-1\n i = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][j]\n i+=1\n j-=1\n end\n return true if all_same\n false\nend", "def compare( tuples, i, j )\n a, x = tuples[i][0], tuples[i][1]\n b, y = tuples[j][0], tuples[j][1]\n\n a, x, b, y, i, j = b, y, a, x, j, i if x > y\n a / b.to_f > b**((y - x) / x.to_f) ? i : j\n end", "def array_equals(array1, array2)\n #if the arrays are different lengths, will return false\n if array1.length != array2.length\n return false\n end\n\n # compares each element of array, starting at index[0]\n # if they are not equivalent at any point, then it will return false\n # else it will return true when completed \n x = 0\n array1.length.times do\n if array1[x] != array2[x]\n return false\n end\n x += 1\n end\n return true\nend", "def exercise_1113 (matrix)\n end", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def check_columns\n for column in 0..2\n if @game_array[0][column] == @game_array[1][column] &&\n @game_array[0][column] == @game_array[2][column] &&\n !@game_array[0][column].nil?\n\n result = @game_array[0][column]\n end\n end\n\n result\n end", "def array_equals(array1, array2)\n #raise NotImplementedError\n#Check for the nil class first because array methods will not work\n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n return true\n else\n return false\n end\n end\n\n#Check for empty arrays\n if array1[0]==nil && array2[0]==nil\n return true\n elsif (array1[0] == nil) || (array2[0] == nil)\n return false\n end\n\n#Now we know that at least both arrays have elements we can determine their length\n#and look at each element to see if each index is the same.\n len1 = array1.length\n len2 = array2.length\n\n if len2 != len1\n return false\n end\n\n\n len1.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\nend", "def is_valid_matrix_size?\n for i in 0...(@matrix.length-1) do\n return false if @matrix[i].length != @matrix[i+1].length\n end\n true\n end", "def locationsCompare(arr1, arr2)\n if arr2.length == 0\n return false\n elsif arr1.length != arr2.length || arr1 & arr2 != arr1\n return true\n end\n return false\n end", "def matrixZero m\n rows = []\n cols = []\n\n (0..m.length-1).each { |row|\n (0..m[0].length-1).each { |col|\n if m[row][col] == 0 \n rows.push(row) unless rows.include?(m[row][col])\n cols.push(col) unless cols.include?(m[row][col])\n end\n }\n }\n\n (0..m.length-1).each { |row| \n (0..m[0].length-1).each { |col| \n if rows.include?(row) or cols.include?(col) \n m[row][col] = 0\n end\n }\n }\n m\nend", "def array_equals(arr1, arr2)\n if (arr1 == [] && arr2 == [] || arr1 == nil && arr2 == nil)\n return true\n elsif arr1 == nil || arr2 == nil || arr1.length != arr2.length\n return false \n else\n arr1.length.times do |num|\n if arr1[num] != arr2[num]\n return false\n end\n end\n return true\n end\nend", "def raw_compare(triplet, compressed)\n assert_equal triplet.nzValues.size, compressed.nzValues.size\n assert_equal triplet.rowNames, compressed.rowNames\n assert_equal triplet.colNames, compressed.colNames\n\n triplet.rowIdx.zip(triplet.colIdx, triplet.nzValues).each do |i, j, v|\n assert_equal v, get_value(compressed, i, j)\n end\n end", "def array_equals(array1, array2)\n\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil && array2 != nil\n return false\n elsif array1 != nil && array2 == nil\n return false\n elsif array1 == [] && array2 == []\n return true\n end\n\n array1_length = 0\n array1.each do |element|\n array1_length = array1_length + 1\n end\n\n array2_length = 0\n array2.each do |element|\n array2_length = array2_length + 1\n end\n\n if array1_length == array2_length\n index1 = 0\n array1_length.times do\n if (array1[index1] == array2[index1])\n index1 = index1 + 1\n else\n return false\n end\n end\n return true\n else\n return false\n end\nend", "def horzvert?(tdarr)\n tdarr.each do |sub|\n if sub.uniq.length == 1\n return true\n end\n end\n\n tdarr.transpose.each do |sub|\n if sub.uniq.length == 1\n return true\n end\n end\n\n false\nend", "def test_matrix\n m = Matrix[[0, 1],[1, 1]]\n m2 = m*m\n m3 = m2*m\n m4 = m3*m\n m2squared = m2**2\n assert_equal 1, CS::lower_right(m)\n assert_equal 2, CS::lower_right(m2)\n assert_equal 3, CS::lower_right(m3)\n assert_equal 5, CS::lower_right(m4)\n assert_equal m4, m2squared\n e = Matrix[]\n assert_nil CS::lower_right(e)\n end", "def array_equals(array1, array2)\n comparison_array = []\n\n if array1 == nil && array2 == nil\n return true\n\n elsif array1 == nil && array2 != nil\n return false\n\n elsif array2 == nil && array1 != nil\n return false\n\n elsif array1.length == array2.length\n final_answer = \"same\"\n\n i = 0\n while i < array1.length\n if array1[i] == array2[i]\n comparison_array << 1\n else\n comparison_array << 0\n end\n i += 1\n end\n\n comparison_array.length.times do |x|\n if comparison_array[x] == 0\n final_answer = \"different\"\n end\n end\n\n if final_answer == \"same\"\n return true\n else\n return false\n end\n\n else\n return false\n end\n\n\nend", "def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end", "def compare_arrays(*arrays)\n arrays.\n arrays.each do |tab,*tabs|\n puts \"tabs = #{tabs}\"\n\n end\n end", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def squarocol?(array)\n height = array.length\n width = height\n (0...height).each do |i|\n count_c = 1\n count_r = 1\n (0...width - 1).each do |j|\n count_c += 1 if array[i][j] == array[i][j + 1]\n count_r += 1 if array[j][i] == array[j + 1][i]\n end\n return true if count_c == height || count_r == width\n end\n false\nend", "def Matrix3dEqual(arg0, arg1)\n ret = _invoke(1610743917, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def areSimilar(a, b)\n count = 0\n \n for i in 0..(a.count-1)\n if a[i] != b[i]\n count += 1\n end\n end\n \n if count < 3\n if a.sort == b.sort\n return true\n end\n end\n \n false\nend", "def ==(other_grid)\n return @id == other_grid.id\n #result = false\n #if other_grid.x == @x && other_grid.y == @y \n # result = true\n # for y in 0...other_grid.y do\n # for x in 0...other_grid.x do\n # unless other_grid.block(x, y) == self.block(x, y)\n # \t result = false\n # break\n # \t end\n # \tend\n # end\n # end\n # result\n end", "def equal_by_trans?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n bounds_obj1 = bounds(graph_obj1)\n bounds_obj2 = bounds(graph_obj2)\n if (not (bounds_obj1.size == bounds_obj2.size)) #or (not equal_by_dim?(graph_obj1, graph_obj2))\n false\n elsif one_dim?(graph_obj1) and one_dim?(graph_obj2)\n translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)), graph_obj2)\n elsif two_dim?(graph_obj1) and two_dim?(graph_obj2)\n translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first),\n -(bounds_obj1.y_range.first - bounds_obj2.y_range.first)]) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first), \n #-(bounds(graph_obj1).y_range.first - bounds(graph_obj2).y_range.first)]), graph_obj2)\n else false\n end\nend", "def array_equals(array1, array2)\n # false if \n # different length\n # different element value\n # different order\n if (array1 == nil && array2 == nil )|| (array1 == [] && array2 == [])\n return true\n end\n\n if (array1 == [] || array2 == []) || (array1 == nil || array2 == nil)|| (array1.length != array2.length )\n return false \n end \n\n n = 0\n array1.each do |element|\n if element != array2[n]\n return false\n end\n n += 1\n end\n\n return true\n\nend", "def array_equals(array1, array2)\n if array1.nil? && array2.nil?\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n if array1.length != array2.length\n return false\n end\n\nmatching_elem = Hash.new\n\ni = 0\nwhile i < array1.length\n elem = array1[i]\n if matching_elem[elem]\n matching_elem[elem] += 1\n else\n matching_elem[elem] = 1\n end\n i += 1\nend\n\ni = 0\nwhile i < array2.length\n elem = array2[i]\n if matching_elem[elem]\n matching_elem[elem] -= 1\n elsif matching_elem[elem] && matching_elem[elem] < 0\n return false\n else\n return false\n end\n i += 1\nend\n\nreturn true\n# x = \"\"\n# same_count =\n# same_elements =\n# elements_match = 0\n# first_array_counter = 0\n# second_array_counter = 0\n#\n# array1.each_index do |i|\n# i += 1\n# first_array_counter += i\n# end\n# print first_array_counter\n#\n# array2.each_index do |i|\n# i += 1\n# second_array_counter += i\n# end\n# print second_array_counter\n#\n# # list_one = array1.size\n# # list_two = array2.size\n#\n# if first_array_counter == second_array_counter\n# same_count = true\n# elsif array1 == nil && array2 == nil\n# same_elements = true\n# elsif array1 == nil && array2 != nil\n# same_elements = false\n# elsif array2 == nil && array1 != nil\n# same_elements = false\n# else\n# same_count = false\n# end\n#\n# if same_count == true\n# first_array_counter.times do |i|\n# if array1[i] == array2[i]\n# elements_match += 1\n# end\n# end\n# end\n#\n# if elements_match == (first_array_counter) && elements_match == (second_array_counter)\n# same_elements = true\n# end\n#\n# if same_count == same_elements\n# x = true\n# else\n# x = false\n# end\n#\n# return x\nend", "def matrix_check_sum(matrix)\n return false if (matrix.length) != (matrix[0].length)\n (matrix.length).times do |i|\n rows = 0\n columns = 0\n (matrix[0].length).times do |j|\n rows += matrix[i][j]\n columns += matrix[j][i]\n end\n if rows != columns\n return false\n end\nend\nreturn true\nend", "def board_matches(b1, b2)\n b1.board == b2.board\n end", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n end\n\n array1_length = array1.length\n array2_length = array2.length\n if array1_length == array2_length\n array1_length.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\n end\n return false\n \n raise NotImplementedError\n\nend", "def any_mines_detonated?\n for x in 0..@row_count - 1 do\n for y in 0..@column_count - 1 do\n if @cleared_field[[x,y]] && @mine_field[[x,y]]\n return true\n break\n end\n end\n end\n false\n\n end", "def array_equals(array1, array2)\n if array1.length == array2.length\n number = array1.length\n number.times do |i|\n if array1[i] != array2[i] \n return false\n end\n end\n return true\n end \n return false\nend", "def compare_array(current, expect)\n if current.class != Array\n result = (current == expect)\n if !result\n puts 'Error: ' << @array_idx_stack.to_s << '-'*10\n puts [current, expect].to_s\n @error_list[:current].push(@array_idx_stack.dup)\n @error_list[:expect].push(@array_idx_stack.dup)\n end\n return result\n end\n \n return false if !check_ary_lengh(current, expect)\n \n result = true\n for idx in (0...current.length)\n @array_idx_stack.push(idx)\n if !compare_array(current[idx], expect[idx])\n result = false\n # return false\n end\n @array_idx_stack.pop\n end\n \n return result\n end", "def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend", "def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end", "def array_equals(array1, array2)\n if array1 == nil && array1 == array2\n return true\n elsif array1.nil? || array2.nil?\n return false\n end\n return false if array1.length != array2.length\n array1.length.times do |x|\n if array1[x] != array2[x]\n return false\n end\n end\n return true\nend", "def arrays_matching(arr1, arr2)\n if arr1.length != arr2.length\n return false\n else\n lib = {}\n for i in 0..arr1.length-1\n lib[arr1[i]] = true\n end\n for j in 0..arr2.length-1\n if lib[arr2[j]] == nil\n return false\n end\n end\n return true\n end\nend" ]
[ "0.7530192", "0.6959381", "0.66813326", "0.65107685", "0.65058386", "0.6410561", "0.6385345", "0.6385345", "0.637278", "0.6249778", "0.6224424", "0.61948305", "0.6156411", "0.6134711", "0.60726744", "0.6004553", "0.58949095", "0.5883778", "0.5871188", "0.5863032", "0.58626246", "0.585168", "0.5839147", "0.582933", "0.5790067", "0.5782126", "0.57733345", "0.57400936", "0.57372123", "0.5732281", "0.57063687", "0.564465", "0.5637334", "0.56360155", "0.5629774", "0.5618534", "0.5617616", "0.56105214", "0.5607366", "0.5604033", "0.5601266", "0.55924404", "0.55844647", "0.5579829", "0.5579829", "0.55631536", "0.556105", "0.55561155", "0.55492085", "0.5548511", "0.55481404", "0.554778", "0.5535536", "0.55118424", "0.55116785", "0.55108255", "0.55056894", "0.55012", "0.5491954", "0.54907554", "0.54709285", "0.54700327", "0.54489267", "0.54413605", "0.5441219", "0.54372644", "0.5434903", "0.5434644", "0.5428855", "0.5420208", "0.5417977", "0.5416775", "0.54130715", "0.53972954", "0.53945625", "0.53892237", "0.5383706", "0.53834313", "0.53820527", "0.53778493", "0.53736085", "0.53716356", "0.53716356", "0.53584063", "0.53538245", "0.53487194", "0.53404224", "0.5337476", "0.53312373", "0.5330513", "0.53258", "0.53224313", "0.5321253", "0.5319893", "0.5317346", "0.5317094", "0.5316226", "0.53125757", "0.531184", "0.5311378" ]
0.68621004
2
Returns count of number of orders for a particular country
def number_of_orders sql = "SELECT COUNT(*) as count " sql << "FROM orders " sql << "INNER JOIN order_addresses ON ( " sql << " order_addresses.country_id = #{self.id} AND order_addresses.id = orders.shipping_address_id " sql << ");" Order.count_by_sql(sql) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_counts(opts={ })\n unless (leftovers = opts.keys - VALID_COUNT_OPTIONS).empty?\n raise \"Invalid keys: #{leftovers.join(', ')}\"\n end\n\n params = []\n clauses = []\n sql = \"SELECT country, SUM(install_count), SUM(update_count) FROM reports\"\n\n if opts[:from]\n clauses << \"report_date >= ?\"\n params << format_date(opts[:from])\n end\n\n if opts[:to]\n clauses << \"report_date <= ?\"\n params << format_date(opts[:to])\n end\n\n if opts[:country]\n clauses << \"country = ?\"\n params << opts[:country]\n end\n\n sql << \" WHERE \" unless clauses.empty?\n sql << clauses.join(\" AND \") unless params.empty?\n sql << \" GROUP BY country ORDER BY country\"\n\n @db.execute(sql, params).map do |row|\n OpenStruct.new({\n :country => row[0],\n :install_count => row[1].to_i,\n :update_count => row[2].to_i\n })\n end\n end", "def visits_by_country\n City.joins(:visits)\n .where(visits: {short_url_id: self.id})\n .group(\"cities.country\").count\n end", "def count_population(country)\n population = 0\n for country in country\n population += country[:population]\n end\n return population\nend", "def count_by(geo, results)\n totals = results.each_with_object(Hash.new(0)) do |res,counts|\n # binding.pry\n next unless [\"us\",\"ca\"].include?(res.country)\n counts[res.send(geo.to_sym)] += 1\n end\n puts \"TOTAL: #{totals.values.inject(:+)}\"\n\n totals = totals.sort_by { |geo,count| -count }\n\n puts \"Total groups by #{geo.to_s}: \"\n totals.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend", "def get_country_statistics_report(country_list, device_access)\n @country_hash = {}\n country_list.each do |country|\n country_count = device_access.where(:access_country => country).count\n @country_hash[country] = country_count \n end\n country_stat = @country_hash.sort_by {|_key, value| value}.reverse\n hash = Hash[*country_stat.flatten]\n end", "def test_search_order_by_country\n # Test a search.\n assert_same_elements Order.find_by_country(countries(:US).id), orders(:santa_next_christmas_order, :an_order_on_cart, :an_order_to_charge, :an_order_on_hold_payment_failed, :an_order_on_hold_awaiting_payment, :an_order_ordered_paid_shipped, :an_order_sent_to_fulfillment, :an_order_cancelled, :an_order_returned)\n # Test a select count.\n assert_equal Order.find_by_country(countries(:US).id, true), 9\n end", "def count_population_of_uk(collection_of_countries)\n total_population = 0\n for country in collection_of_countries\n total_population += country[:population]\n end\n return total_population\nend", "def all_countries_totals\n json_response('/country/all')\n end", "def country_id\n\t\t\tCountry.count + 1\n\t\tend", "def country_count\n varietal_array = []\n # wine_array = [\"Malbec\", \"Merlot\", \"Syrah\", 'Cabernet Sauvignon', 'Pinot Noir', 'Grenache', 'Sangiovese', 'Tempranillo', 'Montepulcia', 'Petite Syrah', 'Chardonnay', 'Sauvignon blanc', 'Pinot Gris', 'Riesling', 'Semillon', 'Gewurztraminer', 'Chenin Blanc', 'Gruner Veltliner', 'Torrontes']\n variety = Wine.where(variety: params[:variety])\n # , \"Pinot Noir\", \"Merlot\", \"Malbec\", \"Syrah\",\"Chardonnay\",\"Sauvignon blanc\",\"Pinot Gris\",\"Riesling\",\"Pinot Noir\"]\n \n countries = []\n count_array = []\n new_hash = {}\n\n countries = variety.map do |wine| \n wine.country\n end \n\n \n count_array = countries.each_with_object(Hash.new(0)) {|k, v| v[k] += 1}\n new_array = []\n\n count_array.keys.each do |country| \n if country\n hash = {:country => country, :value => count_array[country]}\n new_array.push(hash)\n end\n end\n\n new_hash = {:countries => new_array}\n render json: new_hash\n end", "def order_count\n self.order_ids.count\n end", "def zone_count\n da_zones=zones\n count = da_zones.count\n da_zones.each{ |z| count += z.zone_count }\n count\n end", "def coupon_count\n count = Order.sum(:quantity, :conditions => [\"deal_id = ?\", self.id])\n end", "def sporters_by_country\n \tresult = { }\n \tCountry.all.map do |c|\n \t\tresult[c.name] = c.sporters.count\n \tend\n \trender json: [{name: 'Count', data: result}]\n end", "def get_order_count(list)\n @counts = []\n case list\n when \"complete\"\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND fulflmnt_state IN ('complete', 'customer_complete', 'self_collect_complete', 'collect_complete', 'return_complete')\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = true AND fulflmnt_state IN ('complete', 'customer_complete', 'self_collect_complete', 'collect_complete', 'return_complete')\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = false AND fulflmnt_state IN ('complete', 'customer_complete', 'self_collect_complete', 'collect_complete', 'return_complete')\").count\n when \"partial\"\n return Spree::Order.includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").count\n when \"cancel\"\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND fulflmnt_state='cancel'\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = true AND fulflmnt_state='cancel'\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = false AND fulflmnt_state='cancel'\").count\n when \"tracker\"\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = true\").count\n @counts << Spree::Order.includes(:line_items).where(\"spree_line_items.id IS NOT NULL AND is_pick_at_store = false\").count\n when 'partial_cancel'\n return Spree::Order.includes(:line_items).where(\"cancel_on_fba=false AND is_cancel=true\").count\n end\n return @counts\n end", "def confirmed_coupon_count\n count = Order.sum(:quantity, :conditions => [\"deal_id = ? AND state != ?\", self.id, Order::CREATED])\n end", "def count_places\n COUNT_PLACES\n end", "def num_orders\n item_receipts = @item.item_receipts.where(created_at: @range).includes(:item_order)\n po_ids = item_receipts.map{|ir| ir.item_order.purchase_order_id }.uniq\n purchase_orders = PurchaseOrder.find(po_ids)\n\n purchase_orders.count\n end", "def results_by_country\n \tresult = Country.all.map do |c|\n \t\tplaces = { }\n \t\t(1..6).each do |place|\n \t\t\tplaces[place] = c.sporters.joins(:competition_results).where(\"competition_results.place = #{place}\").count\n \t\tend\n \t\t{\n \t\t\tname: c.name,\n \t\t\tdata: places\n \t\t}\n \tend\n \trender json: result\n end", "def countries_geo_entity_stats\n countries.present? ? GeoEntityStat.where(geo_entity_id: countries.map(&:id)) : geo_entity_stats\n end", "def gpx_airport_count(gpx, airport_to_find)\n airports = Hash.from_xml(gpx).dig(\"gpx\", \"wpt\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end", "def countries_of_members_data(country_name = false)\n data = [['Country', 'Users']]\n members.group(:country).where.not(country: [nil, '']).select('country, COUNT(*) AS number_of_users').each{|i| data << [country_name ? ISO3166::Country.new(i.country).try(:name) : i.country, i.number_of_users] }\n data\n end", "def index\n @total_orders = Order.count\n end", "def customers_count()\n return customers().length()\n end", "def count\n Cim::Dal::CustomerAddress.count\n end", "def number_of_cities(code)\n return 0 if !@states[code.to_sym][:cities]\n @states[code.to_sym][:cities].length\nend", "def count_geographic_occurrences_of_users(users)\n users\n .filter_map { |u| ISO3166::Country[u.try(:organisation).try(:country)] }\n .reduce(Hash.new(0)) { |result, c| result[c] += 1; result }\n .map { |c, z| { name: c.iso_short_name, lat: c.geo[\"latitude\"], lon: c.geo[\"longitude\"], z: z } }\n end", "def value_for_country(country)\n values = []\n\n @possibles.each do |ops_modifiers, count|\n if ops_modifiers.all? { |m| m.qualifies?([country]) }\n values << count\n end\n end\n\n values.max or fail \"No ops value could be found for #{country.inspect}\"\n end", "def order_count(opts = {})\n data, _status_code, _headers = order_count_with_http_info(opts)\n return data\n end", "def order_count_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrderApi.order_count ...\"\n end\n # resource path\n local_var_path = \"/order.count.json\"\n\n # query parameters\n query_params = {}\n query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?\n query_params[:'customer_email'] = opts[:'customer_email'] if !opts[:'customer_email'].nil?\n query_params[:'order_status'] = opts[:'order_status'] if !opts[:'order_status'].nil?\n query_params[:'created_to'] = opts[:'created_to'] if !opts[:'created_to'].nil?\n query_params[:'created_from'] = opts[:'created_from'] if !opts[:'created_from'].nil?\n query_params[:'modified_to'] = opts[:'modified_to'] if !opts[:'modified_to'].nil?\n query_params[:'modified_from'] = opts[:'modified_from'] if !opts[:'modified_from'].nil?\n query_params[:'store_id'] = opts[:'store_id'] if !opts[:'store_id'].nil?\n query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil?\n query_params[:'order_ids'] = opts[:'order_ids'] if !opts[:'order_ids'].nil?\n query_params[:'ebay_order_status'] = opts[:'ebay_order_status'] if !opts[:'ebay_order_status'].nil?\n query_params[:'financial_status'] = opts[:'financial_status'] if !opts[:'financial_status'].nil?\n query_params[:'fulfillment_status'] = opts[:'fulfillment_status'] if !opts[:'fulfillment_status'].nil?\n query_params[:'shipping_method'] = opts[:'shipping_method'] if !opts[:'shipping_method'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key', 'store_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 => 'InlineResponse20041')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#order_count\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_total_population(countries) #function\n population = 0\n\n for country in countries\n population += country[:population]\n country[:population] = 0\n end\n\n return population\n\n end", "def get_countries\n \tresponse = invoke(\"web:GetCountries\", :soap_action => :none)\n\n \tnode = response.document.xpath('//ns:GetCountriesResult', ns)[0]\n \tparse_country_description(node)\n end", "def country\n client.places.get_countries.select{|hash| hash[\"cid\"] == @params[:country].to_i}.first[:title]\n end", "def count_customers\n return customers().length\n end", "def customer_count()\n customers().count()\nend", "def index\n scope = Order.paginate(page: params[:orders_page], per_page: params[:per_page])\n if params[:search].present?\n scope = scope.search(params[:search])\n end\n if params[:ordering] && ordering = ORDERS[params[:ordering].to_i]\n scope = scope.order(ordering)\n end\n @orders = scope.with_current_status()\n @orders_qty = @orders.to_a.count\n end", "def by_country(country='all')\n\n result = [ ['Country', 'Amount'] ]\n country = (country == 'all') ? \"[Nationalities].children\" : \"[Nationalities].[#{country}]\"\n\n r = @connection.from('Gears').\n columns('[Measures].[Players]').\n rows(country).\n nonempty().execute\n\n r.axis_full_names[1].each_with_index {|country, index|\n\n c = TZInfo::Country.get(country.split('.')[1].gsub('[','').gsub(']','')).name\n v = r.values[index][0]\n result << [ c , v ]\n }\n result\n end", "def country\n query = create_query(\n :Location, :regexp_search, regexp: \"#{params[:country]}$\"\n )\n show_selected_locations(query, link_all_sorts: true)\n end", "def country\n data['country']\n end", "def count(dealership)\n @dao.count({ 'dealership' => dealership.id, 'deleted_at' => nil })\n end", "def get_flights_costs(country)\n\tcoll = settings.db.collection(\"flights\")\n\tresult = {}\n\tflights = coll.find({\"origin_country\"=>country}).each { |row| result[row['id']] = row }\n\tputs result\n\tdestinations = result[\"destinations\"]\n\treturn destinations\nend", "def country_list\n get_request( \"/api/v2_1/api/countries\")\n end", "def total_members_by(geo, results)\n totals = results.each_with_object(Hash.new(0)) do |res,counts|\n next unless [\"us\",\"ca\"].include?(res.country)\n counts[res.send(geo.to_sym)] += res.members.to_i\n end\n puts \"TOTAL: #{totals.values.inject(:+)}\"\n \n totals = totals.sort_by { |geo,count| -count }\n puts \"Total members by #{geo.to_s}: \"\n totals.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend", "def number_of_councils\n payer_breakdown && payer_breakdown.select{ |p| p[:organisation_type] == 'Council' }.size\n end", "def countries\n document[\"nationality\"].collect {|nation| nation[\"$\"]} rescue nil\n end", "def country_total\n @totals = {}\n (@start_date..@end_date).each do |date|\n key_pattern = params[:country].present? ? \"Country:#{date}:#{params[:country]}*\" : \"Country:#{date}*\"\n keys = REDIS.keys key_pattern\n keys.each do |key|\n value = REDIS.get key\n split_key = key.split ':'\n split_value = value.split ':'\n country = split_key[2]\n currency = split_key[3]\n amount = split_value[0]\n usd_amount = split_value[1]\n total = split_value[2]\n country_name = split_value[3]\n total_key = \"#{country}_#{currency}\"\n @totals[total_key] ||= { currency: currency,\n country_total: 0,\n country_total_usd: 0,\n country_name: country_name,\n total_count: 0,\n arpu: 0 }\n @totals[total_key][:country_total] += amount.to_d.truncate(2).to_money(currency)\n @totals[total_key][:country_total_usd] += usd_amount.to_d.truncate(2).to_money\n @totals[total_key][:total_count] += total.to_i\n @totals[total_key][:arpu] = @totals[total_key][:country_total_usd] / @totals[total_key][:total_count]\n end\n end\n\n @totals = @totals.sort_by { |_key, value| value[:total_count] }.reverse\n @country_total = @totals.map { |_key, total| total[:country_total_usd] }.sum\n @total_count = @totals.map { |_key, value| value[:total_count] }.sum\n\n respond_to do |format|\n format.html do\n end\n format.csv do\n send_data to_csv('country_total', @totals), type: 'text/csv; charset=utf-8; header=present',\n disposition: \"attachment; filename=country_total-#{Time.now.strftime('%Y-%m-%d-%H:%M:%S')}.csv\"\n end\n end\n end", "def countries\n @countries = Spree::Country.where(name: Spree::Config[:default_address_country])\n zone = Spree::Zone.find_by(name: Spree::Config[:address_zone_name]) if Spree::Config[:address_zone_name]\n @countries = zone.countries.order(:name) if zone.present?\n end", "def countries\r\n\t\t\tCOUNTRIES\r\n\t\tend", "def count\n Core::Dal::Address.count\n end", "def varietal_count\n varietal_array = []\n # wine_array = [\"Malbec\", \"Merlot\", \"Syrah\", 'Cabernet Sauvignon', 'Pinot Noir', 'Grenache', 'Sangiovese', 'Tempranillo', 'Montepulcia', 'Petite Syrah', 'Chardonnay', 'Sauvignon blanc', 'Pinot Gris', 'Riesling', 'Semillon', 'Gewurztraminer', 'Chenin Blanc', 'Gruner Veltliner', 'Torrontes']\n country_iso_array = IsoCountryCodes.for_select.to_h\n variety = Wine.where(variety: params[:variety])\n # , \"Pinot Noir\", \"Merlot\", \"Malbec\", \"Syrah\",\"Chardonnay\",\"Sauvignon blanc\",\"Pinot Gris\",\"Riesling\",\"Pinot Noir\"]\n \n countries = []\n count_array = []\n new_hash = {}\n\n countries = variety.map do |wine| \n if wine.country === \"US\"\n country = \"United States of America\"\n country_iso_array[country]\n elsif wine.country === \"England\"\n country = \"United Kingdom of Great Britain and Northern Ireland\"\n country_iso_array[country]\n else \n country_iso_array[wine.country]\n end\n end \n\n \n count_array = countries.each_with_object(Hash.new(0)) {|k, v| v[k] += 1}\n new_array = []\n\n count_array.keys.each do |iso| \n if iso \n hash = {:country => iso, :value => count_array[iso]}\n new_array.push(hash)\n end\n end\n\n new_hash = {:isoCodes => new_array}\n render json: new_hash\n end", "def sales_orders_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrdersApi.sales_orders_count_get ...\"\n end\n # resource path\n local_var_path = \"/sales/orders/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n query_params[:'customFieldConditions'] = opts[:'custom_field_conditions'] if !opts[:'custom_field_conditions'].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 = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersApi#sales_orders_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def count_items\n order.items.sum(:quantity)\n end", "def no_of_address data\n no_of_addresses = 1\n data.headers.each do |item|\n if item != 'city'\n no_of_addresses+=1\n end\n end\n no_of_addresses\n end", "def countries\n countries_ids = self.answers.where(answer_type: 'geo_countries').first.try(:text_value).split(',')\n Country.where(:id => countries_ids)\n end", "def phone_numbers_by_country(country)\n self.phone_numbers.with_active_state.where(phone_book_entries: {country: country})\n end", "def country\n if !block_given?\n return @j_del.java_method(:country, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling country()\"\n end", "def index\n @countries = Country.all\n @collected = {}\n @not_collected = {}\n @countries.each do |c|\n @collected[c.id] = c.currencies.count#CountriesCurrencies.collected_in(c.id)\n @not_collected[c.id] = CountriesCurrencies.not_collected_in(c.id)\n end\n end", "def country_values\n %w(\n Austria\n Belgium\n Denmark\n Finland\n France\n Germany\n Greece\n Iceland\n Ireland\n Italy\n Netherlands\n Norway\n Portugal\n Spain\n Sweden\n Switzerland\n United Kingdom\n USA\n )\n end", "def locale_count(locale_code)\n locale_counts[locale_code]\n end", "def num_of_customers()\n customers.size\nend", "def country\n ISO3166::Country[@country_code]\n end", "def countries\n collection(\"countries\")\n end", "def countries(input)\n get_single_method('countries', input)\n end", "def count(zone_id, version_id)\n call('domain.zone.record.count', zone_id, version_id)\n end", "def all_organisations_in_country(country)\n sparql = \"\n SELECT DISTINCT ?uri ?label\n WHERE \n {\n VALUES ?country { \\\"#{country}\\\" }\n GRAPH <http://data.artsapi.com/graph/organisations> {\n ?uri <http://data.artsapi.com/def/arts/locationCountry> ?country .\n ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?label .\n }\n }\n \"\n\n results = User.current_user.within { Tripod::SparqlClient::Query.select(sparql) }\n\n results.map { |r| [r[\"uri\"][\"value\"], r[\"label\"][\"value\"]] }\n end", "def get_item_frequency_counts orders\n\n counts = {}\n\n orders.each do |order|\n items = order['line_items']\n items.each do |item|\n id = item['product_id']\n if counts[id]\n counts[id] += 1\n else\n counts[id] = 1\n end\n end\n end\n\n counts\n\nend", "def index\n @ag_countries = Ag::Country.all\n end", "def item_count\n order_items.map(&:quantity).sum\n end", "def import_counties(options)\n import_places PlaceType::County, options\n end", "def countries(input)\n get_single_method(:countries, input)\n end", "def country\n @country || @default_country || 'GB'\n end", "def invoice_counts_per_merchant\n groups = invoices_grouped_by_merchant\n counts = groups.map { |id, invoices| invoices.count.to_f }\n end", "def country_select(country)\n select(country, :from => countryname[:id])\n end", "def get_department_count(company)\n company.departments.count\n end", "def has_country\n query_root_node(\"lgdo:hasCountry/text()\", @@NAMESPACES).to_s\n end", "def count_addresses\n self.people.collect { |a| a.address }.count\n end", "def play_count_country_vice(country_lists,device_accesses,listen_medias,sorted_array = [])\n @device_accesses = device_accesses\n @listen_medias = listen_medias\n country_lists.each do |country_name|\n id_lists = @device_accesses.where(:access_country => country_name).map(&:id)\n add_count=[]\n id_lists.each do |id|\n add_count << @listen_medias.where(device_access_id: id).count\n end\n sorted_array << [country_name,add_count.sum]\n end\n sorted_array\n play_hash = Hash[*sorted_array.flatten]\n sorted_play_hash = play_hash.sort_by {|_key, value| value}.reverse\n end", "def country_details(region, input)\n country = @countries[input - 1]\n\n Table.display_as_summary(country)\n browse_online(country)\n end", "def qtd_oms\n clientes.count\n end", "def country\n 'United Kingdom'\n end", "def probable_country (spots)\n countries = Hash.new(0)\n spots.each do |spot|\n countries[spot.country] += 1\n end\n \n # get the country with max spots\n countries.max_by{|_key, value| value}.first\n end", "def num_parcels_sent_to_city(city)\n count = 0\n @posts.each {|x| count +=1 if x.city == city}\n return count\n end", "def in_country\n return json_response([]) if (country_cities = City.where(params.slice(:country))).blank?\n newest_city = country_cities.sort_by(&:updated_at).last\n Rails.logger.info \"newest_city is #{newest_city.inspect}\"\n render_if_stale(country_cities, last_modified: newest_city.updated_at.utc, etag: newest_city) do |city_presenters|\n city_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end", "def get_total_number_of_ships_count_once\n result = Shipment.distinct().count(:ship_id)\n unless result.blank?\n return {value: result, error:nil}\n else\n return {value: 0, error: \"Error: in ShipmentBLL get_total_number_of_ships_count_once()\"}\n end\n end", "def num_of_customers\n total_customers = self.customers\n return total_customers.size\n end", "def kml_airport_count(kml, airport_to_find)\n airports = Hash.from_xml(kml).dig(\"kml\", \"Document\", \"Folder\").find{|f| f[\"name\"] == \"Airports\"}.dig(\"Placemark\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end", "def count(options = {})\n calculate('COUNT(*)', options).to_i\n end", "def count(opts={})\n sq = Tripod::SparqlQuery.new(self.as_query(opts))\n count_sparql = sq.as_count_query_str\n result = Tripod::SparqlClient::Query.select(count_sparql)\n\n if result.length > 0\n result[0][\"tripod_count_var\"][\"value\"].to_i\n else\n return 0\n end\n end", "def country\n query_root_node(\"gdacs:country/text()\", @@NAMESPACES)\n end", "def country(opts = {})\n data, _status_code, _headers = country_with_http_info(opts)\n data\n end", "def max_weight_for_country(country)\n 0\n end", "def max_weight_for_country(country)\n 0\n end", "def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end", "def countries\n doc.search(\"table.info a[href*='/m_act%5Bcountry%5D/']\").map(&:text)\n end", "def count\n\n Sizetype.find_all_by_godown_id_and_company_id(1,1).each do |h|\n unless h.quantity.nil?\n @count += h.quantity\n end\n end \n end", "def country_names(params = {})\n timeseries = params.is_a?(Timeseries) ? params : Timeseries.new(params)\n table = :\"bitcoinppi_#{timeseries.tick.sub(\" \", \"_\")}\"\n dataset = DB[table]\n .select { distinct(country) }\n .order(:country)\n .map { |row| { key: row[:country], label: Country[row[:country]].name } }\n end", "def country; end", "def country; end", "def country; end", "def countries(opts = {})\n data, status_code, headers = countries_with_http_info(opts)\n return data\n end" ]
[ "0.6673672", "0.63683826", "0.6357323", "0.62660813", "0.623631", "0.62268215", "0.61948514", "0.6163525", "0.6102441", "0.6043712", "0.60426515", "0.5981951", "0.59667706", "0.5949211", "0.59348804", "0.58183247", "0.5808176", "0.57969666", "0.5784962", "0.57681626", "0.57437074", "0.57055354", "0.5687231", "0.56863296", "0.5671502", "0.56536525", "0.56124455", "0.5602833", "0.55971026", "0.559696", "0.5560057", "0.5541747", "0.55174154", "0.5503061", "0.54846156", "0.54788345", "0.5452764", "0.5452222", "0.54459727", "0.54134166", "0.53908306", "0.53635836", "0.5360532", "0.53602", "0.53242695", "0.53219914", "0.53175765", "0.5307018", "0.5306037", "0.5294486", "0.5279986", "0.5265848", "0.5262025", "0.5254863", "0.5252388", "0.5251424", "0.5244931", "0.5236619", "0.5233003", "0.5230794", "0.5217121", "0.5216039", "0.52141166", "0.52093816", "0.5208954", "0.52078366", "0.5207382", "0.51998687", "0.51944435", "0.5193303", "0.51871043", "0.5185693", "0.5181538", "0.51732326", "0.5155379", "0.5154196", "0.515155", "0.5150091", "0.5144928", "0.5143564", "0.5139716", "0.5138411", "0.51374805", "0.51261747", "0.5119483", "0.51152927", "0.51108134", "0.5103893", "0.51031286", "0.5101853", "0.5085548", "0.5085548", "0.50804883", "0.5078734", "0.50768924", "0.5075353", "0.50702506", "0.50702506", "0.50702506", "0.50654244" ]
0.7642466
0
Should find a hero to fight against threat. Append that one in the batles
def release(threat) hero = Hero.find_to_batle(threat.rank) if hero # TODO add more one hero batle = Batle.create(threat: threat, heroes: [hero]) @batles.append(batle) else # run release again in a thread mode Thread.new do Rails.application.executor.wrap do # waits 10 seconds sleep(30) release(threat) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hero_add (fwt, owner_id, hero_id, rating_id)\n\n\town_hero = false\n\t\tfwt.execute(\"SELECT heros_id FROM acquisitions WHERE owners_id=?\",[owner_id]).each do |value|\n\t\t\tif value[0] == hero_id\n\t\t\t\tputs \"\\n\\nYou already own this hero!\"\n\t\t\t\town_hero = true\n\t\t\tend\n\t\tend\n\n\tif own_hero == false\n\t\tfwt.execute(\"INSERT INTO acquisitions (owners_id, heros_id, ratings_id) VALUES (?, ?, ?)\", [owner_id, hero_id, rating_id])\n\t\tputs \"\\n\\nHero has been added!\"\n\tend\nend", "def hero_ability(target)\n case\n when @hero_class == 'druid'\n @attack = 1\n @armour = amour + 1\n when @hero_class == 'hunter'\n target.health = target.health - 2\n when @hero_class == 'mage'\n target.health = target.health - 2\n when @hero_class == 'paladin'\n @battlefield.push(\"Silver Hand Recruit\")\n when @hero_class == 'priest'\n target.health = target.health + 2\n when @hero_class == 'rouge'\n @weapon = \"Dagger Mastery\"\n when @hero_class == 'shaman'\n totems = ['Healing Totem', 'Searinhg Totem', 'Stoneclaw Totem', 'Wrath of Air Totem']\n @battlefield.push(totems.sample)\n when @hero_class == 'warlock'\n darw_card(2)\n @health = @health - 2\n when @hero_class == 'warrior'\n @armour = @armour + 2\n end\n end", "def hero_win\n puts \"#{monster.name} defeated! You gain #{monster.experience} experience.\"\n hero.update(experience: hero.experience + monster.experience)\n reward\n end", "def fight\n display_hero_attack(attack_resolver(hero, monster))\n if monster.current_health > 0\n display_monster_attack(attack_resolver(monster, hero))\n else\n hero_win\n end\n end", "def enemies_attack\n total_bots_damage = 0\n @enemies.each do |bots_player|\n bots_damage = rand(1..6)\n @human_player.gets_damage(bots_damage)\n total_bots_damage += bots_damage\n end\n puts \"le(s) #{@enemies.length} inflige(nt) #{total_bots_damage} points de vie a #{@human_player.name}\"\n end", "def fight\n # TODO: Add this back in, in a curses way\n #puts\n #puts \"========FIGHT========\"\n #puts \"#{@hero.name} Vs #{@monster.name}\"\n #puts\n\n # Populate an array with X number of levels Hero is and Y number of levels Monster is\n # This way whoever is a higher level has a better chance of attacking \n attack_arr = []\n @hero.level.to_i.times { attack_arr.push(\"Hero\") }\n @monster.level.to_i.times { attack_arr.push(\"Monster\") }\n\n # Loop until one character dies\n while @hero.cur_health > 0 && @monster.cur_health > 0\n case attack_arr.shuffle.first\n when \"Hero\" then @monster.cur_health -= @hero.strength\n when \"Monster\" then @hero.cur_health -= @monster.strength\n end\n end\n\n return (@hero.cur_health > @monster.cur_health)\n end", "def hero_battle_sequence(hero, villain)\n Battle.start_a_battle(hero, villain)\n battle = Battle.all.last\n hero_hp = hero.hp\n villain_hp = villain.hp\n while villain.hp > 0 && hero.hp > 0 do\n attack(hero, villain)\n line\n puts \"The hero's health is #{hero.hp}\"\n puts \"The villain's health is #{villain.hp}\"\n end\n #if villain and hero looses battle, hero dies and villain gets sent to insane asylum\n if villain.hp <= 0 && hero.hp <= 0\n battle.villain_lost(villain)\n line\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n line\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n elsif villain.hp <=0 \n battle.villain_lost(villain)\n battle.update(hero_win: true)\n hero.update(hp: hero_hp)\n villain.update(hp: villain_hp)\n line\n puts \"#{hero.alter_ego} has won the battle\"\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n line\n battle.destruction\n hero_main_menu(hero)\n #destroys the hero, the hero lost and died \n elsif hero.hp <= 0\n puts \"#{villain.alter_ego} has won the battle\"\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n puts \"GAME OVER\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n end\n end", "def generate_your_hero_battle(hero)\n buffer\n line\n puts \"Get ready #{hero.alter_ego}, the people need you!\"\n puts \"What evil wretch are you going to throw behind bars today?\"\n display_villains\n puts \"Would you like to fight any of these Villains?\"\n line\n puts \"Press 1 to fight a Villain from the list. Press 2 to generate a random Villain.\"\n line\n choice = gi_integer\n if choice == 1\n choose_villain_from_list(hero)\n elsif choice == 2\n villain = Villain.create(name: Faker::Name.name_with_middle, alter_ego: Faker::Superhero.name, super_power: Faker::Superhero.power, power_lvl: Faker::Number.within(range: 50..300), resistance: Faker::Number.within(range: 1..40), hp: Faker::Number.within(range: 500..1000), gender: Faker::Gender.binary_type, race: Faker::Games::DnD.species, origin_story: Faker::Lorem.paragraphs(number: 3), nemesis: nil, grievance: Faker::Verb.base, insane_asylum: false, mental_health: Faker::Number.within(range: 1..10))\n hero_battle_sequence(hero, villain)\n else line\n puts \"Your input was not recognized, and the world needs you! Please begin this step again.\"\n line\n generate_your_hero_battle(hero)\n end\n end", "def monsterfight(user, monster, mAtk, enemy)\n\n#make a loop with a boolean value. The loop will keep running unless somebody's health goes to zero or \n#the user runs away\n\n\tenemy['name'] = monster.sample\n\tcombat = true\n\n\tif enemy['name'] == 'Mutated Octopus'\n\t\tenemy['hp'] = 7\n\t\tenemy['atkSpd'] = 6\n\t\tenemy['armor'] = 1\n\n\telsif enemy['name'] == 'Sabertooth Goldfish'\n\t\tenemy['hp'] = 6\n\t\tenemy['atkSpd'] = 5\n\t\tenemy['armor'] = 1\n\n\telsif enemy ['name'] == 'Lady Gaga'\n\t\tenemy['hp'] = 8\n\t\tenemy['atkSpd'] = 8\n\t\tenemy['armor'] = 1\n\n\telsif enemy ['name'] == 'Hannah Montana'\n\t\tenemy['hp'] = 10\n\t\tenemy['atkSpd'] = 10\n\t\tenemy['armor'] = 1\n\tend\n\n\tputs ''\n\n# choosing the random attack of the monster. no need to push into a hash\n\tdef monsterAttack(user, mAtk, enemy)\n\t\trandAttack = mAtk.sample\n\n\t\tif randAttack == 'Slap'\n\t\t\tmonsterDmg = 1\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Bite'\n\t\t\tmonsterDmg = 2\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Eyepoke'\n\t\t\tmonsterDmg = 3\n\t\t\tuser['health'] -= 1\n\t\tend\n\n\t\tputs \"You get hit by #{enemy['name']} for #{monsterDmg}. Your health is now #{user['health']}\"\n\t\t\n\tend\n\n\tdef heroAttack(user, enemy)\n\n\t\theroAttack = user['weapon']\n\n\t\tif heroAttack == 'Sword'\n\t\t\thitDmg = rand(2...5)\n\t\t\tenemy['hp'] -= hitDmg\n\n\t\telsif heroAttack == 'Spear'\n\t\t\thitDmg = rand(1...6)\n\t\t\tenemy['hp'] -= hitDmg\n\n\t\telsif heroAttack == 'Axe'\n\t\t\thitDmg = rand(3...4)\n\t\t\tenemy['hp'] -= hitDmg\n\t\tend\n\t\t\n\t\tputs \"You hit the #{enemy['name']} for #{hitDmg}. Their health is now #{enemy['hp']}\"\n\tend\n\n\tputs \"A wild #{enemy['name']} has appeared. Do you choose to fight or run? (enter 'fight' or 'run')\"\n\n\tchoice = gets.chomp.downcase\n\n\twhile (user['health'] > 0 && enemy['hp'] > 0 && combat == true)\n\n\t\tif choice == 'fight'\n\t\t\tputs 'Alright lets do this!'\n\t\t\tmonsterAttack(user, mAtk, enemy)\n\t\t\theroAttack(user, enemy)\n\n\t\telsif choice == 'run'\n\t\t\tputs 'You attempt to escape'\n\n\t\telsif choice != 'fight' || choice != 'run' \n\t\t\tputs 'Please enter \"fight\" or \"run\"'\n\t\t\tchoice = gets.chomp.downcase\n\t\tend\n\n\t\tif enemy['hp'] > 0 && user['health']\n\t\t\tputs \"Continue fighting? (fight or run)\"\n\t\t\tchoice = gets.chomp.downcase\n\n\t\telsif enemy['hp'] <= 0\n\t\t\tputs \"You have killed #{enemy['name']}\"\n\t\t\tcombat == false\n\n\t\telsif user['health'] <= 0\n\t\t\tputs \"You have died\"\n\t\t\tcombat == false\n\t\tend\n\tend\n\nend", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def search_weapon\n weapon = rand(1..6)\n puts \"Tu as trouvé une arme de niveau #{dice}\"\n if dice > weapon_level\n @weapon_level = weapon\n puts 'Youhou ! elle est meilleure que ton arme actuelle : tu la prends.'\n else\n puts \" M@*!$... elle n'est pas mieux que ton arme actuelle...\"\n end\n end", "def attack(target)\n if @attacked_this_turn == false\n target.health = target.health - @attack\n @health = @health - target.attack\n @attacked_this_turn = true\n else\n raise 'hero already attacked'\n end\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[healthy lettuce gives you #{lettuce} life points]\"\n @life +=lettuce\n fight(enemy, 0)\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[Healthy lettuce gives you #{lettuce} life points!!]\"\n @life += lettuce\n fight(enemy, 0)\n end", "def attack(target)\n\n #check to see if there is any target\n if target == nil\n puts \"Invite some friends to play this awesome game.\".blue\n\n else\n #print fighting for the user\n\n puts Artii::Base.new.asciify \"Fight\"\n\n\n\n ###methods for determining probability of victory\n ###and damage to the opponent or current user#####\n\n #if the characters have the same attack power\n if self.power == target.power\n\n #if the player wins the battle\n if rand > 0.5\n\n #reduce the target's hp by 10\n target.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #see if the target is still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a greater attack power than that of the target\n elsif self.power > target.power\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand < (0.4 + ((self.power - target.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-5*(self.power - target.power))\n\n #print outcome of the battle\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a lower attack power than that of the target\n else\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand > (0.45 + ((target.power - self.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-2*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-3*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n end\n end\n end", "def search_weapon\n dice = rand(1..6)\n puts \"Tu as trouvé une arme de niveau #{dice}\"\n if dice > weapon_level\n @weapon_level = dice\n else\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n end\n puts\"////////////////////////////////////////////////\"\n puts\" \"\n end", "def hero_attack\n #ensure hero is within attacking range\n distance_x = @mon_x - @cur_x\n distance_y = @mon_y - @cur_y\n clear_message_box\n if distance_x.abs <= 1 && distance_y.abs <= 1\n #does hero hit the monster?\n skill = @stats[:luck]+@stats[:agility]\n if skill >= Random.rand(skill + (@mon_attack * 2))\n damage = (@attack + Random.rand(@stats[:luck])) / 2\n @mon_strength -= damage\n @ui.place_text(MSG_ATTACK.sample.ljust(20),1,2)\n kill_monster if @mon_strength <= 0\n else\n @ui.place_text(MSG_MISS.ljust(20),1,2)\n end\n else\n @ui.place_text(MSG_MISS.ljust(20),1,2)\n end\n end", "def fight enemy, weapon\n if life <= 0\n return \"You are dead.\"\n end\n \n out = ''\n\n # Attack the opponent\n your_hit = rand(strength + weapon)\n out << \"[You hit the #{enemy.name} with #{your_hit} points of damage!]\\n\"\n out << enemy.hit(your_hit)\n\n # Retaliation\n if enemy.life > 0\n enemy_hit = rand(enemy.strength + enemy.weapon)\n out << \"[The #{enemy.name} hit with #{enemy_hit} points of damage!]\\n\"\n out << self.hit(enemy_hit)\n end\n out\n end", "def villain_battle_sequence(hero, villain)\n Battle.start_a_battle(hero, villain)\n battle = Battle.all.last\n hero_hp = hero.hp\n villain_hp = villain.hp\n while villain.hp > 0 && hero.hp > 0 do\n attack(hero, villain)\n line\n puts \"The hero's health is #{hero.hp}\"\n puts \"The villain's health is #{villain.hp}\"\n end\n #if villain and hero looses battle, hero dies and villain gets sent to insane asylum\n if villain.hp <= 0 && hero.hp <= 0\n battle.villain_lost(villain)\n line\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n line\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n elsif villain.hp <=0 \n battle.villain_lost(villain)\n battle.update(hero_win: true)\n hero.update(hp: hero_hp)\n villain.update(hp: villain_hp)\n line\n puts \"#{hero.alter_ego} has won the battle\"\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n #destroys the hero, the hero lost and died, sends villain to the main menu\n elsif hero.hp <= 0\n line\n puts \"#{villain.alter_ego} has won the battle\"\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n battle.destruction\n villain_main_menu(villain)\n end\n end", "def fight(enemy, weapon)\n if life <= 0\n puts \"[#{self.class} is too dead!]\"\n return\n end\n\n #Attack the opponent\n your_hit = rand(strength+weapon)\n puts \"[you hit with #{your_hit} points of damage!]\"\n enemy.hit(your_hit)\n\n #Retaliation\n p enemy\n if enemy.life >0\n enemy_hit = rand(enemy.strength + enemy.weapon)\n puts \"[your enemy hit with #{enemy_hit} points of damage!]\"\n self.hit(enemy_hit)\n end\n end", "def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end", "def hero\n fetch('heroes_of_the_storm.heroes')\n end", "def win_fight\n if $boss_hp <= 0\n puts \"You win!\"\n $in_combat = false\n $in_boss = false\n $dead_boss = true #add a unique dialogue somewhere if this is true\n $in_forest = true\n end\nend", "def hatch\n @status = Idle\n @target = nil\n @virility = 0\n babies = []\n rand(MaxBabiesFromEgg).to_i.times {babies << baby_salmon}\n babies\n end", "def fight(enemy, weapon)\n if life <= 0\n puts \"[#{self.class} is too dead to fight!]\"\n return\n end\n\n # Attack the opponent\n your_hit = rand(strength + weapon)\n puts \"[You hit with #{your_hit} points of damage!]\"\n enemy.hit(your_hit)\n\n # Retaliation\n p enemy\n if enemy.life > 0\n enemy_hit = rand(enemy.strength + enemy.weapon)\n puts \"[Your enemy hit with #{enemy_hit} points of damage!]\"\n hit(enemy_hit)\n end\n end", "def monster_attack\n #set up monster distance and next move\n distance_x = @mon_x - @cur_x\n distance_y = @mon_y - @cur_y\n sign_x = distance_x <=> 0\n sign_y = distance_y <=> 0\n new_x = @mon_x-(1*sign_x)\n new_y = @mon_y-(1*sign_y)\n next_square = @room[new_x][new_y]\n #move monster closer to hero unless blocked or next to hero\n if next_square == CHAR_FLOOR && (distance_x.abs > 1 || distance_y.abs > 1)\n @room[@mon_x][@mon_y] = CHAR_FLOOR\n draw_map(@mon_x, @mon_y)\n @mon_x, @mon_y = new_x, new_y\n @room[@mon_x][@mon_y] = @mon_type\n draw_map(@mon_x, @mon_y)\n end\n #hit hero if close enough and hero not on saftey square\n if (distance_x.abs <= 1 && distance_y.abs <= 1) && @room[@cur_x][@cur_y] != CHAR_SAFE\n hit = @mon_attack * 1.5\n #hit if not dodged\n skill = @stats[:luck]+@stats[:agility]\n clear_message_box\n if Random.rand(skill+(@mon_attack*3)) > skill\n @ui.place_text(MSG_DAMGAGE.ljust(20),1,2)\n damage = hit / (2+@defence)\n @stats[:strength] -= damage\n @stats[:vitality] -= damage/10\n #see if hit weapon\n if Random.rand(7) == @mon_attack #1 in 7 chance of loosing item\n item_found = false\n until item_found\n #get a random item, keep trying until found on hero\n object = ['2 HAND SWORD', 'BROADSWORD', 'SHORTSWORD', 'AXE', 'MACE', 'FLAIL', 'DAGGER', 'GAUNTLET',\n 'HEAVY ARMOUR', 'CHAIN ARMOUR'].rotate(Random.rand(10)+1).first\n item = @objects.find { |obj| obj[:name]==object }\n if item\n if object == 'HEAVY ARMOUR' || object == 'CHAIN ARMOUR'\n @defence -= item[:power]\n else\n @attack -= item[:power]\n end\n @ui.place_text(\"#{object}!!\".ljust(20), 1, 3)\n @objects.delete(item)\n item_found = true\n end\n end\n end\n else\n @ui.place_text(MSG_MMISS.ljust(20),1,2)\n end\n sleep 0.5 #slow everything down\n end\n end", "def search_weapon\n\t\t@weapon = rand(1..6)\n\t\tputs \"Tu as trouvé une arme de niveau #{@weapon}\"\n\t\tif @weapon <= @weapon_level # Si le niveau est inférieur ou égal au niveau de l'ancienne arme, on garde l'ancienne.\n\t\t\tputs \" M@*#$ l'arme trouvée est vraiment bidon, tu gardes l'ancienne\"\n\t\telse \n\t\t\tputs \"De la frappe frere !\\n\\n\"\n\t\t\t@weapon_level = @weapon # Si meilleure arme, on la prend\n\t\tend\n\tend", "def search_weapon\n \t\t\t new_weapon = rand(1..6)\n \t\t\t puts \"Tu as trouvé une arme de niveau #{new_weapon} !\"\n \t\t\t if new_weapon > @weapon_level\n \t\t\t \t@weapon_level = new_weapon\n \t\t\t \tputs \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\n \t\t\t else\n \t\t\t \tputs \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n \t\t\t end\n \t\tend", "def attack(hero, villain)\n hero.update(hp: (hero.hp - (villain.power_lvl - hero.resistance)))\n villain.update(hp: (villain.hp - (hero.power_lvl - villain.resistance)))\n sleep(1)\n end", "def search_weapon\n\n #LANCER DE DE\n dice = rand(1..6)\n puts \"Tu as trouvé une arme de niveau #{dice}\"\n\n #SI LE RESULTAT DU DE EST INFERIEUR AU NIVEAU DE L ARME, AFFICHER...\n if dice <= @weapon_level\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n\n #SINON, AFFICHER... \n else\n @weapon_level = dice\n puts \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\n end\n end", "def fight_scene\n\tjason = PowerRanger.new(\"Jason\", \"Red\")\n\ttommy = PowerRanger.new(\"tommy\", \"Green\")\n\tjon = Person.new(\"Jon\")\n\thoward = Person.new(\"Howard\")\n\tevilGuy_a = EvilNinja.new(\"Evil Guy 1\")\n\tevilGuy_b = EvilNinja.new(\"Evil Guy 2\")\n\n\tputs \"Two innocent bystanders are attacked by evil ninjas.\"\n\tjon.scream\n\thoward.scream\n\tjon.run\n\thoward.drink_coffee\n\thoward.run\n\n\tputs \"The Power Rangers arrive!\"\n\tjason.punch(evilGuy_a)\n\ttommy.punch(evilGuy_b)\n\tjason.rest(2)\n\ttommy.drink_coffee\n\n\tputs \"The Evil Ninjas fight back.\"\n\tevilGuy_a.punch(tommy)\n\tevilGuy_b.punch(tommy)\n\tevilGuy_a.cause_mayhem(jason)\n\n\tputs \"The Power Rangers try Megazord\"\n\tjason.use_megazord(evilGuy_a)\n\tevilGuy_a.punch(jason)\n\n\tputs \"Cmon Tommy!\"\n\ttommy.use_megazord(evilGuy_a)\n\ttommy.drink_coffee(10)\n\ttommy.use_megazord(evilGuy_b)\n\n\tputs \"Did the Power Rangers save the day?\"\n\n\tninja_array = [evilGuy_a, evilGuy_b]\n\twin = \"yes\"\n\n\tninja_array.each do |ninja|\n\t\t# p ninja.show_caffeine_level\n\t\tif ninja.caffeine_level > 0\n\t\t\twin = \"no\"\n\t\tend\n\tend\n\n\tif win == \"yes\"\n\t\tputs \"Yes!\"\n\telse\n\t\tputs \"No :(.\"\n\tend\n\nend", "def search_weapon\r\n lvl = rand(1..6)\r\n puts \"Tu as trouvé une arme de niveau #{lvl}\"\r\n if @weapon_level >= lvl\r\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\r\n else\r\n puts \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\r\n @weapon_level = lvl\r\n end\r\n end", "def search_health_pack\n dice = rand(1..6)\n if dice == 1\n puts \"Tu n'as rien trouvé... \"\n elsif dice > 1 && dice < 6 \n @life_points += 50 \n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\" \n if @life_points > 100\n @life_points = 100\n end\n elsif dice == 6 \n @life_points += 80\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\n if @life_points > 100\n @life_points = 100\n end\n end\n end", "def search_weapon\n new_weapon = rand(1..6)\n puts \"Tu as obtenu une nouvelle arme de niveau #{new_weapon}\"\n if new_weapon > self.weapon_level\n self.weapon_level = new_weapon\n puts \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\n else\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n end #if\n end", "def search_weapon\n\t\tnew_weapon_level = rand(1..6)\n\t\tputs \"Tu as trouvé une arme de niveau #{new_weapon_level}\"\n\t\tif new_weapon_level > @weapon_level\n\t\t\tputs \"Youhou ! Elle est meilleure que ton arme actuelle : tu la prends.\"\n\t\t\t@weapon_level = new_weapon_level\n\t\telse\n\t\t\tputs \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n\t\tend\n\tend", "def tcboo_immortal_combat(a, b)\n ap, bp = tcboo_power_for(a), tcboo_power_for(b)\n\n if b.nil?\n puts \"#{a} (#{ap}) wins this match by virtue of being the odd entity out\" if $debug\n return a\n end\n\n total_power = ap + bp\n winner = (rand(1 + total_power) <= ap) ? a : b\n loser = (winner == a ? b : a)\n tcboo_set_power_for winner, total_power\n tcboo_set_power_for loser, 0\n puts \"In a fight between #{a} (#{ap}) and #{b} (#{bp}), who would win? #{winner} (#{total_power})!\" if $debug\n winner\n end", "def give_hr\n monster_attackers.each do |attacker|\n if attacker.damage_done > 50 + attacker.player.hr && attacker.player.hr < 100\n attacker.player.update(hr: attacker.player.hr + 1)\n end\n end\n end", "def fight( enemy, weapon )\n if life <= 0\n puts \"[#{ self.class } is too dead to fight!]\"\n return\n end\n \n # Attack the opponent\n your_hit = rand( strength + weapon )\n puts \"[You hit with #{ your_hit } points of damage!]\"\n enemy.hit( your_hit )\n\n # Retaliation\n puts \"[#{ enemy.class } has #{enemy.life} life remaining!!]\"\n if enemy.life > 0\n enemy_hit = rand( enemy.strength + enemy.weapon )\n puts \"[Your enemy hit with #{ enemy_hit } points of damage!]\"\n self.hit( enemy_hit )\n end\n end", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end", "def search_weapon\n new_weapon = rand(1..6)\n puts \">>> Tu as trouvé une arme de niveau #{new_weapon}\"\n\n # Get a random value for the weapon. If the actual weapon has more power, keep the value\n # if it's lower it change the value to the best weapon value\n if new_weapon > @weapon_level\n puts \">>> Cette arme est plus puissante !\"\n @weapon_level = new_weapon\n else\n puts \">>> Cette arme est moins puissante !\"\n end\n end", "def generate_hero_hp(hero)\n buffer\n line\n puts \"Your hero's hp is being calculated...\"\n buffer\n hp = rand(500..1000)\n hero.hp = hp\n puts \"Your hero's health point are #{hero.hp}\"\n puts \"Is this enough health? Press 1 if it is enough, press 2 to re-roll power level.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_gender(hero)\n elsif choice == 2\n generate_hero_hp(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_hp(hero)\n end\n end", "def tie_with_bj\n self.chips += self.bet_chips\n self.is_complete = true\n \"#{name} hit Blackjack! Dealer hit Blackjack too. Push for #{name}.\"\n end", "def hero; end", "def hero; end", "def hero; end", "def hero; end", "def hero; end", "def decide_random_target_for_enemy\n # Diverge with effect scope\n if for_one_friend_hp0?\n battler = $game_troop.random_target_enemy_hp0\n elsif for_one_friend?\n battler = $game_troop.random_target_enemy\n else\n battler = $game_party.random_target_actor\n end\n # If a target exists, get an index, and if a target doesn't exist,\n # clear the action\n if battler != nil\n @target_index = battler.index\n else\n clear\n end\n end", "def yuusya_attack(hero_attack) #引き数の部分はhero.attackと同義。勇者の攻撃力を用いている\n self.hp -= hero_attack\n end", "def search_weapon\n new_weapon_level = rand(1..6)\n puts \"Tu as trouvé une arme de niveau #{new_weapon_level}\"\n if new_weapon_level > @weapon_level\n puts \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\n @weapon_level = new_weapon_level\n else\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n end\n end", "def choose_hero\n buffer\n display_heros\n buffer\n line\n puts \"Choose a Hero by typing the number they are labeled with into your console.\"\n line\n choice = gi_integer - 1\n if choice <= Hero.all.length\n buffer\n line\n puts \"You chose: #{Hero.all[choice].alter_ego}\"\n line\n hero = Hero.all[choice]\n generate_hero_nemesis(hero)\n else line\n puts \"Your choice does not exist. Press 1 to rechoose, Press 2 to generate a Hero, Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n choose_hero\n elsif choice == 2\n generate_hero_name\n elsif choice == 3\n hero_setup\n end\n end\n end", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n round_report = []\n round_report << \"Runde #{round+1}: \"\n round_report << \"#{turn_user.username} ist am Zug.\"\n if shield > 0\n round_report << \"Schild von #{target_user.username} ist aktiv.\"\n round_report << \"Schild hält noch #{shield} Schaden aus.\"\n round_report << \"Alle Truppen schießen auf den Schildt!\"\n else \n round_report << \"Schild von #{target_user.username} ist inaktiv.\"\n round_report << \"Angriffe werden nicht abgewehrt!\"\n round_report << \" \"\n end\n turn_fleet.each do |a|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if a[1] > 0 && a[2] > 0 \n round_report << \"Die Gruppe #{a[5]} trifft... \"\n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target == -2)\n round_report << \"nicht. Der Angriff ging daneben. \"\n round_report << \" \"\n round_report << \" \"\n elsif(target==-1)\n round_report << \"das Schild. Der Schaden beträgt: \"\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if a[3] == 2\n mult = 1.5\n end\n damage = a[2] * mult\n round_report << \"#{damage} \"\n round_report << \" \"\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult=1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if(a[3]==1)\n mult=1.5\n end \n # Bestimme welche Einheit getroffen wurde\n victim=target_fleet[target]\n # round_report << \"#{victim[5]}. Der Schaden beträgt: \"\n # Schadensberechnung\n damage=a[2]*mult\n round_report << \"#{damage} \"\n # Berechne neue HP\n hit_points=victim[-2]\n victim[-2]=hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim)\n round_report << \"#{victim[4]} Einheiten wurden zerstört. \"\n end\n end \n # Füge Runden-Bericht ein\n # @round_reports << round_report\n end\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue=false\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user==@attacker\n @attacker_shield=@fight_shield\n else\n @defender_shield=@fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet=turn_fleet\n tmp_user=turn_user\n turn_fleet=target_fleet\n turn_user=target_user\n target_fleet=tmp_fleet\n target_user=tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n @report << @round_reports\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n end\n end", "def batten_hatches\n puts \"Batten the hatches\"\n end", "def sword_damage(str, dex, luck)\n damage = (str + dex)/2 * rand(luck)\n if damage == 0\n puts \"You missed!\"\n else\n puts \"Your sword strikes for #{damage} damage!\"\n end\nend", "def battle(monster)\n system(\"clear\") unless ENV['TEST']\n puts \"#{monster.message}\\n\"\n type(\"You've run into a vicious #{monster.name}!\\n\\n\")\n\n while hp > 0\n # Both choose an attack.\n player_attack = choose_attack\n\n # Prevents the user from using \"bad\" commands.\n # Example: \"Use\" with an empty inventory.\n while (player_attack.fails?(self))\n player_attack = choose_attack\n end\n\n monster_attack = monster.choose_attack\n\n attackers = Array.new\n attacks = Array.new\n\n if sample_agilities(monster)\n attackers << self << monster\n attacks << player_attack << monster_attack\n else\n attackers << monster << self\n attacks << monster_attack << player_attack\n end\n\n 2.times do |i|\n # The attacker runs its attack on the other attacker.\n attacks[i].run(attackers[i], attackers[(i + 1) % 2])\n\n if (attackers[i].escaped)\n attackers[i].escaped = false\n return\n end\n\n break if monster.hp <= 0 || hp <= 0\n\n end\n\n break if monster.hp <= 0 || hp <= 0\n\n end\n\n die if hp <= 0\n\n if monster.hp <= 0\n type(\"You defeated the #{monster.name}!\\n\")\n\n # Determine the rewards for defeating the monster.\n rewards = monster.sample_rewards\n\n gold = rewards.first\n treasure = rewards.second\n\n # Output some helpful text and give the rewards to the player.\n if ((gold > 0) || treasure)\n type(\"Rewards:\\n\")\n if (gold > 0)\n type(\"* #{gold} gold\\n\")\n @gold += gold\n end\n if (treasure)\n type(\"* #{treasure.name}\\n\")\n add_item(treasure)\n end\n end\n print \"\\n\"\n end\n\n end", "def add_weapon(weapon)\n b = false\n @weapons.each {|w| b = (w.class == weapon.class)? true : b}\n if b\n # TODO Bug here: not always applied\n @score += 1000\n else\n @weapons << weapon unless b\n end\n end", "def being_attacked\n\tif @enemy_health > 0\n\t\t@enemy_power -= rand(-3..3)\n\t\tputs \"The #{@enemy} attacks again, doing #{@enemy_power - @defense} damage.\"\n\t\t@health -= (@enemy_power - @defense)\n\t\tfight\n\telse\n\t\tputs \"You beat the #{@enemy}!\"\n\t\tputs \"\"\n\t\tputs \"+#{@enemy_power + rand(9) + (@luck * @luck_points)} pointless points!\"\n\t\t@pointless_points += (@enemy_power + rand(9) + (@luck * @luck_points))\n\t\tcontroller\n\tend\nend", "def hit\n self.damage = damage + 1\n check_boat\n end", "def decide_random_target_for_actor\n # Diverge with effect scope\n if for_one_friend_hp0?\n battler = $game_party.random_target_actor_hp0\n elsif for_one_friend?\n battler = $game_party.random_target_actor\n else\n battler = $game_troop.random_target_enemy\n end\n # If a target exists, get an index, and if a target doesn't exist,\n # clear the action\n if battler != nil\n @target_index = battler.index\n else\n clear\n end\n end", "def decide_target(char, dmg, heal, neutral, attack, defend, escape)\n # temporary variables\n x, y, ai = char.x, char.y, char.ai\n # get alignment setup\n negative, positive = ai.negative, ai.positive\n # invert setup if confused\n negative, positive = positive, negative if char.restriction == 3\n # initialize arrays\n allies, enemies = [char], []\n # if enemy\n if char.is_a?(Map_Enemy)\n # find all allies and all enemies in memory\n ai.memory.each_key {|b|\n allies.push(b) if positive.include?(b.ai.group)\n enemies.push(b) if negative.include?(b.ai.group)}\n # if actor\n elsif char.is_a?(Map_Actor)\n # find all allies and all enemies in sight\n ai.sight.each {|b|\n allies.push(b) if positive.include?(b.ai.group)\n enemies.push(b) if negative.include?(b.ai.group)}\n end\n # find all allies who need healing\n to_heal = allies.find_all {|b| b.valid? && b.battler.hp < b.battler.maxhp}\n # if decided to heal\n if (heal.size > 0 && to_heal.size > 0 && (ai.healer || rand(3) == 0) &&\n rand(5) == 0)\n # find all skills that heal all allies\n allheal = heal.find_all {|id|\n $data_skills[id].scope == 2 || $data_skills[id].scope == 4 ||\n $data_skills[id].scope == 6}\n # test again flag\n test_again = true\n # if more than 1 ally who needs healing exists and allheal skills exist\n if to_heal.size > 1 && allheal.size > 0\n # initialize data\n decided, now, new = nil, [], []\n # iterate through all all-healing skills\n allheal.each {|id|\n # fake Blizz-ABS action setup\n ai.act.set(Skills.range(id), ACTSkill, id, Skills.type(id)[0],\n ai.delay_time)\n # all allies who can be targeted by this skill\n new = to_heal.find_all {|b| $BlizzABS.can_execute?(char, b, ai.act)}\n # if not decided yet\n if decided == nil\n # decide this skill and those allies\n decided, now = id, new\n # 50% chance\n elsif rand(2) == 0\n # intialize damage counters\n dmg1 = dmg2 = 0\n # sum up all damage for last decided targets\n now.each {|b| dmg1 += b.battler.maxhp - b.battler.hp}\n # sum up all damage for new targets\n new.each {|b| dmg2 += b.battler.maxhp - b.battler.hp}\n # decide this skill if it contains battlers with more damaged HP\n decided, now = id, new if dmg2 > dmg1\n # if more battlers would be affected by this skill\n elsif new.size > now.size\n # decide this skill and those allies\n decided, now = id, new\n end}\n # if more than one battler can be healed\n if now.size > 1\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time / 2)\n # don't test for one battler\n test_again = false\n end\n end\n # if should test for one battler\n if test_again\n # find all skills that heal one ally\n oneheal = heal.find_all {|id|\n $data_skills[id].scope == 1 || $data_skills[id].scope == 3 ||\n $data_skills[id].scope == 5}\n # if any skill exists\n if oneheal.size > 0\n # decided action\n decided = oneheal[rand(oneheal.size)]\n # decided target\n ai.target = to_heal[rand(to_heal.size)]\n else\n # decided action\n decided = heal[rand(heal.size)]\n end\n # stop execution if no skill decided\n return false if decided == nil\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time / 2)\n end\n # confirm execution\n return true\n end\n # not decided to escape yet\n escaping = false\n # if able to run away\n if escape && rand(5) == 0\n # if observation attribute is active\n if ai.observe && char.restriction != 3\n # iterate through all enemies\n enemies.each {|b|\n # if actor\n if b.is_a?(Map_Actor) && ai.observation[b.battler] != nil\n # get damage per second rate\n dps = get_observation(b.battler, ai.observation[b.battler].clone)\n # 20% chance or damage per second-distance rate high enough\n if rand(5) == 0 || dps * 128 / Math.hypot(b.real_x-\n char.real_x, b.real_y-char.real_y) > char.battler.hp / 2\n # set this battler as escape reference\n ai.target = b\n # running away\n escaping = true\n # abort iteration\n break\n end\n end}\n # 20% chance\n elsif rand(5) == 0\n # initialize minimum range\n min = nil\n # iterate through all enemies\n enemies.each {|b|\n # if closer than anybody else\n if (b.is_a?(Map_Actor) && (min == nil ||\n Math.hypot(b.real_x-char.real_x, b.real_y-char.real_y) < min))\n # set this battler as escape reference\n ai.target = b\n # set new minimum range\n min = Math.hypot(b.real_x-char.real_x, b.real_y-char.real_y)\n # running away\n escaping = true\n # abort iteration\n break\n end}\n end\n end\n # if decided to escape\n if escaping\n # set AI state\n ai.state = Escape\n # set action data\n ai.act.set(ai.view_range - 1, ACTEscape, 0, 0, 80)\n # confirm execution\n return true\n end\n # not decided to defend yet\n defending = false\n # if able to defend\n if defend && rand(5) == 0\n # probability factor if higher if defensive and reset defend flag\n factor = rand(ai.defensive ? 10 : 30)\n # if decided to defend\n if char.battler.hp * 100 / char.battler.maxhp < factor\n # if observation attribute is active\n if ai.observe && char.restriction != 3\n # iterate through all enemies\n enemies.each {|b|\n # if actor\n if b.is_a?(Map_Actor) && ai.observation[b.battler] != nil\n # get damage per second rate\n dps = get_observation(b.battler,\n ai.observation[b.battler].clone)\n # 20% chance or damage per second-distance rate high enough\n if rand(5) == 0 || dps * 128 / Math.hypot(b.real_x-\n char.real_x, b.real_y-char.real_y) > char.battler.hp / 3\n # defending\n defending = true\n # abort iteration\n break\n end\n end}\n # 33% chance\n elsif enemies.size > 0 && rand(5) == 0\n # decided to defend\n defending = true\n end\n end\n end\n # if decided to defend\n if defending\n # set AI state\n ai.state = Defend\n # target the closest enemy\n ai.target = enemies.min {|a, b|\n Math.hypot(x-b.x, y-b.y) <=> Math.hypot(x-a.x, y-a.y)}\n # turn toward the target if target exists and not being force moved\n char.turn_toward(ai.target) if ai.target != nil && char.move_type != 3\n # use defend action\n char.use_defend\n # set action data\n ai.act.set(3, ACTDefend, 0, 0, rand(31) + 70)\n # confirm execution\n return true\n end\n # number of skills\n skill_number = dmg.size + heal.size + neutral.size\n # if able to attack and chosen to attack\n if attack && (skill_number == 0 || rand(skill_number) == 0)\n # if enemy\n if char.is_a?(Map_Enemy)\n # set AI state\n ai.state = Ready\n # setup Blizz-ABS action\n ai.act.set(Enemies.range(char.battler_id), ACTAttack, 0,\n Enemies.type(char.battler_id), ai.delay_time)\n # if observing attribute and not confused\n if ai.observe && char.restriction != 3\n # decide a target based upon observation experience\n observation_target(char, ai, enemies)\n end\n # if actor\n elsif char.is_a?(Map_Actor)\n # set AI state\n ai.state = Ready\n # setup Blizz-ABS action\n ai.act.set(Weapons.range(char.battler.weapon_id), ACTAttack, 0,\n Weapons.type(char.battler.weapon_id), ai.delay_time)\n end\n # if no target exists\n if ai.target == nil || !ai.target.valid?\n # get any enemy\n ai.target = enemies[rand(enemies.size)]\n end\n # confirm execution\n return true\n end\n # decide a random skill action\n decided = (dmg + neutral)[rand(dmg.size + neutral.size)]\n # if action exists\n if decided != nil\n # if observing\n if ai.observe && char.restriction != 3\n # decide a target based upon observation experience\n observation_target(char, ai, enemies)\n end\n # if no target was decided\n if ai.target == nil || !ai.target.valid?\n # if targeting enemies\n if $data_skills[decided].scope == 0 ||\n $data_skills[decided].scope == 1 ||\n $data_skills[decided].scope == 2\n # select a random enemy target\n ai.target = enemies[rand(enemies.size)]\n else\n # select a random ally target\n ai.target = allies[rand(allies.size)]\n end\n end\n end\n # stop execution if no target selected\n return false if ai.target == nil || !ai.target.valid?\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time)\n # confirm execution\n return true\n end", "def determine_blue_magic_learn_by_sight(subject, item)\n return unless Bubs::BlueMagic::LEARN_BY_SIGHT\n return unless item.blue_magic && subject\n return unless blue_magic_learn_by_allies?(subject)\n all_battle_members.each do |member|\n if member.result.hit?\n set_blue_magic_skill_to_learn_flags(item)\n break\n end # if\n end # do\n end", "def ^( enemy )\n fight( enemy, 13)\n end", "def /(enemy)\n fight(enemy, rand(4 + ((enemy.life % 10)**2)))\n end", "def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end", "def eat_humans\n @health += 20\n self\n end", "def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end", "def search_weapon\n new_weapon_level = rand(1..6)\n puts \"#{name} a trouve une arme de niveau #{new_weapon_level}\"\n if new_weapon_level > @weapon_level\n @weapon_level = new_weapon_level\n puts \"il fait un changement d arme\"\n puts \"\"\n else\n puts \"pas de changement d arme\"\n puts \"\"\n end\n end", "def move_hero\n #get next square\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n next_x = 0 if next_x < 0\n next_x = 14 if next_x > 14\n next_y = 0 if next_y < 0\n next_y = 14 if next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n draw_map(next_x,next_y)\n #don't move onto it if next square is an object that can't be walked over\n if next_square == CHAR_FLOOR || next_square == CHAR_IN || next_square == CHAR_OUT ||\n next_square == CHAR_TRAP || next_square == CHAR_SAFE\n #walked into trap, keep on trap unless strong and lucky\n if @room[@cur_x][@cur_y] == CHAR_TRAP &&\n @stats[:strength] <= (@orig_stats[:strength] * 0.8) &&\n @stats[:luck] <= Random.rand(15)\n next_x = @cur_x\n next_y = @cur_y\n end\n #increase health on any move\n @stats[:strength] += (@stats[:vitality] / 200.0) if @stats[:strength] < @orig_stats[:strength]\n #move the character\n if next_x != @cur_x || next_y != @cur_y\n draw_map(@cur_x, @cur_y)\n @cur_x = next_x\n @cur_y = next_y\n draw_map(@cur_x, @cur_y)\n end\n #if on exit door then decend to next level if have enough experience\n if next_square == CHAR_OUT\n load_dungeon_file(@current_level+1)\n end\n end\n #cause damage if walked into wall\n if next_square == CHAR_WALL\n @stats[:strength] -= 0.3\n end\n\n #dead\n end", "def fight()\n\tputs \"--------------------\"\n\tputs \"Let's fight, but first we go to the coffe shop.\"\n\tgo_to_coffee_shop()\n\tnumber_of_turns = 10 + rand(20)\n\tputs \"------------------\"\n\tputs \"TIME TO FIGHT! There are #{number_of_turns} rounds in this fight!\"\n\tnumber_of_turns.times do |x|\n\t\tputs \"------------------\"\n\t\tputs \"Round #{x+1}, FIGHT!\"\n\t\tcurrent_fighter = Person.person_array.sample\n\t\t\n\t\tif current_fighter.is_a?(PowerRanger)\n\t\t\trandom_roll = rand(10)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\t\tcurrent_fighter.punch() if random_roll >= 2 && random_roll <= 6\n\t\t\tcurrent_fighter.megazord() if random_roll >= 7 && random_roll <=9\n\t\telsif current_fighter.is_a?(EvilNinja)\n\t\t\trandom_roll = rand(10)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\t\tcurrent_fighter.punch() if random_roll >= 2 && random_roll <= 6\n\t\t\tcurrent_fighter.cause_mayhem() if random_roll >= 7 && random_roll <=9\n\t\telse\n\t\t\trandom_roll = rand(2)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\tend\n\tend\n\tputs \"-------------------\"\nend", "def /(enemy)\n fight(enemy, rand(4+((enemy.life%10) ** 2)))\n end", "def battingteam\n if (hometeambatted == true)\n \"#{match.hometeam.name}\"\n else\n \"#{match.awayteam.name}\"\n end\n end", "def humanplayer_attack_selected_bots(x)\n human_damage = @human_player.compute_damage\n @enemies[x].gets_damage(human_damage)\n puts \"#{@human_player.name} inflige #{human_damage} point(s) de dégât au bots #{x + 1}\" # #####\n if @enemies[x].life_points <= 0 \n puts \"- le bots #{@enemies[x].name} est mort\"\n kill_player(x)\n end\n #show_bots_state\n end", "def attack_town\n @health += 50\n self\n end", "def set_target_battlers(scope)\r\n # If battler performing action is enemy\r\n if @active_battler.is_a?(Game_Enemy)\r\n # Branch by effect scope\r\n case scope\r\n when 1 # single enemy\r\n index = @active_battler.current_action.target_index\r\n @target_battlers.push($game_party.smooth_target_actor(index))\r\n when 2 # all enemies\r\n for actor in $game_party.actors\r\n if actor.exist?\r\n @target_battlers.push(actor)\r\n end\r\n end\r\n when 3 # single ally\r\n index = @active_battler.current_action.target_index\r\n @target_battlers.push($game_troop.smooth_target_enemy(index))\r\n when 4 # all allies\r\n for enemy in $game_troop.enemies\r\n if enemy.exist?\r\n @target_battlers.push(enemy)\r\n end\r\n end\r\n when 5 # single ally (HP 0) \r\n index = @active_battler.current_action.target_index\r\n enemy = $game_troop.enemies[index]\r\n if enemy != nil and enemy.hp0?\r\n @target_battlers.push(enemy)\r\n end\r\n when 6 # all allies (HP 0) \r\n for enemy in $game_troop.enemies\r\n if enemy != nil and enemy.hp0?\r\n @target_battlers.push(enemy)\r\n end\r\n end\r\n when 7 # user\r\n @target_battlers.push(@active_battler)\r\n end\r\n end\r\n # If battler performing action is actor\r\n if @active_battler.is_a?(Game_Actor)\r\n # Branch by effect scope\r\n case scope\r\n when 1 # single enemy\r\n index = @active_battler.current_action.target_index\r\n @target_battlers.push($game_troop.smooth_target_enemy(index))\r\n when 2 # all enemies\r\n for enemy in $game_troop.enemies\r\n if enemy.exist?\r\n @target_battlers.push(enemy)\r\n end\r\n end\r\n when 3 # single ally\r\n index = @active_battler.current_action.target_index\r\n @target_battlers.push($game_party.smooth_target_actor(index))\r\n when 4 # all allies\r\n for actor in $game_party.actors\r\n if actor.exist?\r\n @target_battlers.push(actor)\r\n end\r\n end\r\n when 5 # single ally (HP 0) \r\n index = @active_battler.current_action.target_index\r\n actor = $game_party.actors[index]\r\n if actor != nil and actor.hp0?\r\n @target_battlers.push(actor)\r\n end\r\n when 6 # all allies (HP 0) \r\n for actor in $game_party.actors\r\n if actor != nil and actor.hp0?\r\n @target_battlers.push(actor)\r\n end\r\n end\r\n when 7 # user\r\n @target_battlers.push(@active_battler)\r\n end\r\n end\r\n end", "def monsterAttack(user, mAtk, enemy)\n\t\trandAttack = mAtk.sample\n\n\t\tif randAttack == 'Slap'\n\t\t\tmonsterDmg = 1\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Bite'\n\t\t\tmonsterDmg = 2\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Eyepoke'\n\t\t\tmonsterDmg = 3\n\t\t\tuser['health'] -= 1\n\t\tend\n\n\t\tputs \"You get hit by #{enemy['name']} for #{monsterDmg}. Your health is now #{user['health']}\"\n\t\t\n\tend", "def apply_hits(target_fleet, dice)\n while ( die = dice.shift )\n print \"\\t\\tApplying dieroll: #{die}\" if @verbose\n target_ships = target_fleet.living_ships.sort_by(&:hit_points)\n hittable_ships = target_ships.select{ |ship| die.can_hit?(ship) }\n if hittable_ships == []\n puts \"... miss\" if @verbose\n next\n else\n hit_ship = hittable_ships.first\n puts \"... hit for #{die.damage} on #{hit_ship}\" if @verbose\n hit_ship.add_damage(die.damage)\n raise Victory if target_fleet.destroyed?\n end\n end\n end", "def search_health_pack\r\n des = rand(1..6)\r\n if des == 1 \r\n puts \"Tu n'as rien trouvé...\"\r\n elsif des >=2 && des <= 5\r\n @life_points = @life_points + 50\r\n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\"\r\n else\r\n @life_points = @life_points + 80\r\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\r\n end\r\n\r\n if @life_points > 100\r\n @life_points = 100\r\n end\r\n end", "def smoke_weed\n\tif (@inventory.include?('marijuana') && @inventory.include?('bong') && @inventory.include?('lighter'))\n\t\t@health = 100\n\t\t@pointless_points += 50\n\t\tputs \"You pack the bong full of weed and take a huge rip!\"\n\t\tputs \"\"\n\t\tputs \"Youre health is now at 100/100\"\n\t\tputs \"+50 points!\"\n\t\tputs \"\"\n\t\[email protected]!(@inventory.index('marijuana'))\n\telse\n\t\tputs \"Maybe you can find somebody to help you out with that...\"\n\t\tputs \"\"\n\tend\n\tcontroller\nend", "def fight\n if @gladiators.length == 2\n if @gladiators.first.weapon == @gladiators.last.weapon\n @gladiators.pop(2)\n elsif @gladiators.first.weapon == \"Spear\" && @gladiators.last.weapon == \"Trident\"\n @gladiators.shift(1)\n elsif @gladiators.first.weapon == \"Spear\" && @gladiators.last.weapon == \"Club\"\n @gladiators.pop(1)\n elsif @gladiators.first.weapon == \"Trident\" && @gladiators.last.weapon == \"Club\"\n @gladiators.shift(1)\n end\n end\n end", "def make_damage(hero, damage)\n hero.hp_pool -= damage\n end", "def throne_battle(targaryen_1, targaryen_2)\n puts \"Who killed who?\"\n return targaryen_1 + targaryen_2\nend", "def set_target_battlers(scope)\n # If battler performing action is enemy\n if @active_battler.is_a?(Game_Enemy)\n # Branch by effect scope\n case scope\n when 1 # single enemy\n index = @active_battler.current_action.target_index\n @target_battlers.push($game_party.smooth_target_actor(index))\n when 2 # all enemies\n for actor in $game_party.actors\n if actor.exist?\n @target_battlers.push(actor)\n end\n end\n when 3 # single ally\n index = @active_battler.current_action.target_index\n @target_battlers.push($game_troop.smooth_target_enemy(index))\n when 4 # all allies\n for enemy in $game_troop.enemies\n if enemy.exist?\n @target_battlers.push(enemy)\n end\n end\n when 5 # single ally (HP 0) \n index = @active_battler.current_action.target_index\n enemy = $game_troop.enemies[index]\n if enemy != nil and enemy.hp0?\n @target_battlers.push(enemy)\n end\n when 6 # all allies (HP 0) \n for enemy in $game_troop.enemies\n if enemy != nil and enemy.hp0?\n @target_battlers.push(enemy)\n end\n end\n when 7 # user\n @target_battlers.push(@active_battler)\n end\n end\n # If battler performing action is actor\n if @active_battler.is_a?(Game_Actor)\n # Branch by effect scope\n case scope\n when 1 # single enemy\n index = @active_battler.current_action.target_index\n @target_battlers.push($game_troop.smooth_target_enemy(index))\n when 2 # all enemies\n for enemy in $game_troop.enemies\n if enemy.exist?\n @target_battlers.push(enemy)\n end\n end\n when 3 # single ally\n index = @active_battler.current_action.target_index\n @target_battlers.push($game_party.smooth_target_actor(index))\n when 4 # all allies\n for actor in $game_party.actors\n if actor.exist?\n @target_battlers.push(actor)\n end\n end\n when 5 # single ally (HP 0) \n index = @active_battler.current_action.target_index\n actor = $game_party.actors[index]\n if actor != nil and actor.hp0?\n @target_battlers.push(actor)\n end\n when 6 # all allies (HP 0) \n for actor in $game_party.actors\n if actor != nil and actor.hp0?\n @target_battlers.push(actor)\n end\n end\n when 7 # user\n @target_battlers.push(@active_battler)\n end\n end\n end", "def search_health_pack\n\t\thealing = rand(1..6)\n\t\tif healing == 1\n\t\t\tputs \"Tu n'as rien trouvé... \"\n\t\telsif healing >= 2 && healing <= 5\n\t\t\tif self.life_points > 50 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 50\n\t\t\tend\n\t\t\tputs \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n\t\telsif healing == 6\n\t\t\tif self.life_points > 20 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 80\n\t\t\tend\n\t\t\tputs \"Champagne! Tu as trouvé un pack de +80 points de vie !\"\n\t\tend\n\t\t\n\tend", "def should_eat?\n !stat_boosted?\n end", "def search_health_pack\n \t\t\trand(1..6)\n \t\t\tresult = rand(1..6)\n \t\t\tif result == 1\n \t\t\t \tputs \"Tu n'as rien trouvé... \"\n\n\t \t\telsif result.between?(2,5)\n\t \t\t\tunless @life_points < 100\n\t \t\t\t\t@life_points = @life_points+50 \n\t \t\t\t\tputs \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n\t \t\t\telse \n\t \t\t\t\tputs \"Désolé tu as déjà plein de vies\"\n\t \t\t\tend\n\t \t\telse \n\t \t\t\tunless @life_points < 100\n\t\t \t\t\t@life_points = @life_points+80\n\t\t\t \t\tputs \"Waow, tu as trouvé un pack de +80 points de vie !\"\n\t\t\t \telse \n\t \t\t\t\tputs \"Désolé tu as déjà pleins de vies\"\n\t\t \t\tend\n\t \t\tend\n\t \tend", "def attacked(attacker)\n attack = rand(2+attacker.agility)-rand(@agility)\n if attack>0\n @health -= rand(attacker.strength)\n @game.message(self.name + \" suffers \" + attack.to_s + \" damage!\")\n end\n if self.health <= 0\n return true\n else \n return false\n end\n end", "def enemy_attack(pika_hp)\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2 || random == 3 || random == 4\n puts \"The enemy's attack missed! Pikachu's hp is #{pika_hp}.\".colorize(:red)\n elsif random == 5 || random == 6\n pika_hp = pika_hp - 1\n puts \"The enemy used Growl. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n elsif random == 7 || random == 8\n pika_hp = pika_hp - 2\n puts \"The enemy used Quick Attack. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n else\n pika_hp = pika_hp - 3\n puts \"The enemy used Scratch. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n end\n return pika_hp\nend", "def set_summoned_battlers(battler)\n for summon_id in Summon_Skill[battler.summoning][1].dup\n next if $game_party.summoned.include?($game_actors[summon_id])\n $game_party.summoned << $game_actors[summon_id]\n end\n end", "def search_health_pack \n health_pack = rand(1..6)\n\n if health_pack == 1 \n puts \"Tu n'as rien trouvé !\"\n\n elsif health_pack == 6 \n if @life_points >= 20 \n @life_points = 100\n else\n @life_points + 80\n end\n puts \"Wahouuu, tu as trouvé un pack de +80 points de vie !\"\n\n else \n if @life_points >= 50\n @life_points = 100\n else \n @life_points + 50\n end\n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n end\n end", "def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end", "def catch_fish\n inventory[:fish] += @skills[:fish]\n end", "def make_guess(guess)\n @previous_guesses << guess \n display_string = show_progress()\n if !goal_word.include?(guess) \n guess_counter()\n end \n if display_string == @goal_word\n @player_won = true \n end\n end", "def *( enemy )\n if @bombs.zero?\n puts \"[UHN!! You're out of bombs!!]\"\n return\n end\n @bombs -= 1\n fight( enemy, 86 )\n end", "def *( enemy )\n if @bombs.zero?\n puts \"[UHN!! You're out of bombs!!]\"\n return\n end\n @bombs -= 1\n fight( enemy, 86 )\n end", "def search_health_pack\n use_health_pack = rand(1..6)\n #pas de vie\n if use_health_pack == 1\n puts \"rien ne ce passe\"\n puts \"\"\n #un gros pack de vie verif life ne depasse pas 100\n elsif use_health_pack == 6\n @life_points += 80\n @life_points = 100 if @life_points > 100\n puts \"tu te heal pour 80HP\"\n puts \"\"\n #un moyen pack de vie verif life ne depasse pas 100\n else\n @life_points += 50\n @life_points = 100 if @life_points > 100\n puts \"tu te heal pour 50HP\"\n puts \"\"\n end\n end", "def fight(other, initial_health, walking = true)\n unless fought_in_turn.include?(other)\n self.fought_in_turn << other\n other.fought_in_turn << self\n self.damage(other.health)\n other.damage(initial_health)\n if self.health > 0 && walking\n @grid.move_token(self.x, self.y, other.x, other.y)\n end\n end\n end", "def pika_attack(enemy_hp)\n #randomization\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2\n puts \"Oh no, Pikachu missed!\".colorize(:yellow)\n elsif random == 3 || random == 4 || random == 5\n enemy_hp = enemy_hp - 2\n puts \"Pikachu used Tail Whip. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n elsif random == 6 || random || 7 || random == 8\n enemy_hp = enemy_hp - 3\n puts \"Pikachu used ThunderShock. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n else\n enemy_hp = enemy_hp - 4\n puts \"Pikachu used Slam. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n end\n return enemy_hp\nend", "def enemies_attack\n @enemies.each do |mechant| #player contient Josiane et José\n if mechant.life_points > 0\n mechant.attacks(@human_player)\n end #end of if \n end #end of do\n end", "def underdog\n\t if home_team != favorite\n\t home_team\n\t else\n\t visitor_team\n\t end\n\tend", "def attack_use\n puts \"\"\n puts \"#{@type.name.upcase} MOVES ARE POWERFUL AGAINST:\"\n @type.super_effective.each_with_index {|other_type, index| puts \"#{index+1}. #{other_type.name}\"}\n end" ]
[ "0.6619536", "0.6416011", "0.63749695", "0.6328689", "0.6266054", "0.6224077", "0.6188326", "0.6150375", "0.60659486", "0.60075927", "0.60075927", "0.5991556", "0.5973991", "0.5973471", "0.596981", "0.5956465", "0.5943797", "0.5943622", "0.5940115", "0.59194857", "0.59087265", "0.5906445", "0.58815867", "0.5878293", "0.58772635", "0.58633983", "0.58524835", "0.58516043", "0.5820681", "0.5815472", "0.5799967", "0.5777975", "0.5772876", "0.5770006", "0.57695657", "0.57504773", "0.5749581", "0.57421005", "0.5729253", "0.5726525", "0.5706943", "0.57017356", "0.5694107", "0.5690931", "0.5690931", "0.5690931", "0.5690931", "0.5690931", "0.5681459", "0.5678701", "0.56681544", "0.5664224", "0.5643764", "0.5640505", "0.5636003", "0.5618531", "0.5618166", "0.56165785", "0.55950576", "0.5581129", "0.5580501", "0.5563141", "0.555724", "0.5552388", "0.55514866", "0.55485016", "0.5546207", "0.5542877", "0.55402523", "0.5539378", "0.5534287", "0.5524281", "0.55161816", "0.5515823", "0.5511923", "0.55060965", "0.5504552", "0.5490069", "0.5486714", "0.54847693", "0.5484676", "0.5476977", "0.5471696", "0.54712105", "0.5452191", "0.5451517", "0.54425466", "0.544074", "0.5440139", "0.54391825", "0.5437839", "0.54370856", "0.54365015", "0.5436005", "0.5436005", "0.5434211", "0.5431199", "0.542999", "0.5425731", "0.54235864", "0.5423377" ]
0.0
-1
def auto_complete_for_ttx_group_title end GET /items GET /items.xml
def index unless params[:type] @page = Page.find_by_permalink("production", :order => "position ASC") #@page_ids = [] else @page = Page.find_by_permalink("accessories", :order => "position ASC") #@items = Item.find_by_page_id(params[:page_id]) end #respond_to do |wants| # wants.html # index.html.erb # # wants.xml { render :xml => @items } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end", "def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end", "def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case type\n\n when 'location'\n @items = Observation.connection.select_values(%(\n SELECT DISTINCT `where` FROM observations\n WHERE `where` LIKE '#{letter}%' OR\n `where` LIKE '% #{letter}%'\n )) + Location.connection.select_values(%(\n SELECT DISTINCT `name` FROM locations\n WHERE `name` LIKE '#{letter}%' OR\n `name` LIKE '% #{letter}%'\n ))\n if scientific\n @items.map! {|i| Location.reverse_name(i)}\n end\n @items.sort!\n\n when 'name'\n @items = Name.connection.select_values %(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{letter}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )\n\n when 'name2'\n @items = Name.connection.select_values(%(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{instr}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )).sort_by {|x| (x.match(' ') ? 'b' : 'a') + x}\n # This sort puts genera and higher on top, everything else on bottom,\n # and sorts alphabetically within each group.\n letter = ''\n\n when 'project'\n @items = Project.connection.select_values %(\n SELECT title FROM projects\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'species_list'\n @items = SpeciesList.connection.select_values %(\n SELECT title FROM species_lists\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'user'\n @items = User.connection.select_values %(\n SELECT CONCAT(users.login, IF(users.name = \"\", \"\", CONCAT(\" <\", users.name, \">\")))\n FROM users\n WHERE login LIKE '#{letter}%'\n OR name LIKE '#{letter}%'\n OR name LIKE '% #{letter}%'\n ORDER BY login ASC\n )\n end\n end\n\n # Result is the letter requested followed by results, one per line. (It\n # truncates any results that have newlines in them -- that's an error.)\n render(:layout => false, :inline => letter +\n %(<%= @items.uniq.map {|n| h(n.gsub(/[\\r\\n].*/,'')) + \"\\n\"}.join('') %>))\n end", "def auto_complete\n @query = params[:auto_complete_query]\n @auto_complete = self.controller_name.classify.constantize.scoped(:limit => 10).search(@query)\n render :template => \"common/auto_complete\", :layout => nil\n end", "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "def typeahead\n model_name = controller_name.classify\n model_class = class_for_controller_name\n\n results = model_class.authorize_asset_collection(model_class.where('title LIKE ?', \"#{params[:query]}%\"), 'view')\n items = results.first(params[:limit] || 10).map do |item|\n contributor_name = item.contributor.try(:person).try(:name)\n { id: item.id, name: item.title, hint: contributor_name, type: model_name, contributor: contributor_name }\n end\n\n respond_to do |format|\n format.json { render json: items.to_json }\n end\n end", "def getSearchURL itemName, itemType\n itemEncoded = URI.encode itemName\n if itemType == 'title'\n return ROOT_URL + 'find?q=' + itemEncoded + '&' + QPARAMS_TITLE_SEARCH\n end\nend", "def autocomplete; end", "def set_university_autocomplete\n render json: @group_tags\n end", "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end", "def get_autocomplete_items(parameters)\n super(parameters).active rescue nil\n end", "def autocomplete\n key = params[:key]\n feeds = Feed.select('title').where('title LIKE ?', \"%#{key}%\").limit(5).map { |f| f.title }\n upcomings = Upcoming.select('title').where('title LIKE ?',\"%#{key}%\").limit(5).map { |u| u.title }\n artists = Artist.select('name').where('name LIKE ?',\"%#{key}%\").limit(5).map { |u| u.name }\n result = feeds + upcomings + artists\n\n respond_to do |format|\n format.json { render json: result.shuffle }\n end\n end", "def auto_complete\n type = params[:type].to_s\n string = CGI.unescape(params[:id].to_s).strip_squeeze\n if string.blank?\n render(text: \"\\n\\n\")\n else\n auto = AutoComplete.subclass(type).new(string, params)\n results = auto.matching_strings.join(\"\\n\") + \"\\n\"\n render(text: results)\n end\n end", "def auto_complete_for_album_tag_list\n auto_complete_for_tag_list_first_beginning_then_the_rest(params[:album][:tag_list])\n if @tags.length > 0\n render :inline => \"<%= content_tag(:ul, @tags.map {|t| content_tag(:li, t.name)}.join.html_safe) %>\"\n else\n render :nothing => true\n end\n end", "def find_item_names(doc)\nend", "def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\n end", "def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\n end", "def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\n end", "def get_autocomplete_items(parameters)\n items = active_record_get_autocomplete_items(parameters)\n if params[:organization_id].present?\n items = items.where(:organization_id => params[:organization_id])\n end\n items\n end", "def auto_complete_for_filter_expense_pending_description\r\n project_ids = (@current_user.supervised_projects.nil? || @current_user.supervised_projects.empty? ) ? '' : (@current_user.supervised_projects.collect {|p| p.id}.flatten)\r\n \r\n @items=BulkExpense.find(:all,:include=> [:user, :project],\r\n :conditions=>['expenses.description like ? and users.enterprise_id=? and (users.supervisor_id= ? OR projects.id IN (?))',\"%#{params[:crt_description]}%\",@enterprise.id,@current_user.id, project_ids])\r\n render :inline => '<%= auto_complete_result(@items, \"description\") %>'\r\n end", "def autocomplete_summary\n summary = \"Trip Report: #{title}\"\n end", "def quest_autocomplete\n render json: Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n end", "def auto_complete_for_user_name\n @users = session[:user].get_available_users(params[:user][:name])\n render inline: \"<%= auto_complete_result @users, 'name' %>\", layout: false\n end", "def heading\n\t\t\"Items\"\n\tend", "def scaffold_auto_complete_for(object, options = {})\n define_method(\"scaffold_auto_complete_for_#{object}\") do\n @items = object.to_s.camelize.constantize.scaffold_auto_complete_find(params[:id], options)\n render :inline => \"<%= scaffold_auto_complete_result(@items) %>\"\n end\n end", "def search_room\n item_description\n end", "def scaffold_auto_complete_result(entries)\n return unless entries\n content = '<ul>'\n entries.collect{|entry| content << \"<li>#{h(entry.scaffold_name_with_id)}</li>\"}\n content << '</ul>'\n content\n end", "def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend", "def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end", "def complete_item(id)\n record \"/todos/complete_item/#{id}\"\n end", "def scaffold_auto_complete_result(entries)\n return unless entries\n content_tag(\"ul\", entries.map{|entry| content_tag(\"li\", h(entry.scaffold_name_with_id))}.uniq)\n end", "def item_title\n if @res[\"title\"].present?\n @res[\"title\"].length > 20 ? \"#{@res[\"title\"][0,20]}...\" : @res[\"title\"]\n else\n \"Item #{@res[\"identifier\"]}\"\n end\n end", "def show_titlesource(result)\n item = result.fetch('Items', []).find { |item|\n item['Group'].downcase == \"src\"\n }\n item.present? ? processAPItags(item['Data'].to_s).html_safe : ''\n end", "def get_all_food_items\n @menu.search('food')\n end", "def get_autocomplete_items(parameters)\n items = super(parameters)\n if current_user.admin?\n items\n else\n items.includes(:users).where(users:{id: current_user.id})\n end\n end", "def auto_complete(controller, context = {})\n query, tags = parse_query_and_tags(context[:query])\n klass = controller.controller_name.classify.constantize\n if tags.empty?\n klass.my(:user => context[:user], :limit => 10).search(query)\n else\n klass.my(:user => context[:user], :limit => 10).search(query).tagged_with(tags, :on => :tags)\n end\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def all_autocomplete\n quests = Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n recs = Record.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n render json: Search.json(quests.results + recs.results)\n end", "def autocomplete\n @taxa = Taxon.order(:scientific_name).search(params[:term])\n list = @taxa.map {|t| Hash[id: t.id, label: t.label, value: t.scientific_name]}\n respond_to do |format|\n format.html { render :index }\n format.json do\n render json: list.to_json\n end\n end\n end", "def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end", "def get_autocomplete_label\n label = ActionController::Base.helpers.strip_tags(self.title.strip)\n label += \" (\" + self.collection_identifier + \")\" if (self.collection_identifier && self.collection_identifier.length > 0)\n label += \" [COLLECTION]\" if (self.is_collection)\n label += \" [RESOURCE]\" if (self.is_resource)\n label += \" [EXHIBITION]\" if (self.is_exhibition)\n label += \" [STUDY SET]\" if (self.is_crcset)\n\n label\n end", "def show\n @item_group= Vger::Resources::Suitability::ItemGroup.find(params[:id], :include => [ :items ])\n respond_to do |format|\n format.html\n end\n end", "def search(group, items)\n # Creates an Array of [String, RSS item] for all combinations.\n group.requests.product(items).each do |request, item|\n if match?(group, request, item)\n download(group.path, item)\n Notification.send(item.title)\n end\n end\n end", "def search(group, items)\n # Creates an Array of [String, RSS item] for all combinations.\n group.requests.product(items).each do |request, item|\n if match?(group, request, item)\n download(group.path, item)\n Notification.send(item.title)\n end\n end\n end", "def item_title(item)\n item.title\n end", "def get_autocomplete_items(parameters)\n HsCode.where(\"hs_codes.code like :search or hs_codes.description like :search\", :search => \"%#{params[:term]}%\").select('description, code').limit(100)\n end", "def show\n @item = ItemTemplate.find(params[:id])\n @title = @item.name.titleize\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def test_iteration_items\n\t\ta = @a.request(\"한국전쟁\")\n\t\ta.items.each do |i|\n\t\t\tputs i.title\n\t\tend\n\tend", "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end", "def searchtitle\n end", "def get_items input\n\t\t@items[input]\n\tend", "def item\n case item_type\n when 'group'\n group\n end\n end", "def item\n case item_type\n when 'group'\n group\n end\n end", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend", "def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end", "def items\n all(locator(:item)).map do |item|\n item.find(locator(:item_name)).text\n end\n end", "def auto_complete_belongs_to_for_record_client_id\n auto_param = params[:record][:client][:text]\n @results = Client.find(:all,\n :conditions => [\"LOWER(name) LIKE ?\", \"%#{auto_param.downcase}%\"],\n :limit => 10\n )\n render :inline => '<%= model_auto_completer_result(@results, :name) %>'\n end", "def search_items\n @resources = current_company.items.search_for(params[:name]).limit(10)\n @resources = Admin::InventoryItemDecorator.decorate(@resources)\n end", "def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end", "def feed_items\n feed_item\n end", "def list_items\r\n begin\r\n expand_combo\r\n get(:type => :list_item, :scope => :children, :how_many => :all)\r\n ensure\r\n collapse_combo\r\n end\r\n end", "def user_items_list\n @items = Item.find_all_by_user_id(current_user.id)\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def findorsuggest()\n \n end", "def auto_complete_result(entries, field, phrase = nil)\n return unless entries\n render :partial => '/admin/orders/autocomplete', :locals => { :entries => entries, :field => field, :phrase => phrase }\n end", "def auto_complete_for_ingredient_name\n value = params[:ingredient][:name]\n @ingredients = Ingredient.find(:all, \n :conditions => [ 'LOWER(name) LIKE ?',\n '%' + value.downcase + '%' ], \n :order => 'name ASC',\n :limit => 8)\n render :partial => 'ingredient_name_matches'\n end", "def start_special_list_item\n end", "def showList() \t\n\t\t@searchSuggestionList\t\n\tend", "def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end", "def uncomplete_item(id)\n record \"/todos/uncomplete_item/#{id}\"\n end", "def show\n barcodes = params[:barcodes] == \"true\"\n @categorized_items = Item.includes(:category => :limit_category)\n .preferred\n .sort_by(&:description) # sort the items\n .group_by(&:category_descriptor)\n\n respond_to do |format|\n format.html\n if barcodes\n format.docx { render :docx => \"sku_list_barcodes\", :template => \"sku_lists/sku_list_barcodes\", :formats => [:xml], :handlers => [:builder] }\n else\n format.docx { render :docx => \"sku_list\"} # renders show.docx.builder\n end\n end\n end", "def item_name\n params['item_name']\n end", "def get_autocomplete_items(parameters)\n session[:from_follower_following] ? @login_user.from_follower_following(parameters[:term]) : @login_user.all_message_users(parameters[:term])\n end", "def index\n @items = Item.find(:all, :order => 'created_at DESC', :limit => 50)\n @parameter = params[:query]\n @item_type = params[:category]\n\n if params[:tag]\n @items = Item.tagged_with(params[:tag])\n else \n if @parameter\n @items = Item.search_by_name(@parameter)\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js {render :layout => false}\n format.json { render :json => @items\n }\n end\n end", "def autocomplete(name)\n self.class.get(\"/cards/autocomplete?q=#{name}\")\n end", "def items\n authors\n end", "def index\n @archetypes = Archetype.by_item(params[:item_id])\n end", "def typeahead\n @users = User.search do\n fulltext params[:query] do\n fields(:bio, :name => 2.0)\n end\n order_by :id, :desc\n paginate :page => 1, :per_page => 15\n end.results.collect { |u| u.name }\n\n respond_to do |format|\n format.html #typeahead.html.erb\n format.xml { render :xml => {:options => @users} }\n format.json { render :json => {:options => @users} }\n end\n end", "def get_item(label, action) \n\titem = REXML::Element.new \"item\"\n\titem.add_attribute(\"label\", label) \n\tact = REXML::Element.new \"action\"\n\tact.add_attribute(\"name\", \"Execute\")\n\titem.add_element act\n\tcmd = REXML::Element.new \"command\"\n\tcmd.add_text action\n\tact.add_element cmd\n\treturn item\nend", "def title\n return @title if @title\n\n # The correct title for a UmmMultiItems is saved under label\n return parsed_json['label'] if parsed_json['type'] == 'UmmMultiItems'\n\n value = schema.fetch_key_leaf(full_key)\n\n if value.ends_with?('ID')\n value.titleize + ' ID'\n else\n value.titleize\n end\n end", "def get_list\n \t@items\n end", "def auto_complete_for_asset_developer_name\n name = params[:asset][\"developer_name\"]\n # OPTIMIZE: regexp or like can be expensive (cause full table search), instead use fulltext search if possible\n # @developers = Developer.find(:all, :conditions => [\"name LIKE ?\", \"%#{name}%\"])\n @developers = Developer.find(:all, :conditions => [\"name ~* ?\", name])\n if @developers.blank?\n render :nothing => true\n else\n render :inline => \"<%= content_tag :ul, @developers.map {|d| content_tag(:li, h(d.name))} %>\" \n end\n end", "def fill_auto_complete(field, filter = nil, full_text)\n fill_in field, with: filter unless filter\n\n page.execute_script %Q{ $('##{field}').trigger('focus') }\n page.execute_script %Q{ $('##{field}').trigger('keydown') }\n\n selector = %Q{ul.ui-autocomplete li.ui-menu-item a:contains(\"#{full_text}\")}\n\n sleep 5\n page.execute_script %Q{ $('#{selector}').trigger('mouseenter').click() }\n sleep 5\n end", "def getItemList(name, vault = \"Private\")\n regex = %r{#{name}}i\n all = self.op \"list\", \"items\", \"--vault\", vault\n arr = all.select{|i| regex.match?(i[\"overview\"][\"title\"])}\n return_arr = []\n if arr.class == Array\n arr.each do |item|\n return_arr << item[\"overview\"][\"title\"]\n end\n end\n return_arr\n end", "def complete_title\n if self.title.present?\n self.title\n else\n I18n.translate(\"bento_search.missing_title\")\n end\n end", "def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end", "def index\n @items = Item.valid_items.search(params[:search],params[:action]).order(sort_column('Item', 'name') + ' ' + sort_direction).paginate(:page => params[:page], :per_page => 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end", "def index\n @transaction_group_items = @transgroup.transaction_group_items.find(:all, :order => \"order_number ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_group_items }\n end\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def index\n @avalon_items = AvalonItem.where(pod_unit: UnitsHelper.human_readable_units_search(User.current_username)).order(:title)\n end", "def auto_complete_for_questionbank_topic\n if params[:questionbank][:topic] and request.xhr?\n auto_complete_responder_for_questionbanks params[:questionbank][:topic]\n end\n end", "def get_item_display(item, key)\n # raise\n # Accept a \"browse item\" structure, or a plain old SolrDocument\n item_display = if item.key? :item_display\n item[:item_display]\n else\n item[:doc][:item_display]\n end\n match = ''\n return nil if key.nil? || key.length.zero?\n [item_display].flatten.each do |item_disp|\n return item_disp if item_disp.downcase.include? key.downcase\n # raise\n # match = item_disp if item_disp =~ /#{CGI::escape(key)}/i\n # # marquis - add this match...\n # match = item_disp if item_disp =~ /#{key}/i\n end\n return match unless match == ''\n end", "def index\n if params[:search]\n @items = Item.tagged_with(params[:search])\n @items ||= Item.find_by_title(params[:search])\n @page_title = params[:search]\n\n elsif params[:category]\n @category = Category.where(:name => params[:category]).first\n @items = @category.items.order(\"created_at DESC\").paginate(:per_page => 12, :page => params[:page])\n @page_title = params[:category]\n else\n @items = Item.all.limit(6).order(\"items.created_at DESC\")\n @page_title = \"محصولات\"\n end\n end", "def auto_complete_for_headline_tag_list_without_areas\n auto_complete_for_tag_list_first_beginning_then_the_rest(params[:headline][:tag_list_without_areas])\n if @tags.length > 0\n render :inline => \"<%= content_tag(:ul, @tags.map {|t| content_tag(:li, t.name)}.join.html_safe) %>\"\n else\n render :nothing => true\n end\n end", "def auto_complete_info(field)\r\n { \"id\" => id, \"label\" => send(field), \"value\" => send(field) }\r\n end", "def review_items\n @dialog.setSubStatusAndLogIt('Finding items to review')\n @dialog.setSubProgress(0)\n items = add_status('endpoint')\n unless @items['endpoint-attach'].empty?\n items.concat(add_status('endpoint-attach'))\n items.concat(add_attachments)\n end\n @dialog.setSubProgress(1, 1)\n items\n end", "def new_items_list\n @items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability\n @items = @items.first(16)\n #TODO: Once we have populated more data, maybe show 12 items instead of four\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def find(items)\n query_array = query.gsub(/_/,\" \").downcase.split\n\n results = []\n items.each{ |item|\n match_all = true\n query_array.each{ |query|\n description = item.description.gsub(\"/,/\",\"~\")\n if !item.name.gsub(/_/,\" \").downcase.include?(query) and !description.gsub(/_/,\" \").downcase.include?(query)\n match_all = false\n else\n if description.gsub(/_/,\" \").downcase.include?(query)\n self.description_map[item] = map_description_part(description, query)\n else\n self.description_map[item] = if item.description.size>=30 then item.description[0..27] + \"...\" else item.description end\n end\n end\n }\n if match_all\n results.push(item)\n end\n }\n\n self.found_items = results\n if self.found_items.size == 0 and self.query.size >= 2\n suggest_other_query(items, query)\n end\n\n end", "def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end", "def render_items(items)\n @list.items = case @footer.filters.selected.value\n when :active\n items.reject { |item| item[:done] }\n when :completed\n items.select { |item| item[:done] }\n else\n items\n end.sort_by { |item| item[:text] }\n end", "def set_content_group_text_item\n @content_group_text_item = ContentGroupItem.find(params[:id]) \n end" ]
[ "0.6163128", "0.59985924", "0.5966603", "0.5940773", "0.5939429", "0.5900986", "0.57387614", "0.57221216", "0.5693845", "0.5664657", "0.56337833", "0.5633362", "0.5631914", "0.5605618", "0.56022465", "0.55933535", "0.55933535", "0.55933535", "0.55521554", "0.5495915", "0.5476574", "0.54239297", "0.5370128", "0.535303", "0.53516597", "0.5350856", "0.5343428", "0.53297716", "0.5320289", "0.53109676", "0.52952236", "0.5285856", "0.52834445", "0.5276597", "0.5272999", "0.5269682", "0.5249475", "0.5233171", "0.5227537", "0.5219407", "0.5209272", "0.52084285", "0.51920605", "0.51920605", "0.51895946", "0.51885873", "0.51811516", "0.51752764", "0.51673067", "0.51670164", "0.51651245", "0.51568395", "0.51568395", "0.5156777", "0.5152627", "0.514377", "0.51411116", "0.51315284", "0.51289856", "0.5126528", "0.5120709", "0.51183486", "0.51160663", "0.51144356", "0.51139414", "0.5113098", "0.5102766", "0.5093679", "0.5088841", "0.5088731", "0.50846756", "0.50763476", "0.50763077", "0.5070625", "0.5066269", "0.50660574", "0.5064886", "0.5061596", "0.5060427", "0.5060028", "0.50575924", "0.5056469", "0.5053391", "0.50532675", "0.5048542", "0.5043364", "0.50358176", "0.5033492", "0.50283545", "0.5027832", "0.5023306", "0.50230587", "0.5017066", "0.50155926", "0.50137234", "0.50101763", "0.49999696", "0.4988427", "0.49841192", "0.49835902", "0.49776092" ]
0.0
-1
GET /items/1 GET /items/1.xml
def show respond_to do |wants| wants.html # show.html.erb wants.xml { render :xml => @item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def xml(item)\n presenter.xml(item)\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\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 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 index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "def index\n @front_page = true\n @items_count = Item.count\n @items = Item.all.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def show\n @actionitem = Actionitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actionitem }\n end\n end", "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @stream_items = StreamItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stream_items }\n end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def item\n @item = Item.find(params[:id])\n end", "def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def index\n @current_item = \"my_account\"\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @accounts.to_xml }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def get(item)\n self.send(\"GET #{item}\")\n\n # Check for errors\n case @retcode\n when 0 then @retmesg # OK\n when 10 then nil # item doesn't exist\n else\n fail(\"Debconf: debconf-communicate returned #{@retcode}: #{@retmesg}\")\n end\n end", "def show\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end", "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def show\n @item_alias = ItemAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def output_xml(items)\n puts \"<?xml version=\\\"1.0\\\"?><items>\"\n items.each do |item|\n puts \"<item uid=\\\"#{item[\"uid\"]}\\\" arg=\\\"#{item[\"arg\"]}\\\">\n <title>#{item[\"title\"]}</title>\n <icon>icon.png</icon>\n <subtitle>#{item[\"subtitle\"]}</subtitle>\n </item>\"\n end\n puts \"</items>\" \n end", "def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @news_item.to_xml }\n end\n end", "def get(item)\n run(\"show #{ item }\")\n end", "def show\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop_item }\n end\n end", "def show\n @account = Account.find(params[:account_id])\n @account_item = @account.account_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_item }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n @stream_item = StreamItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stream_item }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @news_items = NewsItem.find(:all, :order => 'updated_at desc')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @news_items.to_xml }\n end\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def show\n @item = ItemTemplate.find(params[:id])\n @title = @item.name.titleize\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def get(pAuthToken, p_item_id, p_args)\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_get}#{p_item_id}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # verify user intention about related items, if :related_items flag is set\r\n # load all related items\r\n if p_args.nil? == false and p_args[:related_items] == true\r\n service_uri += \"&#{PARAM_LOAD_RELATED_ITEMS}=true\"\r\n\r\n # verify whether user has set any offset\r\n offset = p_args[:offset]\r\n unless offset.nil?\r\n service_uri += \"&offset=#{offset.to_s}\"\r\n end\r\n\r\n # verify whether user has set any maximum number of related items\r\n max = p_args[:max]\r\n unless max.nil?\r\n service_uri += \"&max=#{max}\"\r\n end\r\n\r\n # verify whether user has set the accepted relation types\r\n relation_types_array = p_args[:relation_types]\r\n unless relation_types_array.nil? and relation_types_array.empty?\r\n relation_types = \"\"\r\n relation_types_array.each do |relation_type|\r\n if relation_types.size > 0\r\n relation_types += \",\" + relation_type\r\n else\r\n relation_types += relation_type\r\n end\r\n end\r\n service_uri += \"&relation_types=#{relation_types}\"\r\n end\r\n end\r\n debug service_uri\r\n response = Net::HTTP.start(@@m_service_url.host,\r\n @@m_service_url.port) {|http|\r\n http.get(service_uri, {HEADER_COOKIE => @@m_cookies})\r\n }\r\n xml_content = response.body\r\n built_item = build_item(xml_content)\r\n debug(\"built item - #{built_item}\")\r\n return built_item\r\n end", "def show\n @nav_item = NavItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nav_item }\n end\n end", "def show\n @asset_item = AssetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_item }\n end\n end", "def show\r\n @item_type = ItemType.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def show\n @mail_item = MailItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def show\n @item_photos = ItemPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end" ]
[ "0.678745", "0.67821956", "0.67821956", "0.67821956", "0.67821956", "0.67821956", "0.67821956", "0.6725394", "0.6717308", "0.66033036", "0.6591751", "0.65765375", "0.65546113", "0.64771855", "0.64768195", "0.6447563", "0.6427009", "0.63991284", "0.6367221", "0.63387835", "0.6315538", "0.6297926", "0.6262323", "0.62607825", "0.6239059", "0.62387055", "0.6202355", "0.6200597", "0.6195371", "0.6195311", "0.6176181", "0.6173667", "0.61718863", "0.6163507", "0.61553127", "0.61553127", "0.61525005", "0.61490005", "0.6139443", "0.613538", "0.6130047", "0.6104681", "0.60992956", "0.6088392", "0.60623294", "0.6057781", "0.60544753", "0.60539573", "0.60530204", "0.60526556", "0.60410416", "0.6039279", "0.6012468", "0.60048115", "0.59989053", "0.5997615", "0.5993997", "0.59931105", "0.5980261", "0.59787697", "0.59773266", "0.5976352", "0.5973319", "0.5973319", "0.5964174", "0.5964174", "0.5964174", "0.5964174", "0.5961231", "0.5951755", "0.5936123", "0.59322625", "0.5923989", "0.59234095", "0.5919156", "0.59160113", "0.591413", "0.59127", "0.5907015", "0.59004724", "0.58994377", "0.58994377", "0.58994377", "0.58994377", "0.58994377", "0.58994377", "0.58994377", "0.58994377", "0.58954686", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734", "0.58880734" ]
0.6151696
37
GET /items/new GET /items/new.xml
def new @item = Item.create(:published => false, :page_id => params[:page_id]) #@item.page = Page.find(params[:page_id]) if params[:page_id] #@item.page.ttxes.count.times do @item.item_ttxes.build end #3.times do @item.gallery_photos.build #5.times do @item.colour_photos.build(:color => "ffffff") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def item\n @new = New.find(params[:id])\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 @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @ordered_item = OrderedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @item = Item.new\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.rjs\n format.xml { render :xml => @item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end", "def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @goods_item = Goods::Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @inventory_item = InventoryItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventory_item }\n end\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end", "def new\n @to_do_item = ToDoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @to_do_item }\n end\n end", "def new\n @nav_item = NavItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nav_item }\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 new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def new\n @auction_item = AuctionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "def new\n @item_alias = ItemAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @requisicion = Requisicion.new\n @[email protected]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requisicion }\n end\n end", "def new\n @item = current_user.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 new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @order = Order.new\n @items = OrderItem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @question_item = QuestionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_item }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @menu_item = MenuItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def new\n @menu_item = uhook_new_menu_item\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def new\n @shop_item = ShopItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop_item }\n end\n end", "def new\n @item_class = ItemClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_class }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @stock_item = StockItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_item }\n end\n end", "def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @material_item = MaterialItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @material_item }\n end\n end", "def new\n @item_catalog = ItemCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_catalog }\n end\n end", "def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end", "def set_new_item\n @new_item = NewItem.find(params[:id])\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @stream_item = StreamItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stream_item }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def new\n @portfolio_item = PortfolioItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio_item }\n end\n end", "def new\n @item_option = ItemOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_option }\n end\n end" ]
[ "0.7750405", "0.7721567", "0.7721567", "0.7721567", "0.7721567", "0.7721567", "0.7721567", "0.7721567", "0.7721567", "0.7674057", "0.7650397", "0.7624482", "0.7310945", "0.7224427", "0.7214633", "0.71571666", "0.7152413", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.7129221", "0.7129221", "0.7113735", "0.71053255", "0.709452", "0.70915234", "0.7070292", "0.7010604", "0.6997517", "0.6997517", "0.699483", "0.6989647", "0.6962315", "0.6950287", "0.6925482", "0.6925428", "0.6923494", "0.6923494", "0.69189775", "0.6915415", "0.6907549", "0.6894268", "0.6874881", "0.687417", "0.683855", "0.6833972", "0.6811353", "0.6807025", "0.6802822", "0.67999506", "0.6787933", "0.6779471", "0.67490417", "0.67291135", "0.6727892", "0.6718457", "0.67161024", "0.67145824", "0.67142606", "0.67023045", "0.66967815", "0.66915214", "0.6689704", "0.66760546", "0.66760546", "0.6667374", "0.6664618", "0.6662776", "0.66508657", "0.66508657", "0.66508657", "0.6641776", "0.6641776", "0.6610741", "0.66070956", "0.65938926", "0.65922964", "0.65917206", "0.65917206", "0.6586411", "0.6586276", "0.6584741", "0.6573925", "0.6571739" ]
0.0
-1
POST /items POST /items.xml
def create @item = Item.new(params[:item]) respond_to do |wants| if @item.save flash[:notice] = 'Item was successfully created.' wants.html { redirect_to(admin_items_url) } wants.xml { render :xml => @item, :status => :created, :location => @item } else wants.html { render :action => "new" } wants.xml { render :xml => @item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item(data, question_ids)\n xml = xml_root(\"items\")\n\n questions = question_ids.inject(XML::Node.new(\"questions\")) do |doc, id|\n question = XML::Node.new(\"question\")\n question[\"id\"] = id.to_s\n doc << question\n end\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"item\") << (XML::Node.new(\"data\") << name) << questions.copy(true))\n end\n\n send_and_process('items/add', 'items/item', xml)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end", "def api_post(method: nil, item: [], params: {})\n raise ArgumentError, 'Missing method in API request' unless method\n\n login(@host) if Time.new.to_i > @session_timeout\n\n request = {}\n request[:method] = method\n request[:params] = [[item || []], params.to_h]\n # This is how we create request params once all methods use structs\n # request[:params] = [[item || []], params.to_h]\n # We use a StandardError since it is based on the HTTP response code with a JSON payload definition\n begin\n resp = @http.post(@uri, request.to_json, @headers)\n JSON.parse(resp.body)['result']['result']\n rescue StandardError\n puts \"The following error has occurred #{JSON.parse(resp.body)['error']['message']}\"\n end\n end", "def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\n end", "def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, 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 item_params\n params.require(:item).permit(:name, :value)\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\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\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end", "def item_params\n params.require(:item).permit(:name, :tag_list, :type_list, :description)\n end", "def item_params\n params.require(:item).permit(:title, :body)\n end", "def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end", "def create\n @item = Item.new(item_params)\n \n respond_to do |format|\n if @item.save \n format.html { redirect_to @item, 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 writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend", "def create\n @apiv1_item = Item.new(apiv1_item_params)\n\n respond_to do |format|\n if @apiv1_item.save\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @apiv1_item }\n else\n format.html { render :new }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @items_mob = ItemsMob.new(params[:items_mob])\n\n respond_to do |format|\n if @items_mob.save\n flash[:notice] = 'ItemsMob was successfully created.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :created, :location => items_mob_url(@items_mob) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end", "def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n @item.save_info\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 @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', 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 @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def item_params\n params.require(:item).permit(:name)\n end", "def item_params\n params.require(:item).permit(:name)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ordered_item = OrderedItem.new(params[:ordered_item])\n\n respond_to do |format|\n if @ordered_item.save\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully created.') }\n format.xml { render :xml => @ordered_item, :status => :created, :location => @ordered_item }\n format.json { render :json => @ordered_item, :status => :created, :location => @ordered_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_item\n #params[item_id]\n end", "def item_params\n params.require(:item).permit!\n end", "def create\r\n @item = Item.new(params[:item])\r\n if @item.save\r\n redirect_to @item, notice: 'Item was successfully created.'\r\n else\r\n render action: \"new\"\r\n end\r\n end", "def create\n @question_item = QuestionItem.new(params[:question_item])\n\n respond_to do |format|\n if @question_item.save\n format.html { redirect_to(@question_item, :notice => 'Question item was successfully created.') }\n format.xml { render :xml => @question_item, :status => :created, :location => @question_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n # @item.build_note\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n respond_with(@items)\n end\n end\n end", "def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :type_id, :user_id)\n end", "def create\n @item = Item.new(params[:item])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :url, :price, :container)\n end", "def create\n @item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end", "def create\n @item = @list.items.build(item_params)\n @item.user = current_user\n\n if @item.save\n return success_item_create\n else\n return error_item_save\n end\n end", "def create\n @instancia_item = InstanciaItem.new(params[:instancia_item])\n\n respond_to do |format|\n if @instancia_item.save\n format.html { redirect_to(@instancia_item, :notice => 'Instancia item was successfully created.') }\n format.xml { render :xml => @instancia_item, :status => :created, :location => @instancia_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instancia_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def item_params\n params.require(:item).permit(:name, :price, :date, :user_id, :group_id, :item_type, { tag_ids: [] })\n end", "def create\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n flash[:notice] = 'O item foi criado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n error_respond(format, \"new\");\n end\n end\n end", "def create\n @order_item = OrderItem.new(order_items_params)\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: \"Order item was successfully created.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entry }\n end\n end\n end" ]
[ "0.6878987", "0.68121386", "0.6461912", "0.6385658", "0.63709396", "0.63393664", "0.63393664", "0.6333269", "0.6326739", "0.6326739", "0.6207085", "0.617964", "0.61328024", "0.6087989", "0.60817254", "0.60677546", "0.60674924", "0.6064618", "0.6062312", "0.6056173", "0.60460603", "0.603753", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60352844", "0.6033661", "0.6028079", "0.6024467", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.60130453", "0.5970512", "0.5967576", "0.5961362", "0.5958295", "0.59548736", "0.5951618", "0.5948807", "0.5929945", "0.5928832", "0.59223294", "0.59093016", "0.5907063", "0.5907063", "0.5907063", "0.5907063", "0.5907063", "0.59040564", "0.59016395", "0.58971214", "0.5890969", "0.5888336", "0.5856993", "0.58496875", "0.5843399", "0.5830667", "0.581636", "0.580811", "0.5797268", "0.5797105", "0.5794647", "0.5789113", "0.57856816", "0.5777197", "0.5767775", "0.5766641", "0.57632524", "0.574645", "0.5746136", "0.5745855", "0.5727223", "0.57190925", "0.5713327", "0.57126015", "0.5712485", "0.57120353", "0.57078344", "0.5705289", "0.5700787", "0.5696946", "0.5687106" ]
0.62712324
10
PUT /items/1 PUT /items/1.xml
def update respond_to do |wants| if @item.update_attributes(params[:item]) flash[:notice] = 'Item was successfully updated.' wants.html { redirect_to(admin_items_path) } wants.xml { head :ok } else wants.html { render :action => "edit" } wants.xml { render :xml => @item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\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(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item.update!(item_params)\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_apiv1_item\n @apiv1_item = Item.find(params[:id])\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def set_api_v1_item\n @api_v1_item = Item.find(params[:id])\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(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 respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Artikel is succesvol ge-update.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n item = Item.find(params[:item_id])\n\n item.name = params[:name]\n item.details = params[:details]\n item.save\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :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\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item 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: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 @item, 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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, 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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\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 @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n if @ordered_item.update_attributes(params[:ordered_item])\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\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 item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\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(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @swap_item = SwapItem.find(params[:id])\n\n respond_to do |format|\n if @swap_item.update_attributes(params[:swap_item])\n format.html { redirect_to :back }\n format.xml { head :ok }\n else\n format.html { redirect_to :back }\n format.xml { render :xml => @swap_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_item(table_name, item)\n params = {\n table_name: table_name,\n item: item,\n return_values: \"NONE\",\n }\n $client.put_item(params)\n return item\nend", "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(retrospective_path(@item.section.retrospective), :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(list, item, qty)\n add_item(list, item, qty)\nend", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, 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 @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n if @goods_item.update_attributes(params[:goods_item])\n format.html { redirect_to(@goods_item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\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, status: :unprocessable_entity }\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 @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, status: :unprocessable_entity }\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 @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, status: :unprocessable_entity }\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 @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, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @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 @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' 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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def updated(item)\n end", "def update\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 @item.save_info\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 respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\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 @action_item = ActionItem.find(params[:id])\n\n respond_to do |format|\n if @action_item.update_attributes(params[:action_item])\n format.html { redirect_to(@action_item, :notice => 'Action item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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" ]
[ "0.6631222", "0.6629836", "0.66213", "0.6536519", "0.6495193", "0.6495193", "0.6495193", "0.6462979", "0.6444372", "0.6438877", "0.6438877", "0.64248157", "0.63908964", "0.6354812", "0.63242704", "0.63229805", "0.6300457", "0.62652194", "0.62466425", "0.6228893", "0.62224233", "0.6214756", "0.6193574", "0.616325", "0.61564624", "0.61491054", "0.6129873", "0.61252767", "0.61245066", "0.6122936", "0.61077696", "0.61034954", "0.6099023", "0.606325", "0.60547066", "0.6043807", "0.6043807", "0.6027538", "0.60233366", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60225046", "0.60035", "0.59715724", "0.5970441", "0.5964827", "0.59305996", "0.591434", "0.591434", "0.59137803", "0.5912435", "0.58921313", "0.5885961", "0.5879081", "0.58764535", "0.5873766", "0.58637685", "0.58585966", "0.5854152", "0.5848359", "0.5848359", "0.5848359", "0.5848359", "0.58479017", "0.58474123", "0.5846705", "0.5841612", "0.5839403", "0.58296907", "0.5826771", "0.5826172", "0.58188486", "0.58188045", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777", "0.5818777" ]
0.62116754
22
DELETE /items/1 DELETE /items/1.xml
def destroy @item.destroy respond_to do |wants| wants.html { redirect_to(admin_items_url) } wants.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @course.items.find(:first, :conditions => ['lower(name) = ?', params[:id].downcase.gsub('_', ' ')])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_items_url(@course)) }\n format.xml { head :ok }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def delete_item\n\nend", "def destroy\n @item = @project.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_items_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(item_ids = [])\n body = { itemIds: item_ids }\n Iterable.request(conf, base_path).delete(body)\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @ordered_item = OrderedItem.find(params[:id])\n @ordered_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordered_items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def deleted(item)\n end", "def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\n end\n end", "def deleteItems\n self.items.each do |item|\n item.delete\n end\n end", "def delete\n @@all_items.delete(@id)\n end", "def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def destroy\n @mail_item = MailItem.find(params[:id])\n @mail_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(mail_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_item = QuestionItem.find(params[:id])\n @question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n \t@item = Item.find(params[:id])\n \[email protected]\n \tredirect_to :action => 'index'\n\tend", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy(item)\n raise StandardError unless @mode == :update\n @attached.delete(item)\n @remove_file.puts(XML.generate({ :id => item.is_a?(String) ? item : item.id }, false))\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_item = AuctionItem.find(params[:id])\n @auction_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @items_mob = ItemsMob.find(params[:id])\n @items_mob.destroy\n\n respond_to do |format|\n format.html { redirect_to items_mobs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_alias = ItemAlias.find(params[:id])\n @item_alias.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_aliases_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(item)\r\n @list.delete(item)\r\n end", "def destroy\n @receiving_item = ReceivingItem.find(params[:id])\n @receiving_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(receiving_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy!\n end", "def destroy\n @inventory_item = InventoryItem.find(params[:id])\n @inventory_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_with @item\n end", "def destroy\n @news_items = NewsItem.find(params[:id])\n @news_items.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_items_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.70774895", "0.70774895", "0.70774895", "0.70774895", "0.70774895", "0.70774895", "0.70688236", "0.70301396", "0.689336", "0.68701774", "0.683731", "0.68249005", "0.6819569", "0.68018186", "0.67970824", "0.6779381", "0.6778662", "0.6771514", "0.6748655", "0.67484534", "0.6708623", "0.6708096", "0.66860795", "0.66783786", "0.6665696", "0.6587462", "0.6584799", "0.65688527", "0.65628475", "0.655442", "0.65477806", "0.6531394", "0.6516841", "0.65057516", "0.6505255", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.65049607", "0.650431", "0.65016687", "0.6501214", "0.6487849", "0.64869064", "0.6482694", "0.6473235", "0.64689714", "0.64444244", "0.64432156", "0.6442602", "0.64337975", "0.6427495", "0.64216346", "0.6413783", "0.6411932", "0.64066225", "0.63984394", "0.6394429", "0.6390696", "0.63905275", "0.6375429", "0.6374535", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.6359223", "0.635537", "0.63495004", "0.6349308", "0.6346535", "0.63300294", "0.63299686", "0.6328247", "0.6325199", "0.63211817", "0.63194233", "0.63173187", "0.63076466", "0.6301619", "0.6298121", "0.62937456", "0.62912977", "0.62866163" ]
0.6738314
20
If you want to add new category, please make new method
def check_config data = merge_yaml_data(@@config_dir) @rule_data = merge_yaml_data(@@rule_config_dir) actual = make_key_chain(data) expect = make_key_chain(@rule_data) diff = diff_arr(expect, actual) make_message(diff) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_category\n end", "def uhook_create_category\n category = ::Category.new(params[:category])\n category.locale = current_locale\n category\n end", "def add_category params\n cat = validate_and_store :category, params\n cat ? category_key(cat) : nil\n end", "def add_cat(name_en, name_nl)\n c = Category.new(name_en: name_en, name_nl: name_nl)\n c.save!\nend", "def add_category(*category)\n unless category.blank?\n what.query.add(:categories) << category.flatten\n changed\n end\n end", "def addCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.new(name: params[:name])\n status = c.save\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def add_category(category)\n category = CategoryNamer.prepare_name(category)\n @backend.add_category(category)\n end", "def add_category(category_id)\n if !category_id.nil? && !(category = Category.find(category_id)).nil?\n categories << category unless categories.include?(category)\n end\n end", "def add_category(storyDict, category)\n\tif not storyDict[category] #----> 2\n\t\tstoryDict[category] = []\n\t\tresult = \"New Category\"\n\telse\n\t\tresult = \"Existing Category\"\n\tend\n\n\t# Returns if the category was new or not\n\treturn result\nend", "def category; end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Категория добавлена.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_category category\r\n raise TypeError unless category.class == SettingsCategory\r\n self[category.name] = category\r\n end", "def create_category(category_node)\n url = category_node.xpath(\"./a[1]/@href\").text\n name = url.sub(URL,'').delete('/')\n name_ru = category_node.xpath(\"./a[last()]\").text\n is_new = category_node.xpath(\"./a[2]/img[@class='img_new']\").any?\n Category.create(name: name, name_ru: name_ru, url: url, is_new: is_new)\n end", "def category(category)\n self.category = category\n self\n end", "def category(category)\n self.category = category\n self\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def add_category(category)\n @categories ||=[]\n @categories << category unless @categories.index(category)\n end", "def add_category(category)\n raise ArgumentError unless category.class <= Categories::Base\n @categories << category\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_categories_url, notice: 'Добавлена новая категоря.' }\n else\n format.html { render :new }\n end\n end\n end", "def set_add_category_to_post\n @add_category_to_post = AddCategoryToPost.find(params[:id])\n end", "def add_category(category_name)\n category = Category.new(:name => category_name)\n if category.save\n notify \"Created category: #{category_name}\"\n else\n error_string = \"Error creating category\"\n unless category.valid?\n category.errors.each { |k,v| error_string << \"\\n#{k}: #{v}\" }\n end\n notify error_string\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_category\n @category = GoodCategory.find(params[:id])\n end", "def category_new\n @finance_transaction_category = FinanceTransactionCategory.new\n end", "def new\n # category instance\n @category = Category.new\n end", "def create\n @category = Category.create(params[:category])\n \n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n \n end", "def set_category\n @category = LibraryCategory.find_by(:object_key => params[:library_category_id])\n\n add_breadcrumb @category.name, library_category_path(@category)\n end", "def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end", "def create_category(cat_name)\n category = Spree::Taxonomy.where(name: 'Categories').first\n category = Spree::Taxonomy.create(name: 'Categories') if category.nil?\n taxon = Spree::Taxon.find_by(name: cat_name, taxonomy_id: category.id)\n if taxon.present?\n spree_taxons.append(taxon)\n else\n taxon = Spree::Taxon.new(name: cat_name, taxonomy_id: category.id, parent_id: category.root.id)\n if taxon.save\n spree_taxons.append(taxon)\n else\n Rails.logger.info \"Error! #{taxon.errors.full_messages}\"\n end\n end\n end", "def new\n @category = Category.new(position: Category.current.count + 1)\n end", "def set_category\n @categories = Category.friendly.find(params[:id])\n end", "def set_category\n @category = params[:id] ? Category.find(params[:id]) : Category.new(category_params)\n end", "def new\n\t\t@category = Category.new\n\tend", "def new\n\t\t@category = Category.new\n\tend", "def category_name=(name)\n self.category = Category.find_or_create_by(name: name)\n self.save\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def set_category\n @category = Category.friendly.find(params[:id])\n end", "def new\n \t@category =Category.new\n end", "def category\n super\n end", "def create\n @category = @section.dish_categories.build(params[:dish_category])\n if @category.save\n redirect_to (params[:commit] == \"Сохранить\" ? [:admin, @section, :dish_categories] : [:edit, :admin, @section, @category]), notice: 'Категория успешно добавлена.'\n else\n render action: \"edit\"\n end\n\n end", "def set_category\r\n @category = Category.find(params[:id])\r\n end", "def add_categories_into_items(category_id)\n client = create_db_client\n client.query(\"insert into item_categories values (#{@id}, #{category_id})\")\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Категория была успешно создана'}\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n \t@category = Category.new\n end", "def set_category\n @categories = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def create\n \n @category = Category.new(category_params)\n @category.category = @category.category.strip\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n \n \n end", "def set_category\n @category = Category.find(params[:id])\n end", "def create\n @category = Category.new(params[:category])\n @category.category_group_id ||= params[:category_group_id]\n\n respond_to do |format|\n if @category.save\n save_curated_items(@category)\n format.html { redirect_to(categories_path, notice: 'Category was successfully created.') }\n format.json { render json: @category, status: :created, location: @category }\n else\n set_flash_messages_from_errors(@category)\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def category_name=(name)\n self.category = Category.find_or_create_by(name: name)\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def create\n @category = Category.new(params[:category].permit(:name, :category_id))\n\n if @category.save\n redirect_to [:admin, @category]\n end\n end", "def set_category\n @category = Category.find_by(id: params[:id])\n end", "def create\n @category.family = current_user.family\n authorize! :create, @category\n if @category.save!\n flash[:notice] = \"Категория успешно добавлена\"\n else\n flash[:alert] = \"Ошибка добавления категории трат: #{@category.errors.full_messages}\"\n end\n\n respond_to do |format|\n format.html { redirect_to categories_path }\n end\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def add_category\n @product = Product.find(params[:product_id])\n @product.add_category(params[:category_id])\n respond_to do |format|\n format.html { redirect_to product_path(@product) }\n format.js { render :json => {:action => \"add\"} }\n end\n end", "def add_category(project_id_or_key, name)\n post(\"projects/#{project_id_or_key}/categories\", name: name)\n end", "def create\n\t\t@category = Category.new(category_params)\n\t\[email protected] = current_user\n\t\tif(category_params[:titulo] == \"Geral\")\n\t\t\[email protected] = \"Geral (nova)\"\n\t\tend\n\t\trespond_to do |format|\n\t\t\tif @category.save\n\t\t\t\tformat.html { redirect_to @category, notice: 'Category criada com sucesso!' }\n\t\t\t\tformat.json { render :show, status: :created, location: @category }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @category.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def buy_cat(cat_name)\n self.cats << Cat.new(cat_name,self)\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def new\n @category = Category.new\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end", "def set_category\n @category = Category.find(params[:id])\n end" ]
[ "0.8053537", "0.77390367", "0.7692365", "0.75559205", "0.7553034", "0.7442568", "0.7413503", "0.7392762", "0.7377145", "0.732621", "0.7304141", "0.72734666", "0.7242457", "0.7212821", "0.7212821", "0.7208786", "0.71838903", "0.7177043", "0.7136694", "0.7134516", "0.7131486", "0.7096187", "0.70830935", "0.7053201", "0.70495754", "0.7046832", "0.7042319", "0.70422995", "0.70362", "0.7032412", "0.7015564", "0.69994974", "0.6979956", "0.6979956", "0.6979582", "0.6974449", "0.6974449", "0.6974449", "0.6974449", "0.6974449", "0.6974449", "0.6974449", "0.6971824", "0.6971824", "0.69691414", "0.69664013", "0.69396186", "0.69340974", "0.6930801", "0.6928566", "0.6921701", "0.6913867", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6905196", "0.6903364", "0.6899578", "0.68968904", "0.6896501", "0.68936884", "0.6889382", "0.6879925", "0.68753713", "0.6870959", "0.6855135", "0.68484026", "0.68478394", "0.68420136", "0.68364024", "0.6835148", "0.68263215", "0.68263215", "0.68263215", "0.68263215", "0.68263215", "0.68263215", "0.68263215", "0.68263215", "0.68227345", "0.68227345", "0.68227345", "0.68227345", "0.68227345", "0.68227345" ]
0.0
-1
Merge yaml in target directory.
def merge_yaml_data(dir) data_output = {} file_sort_hierarchy(dir).each do |file| data = load_yaml(file) data_output.merge!(data) unless data.empty? end data_output.any? ? data_output : (raise StandardError, "No key! please check the directory existence [#{dir}]") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n end", "def load_config\n create_yolo_dir\n unless File.exist?(yaml_path)\n @formatter.config_created(yaml_path)\n FileUtils.cp_r(File.dirname(__FILE__) + \"/config.yml\", yaml_path)\n end\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 copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end", "def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end", "def copy_config_files\n copy_file 'config/arkivo.yml', 'config/arkivo.yml'\n copy_file 'config/zotero.yml', 'config/zotero.yml'\n end", "def load_vms_dir(dirpath, vagrant_config)\n Dir.glob(dirpath) do |filepath|\n namespace = File.basename(filepath, \".*\") # stackfilename\n vms_file = load_yaml(filepath)\n vms_file.each do |key, value| \n vm_config = value\n vm_config['lib'] = vm_config['lib'] || {}\n vm_config['lib']['namespace'] = namespace\n vm_config['lib']['key'] = \"#{key}\"\n vm_hash_id = \"#{vm_config['lib']['key']}.#{vm_config['lib']['namespace']}\"\n # puts \"resolving #{vm_hash_id}\"\n unless value['definition'].to_s.empty?\n if $definitions[value['definition']]\n # puts \"#{vm_hash_id} has #{value['definition']}\"\n definition = $definitions[value['definition']]\n vm_config = definition.deep_merge(vm_config)\n end\n end\n if $vms[vm_hash_id]\n # puts \"merging #{vm_hash_id}\"\n vm_config = $vms[vm_hash_id].deep_merge(vm_config)\n else\n # puts \"not merging #{vm_hash_id}\"\n end\n if $user\n vm_config = $user.deep_merge(vm_config)\n end\n $vms[vm_hash_id] = vm_config\n end\n end\nend", "def copy_file(file_name, existing_data)\n data = YAML.load_file(file_name)\n\n new_data = process_data(data)\n\n existing_data.concat(new_data)\n\n #file = File.open(new_file_name, 'w')\n #file.puts new_data.to_yaml\n #file.close\nend", "def merge srcdir, dstfile\n FileUtil.copy_merge(@hdfs, Path.new(srcdir), @hdfs, Path.new(dstfile), false, @conf, \"\")\n end", "def merge srcdir, dstfile\n FileUtil.copy_merge(@hdfs, Path.new(srcdir), @hdfs, Path.new(dstfile), false, @conf, \"\")\n end", "def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end", "def edit_yaml(yaml_location, &block)\n d = YAML.load_file(yaml_location)\n block.call(d)\n File.open(yaml_location, 'w') {|f| f.write d.to_yaml }\n end", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def yaml(*files, **options, &block) = read(*files, parse: :yaml, ext: ['.yml', '.yaml'], **options, &block)", "def modify_yaml_for_testing(yaml_path)\n puts \"Modifying yaml for testing\"\n yaml_file = yaml_path + \"/bf.config.yaml\"\n c_path = Dir.pwd\n c_path.slice!(/\\/test$/)\n\n bf_config = File.open(yaml_file).read\n bf_config.gsub!(/\\/h\\/hsap.36.1.hg18\\/hsap_36.1_hg18.fa/, \"/t/test/test.fa\")\n bf_config.gsub!(%r{h/hsap.36.1.hg18/bwaaln/hsap_36.1_hg18.fa}, \n \"/t/test/bwaaln/test.fa\")\n %w{28000 8000 4000}.each {|n| bf_config.gsub!(/#{n}/, \"400\") }\n %w{8g 4g}.each {|n| bf_config.gsub!(/#{n}/, \"1g\") }\n \n bf_config.gsub!(/dist_dir:.+$/, \"dist_dir: #{c_path}\")\n bf_config.gsub!(/reads_per_file:.+$/, \"reads_per_file: 480\")\n\n # Send email only to the user that is testing this\n user=`id -u -n`.chomp\n bf_config.gsub!(/email_to:.+$/, \"email_to: #{user}@bcm.edu\")\n\n File.open(yaml_file, \"w\") {|f| f.write(bf_config)}\nend", "def load\n config_files.each do |file|\n config = YAML::load(File.open(file))\n @config.merge! config\n end\n end", "def config_to_yaml(destination_directory = nil)\n destination_directory = Pkg::Util::File.mktemp if destination_directory.nil?\n config_yaml_file_name = \"#{self.ref}.yaml\"\n\n config_yaml_path = File.join(destination_directory, config_yaml_file_name)\n\n Pkg::Util::File.file_writable?(File.dirname(config_yaml_path), :required => true)\n File.open(config_yaml_path, 'w') do |f|\n f.puts self.config_to_hash.to_yaml\n end\n puts config_yaml_path\n return config_yaml_path\n end", "def update\n\t\t\tpath = File.join(Config[:lists_directory], @name.downcase.gsub(/ /, '_') +'.yml')\n\t\t\tFile.open(path, 'w') do |fh|\n\t\t\t\tfh.puts(self.to_yaml)\n\t\t\tend\n\t\tend", "def load(filename)\n files= filename.include?(',') ? filename.split(',') : [filename]\n @yml = files.inject({}) do |total_merge,file|\n total_merge.merge!(::YAML.load(ERB.new(File.read(\"#{yml_directory}/#{file}\")).result(binding)))\n end\n end", "def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end", "def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end", "def update_config\n if File.exist?(config_file) then\n puts \"updating #{config_file}\"\n config = YAML.load_file(config_file)\n else\n puts \"generating #{config_file}\"\n config = {}\n end\n\n files = Dir.glob(File.join(libdir, '**', \"rbconfig.rb\")).sort\n\n files.each do |rbconfig|\n version = rbconfig.match(/.*-(\\d.\\d.\\d)/)[1]\n config[\"rbconfig-#{version}\"] = rbconfig\n puts \"Found Ruby version #{version} (#{rbconfig})\"\n end\n\n mkdir_p(File.dirname(config_file))\n\n File.open(config_file, 'w') do |f|\n f.puts(config.to_yaml)\n end\n end", "def load_yaml_files\n @room_list = YAML.load_file(__dir__ + '/rooms.yml')\n @weapon_list = YAML.load_file(__dir__ + '/weapons.yml')\n @enemy_list = YAML.load_file(__dir__ + '/enemy.yml')\n @high_score_list = YAML.load_file(__dir__ + '/high_score.yml')\n end", "def copy_database_yml\n unless File.exists?(\"config/database.yml\")\n puts \"Copying database.yml...\"\n system \"cp config/database-sample.yml config/database.yml\"\n end\nend", "def local_clear_yaml(pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend", "def local_clear_yaml(pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend", "def load_yaml(yaml_file, merge = nil)\n raise ArgumentError, \"Cannot find file #{yaml_file}\" unless File.exist?(yaml_file)\n raise ArgumentError, \"Cannot find file #{merge}\" unless merge.nil? || File.exist?(merge)\n unless merge.nil?\n merge_data = YAML.load_file(merge)\n merge_data.each do |key, value|\n self.set(key, value)\n end\n end\n proc = YAML.load_file(yaml_file)\n @id = proc['id']\n @description = proc['description']\n proc['properties'].each do |key, value|\n self.set(key, value)\n end\n end", "def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end", "def yaml_files\n file_list('{,puppet/}{,hiera}data/**/*.{yaml,eyaml}') +\n file_list('config/**/*.yml')\n end", "def load_yaml(path)\n YAML.load_file File.expand_path(\"../#{path}\", File.dirname(__FILE__))\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 yaml\n copy = {}\n @lock.synchronize do\n copy.merge!(@yaml)\n end\n copy\n end", "def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end", "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def copy_config_file\n copy_file \"theme.yml\", \"config/theme.yml\"\n end", "def merge_i18n(barclamp)\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if DEBUG\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\n end", "def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end", "def copy_configs\n template \"config/compass.rb\"\n template \"config/html5_rails.yml\"\n end", "def local_clear_yaml(news_pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(news_pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend", "def merge_i18n(barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if debug\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\nend", "def dump_yaml(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t data = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"dump_yaml() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # serialize the file\n\t # \n\t File.open(output_path, 'w') {|f| f.write data.to_yaml }\n\tend", "def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend", "def add_yaml(filename)\n assessment = YAML.load(File.open(filename))\n add_assessment(assessment)\n end", "def set_yaml\n if @parent\n @yaml.has_key?(@parent) ? set(defaults.recursive_merge(@yaml[@parent])) : raise(Configarrr::OptionError, \"Please provide a valid parent value. #{@parent} does not exist.\")\n else\n set defaults.recursive_merge(@yaml)\n end\n end", "def copy_stage_config\n run \"if [ -f #{release_path}/config/stage_configs/#{stage}.rb ]; then cp #{release_path}/config/stage_configs/#{stage}.rb #{release_path}/config/environments/stage.rb; fi\"\n end", "def write_to_yaml_file(dest_path = nil)\n if dest_path.nil?\n file = Tempfile.new('config')\n file.close\n dest_path = file.path\n # deleting temp file but reusing file name. This is to avoid premature garbage collection.\n file.unlink\n end\n File.open(dest_path, 'w') do |f|\n f.write(@config.to_yaml)\n end\n dest_path\n end", "def update\n tmp_file = Rails.root.join('tmp', 'deployment-rc.yml')\n self.to_file tmp_file\n self.class.replace tmp_file\n end", "def load_yaml(filename); end", "def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end", "def load_yaml(base=ENV['PWD'], env=\"active\")\n env = \"dev\" if env == \"active\" and not File.exist? \"#{base}/opt/active\"\n @data = ::YAML.load_file(\"#{base}/opt/#{env}/config.yaml\")\n end", "def install(template)\n # Load & parse\n return false unless ( File.exists?(template) && \n YAMLDoc::YAMLFile.template?(template) )\n\n target = associated_filename(template)\n\n documents = YAMLDoc::Parser.load_file(template)\n\n # Validate (only proceed if all pass)\n return false unless YAMLDoc::Validator.validate_documents(documents)\n \n # Generate YAML\n yaml = documents.map { |d| d.to_yaml }.join(\"\\n\")\n\n # Write to file\n File.open(target, 'w+') { |f| f << yaml }\n end", "def merge_builds merged_build\n FileUtils.mkdir_p @temp_root\n debug_msg \"Merging #{merged_build}\"\n require \"sdoc/merge\"\n \n tmp = temp_dir\n target = File.join @public_dir, merged_build.to_s\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n urls = merged_build.builds.map do |build|\n '../' + build.to_s\n end.join(' ')\n \n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n options << '--urls' << urls\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n FileUtils.rm_rf target if File.exists? target\n FileUtils.cp_r File.join(tmp, '.'), target, :preserve => true \n \n zip_tmp = merge_zip merged_build\n FileUtils.cp File.join(zip_tmp, 'rdoc.zip'), target, :preserve => true\n clean_up\n end", "def merge(*args)\n options = Hash === args.last ? args.pop : {}\n files = to_artifacts(args)\n rake_check_options options, :path\n raise ArgumentError, \"Expected at least one file to merge\" if files.empty?\n path = options[:path] || @path\n expanders = files.collect do |file|\n @sources << proc { file.to_s }\n expander = ZipExpander.new(file)\n @actions << proc do |file_map, transform_map|\n file.invoke() if file.is_a?(Rake::Task)\n expander.expand(file_map, transform_map, path)\n end\n expander\n end\n Merge.new(expanders)\n end", "def generate_staging_config(url, config)\n staging = {'domain' => url, 'baseurl' => url,\n 'assets' => {'baseurl' => \"#{url}/assets\"}}\n File.open(config, 'w') { |f| f.write staging.to_yaml }\nend", "def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend", "def convert_config_file(file)\n print \"Converting: #{File.basename(file)}...\"\n dest_file = file.gsub(\".yml\", \".rb\").gsub('app_config', 'configatron')\n bak_file = file\n hash = YAML.load(File.read(file))\n config_list = (hash) ? hash_to_configatron(hash) : []\n data = \"\"\n config_list.each do |line|\n line = update_data(line)\n data += (line + \"\\n\")\n end\n FileUtils.mkdir_p(File.dirname(dest_file))\n File.open(dest_file, \"w\") { |f| f.write(data.to_s) }\n puts \"done.\"\nend", "def merge_config_file(site)\n required = [TITLE_KEY, DESC_KEY, GITHUB_KEY, SEARCH_KEY, URL_KEY]\n optional = [ORG_KEY]\n\n original_url = site.config[URL_KEY]\n\n customizations = YAML.load_file(GUIDE_CONFIG)\n if customizations\n required.each do |k|\n site.config[k] = customizations[k]\n end\n\n optional.each do |k|\n if customizations.key?(k)\n site.config[k] = customizations[k]\n end\n end\n\n # Per https://jekyllrb.com/docs/variables/, Jekyll will set\n # the url at runtime in dev environments -- preserve, if set\n if original_url\n site.config[URL_KEY] = original_url\n end\n end\n puts \" Merged \" + GUIDE_CONFIG\n end", "def update_params_yaml\n if File.exist?(\"#{Ufo.root}/.ufo/params.yml\")\n update_params_yaml_existing\n else\n update_params_yaml_new\n end\n end", "def add_teams\n Dir['teams/*.yml'].each do |team|\n t = YAML.load_file team\n Team.create name: t['name'], members: t['members']\n end\nend", "def merge_local_with_api(filename)\n project = YAML.safe_load_file(filename)\n api_data = JSON.parse(open(\"_data/projects/all.json\").read)\n unless project.nil?\n new_data = update_from_api(project, api_data[project['name']])\n end\nend", "def deploy_config_files(path, config_files = Rake::FileList.new(\"#{@base}/*.yml\"))\n config_files.each do |config_file|\n config_file_path = File.join(path, File.basename(config_file))\n @logger.info \"Deploying #{config_file} to #{config_file_path}\"\n cp config_file, config_file_path, :verbose => @verbose\n end\n end", "def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end", "def config_for_yaml(opts = {})\n path = opts[:yaml] || fixture('app_config.yml')\n config_for({ yaml: path }.merge(opts))\n end", "def load_settings\n attributes = YAML.load_file(\"defaults.yml\")\n begin\n custom_attributes = YAML.load_file(\"config.yml\")\n attributes = simple_deep_merge(attributes, custom_attributes)\n rescue\n end\n attributes\nend", "def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end", "def save\n File.write(yfile, to_yaml)\n end", "def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end", "def yaml_files\n Dir.glob(root.join(\"{test,spec}/fixtures/**/*.{yaml,yml}\").to_s)\n end", "def fetch_sync_yml\n if @owner == Pluginsync::Github::INTEL_ORG\n path = File.join(Pluginsync::PROJECT_PATH, 'config_defaults.yml')\n config = Pluginsync::Util.load_yaml(path)\n config.extend Hashie::Extensions::DeepMerge\n config.deep_merge(yml_content('.sync.yml'))\n else\n {}\n end\n end", "def merge_with_default(config, config_file, unset_nil:); 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 yaml_path\n \"#{user_directory}/.yolo/config.yml\"\n end", "def setup\n preference_file = \"#{defaults[:root_dir]}/config.yml\"\n preferences = {}\n if File.exists? preference_file\n require 'yaml'\n File.open(preference_file) { |file| preferences = YAML.load(file) }\n end\n base_file_variations(absolute_paths(defaults.merge(preferences)))\n end", "def store(dir,resume)\n if File.exists?(dir)\n rm(Dir.glob(\"#{dir}/*.yaml\"))\n else\n mkdir(dir)\n end\n File.open(\"#{dir}/resume.yaml\",'w') { |out| YAML::dump(resume.core,out) }\n dump(dir,\"experience\",resume.experience)\n dump(dir,\"education\",resume.education)\n dump(dir,\"reference\",resume.references)\n dump(dir,\"samples\",resume.samples)\n File.open(\"#{dir}/skills.yaml\",'w') { |out| YAML::dump(resume.skills,out) }\n end", "def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end", "def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end", "def load_definitions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n definitions = load_yaml(item)\n definitions.each do |key, value|\n definition_key = \"#{key}.#{namespace}\"\n if $definitions[definition_key]\n $definitions[definition_key] = $definitions[definition_key].deep_merge(value)\n else\n $definitions[definition_key] = value\n end\n end\n end\n log_to_file(\"_definitions.yaml\", $definitions.sort_by_key(true).to_h.to_yaml)\nend", "def atomic_write(data, path, name, options = {})\n main_file = File.join(path, name) + '.yml'\n dup_file = File.join(path, name) + '.yml2'\n \n # append verification info at the end of the file to guard from incomplete writes\n ts = Time.now\n ts_checksum = Digest::MD5.hexdigest(\"#{ts.tv_sec}.#{ts.tv_usec}\")\n if options[:owner]\n # secure the file\n File.open(dup_file, 'w').close\n uid = uid_for_username options[:owner]\n gid = gid_for_username options[:owner]\n File.chown uid, gid, dup_file\n File.chmod options[:permissions] || 0660, dup_file\n end\n File.open(dup_file, 'w') { |f| YAML::dump [data, ts.tv_sec, ts.tv_usec, ts_checksum], f }\n \n # move the file atomically to the main copy\n FileUtils.mv(dup_file, main_file)\n end", "def update_yaml_setting(yaml, key, setting, default)\n unless yaml[key][setting]\n yaml[key][setting] = default\n File.open(yaml_path, 'w') {|f|\n f.write(yaml.to_yaml)\n }\n @formatter.config_updated(yaml_path)\n end\n end", "def save( directory )\n File.open( \"parsed_data/#{directory}.yaml\", 'w' ) do |f|\n f.write( @pages.to_yaml )\n end\n end", "def load_yaml(file, default={})\n default.merge(YAML.load_file(file))\n end", "def load_provisions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n provisions = load_yaml(item)\n provisions.each do |key, value|\n provision_key = \"#{key}.#{namespace}\"\n if $provisions[provision_key]\n $provisions[provision_key] = $provisions[provision_key].deep_merge(value)\n else\n $provisions[provision_key] = value\n end\n end\n end\n log_to_file(\"_provisions.yaml\", $provisions.sort_by_key(true).to_h.to_yaml)\nend", "def load_assemblers\n Biopsy::Settings.instance.target_dir.each do |dir|\n Dir.chdir dir do\n Dir['*.yml'].each do |file|\n name = File.basename(file, '.yml')\n target = Biopsy::Target.new\n target.load_by_name name\n @assemblers << target\n end\n end\n end\n end", "def read_yaml(base, name)\n path = File.join(base, name)\n self.content = File.read(path)\n relative_base = base.gsub(Dir.pwd, \"\")\n if relative_base.start_with?(\"/#{JDoc::DocumentationFile.documentation_directory}\")\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n self.data[\"layout\"] = \"documentation\" if self.data[\"layout\"].nil?\n self.data[\"title\"] = JDoc::DocumentationFile.file_title(path) if self.data[\"title\"].nil?\n return\n elsif self.content =~ /^(---\\s*\\n.*?\\n?)/m\n self.content = $POSTMATCH\n self.data = {\n \"layout\" => \"documentation\",\n \"title\" => JDoc::DocumentationFile.file_title(path)\n }\n return\n end\n end\n\n read_yaml_original(base, name)\n end", "def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end", "def yaml_properties\n if directory?\n yaml_path = ::File.join(@node.path, @yaml_file)\n @node.repos.stat(yaml_path, @node.rev_num) ?\n YAML.load(@node.repos.file(yaml_path, @node.rev_num)[0]) :\n {}\n else\n has_yaml_props? ?\n YAML.load(yaml_split[0]) :\n {}\n end\n end", "def pupmods_in_fixtures_yaml\n require 'yaml'\n fixtures_yml = File.expand_path( '../.fixtures.yml', File.dirname(__FILE__))\n data = YAML.load_file( fixtures_yml )\n repos = data.fetch('fixtures').fetch('repositories').keys\n symlinks = data.fetch('fixtures').fetch('symlinks', {}).keys\n (repos + symlinks)\nend", "def ansible_setup_yaml(built_setup)\n YAML.dump(built_setup)\nend", "def merge(doc)\n src = open_pdoc(doc)\n merge_pdoc(src)\n end", "def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n # Always backup\n bak_file = config_file.sub('.yaml', '_template.yaml')\n File.rename(config_file, bak_file)\n yaml = YAML::load_file(bak_file)\n puts cfg\n\n cfg.each_key { |key|\n if key == \"data_file_directories\"\n val = parse_json(cfg[key]).split(\",\")\n elsif key == \"seed_provider\"\n val = cfg[key]\n else\n val = parse_json(cfg[key])\n end\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# or #{bak_file} file for full\n# explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end", "def yml_directory\n @data_magic_yml_directory ||= 'config'\n end", "def load_config\n YAML::load_file(File.join(__dir__, '../config/config.yml'))\n end", "def read_yaml(base, name, opts = {})\n ret = site.yaml_cache.get(base, name, self.merged_file_read_opts(opts))\n self.content = ret[:content]\n self.data = ret[:yaml]\n self.modified = ret[:modified]\n end", "def test_buildstep_replace\n TeamcityRuby::Core.new(['property_replace', '.\\config.rb', 'dev', 'test_buildstep_replace_expected', 'test_buildstep_replace_modified', '.\\result_buildstep_replace.yml'])\n result = TeamcityRuby::Core.new(['property_replace', '.\\config.rb','dev', 'test_buildstep_replace_modified', 'test_buildstep_replace_expected', '.\\result_buildstep_replace.yml'])\n result = YAML::load_file('.\\result_buildstep_replace.yml')\n bed = YAML::load_file(File.join(File.dirname(__FILE__), 'bed_buildstep_replace.yml'))\n assert_equal result, bed\n end", "def pack_clouds_dot_rb_and_expected_directories\n %w(lib plugins).each do |dir|\n if File.directory?(d = cloud.clouds_dot_rb_dir/dir)\n dputs(\"Adding local path: #{d}\")\n FileUtils.cp_r d, cloud.tmp_path/cloud.base_config_directory, :verbose => true, :remove_destination => true # req'd for symlinks\n end\n end\n FileUtils.cp cloud.clouds_dot_rb_file, cloud.tmp_path/\"/etc/poolparty/clouds.rb\"\n end", "def mkyml(yml, allow_suffix=true)\n file = \"#{$config[:'config-dir']}/#{yml.downcase}.yml\"\n file += '.new' if File.exists?(file) && allow_suffix\n if !File.exists?(file)\n File.open(file, 'w') do |f|\n f.puts eval(yml).rekey(&:to_s).to_yaml\n end\n File.chmod(0640, file)\n File.chown($config[:uid], $config[:gid], file)\n end\n end" ]
[ "0.6416915", "0.6357454", "0.6100214", "0.5926936", "0.57638", "0.5687588", "0.5603746", "0.5502539", "0.54596484", "0.54596484", "0.5407498", "0.5375737", "0.5253319", "0.5253319", "0.5253319", "0.5246575", "0.52388936", "0.52383316", "0.5229091", "0.52086496", "0.5208271", "0.52037257", "0.5193703", "0.5167539", "0.5160587", "0.5121691", "0.512047", "0.512047", "0.51015145", "0.509222", "0.5090337", "0.508518", "0.50799143", "0.5077614", "0.50760007", "0.5067076", "0.5063813", "0.50491476", "0.5046381", "0.5040943", "0.50346315", "0.5034067", "0.4995869", "0.49863222", "0.49807504", "0.4967749", "0.49677306", "0.4967005", "0.4965224", "0.49639386", "0.49592808", "0.4949862", "0.49385735", "0.4930422", "0.49279547", "0.49259028", "0.4925435", "0.4921407", "0.49114528", "0.49074423", "0.49069706", "0.48974052", "0.4893676", "0.48847365", "0.48843378", "0.48754942", "0.48702434", "0.48689455", "0.48662814", "0.48662576", "0.48613662", "0.48605785", "0.48566812", "0.48457056", "0.48429272", "0.48399323", "0.48334333", "0.48318416", "0.4826551", "0.48228273", "0.48094964", "0.47982606", "0.47976908", "0.4793446", "0.47913805", "0.47888997", "0.4788113", "0.4788068", "0.475508", "0.47517765", "0.4751038", "0.4745627", "0.47383913", "0.47381678", "0.47320005", "0.47256458", "0.47234204", "0.47224727", "0.4719429", "0.47147134" ]
0.6406922
1
You have a panoramic view in front of you, but you only can take a picture of two landmarks at a time (your camera is small). You want to capture every pair of landmarks that are next to each other. Define a method that, given an array of landmarks, returns an array of every adjacent pair from left to right. Assume the panorama wraps around.
def panoramics(landmarks) result = [] landmarks.each_with_index do |landmark, idx| next_landmark = landmarks[idx + 1] || landmarks[0] result << [landmark, next_landmark] end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def panoramic_pairs(landmarks)\n n = landmarks.length - 1\n pairs = []\n\n (0...n).each do |i|\n pairs << [landmarks[i], landmarks[i + 1]]\n end\n\n pairs << [landmarks[-1], landmarks[0]]\n pairs\nend", "def panoramic_pairs(landmarks)\n #make a new array for pairs of landmarks\n #starting with first landmakr, iterate through array and add two landmakrs to pair of landmarks\n\n pairs_of_landmarks = []\n\n idx = 0\n while idx < landmarks.length\n next_landmark = landmarks[idx + 1] || landmarks[0]\n pairs_of_landmarks << [landmarks[idx], next_landmark]\n idx += 1\n end\n\n pairs_of_landmarks\nend", "def panoramic_pairs(landmarks)\n\nend", "def pins(args)\n pins_from_frame(1, args)\nend", "def pairing_to_waveletpairs(masks)\n (masks.count / 2).times do |i|\n @wavelet_pairs << [masks[i*2],masks[i*2+1]]\n end\n end", "def locator2(image)\n result = []\n how_wide = image.first.length\n how_long = image.length\n\n image.each_with_index do |e, i|\n e.each_with_index do |e2, i2|\n next unless e2.zero? && no_overlaps?(result, i, i2)\n answer = {\n corner: [i, i2],\n height: 1,\n width: 1\n }\n result << answer\n\n lookahead = i2 + 1\n until lookahead >= how_wide || e[lookahead] == 1\n answer[:width] += 1\n lookahead += 1\n end\n\n lookdown = i + 1\n until lookdown >= how_long || image[lookdown][i2] == 1\n answer[:height] += 1\n lookdown += 1\n end\n end\n end\n p result\n result\nend", "def map_to_chunks(frames)\n frames.each_cons(1 + BONUS_LOOKAHEADS.max).to_a\n end", "def rectangle_finder(arr)\n # Find the upper left coordinates\n ul_row = arr.index { |row| row.include?(1) }\n ul_col = arr[ul_row].index(1)\n\n # Find the bottom right coordinates from this\n br = bottom_right(arr, [ul_row, ul_col])\n\n # Return the two together\n [[ul_row, ul_col], br]\nend", "def output_pins(nums)\n ar = Array(nums)\n ar.each {|n| output_pin(n)} \n end", "def available_captures?(board_dup, current_location, desired_location)\n x1, y1 = current_location\n x2, y2 = desired_location\n\n if board_dup.can_capture?(current_location, desired_location)\n\n #if board_dup.can_capture([x,y],[x2,y2])\n end\n \nend", "def to_a\n [left, center, right]\n end", "def to_a\n [left, center, right]\n end", "def hanover_roads\n hanover_north = 43.7031803975023\n hanover_east = -72.28413820266724\n hanover_south = 43.69828604529516\n hanover_west = -72.29262471199036\n OverpassGraph.get_roads(hanover_north, hanover_east, hanover_south, hanover_west, [], [])\nend", "def index\n @images = get_approved\n @left_images = []\n @right_images = []\n @center_images = []\n counter = 0\n @images.each do |image|\n counter+=1\n if counter == 1\n @left_images << image\n elsif counter ==2\n @center_images << image\n elsif counter ==3\n counter = 0\n @right_images << image\n end\n end\n end", "def plot_matched_regions(output, lst = @hits, predicted_seq = @prediction)\n\n max_len = lst.map{|x| x.xml_length.to_i}.max\n\n max_plots = 120\n skip= lst.length/max_plots\n len = predicted_seq.xml_length\n\n R.eval \"jpeg('#{output}_match.jpg')\"\n R.eval \"plot(1:#{lst.length-1}, xlim=c(0,#{len}), xlab='Prediction length (black) vs part of the prediction that matches hit x (red/yellow)',ylab='Hit Number', col='white')\"\n R.eval \"colors = c('yellow', 'red')\"\n R.eval \"colors2 = c('black', 'gray')\"\n height = -1;\n lst.each_with_index do |seq,i|\n #if skip == 0 or i%skip == 0\n #if i < max_plots\n height += 1\n color = \"colors[#{height%2+1}]\"\n color2 = \"colors2[#{height%2+1}]\"\n R.eval \"lines(c(1,#{len}), c(#{height}, #{height}), lwd=7)\"\n seq.hsp_list.each do |hsp|\n R.eval \"lines(c(#{hsp.match_query_from},#{hsp.match_query_to}), c(#{height}, #{height}), lwd=6, col=#{color})\" \n end\n #end\n end\n R.eval \"dev.off()\"\n end", "def plot_matched_regions(output, lst = @hits, predicted_seq = @prediction)\n\n max_len = lst.map{|x| x.xml_length.to_i}.max\n\n max_plots = 120\n skip= lst.length/max_plots\n len = predicted_seq.xml_length\n\n R.eval \"jpeg('#{output}_match.jpg')\"\n R.eval \"plot(1:#{lst.length-1}, xlim=c(0,#{len}), xlab='Prediction length (black) vs part of the prediction that matches hit x (red/yellow)',ylab='Hit Number', col='white')\"\n R.eval \"colors = c('yellow', 'red')\"\n R.eval \"colors2 = c('black', 'gray')\"\n height = -1;\n lst.each_with_index do |seq,i|\n #if skip == 0 or i%skip == 0\n #if i < max_plots\n height += 1\n color = \"colors[#{height%2+1}]\"\n color2 = \"colors2[#{height%2+1}]\"\n R.eval \"lines(c(1,#{len}), c(#{height}, #{height}), lwd=7)\"\n seq.hsp_list.each do |hsp|\n R.eval \"lines(c(#{hsp.match_query_from},#{hsp.match_query_to}), c(#{height}, #{height}), lwd=6, col=#{color})\" \n end\n #end\n end\n R.eval \"dev.off()\"\n end", "def locate_marks side, image, extent\n d_write_image image\n#\n# Look at a rectangle each of the ends of the bands. Rect1 is one end, Rect2 is the other end.\n#\n rect1segments = Array.new\n if side == :top\n detect_marks image, 0, 0, i2p(EndRectSize), i2p(extent), :left, \n SideBandThresh, :columns, i2p(MinMarkHeight), :rect1, rect1segments, \"top\" \n elsif side == :left\n detect_marks image, 0, 0, i2p(extent), i2p(EndRectSize), :up,\n ThreshLeft1, :rows, i2p(MinMarkWidth), :rect1, rect1segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), 0, i2p(extent), i2p(EndRectSize), :up, \n ThreshRight1, :rows, i2p(MinMarkWidth), :rect1, rect1segments, \"right\" \n end\n return LocateMarks.new(BPoint.nil, BPoint.nil, 0.0) if rect1segments.length != 1\n\n rect2segments = Array.new\n if side == :top\n detect_marks image, columns(image) - i2p(EndRectSize), 0, i2p(EndRectSize), i2p(EndRectSize), :left, \n SideBandThresh, :columns, i2p(MinMarkHeight), :rect2, rect2segments, \"top\" \n elsif side == :left\n detect_marks image, 0, rows(image) - i2p(EndRectSize), i2p(extent), i2p(EndRectSize), :up, \n ThreshLeft2, :rows, i2p(MinMarkWidth), :rect2, rect2segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), rows(image) - i2p(EndRectSize), i2p(extent), i2p(EndRectSize), :up, \n ThreshRight2, :rows, i2p(MinMarkWidth), :rect2, rect2segments, \"right\" \n end\n return LocateMarks.new(BPoint.nil, BPoint.nil, 0.0) if rect2segments.length == 0\n#\n# Now project the timing marks to the top (or side) to figure out the offsets in the other direction.\n#\n rect3segments = Array.new\n if side == :top\n detect_marks image, 0, 0, columns(image), i2p(extent), :up, \n ThreshTop3, :rows, i2p(MinMarkWidth), :rect3, rect3segments, \"top\" \n elsif side == :left\n detect_marks image, 0, 0, i2p(extent), rows(image), :left, \n ThreshLeft3, :columns, i2p(MinMarkHeight), :rect3, rect3segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), 0, i2p(extent), rows(image), :left, \n LongSideThresh, :columns, i2p(MinMarkHeight), :rect3, rect3segments, \"right\" \n end\n d_write_image :rect3\n \n if side == :top\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect3segments[0][0], rect1segments[0][0])\n origin_prime = BPoint.new(rect3segments[0][0], rect1segments[0][1])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect3segments[-1][0], rect2segments[0][0])\n terminal_prime = BPoint.new(rect3segments[-1][0], rect2segments[0][1])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = BPoint.angle(firstmarkmidpoint, secondmarkmidpoint)\n\n# Have a headache yet? Detailed arithmetic is different (signs etc.) depending on side\n \n elsif side == :left \n\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect1segments[0][0], rect3segments[0][0])\n origin_prime = BPoint.new(rect1segments[0][1], rect3segments[0][0])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect2segments[0][0], rect3segments[-1][0])\n terminal_prime = BPoint.new(rect2segments[0][1], rect3segments[-1][0])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = (BPoint.angle(firstmarkmidpoint, secondmarkmidpoint) - 90.0).modulo 90.0\n\n elsif side == :right\n\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect1segments[-1][0], rect3segments[0][0])\n origin_prime = BPoint.new(rect1segments[-1][1], rect3segments[0][0])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect2segments[-1][0], rect3segments[-1][0])\n terminal_prime = BPoint.new(rect2segments[-1][1], rect3segments[-1][0])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = (BPoint.angle(firstmarkmidpoint, secondmarkmidpoint) - 90.0).modulo 90.0\n#\n# unlike the left and top, on the right the origin of the first mark is not the origin of the page. We need \n# to compensate for the distance between the page's actual origin and where the right marks are, by using the\n# known distance between the timing marks along the top and the space between then and how many there are.\n#\n origin.x = origin.x + columns(image) - i2p(extent)\n terminal.x = terminal.x + columns(image) - i2p(extent)\n end\n return LocateMarks.new(origin, terminal, rotation_angle)\n end", "def show_squares_between\n case direction\n when 'left'\n ['b1', 'c1', 'd1']\n when 'right'\n ['f1', 'g1']\n end\n end", "def glide_image_pairs\n @glide_image_pairs = []\n listings = Listing.find(:all)\n pair_offset = 0\n listings.each do |listing|\n if listing.images.length > 1\n pair = []\n listing.images.each_with_index do |image, j|\n pair << image\n pair_offset = pair_offset + 1\n #break if j # only load 2 images at a time into array\n end\n @glide_image_pairs << pair\n end\n end\n return @glide_image_pairs\n end", "def to_a\n [left, top, right]\n end", "def to_a\n [left, top, right]\n end", "def get_ones\r\n ones = []\r\n @picture.each_with_index do |row, row_number|\r\n row.each_with_index do |item, col_number|\r\n if item == 1\r\n ones << [row_number, col_number]\r\n end\r\n end\r\n end \r\n ones\r\n end", "def each_plate_point\n (0...@size).each do |x|\n (0...@size).each do |y|\n yield x, y, @plate_ids[x][y]\n end\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 discover_points # step 1\r\n x = 0\r\n y = 0\r\n @image_arr.each do |row|\r\n x = 0\r\n row.each do |cell|\r\n if cell == 1 # discovered the cell is 1\r\n @ordinal_arr.push([y,x]) # this is where i push the ordinals.\r\n puts \"#{y},#{x}\"\r\n end\r\n x = x + 1\r\n end\r\n y = y + 1\r\n puts \"\" \r\n end\r\n end", "def show\n @photos_1_2 = Array.new\n @photos_2_2 = Array.new\n\n @photos_1_3 = Array.new\n @photos_2_3 = Array.new\n @photos_3_3 = Array.new\n\n @interior_album.interior_photos.each_with_index do |interior_photo, i|\n if i % 2 == 0\n @photos_1_2.push(interior_photo)\n else\n @photos_2_2.push(interior_photo)\n end\n\n if i % 3 == 0\n @photos_1_3.push(interior_photo)\n elsif (i+1) % 3 == 0\n @photos_3_3.push(interior_photo)\n else\n @photos_2_3.push(interior_photo)\n end\n\n end\n end", "def find_all_sequences(x,y)\n ret = []\n ret << [[x,y],[x+1,y],[x+2,y],[x+3,y]] if x+3 <= 19\n ret << [[x,y],[x,y+1],[x,y+2],[x,y+3]] if y+3 <= 19\n ret << [[x,y],[x+1,y+1],[x+2,y+2],[x+3,y+3]] if y+3 <= 19 && x+3 <= 19\n ret << [[x,y],[x-1,y+1],[x-2,y+2],[x-3,y+3]] if x-3 >= 0 && y+3 <= 19\n ret\nend", "def get_list_for_line(index, image_name_list)\n first_image_index = index * SIDE_PICTURES_COUNT\n last_image_index = first_image_index + SIDE_PICTURES_COUNT - 1\n list_for_line = image_name_list[first_image_index..last_image_index]\n list_for_line\n end", "def consecutive(arr)\r\n\r\nend", "def to_a\n [@left, @middle, @right]\n end", "def rectangular\n [re, im]\n end", "def group_into_points(ar)\n points = []\n point = []\n until ar.empty?\n if point.size == 2\n points.push(point)\n point = []\n else\n point.push(ar.shift)\n end\n end\n points.push(point)\n points\nend", "def sequence_images\n \n end", "def getPanoramiaPhotos(destination, photo_size)\n debug = false\n\n puts 'getPanoramiaPhotos called!' if debug\n max_photos = 5.to_s\n\n destination_id = destination.id\n lat_min = (destination.lat - 0.05).to_s #minY\n lat_max = (destination.lat + 0.05).to_s #maxY\n\n lng_min = (destination.lng - 0.05).to_s #minX\n lng_max = (destination.lng + 0.05).to_s #maxX\n\n\n #first, call Panoramio\n response = HTTParty.get(\"http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=\" +\n max_photos + \"&minx=\" + lng_min + \"&miny=\" + lat_min +\n \"&maxx=\" + lng_max + \"&maxy=\" + lat_max + \"&size=\" + photo_size + \"&mapfilter=true\")\n\n puts response.to_yaml if debug\n\n response['photos'].each do |photo|\n puts 'photo title: ' + photo['photo_title'] if debug\n createPhotoFromPanoramioResponse(photo, destination_id, photo_size)\n end\n end", "def pan(direction = :left, distance_bp = (self.length_bp.to_f/5).round)\n upstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp < @start_cumulative_bp}.sort_by{|s| s.start_cumulative_bp}[-1]\n downstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp > @start_cumulative_bp}.sort_by{|s| s.stop_cumulative_bp}[0]\n\n #Check if we actually _can_ pan. Can't do that if the slice in the panned\n #direction has less basepairs than what we want to add to our slice in focus\n if ( direction == :left and upstream_slice.length_bp > distance_bp ) or\n ( direction == :right and downstream_slice.length_bp > distance_bp )\n\n #Just so we can always add the distance_pixel\n if direction == :left\n distance_bp = -distance_bp\n end\n\n @start_cumulative_bp += distance_bp\n @stop_cumulative_bp += distance_bp\n self.fetch_sequence\n\n upstream_slice.stop_cumulative_bp = @start_cumulative_bp - 1\n downstream_slice.start_cumulative_bp = @stop_cumulative_bp + 1\n [upstream_slice, downstream_slice].each do |s|\n s.length_bp = s.stop_cumulative_bp - s.start_cumulative_bp + 1\n s.resolution = s.length_pixel.to_f/s.length_bp\n s.range_cumulative_bp = Range.new(s.start_cumulative_bp, s.stop_cumulative_bp)\n s.fetch_sequence\n end\n self.class.sketch.slices.each{|s| s.format_resolution}\n\n self.class.sketch.buffer_images[:zoomed] = self.class.sketch.draw_zoomed_buffer\n self.class.sketch.buffer_images[:information_panel] = self.class.sketch.draw_information_panel\n end\n end", "def find_ones\n ones = []\n # This line will start at the beginning (upper left corner of the 2D array) so the first value, and the index of that value (i.e. [value: 0, index: 0]).\n # This will then continue on to line 17\n # Line 14 will grab the row item (0) and work along the columns. After first itiretaion (same as above since its the first index), the loop will continue until the\n # last number of the columns on that row item completes. So in this case, the three zeroes at underneath the first zero.\n # Afterwards, it will go back up to the rows line (16) and jump on to the next index and item on that row. This will continue until the entire array has been checked through.\n @image_blur_array.each_with_index do | row_item, row_index| \n row_item.each_with_index do |col_item, col_index|\n if col_item == 1 # If the col_item (since it is the last number we checked) equals to '1', the coordinates of that number will be added onto the array 'ones'\n ones << [row_index, col_index]\n end\n end\n end\n # Returns the 'ones' array to the blur method\n return ones\n end", "def snapshot_boundaries\n minmax = @snapshot.first.map { |dim_coord| [dim_coord, dim_coord] }\n @snapshot.each do |coord|\n coord.each_with_index do |dim_coord, i|\n minmax[i][0] = dim_coord if dim_coord < minmax[i][0]\n minmax[i][1] = dim_coord if dim_coord > minmax[i][1]\n end\n end\n minmax\n end", "def detect_landmarks path_to_image_file:\n # [START get_vision_service]\n vision = Google::Cloud::Vision.new\n # [END get_vision_service]\n\n # [START construct_request]\n image = vision.image path_to_image_file\n landmark = image.landmark\n # [END construct_request]\n\n # [START print_landmark]\n puts \"Found landmark: #{landmark.description}\" unless landmark.nil?\n # [END print_landmarks]\nend", "def download_region\n x = \"{0..#{resolution - 1}}\"\n y = case focus # :full :mid :low\n when :top\n \"{0..#{(resolution / MONITOR_ASPECT).ceil - 1}}\"\n when :low\n \"{#{resolution - (resolution / MONITOR_ASPECT).ceil}..#{resolution - 1}}\"\n else # full / mid\n \"{0..#{resolution - 1}}\"\n end\n [x, y]\n end", "def coord(a, b)\n final_array = []\n first_array = (1..a).to_a\n second_array = (1..b).to_a\n first_array.each do |first_num|\n second_array.each do |second_num|\n coordinates = \"(#{first_num}, #{second_num})\"\n final_array.push(coordinates)\n end\n end\n final_array \nend", "def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend", "def landResult _args\n \"landResult _args;\" \n end", "def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend", "def flat_point_pairs(ride)\n pairs = []\n\n point_pairs(ride) do |pair|\n if active_between?(*pair) && flat_between?(*pair)\n if block_given?\n yield pair\n else\n pairs << pair\n end\n end\n end\n\n pairs unless block_given?\n end", "def points\n [top_left, top_right, bottom_left, bottom_right]\n end", "def all_views(input)\n asteroid_positions(input).map do |p1|\n asteroid_positions(input).map { |p2| angle(p1, p2) }.compact.uniq.size\n end\nend", "def island; end", "def loop_midpoints(addr)\n midpoints = []\n 0.upto(addr.length - 2 ) do | index|\n addr1 = addr[index]\n addr2 = addr[index + 1]\n midpoints << find_midpoint(addr1,addr2)\n end\n return midpoints\n end", "def coords\r\n blur_pixels = []\r\n # blur_pixels is the array, and then we need to fill it\r\n @array.each_with_index do |row, row_int| #nested loops\r\n row.each_with_index do |int, col_index| # iterating over integers in arrays \r\n if int == 1 #1 is the number we are using as the culprit in our blur\r\n blur_pixels << [row_int, col_index] # << is pushing into the blur_pixels array\r\n end\r\n end\r\n end\r\n blur_pixels\r\n end", "def overnight_media_rclist(out_collection, overnight_antibiotic_mat)\n coordinates = out_collection.get_non_empty.each_slice(11).to_a # 11 comes from the known number of samples in each row\n kan_media_coordinates = []\n kan_chlor_coordinates = []\n no_anti_media_coordinates = []\n overnight_antibiotic_mat.each_with_index do |row, r_idx|\n row.each_with_index do |col, c_idx|\n if col == 'Kan'\n kan_media_coordinates.push(coordinates[r_idx][c_idx])\n elsif col == 'Kan_Chlor'\n kan_chlor_coordinates.push(coordinates[r_idx][c_idx])\n elsif col == 'None'\n no_anti_media_coordinates.push(coordinates[r_idx][c_idx])\n end\n end\n end\n return [[no_anti_media_coordinates,'M9'], [kan_media_coordinates,'M9 + Kan'], [kan_chlor_coordinates, 'M9 + Kan + Chlor']]\n end", "def shifted_images\n result = []\n vector = (0...ColorizrVector::VECTOR_LENGTH).to_a\n \n vector.each_with_index do |f, index|\n vector[index] = f.to_f\n end\n \n ColorizrVector::VECTOR_LENGTH.times do |id|\n colorizr_vector = ColorizrVector.new(vector.pack(ColorizrVector::FORMAT_STRING))\n result << ColorizrImage.new([id, colorizr_vector])\n vector << vector.shift\n end\n \n return result\n end", "def construct_ms_per_r(gm, rd, md)\n ms_per_r = Array.new(rd[:num_regions]) {|e| e = Array.new}\n for y in 0...gm[:y] do\n for x in 0...gm[:x] do\n if md[:moves][y][x] != 0\n r = rd[:regions][y][x]\n ms_per_r[r].push(md[:moves][y][x])\n end\n end\n end\n puts \"ms_per_r = \" + ms_per_r.to_s\n return ms_per_r\nend", "def captured_points(range = $capture_distance)\n\t\tchecked_set = []\n\t\tcurrent_set = [@hunter.coords]\n\n\t\tdistance = 0\n\t\t# This collects every nonblocked point next to the current set of points (including diagonals) up to a certain number of moves\n\t\tuntil distance > range || current_set.empty?\n\t\t\tfound_set = ((current_set.map{|c| collect_adjacent_points(c)}.flatten - checked_set) - current_set)\n\t\t\tchecked_set += current_set\n\t\t\tcurrent_set = found_set\n\t\t\tdistance += 1\n\t\tend\n\t\t#\tTake out any points that are outside the CAPTURE DISTANCE in euclidean distance from the hunter, and return the remaining set\n\t\tfinal_set = (checked_set + current_set).reject{|p| distance(@hunter.coords,p) > range}\n\tend", "def rectangles_finder(arr)\n rectangle_spots = {} # will keep track of where rectangles occupy\n rectangles = [] # will keep track of the rectangle corners for output\n\n arr.each_with_index do |row, i|\n row.each_with_index do |el, j|\n if el == 1 && !rectangle_spots.include?([i, j])\n # Found a new rectangle corner\n ul = [i, j]\n br = bottom_right(arr, ul)\n\n # Add the rectangle corners to the output\n rectangles << [ul, br]\n\n # Add the new coordinates to the hash\n rectangle_spots = update_hash(rectangle_spots, [ul, br])\n end\n end\n end\n\n # Return the rectangles\n rectangles\nend", "def dynamic_range \n\t\tpage\n\t\tframes\n\t\tnum = 0\n\t\twhile num < 4 \n\t\t\tif page == frames[num] \n\t\t\t\t@destination = frames[num] \n\t\t\tend \n\t\t\tnum += 1 \n\t\tend\n\tend", "def adjacent_rooms(map, y, x)\n \n north = map[y-1][x]\n south = map[y+1][x]\n west = map[y][x-1]\n east = map[y][x+1]\n\n [north, south, west, east]\nend", "def find_similar_regions image, target, points\n m_begin \"find_similar_regions\"\n res_points = Array.new\n image_being_searched = get_image(image)\n goal_image = get_image(target)\n curX, curY = 0, 0\n while res = image_being_searched.find_similar_region(goal_image, curX, curY) do\n curX, curY = res\n res_points << res\n curX = curX + 1\n curY = curY + 1\n end\n set_variable(points, res_points)\n m_end \"find_similar_regions\"\n end", "def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end", "def sharpen ary\n edge_extend(ary).each_cons(3)\n .map {|l,m,r| [0, (-1.0*l + 5.0*m + -1.0*r)].max }\nend", "def slide(teams)\n top, bottom = teams.each_slice(teams.length / 2).to_a\n\n top.zip(bottom).to_a\n end", "def neighbors(point, scr_height, scr_width)\n deltas = [ [0, 1], [0, -1],\n [1, 0], [-1, 0] ]\n neighbors = []\n deltas.each do |delta|\n neighbor = [point[0] + delta[0], point[1] + delta[1]]\n neighbors.push(neighbor) if in_bounds?(neighbor, scr_height, scr_width)\n end\n neighbors\nend", "def corners(a)\n return a[0], a[2], a[7], a[5]\n end", "def ranges\n x_start, y_start = absolute(0, 0)\n x_end, y_end = absolute(@diameter - 1, @diameter - 1)\n\n [x_start..x_end, y_start..y_end]\n end", "def GetAdjacentPts(pts, i)\r\n res = []\r\n if (i == 0) \r\n res[0] = pts[pts.length-1]\r\n else \r\n res[0]= pts[i-1]\r\n end \r\n res[1] = pts[i]\r\n if (i == pts.length-1) \r\n res[2]= pts[0]\r\n else \r\n res[2] = pts[i+1]\r\n end \r\n return res\r\nend", "def images\n images = @anchors.select { |a| a.object.is_a?(Pic) }\n images.map { |a| a.object }\n end", "def group(array)\n\t\tif (array.length%2) == 0 \n\t\t\tarray2=array[0..(array.length-1)/2]\n\t\t\tarray=array[(array.length)/2..array.length]\n\t\t\treturn array.zip(array2)\n\t\telse\n\t\t\todd_man = array[-1]\n\t\t\tarray = array[0..array.length-2]\n\t\t\tgrouped = group(array)\n\t\t\tgrouped[-1] = grouped[-1].push(odd_man)\n\t\t\tgrouped\n\t\tend\nend", "def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend", "def all_views(input)\n asteroid_positions(input).map do |p1|\n x = asteroid_positions(input).map { |p2| angle(p1, p2) }.compact.uniq.size\n puts \"#{p1} #{x}\"\n x\n end\nend", "def take_multiple_screens(circles, delay, pre_pause)\n sleep(pre_pause) unless pre_pause.nil?\n create_screenshot_path\n circles.times do |index|\n World.take_screenshot(path: @ocr_screenshots_path,\n file_name: \"rec_#{index}.png\")\n sleep(delay) unless delay.nil?\n end\n end", "def construct_ms_per_r(gm, rd, md)\n ms_per_r = Array.new(rd[:num_regions]) {|e| e = Array.new}\n for y in 0...gm[:y] do\n for x in 0...gm[:x] do\n if md[:moves][y][x] != 0\n r = rd[:regions][y][x]\n ms_per_r[r].push(md[:moves][y][x])\n end\n end\n end\n # puts \"ms_per_r = \" + ms_per_r.to_s #NICE TO HAVE\n return ms_per_r\nend", "def corners\n\t\t[[0,0],[0,@m-1],[@n-1,0],[@n-1,@m-1]]\n\tend", "def reverse_segments(arr)\n result = []\n (arr.size / 8).times do\n result << arr.shift(8)\n end\n result.reverse\nend", "def get_adjacent_floors tile\n floors = Array.new\n @maze.get_adjacent_tiles(tile).each do |tile|\n floors.push tile if tile.is_floor\n end\n floors\n end", "def to_marker_arr(array)\n [array[0].marker, array[1].marker, array[2].marker]\n end", "def find_ones\n ones_locations = []\n # => finding index of ROW and COL for each 1 in grid and storing as row/col array pairs\n @image_array.each_index do |row|\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\" # <---this is just to display that it's working, can be removed\n ones_locations << [row, col]\n end\n end\n end\n return ones_locations\n end", "def top_left_to_bottom_right(x1, y1, x2, y2)\n @spiral_array ||= []\n\n # Traversing top left to top right\n (x1..x2).each do |i|\n @spiral_array << self[y1][i]\n end\n\n # Traversing top right to bottom right\n ((y1 + 1)..(y2)).each do |j|\n @spiral_array << self[j][x2]\n end\n\n @spiral_array\n end", "def shoot_4in1(basename, remain_intermediate = false)\n name_x = basename + '-x'\n name_y = basename + '-y'\n name_z = basename + '-z'\n name_w = basename + '-w'\n name_zw = basename + '-zw'\n name_xy = basename + '-xy'\n #name_zwxy = basename + '-zwxy'\n name_zwxy = basename\n\n r = 10.0\n povray = Marshal.load(Marshal.dump(self))\n povray.camera_location_polar(r, 0, 0) ; povray.shoot_snap( name_z )\n povray.camera_location_polar(r, 90, 0) ; povray.shoot_snap( name_x )\n povray.camera_location_polar(r, 90, 90) ; povray.shoot_snap( name_y )\n #povray.camera_location_polar(r, 80, 70) ; povray.shoot_snap( name_w )\n povray.camera_location_polar(r, 120, 230) ; povray.shoot_snap( name_w )\n\n system \"convert +append #{name_z }.png #{name_w }.png #{name_zw }.png\"\n system \"convert +append #{name_x }.png #{name_y }.png #{name_xy }.png\"\n system \"convert -append #{name_zw}.png #{name_xy}.png #{name_zwxy}.png\"\n\n #中間ファイルを消す。\n unless remain_intermediate\n [\n name_w + '.png',\n name_w + '.pov',\n name_x + '.png',\n name_x + '.pov',\n name_y + '.png',\n name_y + '.pov',\n name_z + '.png',\n name_z + '.pov',\n name_zw + '.png',\n name_xy + '.png',\n ].each do |file|\n FileUtils.rm file if FileTest.exist? file\n end\n end\n end", "def positions_of_agents\n positions = []\n @figures.each {|f| positions << f.position}\n positions.shift\n positions\n end", "def kamen_rider(*eras); end", "def shore_acres_roads\n shore_acres_north = 40.95352042058797\n shore_acres_east = -73.71407747268677\n shore_acres_south = 40.94329381595473\n shore_acres_west = -73.73105049133301\n OverpassGraph.get_roads(shore_acres_north, shore_acres_east, shore_acres_south, shore_acres_west, [], [])\nend", "def [] landmark_type\n landmark = Array(@grpc.landmarks).detect do |l|\n l.type == landmark_type\n end\n return nil if landmark.nil?\n Landmark.from_grpc landmark\n end", "def carve_walls_from_point(x, y, grid)\n \nend", "def crossPointsAround\n [KBPoint.new.init([x+1,y]),KBPoint.new.init([x-1,y]),KBPoint.new.init([x,y-1]),KBPoint.new.init([x,y+1])]\n end", "def image_points\n [\n @state.ctm_transform(0, 0),\n @state.ctm_transform(0, 1),\n @state.ctm_transform(1, 0),\n @state.ctm_transform(1, 1)\n ]\n end", "def get_braille_arrays\n string = braille_to_string\n lines = string.scan(/.{1,80}/)\n pairs = lines.map do |string|\n string.scan(/../)\n end\n end", "def get_gaps (array)\n return [] if array.empty?\n (array.first .. array.last).to_a - array\nend", "def scan\n robotlist = @@all\n robotlist.select {|robot| robot.position == [@position[X]+1, @position[Y]]}\n robotlist.select {|robot| robot.position == [@position[X]-1,@position[Y]]}\n robotlist.select {|robot| robot.position == [@position[X],@position[Y]+1]}\n robotlist.select {|robot| robot.position == [@position[X],@position[Y]-1]}\n end", "def find_possible_captures(board)\n result = []\n move_set.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n result << [rank, file] if opposing_piece?(rank, file, board.data)\n end\n @captures = result\n end", "def ranges(ips)\n ranges, start, prev = [], ips.first, ips.first\n ips.each_with_index do |ip, i|\n prev = ips[i-1] if i > 0\n if ip == ips.last\n ranges << [start, ip]\n elsif ip.to_i - prev.to_i > 1\n ranges << [start, prev]\n start = ip\n end\n end\n ranges\n end", "def group_braille_arrays\n get_braille_arrays.each_slice(3).to_a\n end", "def split_showers(showers)\n showers.\n each_slice(2).\n flat_map{|before, after|\n next unless after\n [ [:shower, before], [:pause, hours_between(before, after)] ].\n push([ :shower, showers.last ]).\n unshift([ :pause, hours_between(Time.now, showers.first) ])\n }\nend", "def rotate_picture(picture)\n (0...$PICTURE_SIZE).map do |i|\n ((0...$PICTURE_SIZE).map do |j|\n picture[j].chars[$PICTURE_SIZE - 1 - i]\n end).join\n end\nend", "def transform(manHatDist)\r\n\t\tpixel_on = []\r\n\t\tmanHatDist.times do\r\n\t\[email protected]_index do |row, row_index|\r\n\t\t\trow.each.with_index do |pixel, col_index|\r\n\t\t\t\tif pixel == 1\r\n\t\t\t\t\tpixel_on.push [row_index, col_index]\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tpixel_on.each do |touple|\r\n\t\t\t#blur(*touple)\r\n\t\t\trow_index, col_index = touple\r\n\t\t\tblur(row_index, col_index)\r\n\t\tend\r\n\tend\r\n\tend", "def combine_frames(frames)\n frames.first.zip(*frames[1..-1]).map do |pixels|\n combine_pixels pixels\n end\n end", "def crop\n block = block_given? ? Proc.new : Arigatomation::LUMINANCE\n left_x, right_x, top_y, bottom_y = lrc.x, ulc.x, lrc.y, ulc.y\n changed = false\n\n each do |point|\n if !block.call(self[point])\n changed = true\n left_x = point.x if point.x < left_x\n right_x = point.x if point.x > right_x\n top_y = point.y if point.y < top_y\n bottom_y = point.y if point.y > bottom_y\n end\n end\n\n return self unless changed\n $log.debug \"CROPPED to #{[left_x, top_y, right_x, bottom_y].join(\", \")}\"\n capture(Arigatomation::Point.new(left_x, top_y), Arigatomation::Point.new(right_x, bottom_y))\n rescue\n $log.error \"Crop error: #{$!}\"\n end", "def paths(points)\n paths = []\n (0...(points.count-1)).each do |point_1|\n ((point_1+1)...points.count).each do |point_2|\n paths << [point_1,point_2]\n end\n end\n paths\nend", "def favor_corners(moves) # array of moves: [ a1, b2, c3, ... ]\n a = []\n moves.each { |e| a.push(e) if CORNERS.include?(e) }\n\n if a.length == 0\n moves\n else\n a\n end\nend", "def surrounding_tiles(x, y)\n diffs = [\n [-1, -1], [0, -1], [1, -1],\n [-1, 0], [0, 0], [1, 0],\n [-1, 1], [0, 1], [1, 1],\n ]\n\n diffs.map { |dx, dy| tiles_at(x + dx, y + dy) }.flatten\n end", "def stutter(a) \n a.zip(a).flatten(1)\nend", "def camera\n end" ]
[ "0.7715019", "0.76393974", "0.76331586", "0.52761304", "0.5212838", "0.5177703", "0.51370716", "0.50811213", "0.49836102", "0.49793318", "0.49764058", "0.49764058", "0.49691415", "0.49393016", "0.49117616", "0.49117616", "0.48952052", "0.48743293", "0.48636356", "0.4853828", "0.4853828", "0.48529983", "0.4850724", "0.48440915", "0.4835109", "0.48292306", "0.48268744", "0.4824393", "0.4795863", "0.47791046", "0.477297", "0.4770723", "0.4767407", "0.47617307", "0.4758478", "0.47457707", "0.473966", "0.4738027", "0.47362322", "0.47347128", "0.47300386", "0.4726727", "0.47188511", "0.47183844", "0.47159266", "0.47139758", "0.47060046", "0.46937394", "0.4687904", "0.46801162", "0.46754572", "0.46752095", "0.46727178", "0.46646607", "0.46609432", "0.46587497", "0.46568963", "0.4656739", "0.46442443", "0.46368346", "0.46334797", "0.46332258", "0.46312338", "0.46272", "0.46261445", "0.46256202", "0.46246967", "0.46206132", "0.4619201", "0.4618841", "0.46160647", "0.4613802", "0.46137023", "0.46134347", "0.4611756", "0.4605329", "0.4602428", "0.46004242", "0.45998162", "0.45977083", "0.45879963", "0.45872688", "0.45824942", "0.45798692", "0.45787752", "0.45719644", "0.45652175", "0.45568988", "0.45568854", "0.4546678", "0.4545495", "0.45454165", "0.45392397", "0.45392284", "0.45350844", "0.4535061", "0.45347995", "0.4530959", "0.45258713", "0.45223588" ]
0.8125142
0
Set the bterm to half width
def unfullscreen_height return unless @window @window.decorated = true @window.set_resizable(true) # Resize the width of the window width = @window.screen.width height = @window.screen.height # We need to change the minimum size of the window min_width = width / 4 min_height = height / 4 @window.set_size_request(min_width, min_height) #puts "height: #{width} / #{height}" @window.unfullscreen # then we can resize to a smaller size new_height = height / 2 @window.move(0, 0) @window.resize(width, new_height) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw; self.fixed_width = true; self; end", "def set_character_width_narrow\n set_print_mode 1\n set_linefeed_rate 40\n end", "def width=(_); end", "def width=(_); end", "def my_width \n 0.75\n end", "def width(val); @width = val; self; end", "def setlinewidth(*)\n super\n end", "def terminal_width; end", "def terminal_width; end", "def fit_width; end", "def set_character_width_normal\r\n set_print_mode 0\r\n set_linefeed_rate 55\r\n end", "def set_character_width_normal\n set_print_mode 0\n set_linefeed_rate 55\n end", "def set_tyre_width(tyre_width)\n\t\t@tyre_width = tyre_width\n\tend", "def set_tyre_width(tyre_width)\n\t\tif tyre_width < 57 || tyre_width > 61\n\t\t\traise Exception.new \"Invalid tyre width for MTB\"\n\t\tend\n\t\t@tyre_width = tyre_width\n\tend", "def term_width\n @term_width.visible\n end", "def set_HalfBathrooms(value)\n set_input(\"HalfBathrooms\", value)\n end", "def setborderwidth(*)\n super\n end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def drb_width\n instance.options[:drb_width]\n end", "def drb_width\n instance.options[:drb_width]\n end", "def width=(width)\n end", "def setwidth(width)\n @width = width\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def set_tyre_width(tyre_width)\n\t\tif tyre_width < 23 || tyre_width > 30\n\t\t\traise Exception.new \"Invalid tyre width for Road Bike\"\n\t\tend\n\t\t@tyre_width = tyre_width\n\tend", "def width(value)\n @ole.Width = value\n nil\n end", "def width(value)\n @ole.Width = value\n nil\n end", "def border_width=(width)\n self.each {|cell| cell.border_width = width}\n end", "def set_bar_width_and_spacing\n width_and_spacing_values = case bar_width_and_spacing\n when String\n bar_width_and_spacing\n when Array\n bar_width_and_spacing.join(',')\n when Hash\n width = bar_width_and_spacing[:width] || 23\n spacing = bar_width_and_spacing[:spacing] || 4\n group_spacing = bar_width_and_spacing[:group_spacing] || 8\n [width,spacing,group_spacing].join(',')\n else\n bar_width_and_spacing.to_s\n end\n \"chbh=#{width_and_spacing_values}\"\n end", "def width=(_arg0); end", "def strokewidth(width)\n @style[:strokewidth] = width\n end", "def strokewidth(width)\n @style[:strokewidth] = width\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def inqlinewidth\n inquiry_double { |pt| super(pt) }\n end", "def terminal_width\n if ENV['THOR_COLUMNS']\n result = ENV['THOR_COLUMNS'].to_i\n else\n result = unix? ? dynamic_width : 80\n end\n (result < 10) ? 80 : result\n rescue\n 80\n end", "def set_textborderwidth(width)\n @text.borderwidth(width)\n end", "def inqborderwidth\n inquiry_double { |pt| super(pt) }\n end", "def base_width; 26 + @width; end", "def change_border_right(weight='thin')\n change_border(:right, weight)\n end", "def set_Width(value)\n set_input(\"Width\", value)\n end", "def width\n end", "def width\n end", "def setcharheight(*)\n super\n end", "def SetLineWidth(width)\n\t\t#Set line width\n\t\t@line_width = width;\n\t\tif (@page>0)\n\t\t\tout(sprintf('%.2f w', width*@k));\n\t\tend\n\tend", "def setwidth\n if @max != nil && !min !=nil then\n @vwidth = @max - @min\n if @min > 0.0 then \n @logmin = log10(@min)\n if @max > 0.0 then\n @logwidth = log10(@max) - log10(@min)\n end\n end\n end\n end", "def set_width_and_length\n footprint = @total_floor_area / num_stories.to_f\n @width = Math.sqrt(footprint / @ns_to_ew_ratio)\n @length = footprint / @width\n end", "def width\n Terminal.width\n end", "def adjust_width\n self.width = [[text_size('O' * @max_characters).width + padding * 2,\n @title ? text_size(@title).width + padding * 2 : 0].max, Graphics.width].min\n end", "def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend", "def center(width)\n spaces_needed = width - self.print_width\n left_side = spaces_needed / 2\n right_side = spaces_needed - left_side\n (\" \" * left_side) << self << (\" \" * right_side)\n end", "def full_width\n width + (margin * 2)\n end", "def full_width\n width + (margin * 2)\n end", "def full_width\n width + (margin * 2)\n end", "def border\n buffer = screen_width % @border_character.length\n border_length = (screen_width / @border_character.length)\n @border_character * (border_length + buffer)\n end", "def widthcell\n 10\n end", "def term_width\n return @@terminal_width unless @terminal_width == nil\n begin\n require 'terminfo'\n @@terminal_width = TermInfo.screen_width - 1\n rescue\n @@terminal_width = 79\n end\n end", "def column_width=(value)\n @column_width = value\n end", "def set_band_width_mbps(v)\n Saklient::Util::validate_type(v, 'Fixnum')\n raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Router#band_width_mbps') if !@is_new\n @m_band_width_mbps = v\n @n_band_width_mbps = true\n return @m_band_width_mbps\n end", "def adjust w\n end", "def adjust w\n end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def full_width\n options.fetch(:full_width, false)\n end", "def calculate_width(width)\n new_width = width\n\n if /%/ === new_width\n new_width.delete!('%')\n width_num = new_width.to_i / 100.0\n new_width = \"#{width_num}\\\\textwidth\"\n end\n\n new_width\n end", "def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end", "def bordered; self.border = true; self; end", "def base_width; 24 + SKC_Settings::WIDTH; end", "def stroke_width(width)\n end", "def hscale(factor)\n @width *= factor\n @left *= factor\n self\n end", "def width!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n type = WIDTH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 365:8: 'width'\n match( \"width\" )\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__, 35 )\n\n end", "def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end", "def width=(value)\n @width = value\n end", "def half\n self / 2.0\n end", "def width(value)\n model.width = proc { value }\n end", "def width=(w)\n @view__.width = w\n end", "def print_top_right(htext)\n hlen = htext.length\n len = @window.getmaxx # width was not changing when resize happens\n len = Ncurses.COLS-0 if len == 0 || len > Ncurses.COLS\n #$log.debug \" def print_top_right(#{htext}) #{len} #{Ncurses.COLS} \"\n @form.window.printstring 0, len-hlen, htext, @color_pair, @attr\n end", "def outer_width; rect.width + @border_thickness * 2; end", "def width=(width)\n @width = width || 0\n end", "def width=(width)\n @width = width || 0\n end", "def width=(value)\n\t\t\t@width = value\n\t\tend", "def width=(value)\n\t\t\t@width = value\n\t\tend", "def terminal_height; end", "def terminal_height; end", "def width\n @column_widths.inject(0) { |s,r| s + r }\n end", "def print_bar(width, title=nil)\n if title\n title += \" (pretend)\" if pretend?\n half_width = (width / 2) - (title.length / 2) - 2\n left_bar = '=' * half_width\n right_bar = '=' * (title.length % 2 == 0 ? half_width : half_width - 1) # TODO: lame.\n puts \"#{left_bar}( #{title} )#{right_bar}\"\n else\n puts \"=\" * width\n end\n end", "def width_multiplier\n @width_multiplier || 1\n end", "def get_width; end", "def half( side )\n case side\n when :u; size.dup.y * ( 0.5 )\n when :d; size.dup.y * ( 0.5 )\n when :l; size.dup.x * ( 0.5 )\n when :r; size.dup.x * ( 0.5 )\n when :v; size.dup.y * ( 0.5 )\n when :h; size.dup.x * ( 0.5 )\n end\n end", "def tab width = 4\n \"&nbsp;\" * width\nend", "def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end", "def calc_width; padding * 2 + base_width; end", "def calc_width; padding * 2 + base_width; end", "def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end", "def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end" ]
[ "0.61330074", "0.6052642", "0.6025214", "0.6025214", "0.59762245", "0.59625757", "0.5883933", "0.58233356", "0.58233356", "0.58118", "0.5809252", "0.580705", "0.5781642", "0.57262594", "0.5705119", "0.56784034", "0.5667397", "0.566446", "0.566446", "0.566446", "0.566446", "0.566446", "0.566446", "0.566446", "0.566446", "0.566446", "0.56560403", "0.56560403", "0.55482703", "0.5505444", "0.54809207", "0.54753304", "0.5469384", "0.5469384", "0.54667985", "0.54583186", "0.5451922", "0.54471165", "0.54471165", "0.54176074", "0.5406384", "0.5399455", "0.5376063", "0.5374985", "0.53701735", "0.5353529", "0.53463566", "0.53368324", "0.53368324", "0.53335845", "0.5286962", "0.52804595", "0.52745277", "0.52421904", "0.5224259", "0.5219883", "0.52139735", "0.5173132", "0.5173132", "0.5173132", "0.5166601", "0.5151289", "0.5135108", "0.5117938", "0.5094101", "0.5083608", "0.5083608", "0.50800765", "0.50800765", "0.50648004", "0.50443614", "0.5043683", "0.50367934", "0.50247794", "0.50223565", "0.5020045", "0.50152194", "0.5007912", "0.50058895", "0.49975678", "0.49843022", "0.49782777", "0.497406", "0.49710694", "0.49706817", "0.49706817", "0.4968417", "0.4968417", "0.49665216", "0.49665216", "0.4964223", "0.49616462", "0.4956956", "0.49539572", "0.49536893", "0.49509507", "0.49443662", "0.49394348", "0.49394348", "0.49321193", "0.49037743" ]
0.0
-1
Set the bterm to half height
def unfullscreen_width return unless @window @window.decorated = true @window.set_resizable(true) # Resize the width of the window width = @window.screen.width height = @window.screen.height # We need to change the minimum size of the window min_width = width / 4 min_height = height / 4 @window.set_size_request(min_width, min_height) #puts "width : #{width} / #{height}" @window.unfullscreen # then we can resize to a smaller size new_width = width / 2 @window.move(0, 0) @window.resize( new_width , height) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_height; 24; end", "def base_height; 24; end", "def adjust_height\n self.height = fitting_height(1 + @max_lines)\n end", "def terminal_height; end", "def terminal_height; end", "def setcharheight(*)\n super\n end", "def initialize\n\t\t@height = 5\n\tend", "def height=(height) @side = height end", "def setheight(height)\n @height = height\n end", "def outer_height; rect.height + @border_thickness * 2; end", "def bottom!\n self.ox = self.width/2\n self.oy = self.height\n end", "def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end", "def height=(_); end", "def height=(_); end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def recalc_height\n line_number = 4 + product.materials.size\n self.height = fitting_height(line_number) + 3\n end", "def set_height_float\n h, f = height.split(\"-\")\n f = f.to_f/12\n h = h.to_f\n val = h+f\n self.update_attributes(height_float:val) \n end", "def height; end", "def height; end", "def box_height\n return line_height + 104 + line_height * (@params.size + 1)\n end", "def drb_height\n instance.options[:drb_height]\n end", "def drb_height\n instance.options[:drb_height]\n end", "def inqcharheight\n inquiry_double { |pt| super(pt) }\n end", "def height=(height)\n end", "def calc_height; padding * 2 + base_height; end", "def calc_height; padding * 2 + base_height; end", "def change_border_bottom(weight='thin')\n change_border(:bottom, weight)\n end", "def update_change_height\n return unless @mode == :take\n return unless open?\n optimal_h = fitting_height(1)\n return if self.height == optimal_h\n if self.height < optimal_h\n self.height = optimal_h\n elsif self.height > optimal_h\n self.height -= 5\n end\n end", "def per_legend_height\n 5\n end", "def line_height(*args, &block)\n MARW_CONFIGURATION[:line_height] < 18 ? super(*args, &block) : MARW_CONFIGURATION[:line_height]\n end", "def bottom_border_stroke\n line_stroke(\n settings.border.style.bottom_left,\n settings.border.style.bottom_junc,\n settings.border.style.bottom_right\n ) do\n settings.border.style.bottom_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def update_height\n @height = max_column.size if max_column.size > @height\n end", "def set_HalfBathrooms(value)\n set_input(\"HalfBathrooms\", value)\n end", "def height(value)\n @ole.Height = value\n nil\n end", "def height(value)\n @ole.Height = value\n nil\n end", "def default_body_height\n 420\n end", "def fitting_height(line_number)\n (line_number/2) * line_height + standard_padding * 2\n end", "def window_height\n fitting_height(11)\n end", "def window_height\n fitting_height(11)\n end", "def window_height\n fitting_height(11)\n end", "def standard_row_height\n 35\n end", "def line_height\r\n 15\r\n end", "def set_Height(value)\n set_input(\"Height\", value)\n end", "def window_height\n base_height = (wb = current_window_builder)[5] + wb[-1]\n base_height + default_line_height * line_number\n end", "def height\n @height || 100\n end", "def conveyor_belt_y\n center_y + center_y / 2 + 20\n end", "def height_multiplier\n @height_multiplier || 1\n end", "def border; end", "def reset_body\n mixin({\n line_height: 1\n })\n end", "def height\n Terminal.height\n end", "def setlinewidth(*)\n super\n end", "def terminal_height\n terminal_size.last\n end", "def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end", "def compute_height(pad = 2, factor = 13)\n (max_actions + pad) * factor\n end", "def bordered; self.border = true; self; end", "def height\n end", "def height\n end", "def grow \n\t\t@height += 1\n\tend", "def change_border_right(weight='thin')\n change_border(:right, weight)\n end", "def stretches\n @stretches ||= 20\n end", "def height=(value)\n @height = if @columns && value <= max_column.size\n max_column.size\n else\n value\n end\n end", "def height=(value)\n\t\t\t@height = value\n\t\tend", "def height=(value)\n\t\t\t@height = value\n\t\tend", "def height=(value)\n @height = value\n end", "def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end", "def line_height\n TDD::ABF::SETTINGS::OVERRIDE_LINE_HEIGHT[name] || @info[:lineHeight]\n end", "def half( side )\n case side\n when :u; size.dup.y * ( 0.5 )\n when :d; size.dup.y * ( 0.5 )\n when :l; size.dup.x * ( 0.5 )\n when :r; size.dup.x * ( 0.5 )\n when :v; size.dup.y * ( 0.5 )\n when :h; size.dup.x * ( 0.5 )\n end\n end", "def window_height\n end", "def print_border_mb row, col, height, width, color, attr\n # the next is for xterm-256 \n att = get_attrib attr\n len = width\n len = Ncurses.COLS-0 if len == 0\n # print a bar across the screen \n #attron(Ncurses.COLOR_PAIR(color) | att)\n # this works for newmessagebox but not for old one.\n # Even now in some cases some black shows through, if the widget is printing spaces\n # such as field or textview on a messagebox.\n # 2016-01-14 - replacing 1 with space since junk is showing up in some cases.\n space_char = \" \".codepoints.first\n (row-1).upto(row+height-1) do |r|\n # this loop clears the screen, printing spaces does not work since ncurses does not do anything\n mvwhline(r, col, space_char, len)\n end\n #attroff(Ncurses.COLOR_PAIR(color) | att)\n\n mvwaddch row, col, Ncurses::ACS_ULCORNER\n mvwhline( row, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, Ncurses::ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, Ncurses::ACS_VLINE, height-4)\n end", "def outside_border_size\n renderer.border_class == TTY::Table::Border::Null ? 0 : 2\n end", "def new_line\n biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH\n @contents_x = 0 \n @contents_y += biggest\n @biggest_text_height = WLH\n end", "def setup\n size 640, 360 \n @bar_width = 20\n @hue = Array.new( (width/@bar_width), 0 ) \n color_mode HSB, height\n no_stroke\n background 0\nend", "def height\n @height = @height + 1\n end", "def set_right_bottom_component comp, weight=nil\n raise \"Please add top component first!\" unless @added_top\n # what if user gives in wrong order !!\n @gb = @vim.add :divider, :SECOND, 0\n @right2 = @vim.add comp, :SECOND, weight\n @gb.next_component(@right2)\n _add_component comp\n @right2\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height=(value)\n @style.height = value\n end", "def initialize\n @root = nil\n @height_black = 0\n end", "def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end", "def setup\n size 640, 360\n color_mode HSB, 360\n no_stroke \n @bar_width = 20\n @saturation = Array.new( width/@bar_width, 0 ) \nend", "def bottom=(b); self[1] = b - self[3]; return b; end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def update_size\n @max_x = @glade['drawingarea'].allocation.width - 1\n @max_y = @glade['drawingarea'].allocation.height - 1\n @glade['xvalue'].set_range(1,@max_x)\n @glade['yvalue'].set_range(1,@max_y)\n end", "def on_get_line_height(x); (@row_height || -1); end", "def initialize(height = 0.0)\n @smells= true\n super\n end", "def setarrowsize(*)\n super\n end", "def cursor_height\n if @segments.first.text.empty?\n # Heights are off for empty text layouts. Fake it to make it (it\n # being a real height).\n new_segment = TextSegment.new(@dsl, \"Hi\", 100)\n height_from_segment(new_segment)\n else\n height_from_segment(@segments.first)\n end\n end", "def wclrtobot\n Ncurses.wclrtobot(pointer)\n end", "def tenth_frame; end", "def row_height=(value)\n @row_height = value\n end", "def height\n @bottom_edge - @top_edge\n end", "def my_width \n 0.75\n end", "def resize_by_bb!(bb)\n\t\t# this seems to only have a problem with the first selection?\n\t\t# after that, the code seems to work totally fine.\n\t\t\n\t\t\n\t\t# [\n\t\t# \t[CP::Vec2.new(-1, 0), CP::Vec2.new(bb.l,0)],\n\t\t# \t[CP::Vec2.new( 0, -1), CP::Vec2.new(0,bb.b)],\n\t\t# \t[CP::Vec2.new( 1, 0), CP::Vec2.new(bb.r,0)],\n\t\t# \t[CP::Vec2.new( 0, 1), CP::Vec2.new(0,bb.t)]\n\t\t# ].each do |a,b|\n\t\t# \tself.resize!(\n\t\t# \t\ta, :world_space, point:b, lock_aspect:false\n\t\t# \t)\n\t\t# end\n\t\t\n\t\t\n\t\t# maybe coordinate space conversion is making this screwy?\n\t\t# still not totally sure what corner is being used for the origin point any more\n\t\t# because I changed the notion of the Rect local coordinate space so many times.\n\t\t\n\t\t# (really want global y+ to be up, but currently it is down)\n\t\t# (so will likely have to change everything again)\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t# following calculation to get verts is from Rect#new_geometry (this file, further down)\n\t\t# cw winding\n\t\tverts = [\n\t\t\tCP::Vec2.new(bb.l, bb.t),\n\t\t\tCP::Vec2.new(bb.r, bb.t),\n\t\t\tCP::Vec2.new(bb.r, bb.b),\n\t\t\tCP::Vec2.new(bb.l, bb.b)\n\t\t]\n\t\t\n\t\t# mutate the state of the polygon\n\t\tcommit_verts!(verts)\n\t\t\n\t\t\n\t\t# # following line is from on BB#to_rectangle\n\t\t# self.body.p = CP::Vec2.new(bb.l, bb.b)\n\tend", "def height=(h)\n @view__.height = h\n end", "def formatted_height\n '000'\n end", "def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end", "def height\n\t\tfloors.size\n\tend" ]
[ "0.6235749", "0.6235749", "0.6040844", "0.6012444", "0.6012444", "0.5987575", "0.59422666", "0.59336895", "0.5923101", "0.58007324", "0.57415164", "0.5737822", "0.5711745", "0.5711745", "0.56730956", "0.56730956", "0.56730956", "0.5638921", "0.56002283", "0.5599227", "0.5599227", "0.5589957", "0.557402", "0.557402", "0.55265486", "0.5498707", "0.5492271", "0.5492271", "0.54627675", "0.5453004", "0.54452795", "0.5441945", "0.5434054", "0.541409", "0.5392495", "0.5370518", "0.5370518", "0.53543377", "0.53519505", "0.53450364", "0.53450364", "0.53450364", "0.53164786", "0.5309076", "0.529385", "0.52844554", "0.526823", "0.5259616", "0.5256333", "0.52527004", "0.52463496", "0.5244923", "0.52187365", "0.5200714", "0.5200123", "0.51902306", "0.5184134", "0.51774347", "0.51774347", "0.51595676", "0.51475024", "0.51290363", "0.5117224", "0.51115483", "0.51115483", "0.51078695", "0.5105039", "0.5104799", "0.51002675", "0.5087586", "0.5081047", "0.508081", "0.5076217", "0.5074481", "0.507398", "0.5051697", "0.50396705", "0.50396705", "0.50393564", "0.50360477", "0.5029347", "0.50257707", "0.5023756", "0.50221753", "0.50221753", "0.50221753", "0.5017713", "0.5013532", "0.50063914", "0.49989292", "0.49976677", "0.4991559", "0.4981644", "0.49776873", "0.49763408", "0.49654406", "0.49583775", "0.49398214", "0.49269652", "0.49247697", "0.4924233" ]
0.0
-1
Restore fullwidth for bterm
def fullscreen return unless @window # Restore the original dimensions and fullscreen @window.set_default_size(-1, -1) @window.move(0,0) @window.fullscreen @window.decorated = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_character_width_normal\n set_print_mode 0\n set_linefeed_rate 55\n end", "def set_character_width_normal\r\n set_print_mode 0\r\n set_linefeed_rate 55\r\n end", "def set_character_width_narrow\n set_print_mode 1\n set_linefeed_rate 40\n end", "def fw; self.fixed_width = true; self; end", "def full_width\n options.fetch(:full_width, false)\n end", "def in_xterm_state(options = {})\n output.echo_off\n output.enable_alternate_screen if options[:full] || options[:alternate_screen]\n output.enable_mouse if options[:full] || options[:mouse]\n output.hide_cursor if options[:full] || options[:no_cursor]\n output.enable_utf8 if options[:utf8]\n output.enable_focus_events\n output.enable_resize_events\n output.clear\n\n yield self\n ensure\n output.reset_all\n output.disable_utf8 if options[:utf8]\n if options[:full] || options[:alternate_screen]\n output.reset_color\n output.clear\n output.disable_alternate_screen\n end\n end", "def terminal_width; end", "def terminal_width; end", "def term_width\n @term_width.visible\n end", "def partial_reset_terminal\n # Reset the terminal to a useable state (undo all changes).\n # '\\e[?7h': Re-enable line wrapping.\n # '\\e[?25h': Unhide the cursor.\n # '\\e[2J': Clear the terminal.\n # '\\e[;r': Set the scroll region to its default value.\n # Also sets cursor to (0,0).\n # '\\e[?1049l: Restore main screen buffer.\n print \"\\e[?7h\\e[?25h\\e[;r\\e[?1049l\"\n\n # Show user input.\n system 'stty echo'\nend", "def wclrtobot\n Ncurses.wclrtobot(pointer)\n end", "def unfullscreen_width\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n \n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"width : #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_width = width / 2 \n @window.move(0, 0)\n @window.resize( new_width , height)\nend", "def reset!\n # Attributes affected by mode changes\n @gutter_attr = AnsiTerm::Attr.new(flags: 0, bgcol: [\n 48,2,*(adjust_color(background_color, 0.8) || GUTTER)])\n \n @cursor_attr = AnsiTerm::Attr.new(\n bgcol: [48,2,*hexcol(get_style_option(\"cursor\", :bg, default: \"#802080\"))],\n fgcol: [38,2,*hexcol(get_style_option(\"cursor\", :fg, default: \"#ffffff\"))],\n flags: nil\n )\n\n @moderender.mode = @editor.mode\n @moderender.buffer = @editor.buffer\n @moderender.reset!\n end", "def term_width\n return @@terminal_width unless @terminal_width == nil\n begin\n require 'terminfo'\n @@terminal_width = TermInfo.screen_width - 1\n rescue\n @@terminal_width = 79\n end\n end", "def terminal_width\n @terminal_width ||= (ENV[\"COLUMNS\"] || 80).to_i\nend", "def set_tyre_width(tyre_width)\n\t\t@tyre_width = tyre_width\n\tend", "def width=(_); end", "def width=(_); end", "def reset_cursor\n c = get_cursor_pos\n print_area_to_buffer(@main_buffer, c[0], c[1], @last_chars)\n @last_chars = cache_area(@main_buffer,\n c[0], 1,\n c[1], 1)\n @cursor = [\"\\u2588\"]\n print_area_to_buffer(@main_buffer, c[0], c[1], @cursor)\n\n return\n end", "def full_screen; end", "def restore_cursor; puts \"\\e[u\" end", "def set_fg\n STDOUT.write \"\\033[38;5;#{to_xterm}m\"\n end", "def reset_font_settings(*args, &block)\n super(*args, &block)\n self.contents.font.name = MARW_CONFIGURATION[:window_fontname] unless\n MARW_CONFIGURATION[:window_fontname].empty?\n self.contents.font.size = MARW_CONFIGURATION[:window_fontsize] unless\n MARW_CONFIGURATION[:window_fontsize] < 8\n end", "def screen_settings\n # TODO these need to become part of our new full_indexer class, not hang about separately.\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n # this depends now on textpad size not screen size TODO FIXME\n $grows = $glines - 1\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend", "def clear_output\n clear_output = ''\n\n (by..byn).each do |row|\n clear_output << \"\\e[#{row};#{bx}H\" + (' ' * width)\n end\n\n # reset cursor to top left of document\n clear_output << \"\\e[#{by};#{bx}H\"\n end", "def reset\n STDOUT.write \"\\033[0m\"\n end", "def print_top_right(htext)\n hlen = htext.length\n len = @window.getmaxx # width was not changing when resize happens\n len = Ncurses.COLS-0 if len == 0 || len > Ncurses.COLS\n #$log.debug \" def print_top_right(#{htext}) #{len} #{Ncurses.COLS} \"\n @form.window.printstring 0, len-hlen, htext, @color_pair, @attr\n end", "def to_s_auto \n width = Terminal.terminal_width\n end", "def full_width\n width + (margin * 2)\n end", "def full_width\n width + (margin * 2)\n end", "def full_width\n width + (margin * 2)\n end", "def fit_width; end", "def reset_terminal\n # Reset the terminal to a useable state (undo all changes).\n # '\\e[?7h': Re-enable line wrapping.\n # '\\e[?25h': Unhide the cursor.\n # '\\e[2J': Clear the terminal.\n # '\\e[;r': Set the scroll region to its default value.\n # Also sets cursor to (0,0).\n # '\\e[?1049l: Restore main screen buffer.\n print \"\\e[?7h\\e[?25h\\e[2J\\e[;r\\e[?1049l\"\n\n # Show user input.\n system 'stty echo'\nend", "def reset_screen\n print \"\\e[2J\\e[H\"\nend", "def apply_backspace\n end", "def erase_all\n getmaxyx\n clrtoeol(0...@lines)\n end", "def clear_to_cursor; print \"\\e[1K\" end", "def refresh_window_alignment\n self.x = case @@alignment\n when 0 then 0\n when 1 then Graphics.width/2-(width/2)\n when 2 then Graphics.width-width\n end\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def width\n Terminal.width\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def terminal_width\n if ENV['THOR_COLUMNS']\n result = ENV['THOR_COLUMNS'].to_i\n else\n result = unix? ? dynamic_width : 80\n end\n (result < 10) ? 80 : result\n rescue\n 80\n end", "def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n @tabs.render\n end", "def clear_up_to_cursor; puts \"\\e[1J\" end", "def restore_mode\n system \"stty #{@state}\"\n end", "def rouge\n \"\\033[0;91m#{self}\\033[0m\"\n end", "def screen_settings\n @glines, @gcols = `stty size`.split.map(&:to_i)\n # @glines = `tput lines`.to_i\n # @gcols = `tput cols`.to_i\n @grows = @glines - 3\n # @pagesize = 60\n # @gviscols = 3\n @pagesize = @grows * @gviscols\nend", "def window_width() Graphics.width - 128 end", "def wdeleteln\n Ncurses.wdeleteln(pointer)\n end", "def setcharheight(*)\n super\n end", "def rl_deprep_terminal()\r\n return if ENV[\"TERM\"].nil?\r\n return if (!@terminal_prepped)\r\n\r\n # Try to keep this function from being interrupted.\r\n block_sigint()\r\n\r\n if (@_rl_enable_keypad)\r\n _rl_control_keypad(false)\r\n end\r\n\r\n @rl_outstream.flush\r\n\r\n # restore terminal setting\r\n retry_if_interrupted do\r\n `stty #{@otio}`\r\n end\r\n\r\n @terminal_prepped = false\r\n rl_unsetstate(RL_STATE_TERMPREPPED)\r\n\r\n release_sigint()\r\n end", "def reset_window\n end", "def reset_focus\n mixin({\n outline: 0\n })\n end", "def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend", "def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend", "def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end", "def set_tyre_width(tyre_width)\n\t\tif tyre_width < 57 || tyre_width > 61\n\t\t\traise Exception.new \"Invalid tyre width for MTB\"\n\t\tend\n\t\t@tyre_width = tyre_width\n\tend", "def setlinewidth(*)\n super\n end", "def unfullscreen_height\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n\n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"height: #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_height = height / 2\n @window.move(0, 0)\n @window.resize(width, new_height)\nend", "def set_bg\n STDOUT.write \"\\033[48;5;#{to_xterm}m\"\n end", "def handle_offscreen_right() end", "def handle_offscreen_right() end", "def print_border_mb row, col, height, width, color, attr\n # the next is for xterm-256 \n att = get_attrib attr\n len = width\n len = Ncurses.COLS-0 if len == 0\n # print a bar across the screen \n #attron(Ncurses.COLOR_PAIR(color) | att)\n # this works for newmessagebox but not for old one.\n # Even now in some cases some black shows through, if the widget is printing spaces\n # such as field or textview on a messagebox.\n # 2016-01-14 - replacing 1 with space since junk is showing up in some cases.\n space_char = \" \".codepoints.first\n (row-1).upto(row+height-1) do |r|\n # this loop clears the screen, printing spaces does not work since ncurses does not do anything\n mvwhline(r, col, space_char, len)\n end\n #attroff(Ncurses.COLOR_PAIR(color) | att)\n\n mvwaddch row, col, Ncurses::ACS_ULCORNER\n mvwhline( row, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, Ncurses::ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, Ncurses::ACS_VLINE, height-4)\n end", "def clear_screen\n print \"\\e[2J\\e[f\"\nend", "def reset\n @window_size = options.window_size\n contexts.reset\n end", "def do_window_adjust(bytes); end", "def restore\n ConsoleGlitter.escape(\"u\")\n end", "def setwidth(width)\n @width = width\n end", "def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend", "def clear_frame\n print(\"\\e[1K\\e[G\")\n end", "def _screen_width\n\t\t80\n\tend", "def restore_screen\n output(Esc.string('screen_exit'), Esc.string('clear_last_line'))\n end", "def clear_to_beginning\n ConsoleGlitter.escape('1J')\n end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width=(width)\n end", "def self_clear\n print \"\\e[2J\\e[f\"\nend", "def cls\n `reset`\nend", "def raw_mode!\n Vedeu.log(\"Terminal switching to 'raw' mode\")\n\n @_mode = :raw\n end", "def setup_main_window\n main_window = Curses::Window.new(48, 60, 0, 0)\n main_window.attron(Curses.color_pair(8))\n main_window.box('|', '-')\n main_window.noutrefresh\n main_window\nend", "def clear_all\n Terminal.move_up(previous_draw_amount_of_lines)\n Terminal.clear_screen_from_cursor\n end", "def terminal_height; end", "def terminal_height; end", "def max_width\n FFI::NCurses.getmaxx FFI::NCurses.stdscr\n end", "def set_cursor_mode\n output(Esc.string('show_cursor')) unless raw_mode?\n end", "def clear_screen\n \"\\e[2J\\e[H\"\nend", "def terminal_size\n size = [80, 40]\n FFI::NCurses.initscr\n begin\n size = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr).reverse\n ensure\n FFI::NCurses.endwin\n end\n size\n end", "def clear_screen\n print \"\\e[2J\"\nend", "def reset_screen_clearing\n @clear_screen = false\n @clear_screen_code = \"\\e[H\\e[2J\"\n end", "def width(new_width, options = {})\n fill_window(false, options)\n width_str = \"width: #{new_width};\"\n\n add_style(width_str, options[:screen])\n end", "def adjust_width\n self.width = [[text_size('O' * @max_characters).width + padding * 2,\n @title ? text_size(@title).width + padding * 2 : 0].max, Graphics.width].min\n end", "def display\n system('clear')\n border\n puts table\n border\n end", "def terminal_width\n terminal_size.first\n end" ]
[ "0.6385343", "0.63474363", "0.62461656", "0.59402126", "0.5895237", "0.5821676", "0.5791077", "0.5791077", "0.5711419", "0.56973046", "0.5614492", "0.5605553", "0.5602575", "0.5565293", "0.5446268", "0.5434023", "0.5422502", "0.5422502", "0.5396127", "0.5389353", "0.5366721", "0.533987", "0.5330683", "0.52795696", "0.52349985", "0.5219642", "0.51999885", "0.5197807", "0.51948696", "0.51948696", "0.51948696", "0.51869434", "0.51784503", "0.5174853", "0.51307636", "0.5130059", "0.5128755", "0.51165086", "0.51150924", "0.5105898", "0.51034135", "0.5078466", "0.5071666", "0.5067188", "0.506534", "0.5034425", "0.5033195", "0.5011222", "0.49921343", "0.49914274", "0.49815744", "0.49718714", "0.4963872", "0.4960508", "0.4960508", "0.49432594", "0.49424216", "0.49148673", "0.49100193", "0.48972243", "0.48899937", "0.48899937", "0.48804688", "0.4877161", "0.4868545", "0.48625034", "0.4826007", "0.4820276", "0.48181817", "0.4815712", "0.48046678", "0.48040208", "0.47957256", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4790197", "0.4788871", "0.47868347", "0.47727007", "0.47726095", "0.47653562", "0.47636086", "0.47613913", "0.47613913", "0.47591954", "0.47590247", "0.47555315", "0.47551736", "0.47488558", "0.47468585", "0.47455248", "0.47421372", "0.47414038", "0.47407678" ]
0.5193306
31
choose random private stream and make sure not to choose two times the same for the same user
def create_private_stream user type = "" if @rand.uniform > @probabilities[:facebook_twitter_stream_probabillity].to_f type = "User::Authentication::Twitter" else type = "User::Authentication::Facebook" end if user.authentications.first && user.authentications.first._type == "User::Authentication::Twitter" type = "User::Authentication::Facebook" end if user.authentications.first && user.authentications.first._type == "User::Authentication::Facebook" type = "User::Authentication::Twitter" end authentications = user.authentications.to_a if type == "User::Authentication::Facebook" access_token = "access_token_facebook_#{@uuid}" authentications << User::Authentication::Facebook.new({ "uid" => @uuid, "access_token" => access_token, "fetch" => true, "expires_at" => Time.now+ 4.weeks, "last_fetched_at" => 4.weeks.ago }) BenchmarkStreamServer::Cache.instance.add_stream :url => "#{STREAM_SERVER}/facebook/#{access_token}", :length => 100, :id => access_token, :type => :facebook else access_token = "access_token_twitter_#{@uuid}" authentications << User::Authentication::Twitter.new({ "uid" => @uuid, "access_token" => access_token, "fetch" => true, "expires_at" => Time.now+ 4.weeks, "last_fetched_at" => 4.weeks.ago, "access_secret" => "abcedefewfwe" }) BenchmarkStreamServer::Cache.instance.add_stream :url => "#{STREAM_SERVER}/twitter/#{access_token}", :length => 200, :id => access_token, :type => :twitter end user.authentications = authentications @stream_counter += 1 @uuid += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_random(stream)\n stream.chars.uniq.sample\nend", "def randomStream\n Stream::ImplicitStream.new { |s|\n\t s.set_to_begin_proc = proc {srand 1234}\n\t s.at_end_proc = proc {false}\n\t s.forward_proc = proc {rand}\n\t}\nend", "def get_random_user\n $user_keys.sample()\nend", "def gen_uniq_rand(limit, unuseable)\n random = rand(limit)\n !(unuseable.include?(random)) ? random : gen_uniq_rand(limit, unuseable)\nend", "def random_user\n\t\tUser.find([*1..40].sample)\n\tend", "def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend", "def choice\n rand\n end", "def connect_stream (stream=1)\n\n\t\tlogger.info('Starting Random adapter')\n\t\trandom = RandomPhraseGenerator.new\n\t\ti=0\n\t\twhile true\n\t\t\t\n\t\t\tpersist random.generate\n\n\t\t\ti = i+1\n\t\t\tif i%10 == 0\n\t\t\t\tsleep 10\n\t\t\tend\n\t\t\t\n\t\tend\n\n\tend", "def test_different_rand_for_different_seeds\n random_generator = RandomGenerator::new\n random_generator.get_rand(1)\n first_val = rand()\n random_generator.get_rand(2)\n second_val = rand()\n assert_equal false, (first_val == second_val)\n end", "def gen_pub_key(tn)\n begin\n pub = rand(3..tn)\n # end until Prime.fermat_prime?(pub) && pub.gcd(tn) == 1\n end until pub % 2 != 0 && pub.gcd(tn) == 1\n pub\n end", "def get_random()\n \n end", "def get_random()\n \n end", "def private_generate_token\n begin\n #self.access_id = SecureRandom.base64(40)\n\t self.access_id = SecureRandom.hex(40)\n end while self.class.exists?(access_id: access_id)\n end", "def random_player \n\t\tsalida_aleatoria = rand(1..3)\n\t\tsalida_aleatoria\n\tend", "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 generate_around_site\n return Video.order(\"RAND()\").limit(4)\n end", "def pick(seed)\n @perms.sample random: Random.new(seed)\n end", "def shareAllRandomly (id)\nend", "def nostalgia; return rand end", "def rand\n Kernel.rand(self)\n end", "def generate_tokens\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless User.exists?(token: random_token)\n end\n self.owner_token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless User.exists?(owner_token: random_token)\n end\n end", "def random_user\n User.offset(rand(User.count)).first\nend", "def generate\n (0..30).sort{ rand() } .take(@conf)\n end", "def secure_random\n OpenSSL::Random.random_bytes(32).unpack(\"H*\")[0]\n end", "def generateRandomMember(members_count)\n rand(members_count)\nend", "def generate_password\n ['test', 'guest'].sample\nend", "def check_key2\n while @key2 == @key1\n @key2 = 1 + rand(6)\n end\n end", "def random_incoming(delta, rock_count, now)\n if delta > 100 && rock_count < rand(5..15)\n rand_rot = rand(0.1..0.5) * [-1, 1].sample\n Rock.new(@window, @object_pool, x: @window.width, y: rand([email protected]), vel_x: rand(-3.0..-2.0), vel_y: rand(-0.5..0.5), ang_vel: rand_rot)\n @last_spawn = now\n end\n end", "def pick_random_number(digits=1)\n min = 10 ** (digits - 1)\n max = (10 ** digits ) - 1\n semirandom = min + rand(max-min)\n semirandom += 1 if semirandom == 666 #would be unpleasant to receive...\n return semirandom\n end", "def create_event_tickets(event)\n # Ensures that the event creator doesn't request to join his own event and no users request twice.\n unused_users = User.all.to_a.reject!{ |u| u == event.user}\n rand(4..6).times do\n ticket = Ticket.new(\n event: event,\n user: unused_users.sample\n )\n unused_users.delete(ticket.user)\n ticket.status = ['pending', 'accepted'].sample\n ticket.save\n end\nend", "def rand_choice \n Random.rand(0...6)\n end", "def get_user2\n alphabet = ('a'..'z').to_a\n @user_2 = alphabet.sample\nend", "def generate_identity\n self.uid ||= OpenSSL::Random.random_bytes(16).unpack('H*').first\n self.secret ||= OpenSSL::Random.random_bytes(32).unpack('H*').first\n true\n end", "def new_random\n @randomizer = Random.new if $options['respect_randomize'].value\n end", "def choose_first\n num = 1 + rand(2)\n puts \"Player #{num} will start the game.\"\n if num == 1\n @current_player = @player1\n else\n @current_player = @player2\n end\n end", "def randomkey; end", "def randomkey; end", "def rand\n warn \"STUB: rand in distribution.rb\"\n end", "def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend", "def create_share_token\n # Don't update it if you don't need to! We never want this to change\n self.share_token = SecureRandom.hex(13) unless share_token\n end", "def generate_url_token\n begin\n self.url_token = SecureRandom.urlsafe_base64(8)\n end while Presentation.exists?(:url_token => self.url_token) \n end", "def generate_reviewer_key\n if self.reviewer_key.blank?\n self.reviewer_key = Random.new.rand(100_000_000..1_000_000_000-1)\n end\n return true\n end", "def random_computer_input\n ['R', 'S', 'P'].shuffle!.last\nend", "def computer_ai_1\n choices =['r', 'p', 's']\n choices.sample\n end", "def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend", "def pick_suspect\n #random number and grab index from suspect array\n random_index = rand(0..Suspect.all.size)\n self.suspect = Suspect.all[random_index]\n end", "def cisco_rand\n rand(1 << 24)\n end", "def next_id!\n\t\t\t# Using sequential numbers for the query ID is generally a bad thing because over UDP they can be spoofed. 16-bits isn't hard to guess either, but over UDP we also use a random port, so this makes effectively 32-bits of entropy to guess per request.\n\t\t\tSecureRandom.random_number(2**16)\n\t\tend", "def tribal_council(options)\n # filter out the immune memeber and grab a random sample member\n rejected = @members.reject { |member| member == options[:immune] }.sample\n \n # remove the random sample member\n @members.delete(rejected)\n\n # return the random sample member.\n rejected\n end", "def select_players_for_slytherin(full_list_of_players, already_used_players)\n players = []\n while(players.size < 5) do\n player = full_list_of_players[rand(full_list_of_players.size)]\n if !already_used_players.include?(player) && !players.include?(player)\n players << player\n end\n end\n players\nend", "def prompt_select(key)\n PROMPTS[key].sample(5)\n end", "def typical_users(n=1,randomize=true)\n ids = items.flat_map {|item|\n item.subscriber_ids\n }.reduce(Hash.new(0)) { |h,id|\n h[id] += 1\n h\n }\n .sort_by{|k,v| v}.reverse\n .take(2*n)\n .sample(n)\n .map(&:first)\n\n User.any_in(id: ids)\n end", "def pick_random\r\n @card_list.pick_random\r\n end", "def randomize\n @links.sample\n end", "def generate_secret\n @secret = (1..4).map{ rand(10).to_s }.join \"\"\n @is_showing_secret = true\n return @secret\n end", "def random\n @playlist = @db.shuffle\n end", "def make_not_so_random!\n srand 1213\nend", "def create_key\n self.winner_id = loop do\n random_token = rand.to_s[2..6]\n break random_token unless Winner.exists?(winner_id: random_token)\n end\n end", "def random_resilience_generator\n self.resilience = 10.times.sum{ Random.rand(1..13) } \n end", "def pick_actor\n ACTOR.sample\nend", "def get_stream_selection(description, streams, default_prompt_choice, default_value)\n if streams.count >= 1\n idx = prompt_stream_selection(description, streams, default_prompt_choice).to_i\n return (idx == -1) ? default_value : streams[idx]\n end\n return default_value\nend", "def initialize(secret_number=[1..10].sample) #sample should give me a random number\n @secret_number = secret_number\n end", "def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend", "def randomize_id\n begin\n self.id = SecureRandom.hex 5\n end while ItAsset.where(id: self.id).exists?\n end", "def make_first_guess\n\t first_rand = :default\n\t second_rand = :default\n\t loop do\n\t\tfirst_rand = COLORS[rand(6)]\n\t\tsecond_rand = COLORS[rand(6)]\n\t\tbreak if first_rand != second_rand\n\t end\n\t @first_guess = [first_rand,first_rand,second_rand,second_rand]\n\t sleep 1\n\t @last_guess = @first_guess\n\t return @first_guess\n\tend", "def campaign_for_serving\n self.active_campaigns.rand\n end", "def random\n card_dealt = @possible_cards.sample\n end", "def recite_random_subject\n number = rand(1..@size)\n return recite_subject(number)\n end", "def generate_private_token\n self.private_token = SecureRandom.hex(10) if private_token.blank?\n end", "def slug_candidates\n SecureRandom.uuid\n end", "def random\n # Hack to get the player interface\n player_iface = @parent.player.send(:interface)\n # Second integrer in array is the random status\n return player_iface.GetStatus.first[1] #== 1\n end", "def get_sample\n reviews = Review.where(destination_id: self.id)\n sample = reviews[rand(reviews.length)]\n return sample\n end", "def next_rand\n begin\n num = rand(0...possible_products.count)\n end while(@chosen_nums[num])\n @chosen_nums[num] = 1\n num\n end", "def reset\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n if @current_player == 1\n @current_player = 2\n else\n @current_player = 1\n end\n end", "def random_role\n ['admin', 'player'].sample\n end", "def check_key3\n while @key3 == @key1 || @key3 == @key2\n @key3 = 1 + rand(6)\n end\n end", "def random_type; end", "def generate_token\n begin\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end while Invitation.exists?(:token => self.token)\n end", "def next\n Time.now + @min + Random.rand(@max - @min)\n end", "def find_pair(person)\n total = @pairs.length\n pick = rand(total)\n if invalid_pair? pick,person\n pair = @pairs.delete_at(pick)\n else \n pair = find_pair(person) \n end \n pair \nend", "def random\n RandomJam.jam(@api_key, @https)\n end", "def generate_utoken\n self.utoken = loop do\n random_token = SecureRandom.base58(UTOKEN_LENGTH)\n break random_token unless Session.exists?(utoken: random_token)\n end\n end", "def check_key4\n while @key4 == @key1 || @key4 == @key2 || @key4 == @key3\n @key4 = 1 + rand(6)\n end\n end", "def trading_session\n\t\tmarket_driver = rand(1..2)\n\tend", "def new_session_frame\n \n return SessionIDRandModifier % rand( SessionIDRandLimit ) \n\n end", "def generate_dilute\n found = false\n until found\n slug = SecureRandom.hex(rand(1..5)) #customize range based on requirement\n found = Shortener.where(dilute: slug).take.nil?\n end\n self.dilute = slug\n self.hits = 0\n end", "def random= rnd\n @sampling.random = rnd\n end", "def share\n self.slug = SecureRandom.urlsafe_base64\n end", "def random_flag\n ['au', 'ca', 'gb', 'gb', 'gb', 'nz', 'us', 'us', 'us'].sort { rand <=> rand }.first\n end", "def secure_sample(n=:single, o={})\n o, n = n, :single if n.is_a?(Hash)\n raise ArgumentError, 'wrong number of arguments (2 for 1)' unless o.is_a?(Hash)\n if random = o[:random]\n args = [{random: random}]\n args.unshift(n) unless n == :single\n sample(*args)\n else\n if n == :single\n self[SecureRandom.random_number(size)]\n else\n raise ArgumentError, 'negative sample number' if n < 0\n res = []\n old = dup\n n = size if n > size\n [*(size-n+1)..size].reverse_each.with_object([]){ |i, res|\n res << old.delete_at(SecureRandom.random_number(i))\n }\n end\n end\n end", "def select_player_random\n num_player = rand(@players.length)\n num_player\n end", "def pick_random\n @card_list.pick_random\n end", "def pick_random\n @card_list.pick_random\n end", "def choose_first(player1, player2)\n players = [player1, player2]\n play_first = players[rand(2)]\n play_second = players.find { |elem| elem != play_first }\n puts \"#{play_first.name} has been randomly chosen to play first\"\n [play_first, play_second]\nend", "def generate_token\n loop do\n new_token = Digest::SHA1.hexdigest([Time.now, rand].join).first(35)\n break self.token = new_token unless InvitationLink.where(:token => new_token).exists?\n end\n end", "def result\n user_number = params[:number1].to_i\n number = @@numbers\n if number < user_number\n @result = \"Make it less\"\n elsif number>user_number\n @result = \"Make it more\"\n else\n @result = \"Yes, The secret number is #{number}\"\n # if the player could guess the secret number, this will gonna change-\n # the number as player can play again\n # @@number_rand = rand 500\n @@numbers = rand params[:max]\n end\n end", "def assign!(user_id)\n user_transcribed_filings = Transcription.where(:user_id => user_id).map {|q| q[\"#{self.table_name.downcase.singularize}_id\".to_sym] }.uniq\n filings = self.where(:verified => [nil, false])\n if user_transcribed_filings.length > 0\n filings = filings.where(\"id NOT IN (?)\", user_transcribed_filings)\n end\n pick = rand(filings.length - 1)\n filings.length > 0 ? filings[pick] : nil\n end" ]
[ "0.68680674", "0.6742204", "0.6254884", "0.6064002", "0.58591825", "0.58431154", "0.58306", "0.58177215", "0.5814763", "0.5789193", "0.57784504", "0.57784504", "0.5738883", "0.5667197", "0.5629166", "0.5629166", "0.5629166", "0.5629166", "0.5586183", "0.558515", "0.5581464", "0.55663735", "0.5563573", "0.55614686", "0.55508804", "0.55253655", "0.5517155", "0.54957086", "0.54954815", "0.54917645", "0.54856575", "0.5473388", "0.54693556", "0.54654634", "0.5462681", "0.5458258", "0.5453452", "0.54500544", "0.54493916", "0.54493916", "0.54415935", "0.54197055", "0.5419169", "0.5413939", "0.5412132", "0.5403742", "0.53962404", "0.53959495", "0.5395943", "0.5387952", "0.5385597", "0.5385164", "0.5379036", "0.5374994", "0.5369699", "0.5365274", "0.5359189", "0.53502756", "0.5350012", "0.53462005", "0.53339136", "0.53253424", "0.5313042", "0.53117895", "0.53083575", "0.5293039", "0.52888703", "0.5283276", "0.5280625", "0.5279505", "0.5279388", "0.5271786", "0.52708244", "0.5267905", "0.5265935", "0.5260622", "0.52590436", "0.5257897", "0.52577513", "0.5251626", "0.5242327", "0.523698", "0.52339995", "0.52333826", "0.52322024", "0.5230805", "0.52283573", "0.5226151", "0.52252334", "0.52224123", "0.52213013", "0.5220819", "0.52177215", "0.521767", "0.52173084", "0.52173084", "0.5213331", "0.5208477", "0.5208135", "0.5202315" ]
0.6067243
3
logs the last played code and hits
def new_hits(code, hits) @log << {code: code, hits: hits} nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_log\n puts \"Nr | Codes #{\"-\" * (@code_length * 4 - 9)} | white hit | black hit |\"\n count = @max_rounds\n @max_rounds.times do\n count -= 1\n if count >= @log.length\n puts \"#{sprintf('%02d', count + 1)} |#{\" |\" * (@code_length)} | |\"\n else\n row = @log[count]\n code = row[:code].join(' | ')\n puts sprintf('%02d | %s | %d | %d |', count + 1, code, row[:hits][:white], row[:hits][:black])\n end\n end\n end", "def gamelog(line)\r\nend", "def new_hits(hits)\n @log << {code: @code, hits: hits}\n nil\n end", "def hits_prev\n # see PsiBlastJob for comment\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def on_exit\n\t\tputs \"live coding history: #{@history.size} states\"\n\tend", "def record_hit(klass, data)\n system(\"echo '#{data}' >> #{get_log_file_name(klass)}\")\n end", "def game_history\n MyCliProject::Game.all.each do |game|\n puts Rainbow(\"------------------------------\").red\n puts \"#{game.game_name}\"\n puts Rainbow(\"------------------------------\").red\n end\n continue_or_exit \n end", "def hit(timestamp)\n \n end", "def hit\n @printer = []\n @printer << \"You Hit.\"\n deal_player\n pl_total\n if session[:player].bust? || session[:player].hand_total == 21\n @action = :end\n run_dealer\n else\n @action = :choice\n end\n chat\n end", "def put(code)\n Log.put(code)\n puts\nend", "def handle\n self.status\n output << \"Your final score is => #{player.score}\\n\"\n end", "def add_hit\n @hits += 1\n :hit\n end", "def record\n word = \"GHOST\"\n @losses.each do |player, losses|\n p \"#{player.name}: #{word[0...losses]}\"\n end\n end", "def play\n abort %(None from #{@user}. Fuck off.).magenta if @recordings.empty?\n stdout = preface\n @recordings.each do |r|\n stdout += \"\\n#{r[:time]} : \".cyan + \"@#{r[:user]}\".yellow\n stdout += \"\\n#{r[:message]}\\n\\n\"\n end\n puts stdout\n stdout\n end", "def record(player)\n count = losses[player]\n \"GHOST\".slice(0, count)\n end", "def play\r\n puts @recordings.last\r\n end", "def on_timed_hit_success\n end", "def hit\n player.hit!(deck)\n puts \"[#{player.dealt.last}] Total: #{player.score}.\"\n puts \"Dealer: [#{dealer.dealt[1]}]\"\n end", "def player_hit\n player_hand << deck.cards.pop\n puts \"you drew a #{player_hand.last.face} of #{player_hand.last.suit}.\"\n end", "def scores(asteroids_hit, asteroids_missed, time_left, levels)\n\t\[email protected](\"Hit: #{asteroids_hit} Missed: #{asteroids_missed} Level #{levels} Time: #{time_left.strftime(\"%M:%S\")}\", 10, 10, 3)\n\t\t#### maybe add a counter so that you can have more than 2 lives?\n\tend", "def hit; end", "def track_end track\n track_print track\n end", "def print_current_action\n p phase_sequence[battle_phase].call\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log_results!(player, computer, player_log, computer_log)\n if win_round?(player, computer)\n player_log << 1\n computer_log << 0\n return player_log, computer_log\n elsif player == computer\n player_log << 0\n computer_log << 0\n return player_log, computer_log\n else\n player_log << 0\n computer_log << 1\n return player_log, computer_log\n end\nend", "def play\n puts \"#{name} got zoomies playing fetch!\"\n @hungry = true\n end", "def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend", "def call_debug\n call_idle($game_player.old_character_name, false)\n syn_map_debug\n end", "def profile()\r\n puts \"#{@name} has #{@hitpoint} and #{@attack_damage} attack damage\"\r\n end", "def game_over_check\n if $player.hp > 0\n # allow retry \n puts \"You have #{$player.hp} lives left!\"\n sleep(2.5)\n system \"clear\"\n puts \"Try again\"\n try_again\n else\n puts \"GAME OVER!!!!! :(\"\n puts \"Final score: #{$player_score}\"\n # puts $player.class\n high_score = Hash.new{0}\n high_score[:playername] = $player.name\n high_score[:playerscore] = $player_score\n write_to_file(high_score)\n retry_game\n end\nend", "def announce_code\n puts \"\\nYou lost :( The code was: #{@board.format(@board.maker)}\"\n end", "def last_frame; frames.last; end", "def play\n wake\n puts \"You play fetch with #{@name}.\"\n time_passed\n end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def log\n end", "def played\n won + drawn + lost + noresult\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def record_won_ball!\n @points += 1\n end", "def output\n if player1_wins > player2_wins\n puts \"Player 1: (with a score of) #{player1_wins}\\n\\n Won this game! \\n\\nAfter #{round_number} rounds and survived #{tie} WARs.\"\n elsif player1_wins < player2_wins\n puts \"Player 2: (with a score of) #{player2_wins}\\n\\n Won this game! \\n\\nAfter #{round_number} rounds and survived #{tie} WARs.\"\n # else\n # puts \"ERRRRRRRRRROOOOOOOOOORRRRRR\"\n # puts player1_wins\n # puts player2_wins\n # puts tie\n end\n end", "def hit hits\n # blackout the screen\n @watcher.observe_sensors if @serialEnable\n if hits >= 1 and hits < @frameDelay \n @black.blit @screen,[0,0]\n hits += 1\n @ducks.map &:color_trans\n end\n # Draw each duck as a white square\n if hits >= @frameDelay and hits < @frameDelay*(@ducks.count) + @frameDelay \n puts \"******** drawOffset: #{@drawOffset} ****************\"\n if hits % @frameDelay == 0\n @drawOffset += 1 \n # displays each duck for the alloted frameDelay\n @ducks.each_with_index do |duck, index| \n if (index == @drawOffset ) \n puts \"drawOffset: #{@drawOffset}, index that is white: #{index}\"\n duck.color_white()\n else\n duck.color_black()\n duck.draw @screen\n duck.color_trans()\n end\n end\n end\n\n puts \"P1 #{@whoPulledTrigger}, #{@player1Hit}\"\n puts \"P2 #{@whoPulledTrigger}, #{@player2Hit}\"\n \n # who killed the duck\n if @whoPulledTrigger == \"1\" and @player1Hit == \"1\"\n @player1Score += 1 \n @whoPulledTrigger = \"0\"\n @killDuck = true\n end\n if @whoPulledTrigger == \"2\" and @player2Hit == \"1\"\n @player2Score += 1 \n @whoPulledTrigger = \"0\"\n @killDuck = true\n end\n\n @player1Hit = \"3\" \n @player2Hit = \"3\"\n\n if @killDuck == true\n #@ducks[@drawOffset].alive = false\n @ducks.delete_at @drawOffset\n @killDuck = false\n end\n\n hits += 1\n # Go back to normal\n elsif hits >= @frameDelay*(@ducks.count) + @frameDelay \n @drawOffset = -1\n @whoPulledTrigger = 0\n @ducks.map &:duck\n @background.blit @screen, [0,0]\n hits = 0\n end\n return hits\n end", "def played\n # @@played.inspect\n index = @@played.length \n puts @@played[index-1].show \n end", "def game_info(year, input)\r\n x = get_games(year, input).sort.to_h\r\n\r\n #determine if the team did not exist during the given year\r\n if x == {}\r\n puts \"The #{self.chosen_team_full_name} did not play any games in #{year}.\"\r\n end\r\n\r\n if self.chosen_team_full_name != nil\r\n self.chosen_team_nickname = self.chosen_team_full_name.split(\" \").last\r\n end\r\n\r\n counter = 0\r\n x.each do |key, value|\r\n counter += 1\r\n if value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} win #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".green\r\n sleep(0.2)\r\n elsif value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} lose #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} lose #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} win #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:green)\r\n sleep(0.2)\r\n end\r\n \r\n if counter % 20 == 0\r\n puts \"Type 'n' if you do not want to see more games. Otherwise press 'Enter'\"\r\n input = gets.chomp \r\n\r\n if input == \"n\"\r\n break\r\n end\r\n\r\n end\r\n\r\n end\r\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def record_won_ball!\n @points +=1\n end", "def recordAnalysis(filename)\n\t\t\tfile = File.open(filename, \"a\")\n timenow = Time.now.asctime\n # file.puts @resulta\n file.puts @score\n file.puts @table\n file.puts @turn\n file.puts @turnsleft\n file.puts secret\n file.close \n \n end", "def process_latest_event\n e = @latest_event\n\n new_event(e[:play_count], e[:text])\n update_bases_widget({\n :bases_occupied => e[:bases_occupied],\n :baserunners => e[:baserunners],\n :baserunner_names => e[:baserunner_names],\n })\n update_inning_marker(e[:inning], e[:is_top]) \n update_count_widget(e[:current_balls], e[:current_strikes], e[:current_outs])\n update_weather(e[:weather])\n\n # Who's at the plate now? Remember, there is no \"batter\" as such\n # once they're running.\n #\n # Also, we don't fetch new hitting stats if it's already the player at-bat.\n batterid = e[:is_top] ? e[:away_batter] : e[:home_batter]\n battername = e[:is_top] ? e[:away_batter_name] : e[:home_batter_name]\n\n if batterid && battername && (batterid != @most_recent_batter)\n @most_recent_batter = batterid\n update_playerinfo(batterid, battername)\n get_hitting_stats(batterid)\n end\n end", "def display_info\n\t\tputs \"Total track number: #{@track_list.length}\"\n\t\tputs \"Total artist number: #{@artist_list.length}\"\n\t\tputs \"Last three played track:\"\n\t\t@last_played.each do |last_played_track|\n puts \"------------ Track Info -------------\"\n\t\t\tputs \"#{last_played_track.to_s}\"\n\t\tend\n\tend", "def process\n finish_games\n level_up\n warn_level_up\n start_games\n end", "def end_game_codemaker\n if @won\n puts 'Congratulations! You chose a really difficult code!'\n @player_score += 1\n else\n puts 'Better luck next time!'\n puts \"The computer was able to guess #{@mastermind_code} in #{@turn} turn#{@turn == 1 ? '' : 's'}.\"\n end\n # Give some time for the player's response\n sleep(1)\n end", "def call()\n @logger.info([@type, \"#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})\"])\n @count += 1\n end", "def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end", "def guess\n puts \"Write down a guess.\"\n @guess_code.make_seq\n @code_seq = guess_code.sequence\n end", "def master_mind(solution, guess)\n hits = hit(solution, guess)\n pseudo_hits = psuedo_hit(solution, guess)\n \"hits: #{hits}\\n pseudo hits: #{pseudo_hits}\"\nend", "def game_complete_text\n slow_type(\"\\nCongratulations, #{@new_player_name}! You have found your way out!\")\n pause(0.3)\n slow_type(\"Written, developed and coded by Adam Vaughan and Danny Smith.\")\n pause(0.3)\n slow_type(\"Stayed tuned for more levels!\")\n end", "def logs message\n puts \"#{Time.now}: #{message}\"\n end", "def detect_injury \n @last_hit = time unless events['got_hit'].empty? \n if @last_hit and time - @last_hit < 4\n say('hit')\n @turn_speed = @FAST_TURN \n elsif @last_hit and (time - @last_hit < 10)\n say('not hit')\n @turn_speed = rand(1...@NORMAL_TURN) \n end \n end", "def examine \n\t\tputs \"Your Description: #{@player.desc}\" \n\t\tputs \"Health Status: #{@player.health}\" \n\tend", "def native_hit\n 95\n end", "def begin_backtrack(level)\n # System.out.println(\"enter backtrack \"+level);\n @num_backtrack_decisions += 1\n end", "def current_hp\n puts \"P1: #{@player1.hp}/3 vs P2: #{@player2.hp}/3\"\n end", "def func_lastmatch(sender, dest, args)\r\n\t\tcount= 1\r\n\t\tcount= args[0].to_i() if args.size() >= 1\r\n\r\n\t\tres= @db.query(\"SELECT * FROM matchs WHERE (Type='t' OR Type='m' ) AND Etat='t' ORDER BY Date DESC LIMIT #{count}\")\r\n\t\tshowMatchFromQuery(res, sender)\r\n\t\tres.free()\r\n\tend", "def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end", "def talk(str='')\n if ENV['TALKATIVE']!=nil\n puts str\n end\n if ENV['GRADER_LOGGING']!=nil\n log_fname = ENV['GRADER_LOGGING']\n fp = File.open(log_fname,\"a\")\n fp.puts(\"run: #{Time.new.strftime(\"%H:%M\")} #{str}\")\n fp.close\n end\nend", "def call()\r\n @logger.info([@type, \"#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})\"])\r\n @count += 1\r\n end", "def log(msg)\n puts(\"#{Time.now}> #{msg}\")\n end", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def end_game_codebreaker\n if @won\n puts 'Congratulations! You win!'\n else\n puts \"Better luck next time! The code was #{@mastermind_code}.\"\n @computer_score += 1\n end\n # Give some time for the player's response\n sleep(1)\n end", "def info(msg) log(6, msg); end", "def high_score(current_score,finished_game_counter)\n if finished_game_counter == 0\n puts \"No games played yet\"\n elsif\n puts \"Best game: #{current_score} turns\"\n end\nend", "def player_lost\n\t\tputs \"\\nI am sorry, but you have lost!\"\n\t\tputs \"The secret number was #{self.secret_number}\"\n\t\tself.player_record[\"Losses\"] += 1\n\tend", "def log(phrase)\n puts \"INFO: \" + phrase\nend", "def log(output)\n the_time = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n puts \"#{the_time}: #{output}\"\nend", "def log(str); puts \"[#{Time.now}] #{str}\"; end", "def dealer_hit\n dealer_hand << deck.cards.pop\n puts \"Dealer pulled a #{dealer_hand.last.face} of #{dealer_hand.last.suit}.\"\n end", "def now_playing(m, nick)\n\t\t\t\tnick = CGI::escape(nick)\n\t\t\t\tartist, track = get_data(nick)\n\t\t\t\tm.reply(\"#{nick} has recently played: #{artist} - #{track}\")\n\t\t\tend", "def log\n Engines.log\n end", "def log_action msg\n\t\t\t\tputs '=> ' + msg\n\t\t\tend", "def outcome\n if self.final\n \th = home_team\n \ta = away_team\n \t# h.wins=0 if h.wins==nil\n \t# h.losses=0 if h.losses==nil\n \t# a.wins=0 if a.wins==nil\n \t# a.losses=0 if a.losses==nil\n \tif home_score == away_score\n \t\treturn 'T'\n \telsif home_score > away_score\n \t\tif !self.recorded\n \t \t\th.wins += 1\n \t \t\ta.losses += 1\n \t \t\th.save\n \t \t\ta.save\n \t \t\tself.recorded=true\n \t \t\tself.save\n \t \tend\n \t\tif overtime\n \t\t\treturn 'h'\n \t\telse\n \t\t\treturn 'H'\n \t\tend\n \telse\n \t\tif !self.recorded\n \t \t\th.losses += 1\n \t \t\ta.wins += 1\n \t \t\ta.save\n \t \t\th.save\n \t \t\tself.recorded=true\n \t \t\tself.save\n \t \tend\n \t\tif overtime\n \t\t\treturn 'a'\n \t\telse\n \t\t\treturn 'A'\n \t\tend\n \tend\n end\n end", "def log( m, sentence )\n # Prep the sentence so it doesn't keep msg in memory.\n sentence.msg = nil\n\n # Pop it on our psuedostack\n $bot.logs[m.channel] << sentence \n\n if $bot.logs[m.channel].length > $bot.set['history']\n $bot.delete_at 0\n end\n end", "def play_round #this is a single round \n self.dictionary\n @fragment = \"\"\n round_over = false\n\n while round_over == false\n player = self.current_player\n if self.take_turn(player) == true\n round_over = true\n else\n self.next_player!\n end\n end\n\n puts \"Round is over! Word spelt: #{@fragment}\"\n puts \"STANDINGS:\"\n puts \"#{self.record(self.current_player.name)}\"\n puts \"#{self.record(self.previous_player.name)}\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"\"\n end", "def display_end_game(player)\n if(player.guess == @secret_code)\n if @role == \"computer\"\n puts \"You successfully guessed the code!\"\n else\n puts \"The computer successfully guessed your code in #{player.guess_count} guesses\"\n end\n else\n puts \"You ran out of guesses. The correct code was:\"\n @secret_code.each do |code|\n print code + \" \"\n end\n puts \"\\nPlease try again.\"\n end\n end", "def logs\n end", "def score\n puts \"---#{player.name.upcase}: #{player.score} -- #{dealer.name.upcase}: #{dealer.score}---\"\n end", "def log\n return if @logger.nil?\n\n @logger.debug(\"Counter\") { \"attempt #{self}\" }\n end" ]
[ "0.6126116", "0.61000323", "0.6067652", "0.58857936", "0.5847424", "0.5847424", "0.58336335", "0.5765687", "0.57568127", "0.5699881", "0.56858563", "0.5628003", "0.5612835", "0.5602555", "0.5580907", "0.55758446", "0.5527876", "0.5520096", "0.5518483", "0.5477998", "0.54499215", "0.54024947", "0.53761053", "0.53740644", "0.5366597", "0.53573006", "0.53573006", "0.53573006", "0.53573006", "0.53573006", "0.53573006", "0.53573006", "0.53573006", "0.5331422", "0.53186333", "0.5290747", "0.5260397", "0.5251547", "0.52512133", "0.52259254", "0.52066374", "0.51843184", "0.51672584", "0.5155764", "0.5149733", "0.51236224", "0.51236224", "0.51236224", "0.51236224", "0.51236224", "0.51236224", "0.51236224", "0.51236224", "0.5121062", "0.5119771", "0.5119615", "0.5106081", "0.51030266", "0.5096565", "0.5093445", "0.50882095", "0.50843924", "0.50757164", "0.5068437", "0.5068227", "0.5056303", "0.50550413", "0.5054293", "0.5051129", "0.5042391", "0.50423366", "0.50319797", "0.5027691", "0.5016749", "0.501263", "0.5011174", "0.50102013", "0.5004825", "0.50033236", "0.50023496", "0.4991575", "0.4991575", "0.4991462", "0.49876156", "0.498504", "0.49834013", "0.49817595", "0.49784613", "0.49756682", "0.49599063", "0.4955531", "0.49528912", "0.49510202", "0.4941978", "0.49356028", "0.49327067", "0.4926135", "0.49255168", "0.49227756", "0.49213782" ]
0.62700665
0
prints the game in the console
def print_log puts "Nr | Codes #{"-" * (@code_length * 4 - 9)} | white hit | black hit |" count = @max_rounds @max_rounds.times do count -= 1 if count >= @log.length puts "#{sprintf('%02d', count + 1)} |#{" |" * (@code_length)} | |" else row = @log[count] code = row[:code].join(' | ') puts sprintf('%02d | %s | %d | %d |', count + 1, code, row[:hits][:white], row[:hits][:black]) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end", "def print_out_start_of_game\n\n puts \"Welcome to a new version of the 2 Player Game.\"\n puts \"\"\n\nend", "def display\n puts \"\\n GAME BOARD \"\n puts \" Turn #{turn_count}\"\n puts \"*************\"\n puts \"* #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} *\"\n puts \"*************\\n\\n\"\n end", "def show_start_game(game)\n puts \"#{game.player1.name} is: #{game.player1.identity}\"\n puts \"#{game.player2.name} is: #{game.player2.identity}\"\n puts 'TIC TAC TOE.. start!'\nend", "def current_game\n\tputs \" #{@board[\"1\"]} | #{@board[\"2\"]} | #{@board[\"3\"]}\"\n puts \"-----------\"\n puts \" #{@board[\"4\"]} | #{@board[\"5\"]} | #{@board[\"6\"]}\"\n puts \"-----------\"\n puts \" #{@board[\"7\"]} | #{@board[\"8\"]} | #{@board[\"9\"]}\"\nend", "def game_display\n puts \" \"\n puts \" \"\n puts \"At any time, type 'save' to save and exit\"\n puts \"Guess progress: #{@secret_display}\"\n puts \"Wrong guesses: #{@wrong_guesses}\"\n puts \"Guesses remaining: #{@guess_count}\"\n end", "def display_game \n @@PLAYERS.each do |player|\n puts player\n print \"\\t\"\n hand(player).each do |card|\n print card\n print ' '\n end\n puts\n end\n @hole_cards.each do |card|\n print card \n print ' '\n end\n end", "def print_dealers_play\n puts \"-------------\"\n puts \"Dealer's turn\"\n puts \"-------------\"\n end", "def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend", "def display_board (game)\n puts \" #{game[0]} | #{game[1]} | #{game[2]} \"\n puts \"-----------\"\n puts \" #{game[3]} | #{game[4]} | #{game[5]} \"\n puts \"-----------\"\n puts \" #{game[6]} | #{game[7]} | #{game[8]} \"\nend", "def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend", "def show_board_game(current_game)\n puts \"#{current_game.players[0].name.capitalize} #{current_game.players[0].avatar} #{current_game.players[0].symbol} \\u{1F19A} #{current_game.players[1].name.capitalize} #{current_game.players[1].avatar} #{current_game.players[1].symbol}\"\n puts \"\"\n for i in 0..2 do\n puts \"----------------\"\n for j in 0..2 do\n print \"| #{current_game.board.boardcase[i][j].content} \"\n end\n puts \"|\"\n end\n puts \"----------------\"\n end", "def print_options\n puts '1. Start a new game [new]'\n puts '2. Load a saved game [load]'\n puts '3. Quit the game [quit]'\nend", "def print_game\n print \" Cards in game: \"\n (0..6).each { |c| print show @cards[c] }\n print \"\\n Cards on the table: \"\n (2..6).each { |n| print show @cards[n] }\n print \"\\n Cards in hand of your player: \"\n (0..1).each { |index| print show @cards[index] }\n print \"\\n Hash to analize combinations in game: \",$hash_7_card\n end", "def play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def start_game\n puts \"----- WELCOME TO twO-O-Player MATH GAME! -----\"\n puts \"#{@player1.name} vs #{@player2.name} 🥊 Game on!\\n\\n\"\n end", "def run\n puts \"Welcome to Command-Line-Chess!\"\n @players = set_players\n\n winner = play_game\n \n print_board\n puts \"Congratulations #{winner.name}! You have won the game.\"\n end", "def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end", "def display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end", "def display_board(game)\n \n puts \" #{game[0]} #{VERTBAR} #{game[1]} #{VERTBAR} #{game[2]} \"\n puts \"#{SEP}\"\n puts \" #{game[3]} #{VERTBAR} #{game[4]} #{VERTBAR} #{game[5]} \"\n puts \"#{SEP}\"\n puts \" #{game[6]} #{VERTBAR} #{game[7]} #{VERTBAR} #{game[8]} \"\n \nend", "def show_console(own_board, enemy_board)\n #This method shows the entire player console, with both Ships\n #(friendly waters), and Balistics (enemy waters)\n print \"\\n\\n\"\n print header_row + standard_gap + header_row + \"\\n\"\n own_grid = own_board.visual_grid(:show_ships)\n enemy_grid = enemy_board.visual_grid(:hide_ships)\n y = 0\n 10.times do\n print (\"A\"..\"J\").to_a[y] #Place letter at front of row string\n print \" \" + own_grid[y] + standard_gap\n print (\"A\"..\"J\").to_a[y]\n print \" \" + enemy_grid[y] + \"\\n\"\n y += 1\n end\n print \"\\n\" + ships_title + standard_gap + balistics_title + \"\\n\"\n print \"\\n\" + board_key + \"\\n\\n\"\n end", "def display_game_menu\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts '| 1) Blackjack |'.center(WIDTH)\n @output.puts '| 2) Stud Poker |'.center(WIDTH)\n @output.puts \"| 3) Texas Hold 'em |\".center(WIDTH)\n @output.puts '| A) Add AI Player |'.center(WIDTH)\n @output.puts '| D) Debug Console |'.center(WIDTH)\n @output.puts '| P) Setup Player |'.center(WIDTH)\n @output.puts '| Q) Quit |'.center(WIDTH)\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts # spacer\n @output.print 'Command: '\n end", "def beginning_of_game\n\tputs \"------------------------------------------------------------\"\n\tputs \"| Bienvenue sur 'ILS VEULENT TOUS MA POO ! \"\n\tputs \"| Le but du jeu est d'être le dernier survivant ! \"\n\tputs \"------------------------------------------------------------\"\nend", "def display_game\n\t\t@current_config.each.with_index(1) { |row, index|\n\t\t\tprint \"Row #{index}: \"\n\t\t\trow.times{|num| print 'X'}\n\t\t\tputs \"\"\n\t\t}\n\tend", "def print_board\n reputs('|')\n clear_screen!\n move_to_home!\n @players.each_with_index do |value,index|\n p board[index]\n puts\n end\n\n end", "def show_win\n puts \"Congratulations #{@name}, you've won the game!\"\n puts 'Hangman lives to hang another day!'\n puts \"\\n\"\n end", "def print_status(game)\n cls\n\n puts game.version\n\n # Print the word with underscores instead of not guessed letters\n puts \"\\nWord: #{get_word_for_print(game.letters, game.good_letters)}\"\n # Print wrong letters separated with commas\n puts \"Mistakes: #{game.bad_letters.join(\", \")}\"\n\n # Print the image for the current number of made mistakes\n print_hangman(game.mistakes)\n\n if game.status == :lost\n # If player lost - print a message about it and show the word\n puts \"\\nGame over :(\"\n puts \"The word was: \" + game.letters.join(\"\")\n elsif game.status == :won\n # If player won - congratulate\n puts \"\\nYou won! Congratulations! :)\"\n else\n # If the game is not over, print the number of mistakes that are available to make\n if game.mistakes != 6\n puts \"You have left: #{game.mistakes_left} mistakes\"\n else\n puts \"You have left: 1 mistake. Be careful! \"\n end\n end\n end", "def run_full_game()\n set_max_games()\n name_all_players()\n puts play_through_set_of_games()\n set_determine_set_winner()\n puts overall_winner_message()\n end", "def tie\n\tgreeting\n puts \"---------------------\"\n show_grid\n puts \"\"\n puts \"G A M E O V E R\"\n puts \"\"\n\tputs \"Tied game!\"\n\tputs \"\"\n\tputs \"---------------------\"\nend", "def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end", "def boardprint\n p @board\n puts \"#{@words}\" + \" words\"\n puts \"#{@phraseletters}\" + \" letters overall\"\n puts \"#{guess_count}\" + \" guesses made / \"\"#{@guesses_remaining}\" + \" guesses remaining\"\n puts \"#{@remaining}\" + \" letters remaining\"\n end", "def display_board(gameState)\n puts \" #{gameState[0]} | #{gameState[1]} | #{gameState[2]} \"\n puts \"-----------\"\n puts \" #{gameState[3]} | #{gameState[4]} | #{gameState[5]} \"\n puts \"-----------\"\n puts \" #{gameState[6]} | #{gameState[7]} | #{gameState[8]} \"\nend", "def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend", "def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end", "def game_history\n MyCliProject::Game.all.each do |game|\n puts Rainbow(\"------------------------------\").red\n puts \"#{game.game_name}\"\n puts Rainbow(\"------------------------------\").red\n end\n continue_or_exit \n end", "def display_scoreboard\n puts \"The score is\"\n puts \"#{@player_1_name}\"+\" #{@player_1_score}\" \n puts \"#{@player_2_name}\"+\" #{@player_2_score}\"\n puts\n end", "def launch_battle\n puts \"\\n\"\n puts \"Que le combat commence!\"\n puts \"\\n\"\n end", "def winner\n puts \"██╗ ██╗██╗███╗ ██╗███╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██║ ██║██║████╗ ██║████╗ ██║██╔════╝██╔══██╗\"\n sleep(1)\n puts \"██║ █╗ ██║██║██╔██╗ ██║██╔██╗ ██║█████╗ ██████╔╝\"\n sleep(1)\n puts \"██║███╗██║██║██║╚██╗██║██║╚██╗██║██╔══╝ ██╔══██╗\"\n sleep(1)\n puts \"╚███╔███╔╝██║██║ ╚████║██║ ╚████║███████╗██║ ██║\"\n sleep(1)\n puts \" ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n restart_game\nend", "def display_board(board)\n system 'clear'\n puts \"Player : #{PLAYER_MARKER}\"\n puts \"Computer: #{COMPUTER_MARKER}\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend", "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend", "def game_over\n print_board\n if victor?\n puts \"#{self.victor?} is the victor!\"\n elsif @turn_count == 10\n puts \"Game is a draw.\"\n end\n end", "def show_board\n # Show empty board at initialization and get variable at each player turn\n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end", "def print_board(guess_given)\n print \"#{guess_feedback(guess_given)} \\n\"\nend", "def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end", "def show_board\n\t\tputs \"You have use #{@turn} of 9 turns. Type \\\"save\\\" to save game and quit.\"\n\t\tshow_hangman\n\t\tputs \"Word: #{@guess.split(\"\").join(\" \")}\"\n\t\tputs\n\t\tputs \"Misses: #{@wrong_letters.split(\"\").join(\" \")}\"\n\t\tputs\n\tend", "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def test_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(16)}\n\tend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def output\n if player1_wins > player2_wins\n puts \"Player 1: (with a score of) #{player1_wins}\\n\\n Won this game! \\n\\nAfter #{round_number} rounds and survived #{tie} WARs.\"\n elsif player1_wins < player2_wins\n puts \"Player 2: (with a score of) #{player2_wins}\\n\\n Won this game! \\n\\nAfter #{round_number} rounds and survived #{tie} WARs.\"\n # else\n # puts \"ERRRRRRRRRROOOOOOOOOORRRRRR\"\n # puts player1_wins\n # puts player2_wins\n # puts tie\n end\n end", "def game_start\n game_setup\n @console_delegate.show\n end", "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend", "def display_board\n # phrase=\"Tic Tac Toe board\"\n # puts phrase\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n\nend", "def display_board(gamedata)\n puts(\" #{gamedata[0]} | #{gamedata[1]} | #{gamedata[2]} \")\n puts(\"-----------\")\n puts(\" #{gamedata[3]} | #{gamedata[4]} | #{gamedata[5]} \")\n puts(\"-----------\")\n puts(\" #{gamedata[6]} | #{gamedata[7]} | #{gamedata[8]} \")\nend", "def displayEndgame\n \tputs \"\\e[#{SCREEN_Y+1};#{1}HGame over.\\e[#{SCREEN_Y+2};#{1}H\"\nend", "def show_board\n\t\tputs \n\t\tputs \"-------------------\"\n\t\tputs \"Board so far: \"\n\t\t# Go through each guess and answers and display them\n\t\[email protected]_with_index { |guess, i| puts \"#{guess.join} #{@evaluate[i]}\" }\n\t\tputs \"-------------------\"\n\tend", "def game_board\n puts \" 1 | 2 | 3 \"\n puts \"___________\"\n puts \" 4 | 5 | 6 \"\n puts \"___________\"\n puts \" 7 | 8 | 9 \"\nend", "def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end", "def show_players\r\n puts \"Tu as #{human_player.life_points}\"\r\n puts \"il reste #{@enemies.length} bots, courage!!\"\r\n end", "def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end", "def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def show_game_turn(game_turn) # show the game turn\n puts game_turn\n end", "def display_board(board)\n system('cls')\n puts \"Player is #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end", "def print_player_turn(name)\n sleep 1\n print_header\n puts \"\"\n puts \"#{name} turn #{@best_of3 ? \"#{@board_turn.player.wins} wins\" : ''}\".cyan\n puts \"*************************\".cyan\n puts \"\"\n end", "def play\n\t\t@current_turn = 0\n\t\t@current_player = @hunter\n\t\tplayers.each{|p| p.write(game_parameters)}\n\t\tuntil is_game_over?\n\t\t\tpre_turn_wall_count = @walls.size\n\t\t\treport_state_to_spectators\n\t\t\t@current_player.take_turn\n\t\t\t# Only print the board every 10 turns or if a wall was added or removed\n\t\t\tprint_minified_board() if @current_turn%10 == 0 || @walls.size != pre_turn_wall_count\n\t\t\tadvance_turn!\n\t\t\tprint \"#{@current_turn} \"\n\t\tend\n\t\tresult = report_winner\n\t\tcleanup_players!\n\t\tcleanup_spectators!\n\t\tresult\t# Returns this so the EvasionServer can save results\n\tend", "def print_end\n print_separator_strong\n puts \"GAME OVER!\"\n print_separator_strong\n end", "def display_standings\n system(\"clear\")\n puts \"Current standings:\"\n\n players.each do |player|\n puts \"#{player}: #{record(player)}\"\n end\n\n sleep(2)\n end", "def post_game\n if round.checkmate?\n puts \"\\n#{round.players.last.colour.capitalize} wins by checkmate!\"\n elsif round.stalemate?\n puts \"\\nStalemate!\"\n else\n puts \"Whoops, something went wrong.\"\n end\n end", "def display_game(word, guesses, chances)\n puts \"\\n***********************************\"\n puts \"Your word: #{word}\"\n puts \"\\nChances left: #{chances}\"\n puts \"Your guesses: #{guesses_s(guesses)}\"\n puts \"Enter a letter: \"\nend", "def play_round\n puts @game_word + \"\\n\\n\"\n guess = @curr_player.get_guess\n if correct_guess?(guess)\n @curr_player.correct_guesses += [guess]\n else\n @curr_player.guesses_remaining -= 1\n @curr_player.incorrect_guesses += [guess]\n end\n puts \"#{@curr_player.name}'s' incorrect guesses: #{@curr_player.incorrect_guesses}\"\n puts \"#{@curr_player.name}'s guesses remaining: #{@curr_player.guesses_remaining}\"\n puts \"#{@curr_player.name}'s available points: #{@curr_player.correct_guesses.length * @secret_word.length}\"\n puts \"#{@curr_player.name}'s flower: \"\n puts File.read(\"flower#{@curr_player.guesses_remaining}.txt\")\n puts \"_____________________________________\"\n puts \"\\n\\n\"\n @curr_player_index = (@curr_player_index + 1) % 2\n @curr_player = @players[@curr_player_index]\n end", "def start\n puts \"Welcome! Let's play Tic-Tac-Toe\"\n print_board\n play\n end", "def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def testOutput\n\t\tputs @health\n\t\tputs @total_mana\n\t\tputs @remaining_mana\n\t\tputs @side\n\t\tp @hand\n\tend", "def show\n\tprint sides\n\tputs \"\"\n\tprint roll\n\tputs \"\"\n\tend", "def show_score\n puts\n @@score.each do |player, score|\n print \"- #{player.capitalize}: #{score} -\"\n end\n puts\n end", "def print_all_players(print_title, players)\r\n puts\r\n puts(print_title)\r\n players.each do |player|\r\n puts(\"\\t >> #{player}\")\r\n end\r\n puts\r\nend", "def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend", "def display_board(brd)\n system \"clear\"\n puts \"You're #{PLAYER_MARKER}'s. Computer is #{COMPUTER_MARKER}'s\"\n puts \" | | \"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts \" | | \"\n puts \"=================\"\n puts \" | | \"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]} \"\n puts \" | | \"\n puts \"=================\"\n puts \" | | \"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]} \"\n puts \" | | \"\nend", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n\r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n\r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n\r\n #CAll on the method responsible for ingrementing the game count\r\n game_Count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n\r\n end", "def start\r\n\t\t\[email protected] \"Welcome to Deal or No Deal!\"\r\n\t\t\[email protected] \"Designed by: #{created_by}\"\r\n\t\t\[email protected] \"StudentID: #{student_id}\"\r\n\t\t\[email protected] \"Starting game...\"\r\n\t\tend", "def how_to_play(user)\n puts \"Welcome, #{user.name}!\\n\\n\".blue + \"Here's a quick rundown on how to play:\\n\\n\"\n puts \"The goal of the game is to guess all letters (or the word) of the puzzle word shown in the box.\"\n puts \"If the guess is wrong, the asteroid will get closer to your Dino!\"\n puts \"Type in \" + \"SOLVE \".blue + \"to guess a word.\"\n puts \"Type in \" + \"HINT \".green + \"to get the hint to the puzzle word, which will be a synonym or definition of the word.\"\n puts \"Using the HINT will advance the asteroid!\"\n puts \"You lose the game when the asteroid stikes the dino. :(\\n\\n\"\n puts \"Ready?\\n\\n\\n\"\nend", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def display_board\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\nend", "def display\n puts \"#{@board.join(\" \")}\"\n end", "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def display_board(brd)\n system 'clear'\n puts \"You'e a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board(brd)\n puts \"You are #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board(board, round, player_score, computer_score)\n system('clear') || system('cls')\n puts \"Round #{round}\"\n puts \"Player: #{player_score} Computer: #{computer_score}\"\n puts \"You are a #{PLAYER_MARKER}. \" \\\n \"Computer is #{COMPUTER_MARKER}\"\n puts ''\n puts 'BOARD MAPPING'\n puts ' 7 | 8 | 9 '\n puts '---+---+---'\n puts ' 4 | 5 | 6 '\n puts '---+---+---'\n puts ' 1 | 2 | 3 '\n puts ''\n puts 'GAME BOARD'\n puts ' | |'\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts ' | |'\n puts ''\nend", "def new_game\n # Start again!\n puts \"\\n\\n\"\n\t\n\t# Clears output from last game\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n \n puts \"Beginning new game:\"\n puts \"\"\n start\nend", "def test_barely_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(10)}\n\tend", "def display_board(game_board, guesser)\r\n puts %(Color matches: 1 - #{output_color(' Black ', 1)}; 2 - #{output_color(' Cyan ', 2)}; 3 - #{output_color(' Red ', 3)}; 4 - #{output_color(' Yellow ', 4)}; 5 - #{output_color(' Magenta ', 5)}; 6 - #{output_color(' Blue ', 6)}\r\n Guessing: #{guesser.name}\r\n\r\n ___________________________\r\n | | | | | | | |\r\n | x | #{output_color(game_board.get_game(0, 0))} | #{output_color(game_board.get_game(1, 0))} | #{output_color(game_board.get_game(2, 0))} | #{output_color(game_board.get_game(3, 0))} | #{output_color(game_board.get_game(4, 0))} | #{output_color(game_board.get_game(5, 0))} |\r\n | x | #{output_color(game_board.get_game(0, 1))} | #{output_color(game_board.get_game(1, 1))} | #{output_color(game_board.get_game(2, 1))} | #{output_color(game_board.get_game(3, 1))} | #{output_color(game_board.get_game(4, 1))} | #{output_color(game_board.get_game(5, 1))} |\r\n | x | #{output_color(game_board.get_game(0, 2))} | #{output_color(game_board.get_game(1, 2))} | #{output_color(game_board.get_game(2, 2))} | #{output_color(game_board.get_game(3, 2))} | #{output_color(game_board.get_game(4, 2))} | #{output_color(game_board.get_game(5, 2))} |\r\n | x | #{output_color(game_board.get_game(0, 3))} | #{output_color(game_board.get_game(1, 3))} | #{output_color(game_board.get_game(2, 3))} | #{output_color(game_board.get_game(3, 3))} | #{output_color(game_board.get_game(4, 3))} | #{output_color(game_board.get_game(5, 3))} |\r\n |___|___|___|___|___|___|___|\r\n | #{output_color(game_board.get_game(0,4), 7)} | #{output_color(game_board.get_game(1,4), 7)} | #{output_color(game_board.get_game(2,4), 7)} | #{output_color(game_board.get_game(3,4), 7)} | #{output_color(game_board.get_game(4,4),7)} | #{output_color(game_board.get_game(5,4),7)} |\r\n | #{game_board.get_game(0,5)} | #{game_board.get_game(1,5)} | #{game_board.get_game(2,5)} | #{game_board.get_game(3,5)} | #{game_board.get_game(4,5)} | #{game_board.get_game(5,5)} |\r\n |___|___|___|___|___|___|\r\n)\r\n end", "def displayBoard\n\t\tx = 0\n\t\tprint \"\\n\"\n\t\twhile x < @guesses.length\n\t\t\tprint \" -------------------\\n\"\n\t\t\ty = 0\n\t\t\twhile y < @guesses[x].length\n\t\t\t\tif y < 4\n\t\t\t\t\tprint \"| \" + @guesses[x][y].chr + \" | \" \n\t\t\t\telse\n\t\t\t\t\tprint @guesses[x][y]\n\t\t\t\tend\n\t\t\t\ty = y+1\n\t\t\tend\n\t\t\tprint \"\\n -------------------\\n\"\n\t\t\tx = x+1\n\t\tend\n\t\tprint \"\\n\"\n\t\n\tend", "def run_game\n\t\t# Startup\n\t\tputs \"Welcome to Mastermind: Console Edition!\"\n\n\t\t# Select player or computer\n\t\t@choice = choose_codemaker\n\n\t\tif @choice == 'codemaker'\n\t\t\t@code = record_player_code\n\t\t\tputs \"Thanks! Your code has been stored.\"\n\t\t\tuntil self.game_over?\n\t\t\t\tcomputer_take_turn\n\t\t\tend\n\t\telse \n\t\t\t@code = create_code\n\t\t\tputs \"The computer has chosen a 4-color code.\"\n\t\t\tputs \"While debugging, here is the code: #{@code}\"\n\t\t\tuntil self.game_over?\n\t\t\t\tplayer_take_turn\n\t\t\tend\n\t\tend\n\n\t\tif won_game?\n\t\t\tputs \"Congratulations! You won the game.\"\n\t\telse\n\t\t\tputs \"Sorry, all out of turns. Game over.\"\n\t\tend\n\tend", "def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end", "def display_board(brd, score_board)\n system 'clear'\n puts \"Best of 5! Currently Player is on #{score_board[:player]}\"\n puts \"and the computer is on #{score_board[:computer]}\"\n puts \"You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"_____+_____+_____\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"_____+_____+_____\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\nend", "def show_board\n puts \" \" + board_spaces[1] + \" | \" + board_spaces[2] + \" | \" + board_spaces[3] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[4] + \" | \" + board_spaces[5] + \" | \" + board_spaces[6] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[7] + \" | \" + board_spaces[8] + \" | \" + board_spaces[9] + \" \"\n end", "def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end", "def display\n @board.each { |x| \n puts x.join(\" \")\n }\n end", "def display_current(game_hash)\n\treset_screen\n\tputs pretty_board(hash_to_array(game_hash))\n\tsleep(0.001)\nend" ]
[ "0.7869802", "0.74473923", "0.73977685", "0.73401177", "0.72766817", "0.72702223", "0.72324866", "0.71924686", "0.71866906", "0.71852225", "0.71230876", "0.71095747", "0.7100547", "0.7095642", "0.70690566", "0.7032311", "0.7030552", "0.7025613", "0.7000439", "0.696729", "0.6962863", "0.69583917", "0.6946297", "0.69323826", "0.69118065", "0.68761784", "0.68692285", "0.68656176", "0.6861866", "0.68562615", "0.6840389", "0.68292826", "0.6824521", "0.6820742", "0.68168133", "0.6816796", "0.6814544", "0.6810713", "0.67914665", "0.6791163", "0.6787729", "0.6785216", "0.6783065", "0.6779955", "0.677464", "0.677171", "0.67589366", "0.6754719", "0.67504525", "0.67504525", "0.6746604", "0.6743835", "0.6742318", "0.67348564", "0.6726968", "0.67261297", "0.67230296", "0.6719805", "0.6717923", "0.6716872", "0.6708368", "0.6704023", "0.67005074", "0.6693954", "0.6691837", "0.66839373", "0.6678878", "0.6676932", "0.6672228", "0.66640496", "0.6647812", "0.66395795", "0.6627538", "0.662595", "0.6622148", "0.65997744", "0.6598475", "0.65829164", "0.65817326", "0.65812325", "0.65757483", "0.65756845", "0.6572615", "0.6570771", "0.65668386", "0.65622395", "0.6556254", "0.6555348", "0.6554255", "0.65509635", "0.6550663", "0.65472275", "0.654206", "0.6541707", "0.65401953", "0.65399194", "0.6537611", "0.65343094", "0.6533283", "0.6517296", "0.6513684" ]
0.0
-1
Retrieves a code from either the Codemaker or the code Codebreaker
def new_code(person) code = [] loop do code = person.input_code inval_code = @code_maker.invalid_code_msg(code) break if inval_code.nil? puts inval_code end code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code\n @code\n end", "def code\n @code\n end", "def code\n @code ||= @codes.first\n end", "def getCode()\n return @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code()\n return @code.clone()\n end", "def code\n @info.code\n end", "def code\n info['Code']\n end", "def code(a_code)\n\t\ta_code\n\tend", "def getCode(code1, code2)\n if(code1[1] == code2)\n return code1[0]\n else\n return code1[1]\n end \n end", "def code\n self.class.code\n end", "def code\n body.code.intern if body.respond_to?(:code) && body.code\n end", "def code\n @data['code']\n end", "def code\n @data['code']\n end", "def code\n '202'\n end", "def code\r\n return @code[@index]\r\n end", "def fetch_from_code(code)\n client.code = code\n fetch_and_write\n end", "def code\n @data['code']\n end", "def get_line(code)\n return code[2][0]\n end", "def string=(code); end", "def code\n call_once\n @code\n end", "def code_extractor(code)\n { code: code[:code], code_system: code[:codeSystem], title: code[:descriptor] }\n end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code_for(url)\n if obj = code_object(url)\n obj.data\n end\n end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def extract_code!\n data = @data\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2 }\n id\n end\n data\n end", "def generate_code\n self.code ||= self.create_code(client)\n save && code\n end", "def get_player_code\n puts 'Codemaker, please put in a valid code:'\n puts \"The valid letters/colors are #{'R'.red}, #{'O'.light_red}, #{'Y'.yellow}, #{'G'.green}, #{'B'.blue}, #{'I'.light_blue}, and #{'V'.magenta}.\"\n puts 'Your code should be 4 characters long.'\n begin\n player_code = gets.chomp\n player_code = Code.new(player_code.upcase)\n rescue StandardError => e\n puts e\n retry\n end\n player_code\n end", "def get_code(dial_book, key)\n dial_book[key]\nend", "def subCode\n if self.code.present?\n return self.codeArray[-1]\n else\n return nil\n end\n end", "def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end", "def name\n return \"#{@code}\"\n end", "def code_for(url)\n obj = @cassandra.get(\"urls\", url)\n obj.nil? ? nil : obj[\"code\"]\n end", "def get_system(code)\n return code[2][1][0][1][1][1]\n end", "def code\n path\n end", "def extract_code(data)\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2 }\n id\n end\n data\n end", "def get_name(code)\n return code[1]\n end", "def code_for(url)\n @redis.get url_key(url)\n end", "def parseCpGenerateCode\n return @fields[0][0][0]\n end", "def parse_code(code)\n p Parser::CurrentRuby.parse(code)\n end", "def get_application_code\n case $scm_type\n when 'git' then\n export_source_from_git $scm_path\n $revision = git_get_revision\n end\nend", "def code\n\t\ttoken\n\tend", "def language_code\n @language_code ||= code_parts[0]\n end", "def get_code(partner, pdate, ptype)\n \n @codegen = \"\"\n \n if partner.nil? and not signed_in_and_master?\n return \"P??\"\n end\n \n @pid = 1\n \n unless partner.nil?\n @pid = partner.id \n @codegen += \"P\"\n @codegen += \"%02d\" % partner.fp7_Number\n @codegen += \"-\"\n \n else\n \n if signed_in_and_master?\n @codegen += \"ADM\"\n else\n @codegen += \"P??\"\n end\n \n end\n\n if pdate.nil?\n #only for generate sample code in the new view (but it is hide)\n pdate = Date.today\n end\n\n unless pdate.nil?\n \n @codegen += pdate.strftime(\"%y%m%d\")\n @codegen += \"-\"\n end\n\n @cnt_objs = Sampling.all(:select => \"DISTINCT code\", :conditions => ['code LIKE ? ', '%'+@codegen+'%'], :order => 'code DESC')\n @cnt = 1 \n if not @cnt_objs.nil? \n @cnt_obj = @cnt_objs[0] \n if not @cnt_obj.nil? \n #P03-110129-xx\n if not @cnt_obj.code.nil? \n @end_str = @cnt_obj.code[11..12]\n if not @end_str.nil? \n @end = @end_str.to_i\n @cnt = @end + 1\n else \n @cnt = '0'\n end\n else \n @cnt = '0'\n end\n end\n end\n\n @codegen += \"%02d\" % @cnt\n\n unless ptype.nil?\n @codegen += ptype.to_s\n end\n\n return @codegen\n end", "def call\n eval(@code)\n end", "def find(code)\n if obj = url_object(code)\n obj.data\n end\n end", "def run_code(code)\n begin\n return eval(code)\n rescue\n return \"Error: Code doesn't run!\"\n end\n end", "def block_code(code, language)\n sha = Digest::SHA1.hexdigest(code)\n Rails.cache.fetch ['code', language, sha].join('-') do\n Pygments.highlight(code, lexer:language)\n end\n end", "def display_code \n p @result.code \n end", "def get_instance_system(code)\n return code[1][1]\n end", "def find(code)\n obj = @cassandra.get(\"codes\", code)\n obj.nil? ? nil : obj[\"url\"]\n end", "def get_require(code)\n # return (code[0][2][1][0][1][1][1])\n return (code[2][1][0][1][1][1])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def create_secrete_code\n if @player_role_selection == 'breaker'\n output = computer_code_acquisition\n elsif @player_role_selection == 'maker'\n output = player_choice_acquisition\n end\n output\n end", "def code_to_key\n @code[0..2]\n end", "def code=(v)\n @code = v\n end", "def cifrom(compiler)\n CodeInterpreter.new(compiler.bc, compiler.ctx)\nend", "def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end", "def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category != 'DENIED' or rcfsc.category == nil}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n client_code = client_code_record.adjustment_code\n rcc_log.debug \"CLIENT CODE : #{client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n client_code.to_s.upcase\n end", "def inspect\n \"#<#{self.class}: #@code>\"\n end", "def load_code(name, code)\n instance_variable_set(\"@#{name}_code\", code)\n self\n end", "def read_code first_line\n code = first_line\n while true\n interactive_code = @engine.create_script_source_from_string(code, Scripting::SourceCodeKind.InteractiveCode)\n case interactive_code.get_code_properties\n when Scripting::ScriptCodeParseResult.Complete, Scripting::ScriptCodeParseResult.Invalid:\n return interactive_code\n \n else\n print \"#@language| \"\n next_line = gets\n return interactive_code if next_line.nil? or next_line.strip.size == 0 \n code += next_line\n end \n end\n end", "def code\n @json[:meta][:code]\n end", "def code_point; end", "def content_for(code_object)\n Code.new(render_doc_markup_for(code_object),\n start_line_for(code_object), :text).\n with_line_numbers(use_line_numbers?).to_s\n end", "def block_code(code, language)\n code\n end", "def sic_code; end", "def preferred_code(preferred_code_sets, codes_attribute=:codes)\n codes_value = send(codes_attribute)\n matching_code_sets = preferred_code_sets & codes_value.keys\n if matching_code_sets.present?\n code_set = matching_code_sets.first\n {'code' => codes_value[code_set].first, 'code_set' => code_set}\n else\n nil\n end\n end", "def get_code\n listener = event_table.find{|one| one.class == InstructionListener}\n return nil unless listener\n listener.code\n end", "def cc(code)\n return\n end", "def code_path\n self.code.qualified_name\n end", "def active_code?( code )\n find :first, :conditions => { :code => code }\n end", "def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end", "def code(*codes); end", "def code(*codes); end", "def code= new_code\n @code = new_code\n end", "def find_code start\n current = start\n code = \"\"\n\n while !instructions.empty?\n instr = instructions.shift\n current = decode current, instr\n\n x, y = current\n key = keypad[x][y]\n code += key\n end\n\n code\n end", "def to_s\n code.to_s\n end", "def fetch\n self.send(code + '_value')\n end", "def new_access_code\n client.redirect_uri = 'http://giffare.com/callback'\n uri = client.authorization_uri(:scope => [:create_note, :manage_pages])\n puts \"Visit: #{uri}\"\n `open \"#{uri}\"`\n puts \"Get code param and call #from_code with it\"\n end", "def initialize\n @code_combination = code\n end", "def thru_coderay\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n atts, code = $2, CGI.unescapeHTML($3)\n\n lang =\n if $2 =~ /lang=('|\")(.*?)\\1/i\n $2\n else\n :ruby\n end\n\n tag =\n if code =~ /\\n/\n :pre\n else\n :code\n end\n\n html = CodeRay.scan(code, lang).html(:css => :style)\n\n %{<#{tag} class=\"code\"#{atts}>#{html}</#{tag}>}\n end\n end", "def parse_codespan; end", "def set_code \n puts \"\\nYou have chosen to be the new CodeBreaker!\\nNow wait for me to create a code for you to crack \"\n @code = @role.random_code\n end" ]
[ "0.73643976", "0.73643976", "0.73378664", "0.7306806", "0.72132003", "0.72132003", "0.7126507", "0.68411267", "0.68225634", "0.682148", "0.6765226", "0.67139196", "0.6702224", "0.66820264", "0.66804284", "0.66804284", "0.66782457", "0.66406953", "0.6638965", "0.66127247", "0.6561724", "0.6448585", "0.64289635", "0.6386185", "0.6377454", "0.6377454", "0.6377454", "0.6377454", "0.6377454", "0.6377454", "0.6377454", "0.6357849", "0.6305686", "0.6305686", "0.6305686", "0.6305686", "0.6292429", "0.62474775", "0.6208744", "0.61775994", "0.6122343", "0.60900193", "0.60633516", "0.60498494", "0.6044496", "0.60194594", "0.5965189", "0.5960206", "0.59339374", "0.59322196", "0.5927583", "0.5910856", "0.58988947", "0.58860606", "0.58839154", "0.5883792", "0.58829707", "0.5874961", "0.58589524", "0.58558905", "0.5849897", "0.58471483", "0.58451855", "0.58439994", "0.58439994", "0.58439994", "0.58439994", "0.58439994", "0.58439994", "0.58439994", "0.5839941", "0.5833679", "0.5810222", "0.580494", "0.5799981", "0.57891434", "0.5787344", "0.57861745", "0.5782371", "0.5777662", "0.5776985", "0.57615006", "0.5756197", "0.5755957", "0.57522124", "0.5735524", "0.5720196", "0.5711244", "0.57054216", "0.5698537", "0.5696124", "0.5696124", "0.56939286", "0.56922203", "0.569038", "0.56762666", "0.5646274", "0.5645482", "0.5637363", "0.5637334", "0.563197" ]
0.0
-1
Handles parsing RFC3339 time string
def parse_time_string(time_string) time_string ? Time.parse(time_string) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeparse time\n tt ||= Time.rfc2822(time) rescue nil\n tt ||= Time.iso8601(time) rescue nil\n tt ||= Time.strptime(time, \"%Y-%m-%d %T %z\") rescue nil\n\n if !tt\n if $base_time\n begin\n # base_time has been set so try parsing a relative time\n # todo: I should be a lot stricter about parsing invalid times\n\n # work with \"Jan 7\" as well as \"7 Jan\"\n if time[/^\\s*([A-Za-z]+\\s*[0-9]+):/] # split \"Jan 7: \" off front and use it as base time\n nt = Time.parse($1, $base_time)\n nt = Time.new(nt.year+1, nt.month, nt.day, nt.hour, nt.min, nt.sec, nt.utc_offset) if $base_time.to_date.to_time > nt\n time = $'\n $base_time = nt\n end\n\n tt = Time.parse(time, $base_time) # try a relative time\n tt += 86400 if $base_time > tt # if base_time is 11:30 and tt is 00:00, tt needs to be bumped to the following day\n tt = Time.new(tt.year+1, tt.month, tt.day, tt.hour, tt.min, tt.sec, tt.utc_offset) if $base_time > tt\n log \"parsing #{time} against #{$base_time} and got #{tt}\"\n rescue\n $stderr.puts \"Time could not be parsed: '#{time}'\"\n raise\n end\n else\n raise \"the first time in the file must be rfc or iso: #{time}\"\n end\n end\n\n $base_time = tt\n\n raise \"Invalid time #{time}\" if tt.nil?\n time_floor(tt, 30); # magic value\nend", "def string_to_time(string)\n super(handle_date_parse_input(string))\n end", "def time_parsing str\n Time.parse(str) if str && str != \"<null>\"\n end", "def parse_time(str)\n return nil if str.nil? || str.empty?\n\n # make sure it looks like a time\n # i've seen arrive time cells just be \"+1\" and nothing else\n return nil unless str =~ /^\\d+:\\d+/\n\n format = str =~ /[ap]m$/ ? '%I:%M %P' : '%H:%M'\n Time.strptime(str, format).to_time\n end", "def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end", "def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end", "def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end", "def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end", "def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end", "def parse_time(time)\n if time.is_a? Time\n return Time.parse time.httpdate\n elsif time.is_a String\n return Time.parse(Time.parse(time).httpdate)\n else\n raise \"Argument Error, #{time} is not a valid time\"\n end\n end", "def parse_time\n time_str = @request[FTIME].sub(REGEX_TIME_FIX) { \"#{$1} #{$2}\" }\n Time.parse(time_str) rescue nil\n end", "def time_for_string(time)\n time = time.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/)[0].sub(' ','T')\n Time.xmlschema(time)\n end", "def parse(time_string)\n Time.at(\"#{time_string[0,10]}.#{time_string[10,13]}\".to_f)\n end", "def formatted_time(time_str)\n format = '%Y-%m-%dT%H:%M:%S%Z'\n ::Time.strptime(time_str, format)\n end", "def parse(tz_string); end", "def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend", "def parse_time(attribute, time_string)\n time_string.blank? ? nil : DateTime.parse(time_string).in_time_zone\n rescue ArgumentError\n errors.add(attribute, :invalid_time)\n nil\n end", "def formatted_time(text)\n return nil if text.blank?\n format = '%Y-%m-%dT%H:%M:%S%Z'\n ::Time.strptime(text, format)\n end", "def parse_time(time)\n time = \"0#{time}\" if time.match(/^\\d:\\d\\d/)\n time = time.gsub(/u/, '') if utime?\n time = time.gsub(/s/, '') if stime?\n\n time\n end", "def parse_time(timestr)\n return 0 if timestr.nil?\n \n h = 0\n m = 0\n\n if(not timestr.index(/(h|m)/).nil?)\n h = timestr.scan(/(\\d*)\\s*h/i).flatten.last\n m = timestr.scan(/(\\d*)\\s*m/i).flatten.last\n elsif(not timestr.index(\":\").nil?)\n h = timestr.scan(/(\\d+)\\s*?:/).flatten.last\n m = timestr.scan(/:\\s*(\\d{2})/).flatten.last\n elsif(not timestr.index(/\\d*?(\\/\\d*)?/).nil?)\n h = timestr.to_f\n if(h > 10)\n m = h\n h = 0\n end\n end\n (h.to_f * 60) + m.to_f\n end", "def strptime(str=\"-4712-01-01T00:00:00+00:00\", fmt='%FT%T%z', sg=nil)\n super(str, fmt)\n end", "def parse_arrival_time(str)\n d = Time.parse(str, \"%Y%m%d%H%M%S\")\n d.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def parse_time\n s0 = @scanner.pos\n if match_str('(') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s3 = parse_ms\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str('/') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s5 = parse_hms\n s5 = parse_ms(with_hour: true) if s5 == :failed\n if s5 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str(')') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'now' => s3, 'total' => s5 }\n end\n end\n end\n end\n end\n s0\n end", "def parse(str=\"-4712-01-01T00:00:00+00:00\", comp=false, sg=nil)\n super(str)\n end", "def parse_datetime(str)\n parts = str.scan(/.{2}/)\n year = Time.now.year.to_s[0..1] + parts[0]\n month = parts[1]\n day = parts[2]\n hour = parts[3]\n minute = parts[3]\n \"#{year}-#{month}-#{day} #{hour}:#{minute}\"\n end", "def time_from_iso_format_str(iso_8601_string)\n iso_8601_string [/(\\d+)-(\\d+)-(\\d+)T(\\d+):(\\d+):(\\d+)/];\n y=$1;mon=$2;d=$3;h=$4;min=$5;s=$6\n Time.local(y,mon,d,h,min,s)\n end", "def str_to_time(st)\r\n ret = nil\r\n if st.is_a? Time then\r\n ret = st\r\n elsif st.is_a? String then \r\n begin\r\n self.allday = false\r\n ret = Time.iso8601(st) \r\n rescue \r\n self.allday = true if st =~ /\\d{4}-\\d{2}-\\d{2}/ # yyyy-mm-dd\r\n ret = Time.parse(st)\r\n end\r\n end\r\n ret\r\n end", "def parse_timestamp(time_string, time_zone)\n time_string.slice!(0)\n time_zone.chomp(\"]\")\n Time.strptime(time_string.concat(time_zone), \"%d/%b/%Y:%T%z\")\n end", "def parseTime(time)\n\t\tstr = time.to_s.rjust(4, \"0\")\n\t\t@hour = str[0..1].to_i\n\t\t@minute = str[2..3].to_i\n\tend", "def time_parse(time)\n Time.find_zone(\"UTC\").parse(time)\n end", "def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end", "def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend", "def convert_time(time_string)\n parts = time_string.to_s.split('/')\n return parts.length == 3 ? Time.new(parts[2].to_i, parts[0].to_i, parts[1].to_i) : nil\n end", "def convert_time(t)\n case t\n when nil then nil\n when Date then t.to_time.utc.iso8601(3)\n when Time then t.utc.iso8601(3)\n when String then Time.parse(t).utc.iso8601(3)\n else raise \"Invalid time format '#{t.class}'. Valid options are Time, Date, or String\"\n end\n rescue StandardError => e\n raise \"Failed to parse time value '#{t}'. #{e.message}\"\n end", "def parse_times( times )\n case times\n when /^\\s*any\\b/i\n Hour.new(\"12 AM\")..Hour.new(\"11 PM\")\n when /^\\s*before (\\d+ [AP]M)\\b/i\n Hour.new(\"12 AM\")..Hour.new($1)\n when /^\\s*after (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new(\"11 PM\")\n when /^\\s*(\\d+ [AP]M) to (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new($2)\n when /^\\s*not available\\b/i\n nil\n else\n raise \"Unexpected availability format.\"\n end\n end", "def string_to_time(string)\n Time.parse(string)\n end", "def parse_time(string)\n parts = string.split(\":\").map(&:to_f)\n parts = [0] + parts if parts.length == 2\n hours, minutes, seconds = parts\n seconds = hours * 3600 + minutes * 60 + seconds\n seconds.to_i\n end", "def parse_time(time)\n case time\n when Time\n time\n when Integer, Float\n Time.at(time)\n else\n Time.parse(time.to_s)\n end\n end", "def parse_filtered_time(time = nil)\n case time\n when String then Time.zone.parse(time)\n when nil then Time.zone.now\n when Time, ActiveSupport::TimeWithZone then time.in_time_zone\n else raise \"Invalid time: #{time.inspect}\"\n end\n end", "def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend", "def parse_srt_time(time)\n time =~ /^(\\d+):(\\d+):(\\d+),(\\d{3})$/\n hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)\n hh*3600 + mm*60 + ss + ms/1000.0\n end", "def string_as_t string\n Time.parse(string)\n end", "def strptime(str, format, now = now())\n parts_to_time(DateTime._strptime(str, format), now)\n end", "def parse(str)\n match_data = str.match(DATE_REGEXP)\n # Oh my god, I hate this shit. Basically it prepares dates for \n # Time.parse consuming because it's so stupid and ignorant it wants\n # to make me puke :(\n from = extract_time_string_from_match_data(match_data)\n to = extract_time_string_from_match_data(match_data, 12)\n\n begin\n from = Time.parse(from) unless from.nil?\n rescue ArgumentError\n from = nil\n end\n\n begin\n if to.nil? and not from.nil?\n case extract_context_from_match_data(match_data)\n when :year\n to = from.end_of_year\n when :month\n to = from.end_of_month\n when :day\n to = from.end_of_day\n when :hour\n to = from + (59 - from.min).minutes + (59 - from.sec)\n when :minute\n to = from + (59 - from.sec)\n end \n else\n to = Time.parse(to)\n end\n rescue ArgumentError\n to = nil\n end\n\n [from, to]\n end", "def handle_date_parse_input(string)\n string\n end", "def timeforRFC3339( rfc3339 )\n\t\tyear = rfc3339[ 0..3 ].to_i\n\t\tmonth = rfc3339[ 4..5 ].to_i\n\t\tday = rfc3339[ 6..7 ].to_i\n\t\thour = rfc3339[ 9..10 ].to_i\n\t\tminute = rfc3339[ 11..12 ].to_i\n\t\tsecond = rfc3339[ 13..14 ].to_i\n\t\treturn Time.gm( year, month, day, hour, minute, second)\n\tend", "def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend", "def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end", "def read_start_time(start_time)\n if start_time.is_a?(String)\n start_time.gsub!(\"/\", \"-\")\n start_time = \"20#{r[0]}-01-01\" if r = start_time.match(/^\\d{2}$/) # \"yy\"\n start_time = \"#{r[0]}-01-01\" if r = start_time.match(/^\\d{4}$/) # \"yyyy\"\n start_time = \"#{r[0]}-01\" if r = start_time.match(/^\\d{4}-\\d{1,2}$/) # \"yyyy-m\" or \"yyyy-mm\"\n start_time = Time.zone.parse(start_time)\n raise ArgumentError, \"Start time not valid\" if start_time.nil?\n end\n start_time\n end", "def parse_time(time)\n\t\tadd_a_day = false\n\t\tstripped_time = time.strip\n\t\tregex = /(\\d\\d)(:\\d\\d:\\d\\d)/\n\t\tmatch = regex.match(stripped_time)\n\t\tif match\n\t\t\tif match[1].to_i >= 24\n\t\t\t\tstripped_time = (\"%02d\" % (match[1].to_i-24)) + match[2]\n\t\t\t\tadd_a_day = true\n\t\t\tend\n\t\tend\n\t\tnew_time = Time.parse(stripped_time)\n\t\treturn new_time + ((add_a_day) ? 60*60*24 : 0)\n\tend", "def str_to_time(str) # :nodoc:\n unless str.nil?\n _r, mon, day, year, hour, min, sec =\n str.match(\"^(\\\\d+?)/(\\\\d+?)/(\\\\d+?) (\\\\d+?):(\\\\d+?):(\\\\d+?)$\").to_a\n end\n\n if str.nil? || mon.nil?\n raise ArgumentError, \"Invalid date format, expected MM/DD/YYYY HH24:MI:SS (got #{str})\"\n end\n\n Time.mktime(year, mon, day, hour, min, sec, 0)\n end", "def parse_time(tt)\n tt = tt.force_encoding('utf-8')\n MONTHS.map{|k,v|\n tt.gsub!(/ #{k}/i, \" #{v.downcase}\")\n }\n case tt\n when /Demain.*/\n t = Time.parse(tt)+60*60*24\n else\n t = Time.parse(tt)\n end\n return t\nend", "def parse_time_data input\n while line = input.gets\n line.chomp!\n @line_no += 1\n\n if line =~ /^[\\#;]/\n # ignore comment lines\n elsif line =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2}|\\d{4})$/\n # mm/dd/yy or mm/dd/yyyy\n handle_new_day($1, $2, $3)\n elsif line =~ /^([0-9.:]+)\\s*[-]\\s*([0-9.]+)\\s+(\\S+.*)/\n # t1 - t2 description for example:\n # 7.1-13.6 Mantis issues OR (for Jordan :)\n # 7:30-10 Mantis issues\n handle_new_entry($1, $2, $3)\n elsif line.strip.empty?\n # ignore blank lines\n else\n raise \"parse error - invalid line\"\n end\n end\n rescue Exception => e\n puts \"line #{@line_no}: #{e.message}\"\n end", "def rfc3339(*args)\n #This is a stub, used for indexing\n end", "def parse_time(str)\n seconds = 0\n str.scan(/\\d+ *[Dd]/).each { |m| seconds += (m.to_i * 24 * 60 * 60) }\n str.scan(/\\d+ *[Hh]/).each { |m| seconds += (m.to_i * 60 * 60) }\n str.scan(/\\d+ *[Mm]/).each { |m| seconds += (m.to_i * 60) }\n str.scan(/\\d+ *[Ss]/).each { |m| seconds += (m.to_i) }\n seconds\n end", "def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end", "def strptime(str=\"-4712-01-01\", fmt='%F', sg=nil)\n super(str, fmt)\n end", "def parse_time(row)\n raw_time = row[1]\n if raw_time\n time = \"#{raw_time[0..4]}#{raw_time[-2..-1].downcase!}\"\n\n # remove leading 0\n time = time[1..-1] if time[0] === '0'\n time\n else\n nil\n end\nend", "def conforms_to_dateTime_format(str)\n dateTimeRegex = /\\A(?:(?!0000)\\d{4})(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|3[0-1])(T([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(\\.\\d+)?(Z|(\\+|-)((0\\d|1[0-3]):[0-5]\\d|14:00)))?)?)?\\z/\n dateTimeRegex.match(str)\n end", "def smart_parse(string, default = nil, comp = false, type = 'time')\n # four digit sequences should be interpeted as hh:ss times\n if string =~ /^\\d\\d\\d\\d$/\n string.insert(2,\":\")\n end\n\n # ignore leading zeroes in times like '01:00 pm', chronic can't hack it\n if string[0,1] == \"0\"\n string = string.slice(1, string.length)\n end\n\n # convert \"0:00\" into midnight for Chronic\n if string == '0:00' or string == '0'\n string = '24:00'\n end\n\n # remove everything extraneous from the input\n\t\tif type == 'time'\n \ttime_regex = Regexp.new(/([0-9:apm ]+)/ix)\n \tmatch = time_regex.match(string)\n \tif not match.nil?\n \tstring = match[1]\n \tend\n\t\tend\n\n default ||= Time.today\n #logger.info(\"smart_parse: got: string #{string}, default #{default.class}, comp #{comp}\")\n return default if string.blank?\n time = Chronic.parse(string, :context => :past) ||\n Chronic.parse(string.gsub(\",\", \" \"), :context => :past) ||\n default.parse_or_nil(string, comp) ||\n default\n return default if time.blank?\n #logger.info(\"smart_parse: got a 'smart' time of #{time.to_s}, for string #{string}\")\n time\n end", "def safe_for_time_parse?(string)\n # misformatted cli option\n !string.include?('=') and\n # a date time string needs a number in it\n string =~ /\\d/\n end", "def validate(val)\n if ((val.is_a?(String)) &&\n # This could be expanded. @TODO\n (m = val.match(/([0-9]{4})-([0-9]{2})-([0-9]{2})/)))\n return Time.new(m[1], m[2], m[3])\n elsif (val.respond_to?(:to_time))\n return val.to_time\n elsif (val.is_a?(Time))\n return val\n else\n return nil\n end\n end", "def from_string(s)\n ::Time.parse(\"#{s}Z\")\n end", "def parse_time(file_time_struct)\n wtime_to_time(make_uint64(file_time_struct[:dw_low_date_time],\n file_time_struct[:dw_high_date_time]))\n end", "def parse_time(time)\n zone = ActiveSupport::TimeZone.new(\"Central Time (US & Canada)\")\n time = time.in_time_zone(zone)\n hour = (time.hour - START_TIME) * HOUR_SHIFT\n minute = time.min / TIME_INTERVAL\n return hour + minute # this is the index used in the schedule\n end", "def strptime_format\n #'%Y-%m-%dT%H:%M:%S.%L'\n \"%Y-%m-%dT%H:%M:%SZ\"\n end", "def validate_event_time(item)\n error(msg: 'Invalid iso8601 string', item: __method__.to_s) unless valid_iso_8601(item)\n end", "def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end", "def parse_times(str)\n \tstr.delete(' ')\n \ttimes = []\n \tsuccess = true\n \tstr.split(',').each do |t|\n \t pt = parse_time(t)\n \t if pt\n \t \ttimes << pt\n \t else\n \t \traise \"unable to parse time #{t}\"\n \t \tsuccess = false\n \t \tbreak\n \t end\n \tend\n end", "def time_zone_strptime(str, format, now = Time.zone.now)\n parts = Date._strptime(str, format)\n return if parts.empty?\n\n # https://www.ruby-forum.com/topic/4591844\n if parts.has_key?(:seconds)\n time = Time.zone.at(parts[:seconds])\n elsif parts.has_key?(:leftover)\n seconds = (parts.fetch(:sec, \"0\").to_s + parts.fetch(:leftover, \"0\")).to_i\n time = Time.zone.at(seconds)\n else\n time = Time.new(\n parts.fetch(:year, now.year),\n parts.fetch(:mon, now.month),\n parts.fetch(:mday, now.day),\n parts.fetch(:hour, 0),\n parts.fetch(:min, 0),\n parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),\n parts.fetch(:offset, 0)\n )\n end\n\n if parts[:offset]\n ActiveSupport::TimeWithZone.new(time.utc, Time.zone)\n else\n ActiveSupport::TimeWithZone.new(nil, Time.zone, time)\n end\n end", "def parseTime(time)\n if(time.nil?)\n return nil ;\n elsif(time.is_a?(String))\n return Time.parse(time, DefaultDate) ;\n elsif(time.is_a?(Time))\n return time ;\n else\n raise \"can not convert to Time Object from :\" + time.inspect ;\n end\n end", "def grabTime(str)\n if /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)\n /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)[2]\n else\n \"Ongoing\"\n end\n end", "def parse_date\n REGEX_DATE.match(@request[FTIME]) ? Date.parse($1) : nil\n end", "def typecast_time(datetime) #:nodoc:\n datetime.sub!(%r|^(\\w{2})/(\\w{3})/(\\w{4})|, '\\2 \\1 \\3')\n datetime.sub!(':', ' ')\n Time.parse(datetime)\n end", "def parse(value)\n unless value.is_a?(String)\n raise TimeParseError, \"value must be string: #{value}\"\n end\n\n if @cache1_key == value\n return @cache1_time\n elsif @cache2_key == value\n return @cache2_time\n else\n begin\n time = @parse.call(value)\n rescue => e\n raise TimeParseError, \"invalid time format: value = #{value}, error_class = #{e.class.name}, error = #{e.message}\"\n end\n @cache1_key = @cache2_key\n @cache1_time = @cache2_time\n @cache2_key = value\n @cache2_time = time\n return time\n end\n end", "def parse_task_time(time,anytime)\n if anytime == \"true\"\n return -1\n end\n time = Time.parse(time)\n return (time.hour*60) + time.min\n end", "def time(value)\n _parse_time(value)\n end", "def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end", "def _date_parse(string)\n super(handle_date_parse_input(string))\n end", "def parse_datetime(string)\n res = DATE_PARSERS.detect do |parser|\n return parser.parse(string).feed_utils_to_gm_time\n rescue StandardError => e\n Feedjira.logger.debug { \"Failed to parse date #{string}\" }\n Feedjira.logger.debug(e)\n nil\n end\n\n Feedjira.logger.warn { \"Failed to parse date #{string}\" } if res.nil?\n\n res\n end", "def to_smart_time(form = :utc)\n# 1) Research parsedate to see how it's parsing\n# 2) Refacter the parse to insert the current values from the top down,\n# as they don't exist. Ignore seconds completely unless given by the string.\n ::Time.send(\"#{form}_time\", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0})\n end", "def timestamp_parse(_timestamp)\n _undefined\n end" ]
[ "0.7585522", "0.7453506", "0.7416698", "0.72167873", "0.71446925", "0.71446925", "0.7139991", "0.7139991", "0.7139991", "0.70803285", "0.70590293", "0.70383817", "0.7013638", "0.6932127", "0.6925738", "0.68583983", "0.6848777", "0.6839743", "0.68381286", "0.6821729", "0.68057567", "0.67168057", "0.6712528", "0.66494906", "0.6627575", "0.66257006", "0.65761214", "0.6514505", "0.64930683", "0.6478628", "0.6448485", "0.64276785", "0.6416915", "0.64150226", "0.6383199", "0.6376809", "0.6335967", "0.6332332", "0.6291336", "0.62783426", "0.6255122", "0.6247064", "0.62428266", "0.624075", "0.6230654", "0.62236744", "0.62223756", "0.6221724", "0.62163544", "0.6201303", "0.61983645", "0.6154507", "0.61465657", "0.61379147", "0.613261", "0.612782", "0.61199725", "0.61072975", "0.6105432", "0.6104993", "0.60976374", "0.6088905", "0.6087313", "0.60832655", "0.60814923", "0.6074533", "0.6074245", "0.6067613", "0.6055501", "0.6049336", "0.60409856", "0.60252035", "0.60164565", "0.6016334", "0.60145015", "0.5983224", "0.5976416", "0.5973799", "0.5962327", "0.5961547", "0.5943832", "0.5922775" ]
0.6984776
29
User validation web service for edit and signup forms
def validate only_provides :json @event = Event.new(params[event]) @event.user = current_user @event.title = nil if @event.title.blank? @event.finish = nil if @event.finish.blank? # ignore timeline_event since its fields are optional now display @event.valid? || @event.errors_as_params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appctrl_ensure_user_is_valid\n edit_user = if @current_user.try( :invalid? )\n view_context.apphelp_flash( :error, :provide_account_details, ApplicationController )\n true\n elsif @current_user.try( :must_reset_password? )\n view_context.apphelp_flash( :warning, :must_reset_password, ApplicationController )\n true\n end\n\n redirect_to( edit_user_path( @current_user ) ) if ( edit_user )\n end", "def validate\n super\n\n if server.nil?\n errors.add :over_capacity, 'We are currently at capacity, and cannot create your home page. We will fix this shortly. Please come back later and try again, our apologies.'\n end\n\n # TODO regex fails for usernames <= 2 chars, tempfix for now.\n if new? && values[:username].length > 2 && !values[:username].match(VALID_HOSTNAME)\n errors.add :username, 'A valid user/site name is required.'\n end\n\n if new? && values[:username].length > 32\n errors.add :username, 'User/site name cannot exceed 32 characters.'\n end\n\n # Check for existing user\n user = self.class.select(:id, :username).filter(username: values[:username]).first\n\n if user\n if user.id != values[:id]\n errors.add :username, 'This username is already taken. Try using another one.'\n end\n end\n\n if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)\n errors.add :password, \"Password must be at least #{MINIMUM_PASSWORD_LENGTH} characters.\"\n end\n\n if !values[:domain].nil? && !values[:domain].empty?\n if !(values[:domain] =~ /^[a-zA-Z0-9.-]+\\.[a-zA-Z0-9]+$/i) || values[:domain].length > 90\n errors.add :domain, \"Domain provided is not valid. Must take the form of domain.com\"\n end\n\n site = Site[domain: values[:domain]]\n if !site.nil? && site.id != self.id\n errors.add :domain, \"Domain provided is already being used by another site, please choose another.\"\n end\n end\n end", "def validate\n return HESResponder(\"Field and value required.\", \"ERROR\") unless params[:field] && params[:value]\n fs = ['email','username', 'altid']\n f = params[:field]\n if !fs.include?(f)\n return HESResponder(\"Can't check this field.\", \"ERROR\")\n end\n f = f.to_sym\n v = params[:value]\n if @promotion.users.where(\"LOWER(#{f}) = ?\", v.downcase).count > 0\n return HESResponder(f.to_s.titleize + \" is not unique within promotion.\", \"ERROR\")\n else\n return HESResponder()\n end\n end", "def validate_user\n\n cache_data = CacheManagement::User.new([@user_id]).fetch\n @user = cache_data[@user_id]\n\n return validation_error(\n 'e_sam_2',\n 'invalid_api_params',\n ['invalid_user_id'],\n GlobalConstant::ErrorAction.default\n ) if @user.blank?\n\n return error_with_data(\n 'e_sam_3',\n 'user_not_verified',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @user[:properties].exclude?(GlobalConstant::User.is_user_verified_property)\n\n success\n\n end", "def validation; end", "def validation; end", "def validate_user\n @user = User.find_by_email(params[:email])\n if !@user \n render 'failure', :locals => {:message => 'User not found', :details => \"User: #{params[:email]}\"}\n end\n end", "def ensure_email_or_phone_is_provided\n return if params[:user] && (params[:user][:email].present? || params[:user][:phone].present?)\n user = User.new\n user.errors.add(:base, \"Login is missing, Please return to homepage and try again.\")\n respond_with user, location: root_path\n end", "def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = validate_email\n return r unless r.success?\n\n r = add_user_allowed?\n return r unless r.success?\n\n r = fetch_and_validate_user\n return r unless r.success?\n\n success\n end", "def validate\r\n\r\n end", "def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end", "def validate\n \n \n end", "def user_verification; end", "def validate_sfu_user\n sfu_username = URI.unescape(params[:username])\n invalid_user_response = { valid_user: false }\n render json: { valid_user: sfu_user_is_valid?(sfu_username) }, status: :ok\n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def check_fields\n params[:user] ||= {}\n \n if !params[:user][:email]\n errors = {email: [\"не может быть пустым\"]}\n render json: {msg: \"Укажите адрес эл. почты\", errors: errors}, status: 401\n elsif !params[:user][:password]\n errors = {password: [\"не может быть пустым\"]}\n render json: {msg: \"Укажите пароль\", errors: errors}, status: 401\n end\n end", "def validate_user\n return unauthorized_access_response('um_gbd_vu_1') if @user.blank? || (@user.client_id != @client_id)\n success\n end", "def user_verification?; end", "def valid_user!\n redirect_to administration_users_path if @user.admin?\n end", "def verify\n unless params[:user].nil?\n begin\n @user = User.find(params[:member_id].to_i)\n rescue\n redirect_to \"/main\"\n return\n end\n unless @user.nil?\n if params[:security_code] == @user.signup_validation\n @user.validated = 1\n @user.activated = 1\n if @user.save\n flash[:success] = \"Your account is now activated!\"\n end\n end\n end\n end\n redirect_to \"/main\"\n end", "def extra_validations\n success\n end", "def is_valid; end", "def create_user_check_valid_action\n email = check_create_user_email_is_valid\n name = check_create_user_name_is_valid\n password = check_create_user_password_is_valid\n message = []\n\n if name == false\n message << user_name_error\n end\n\n if email == false\n message << user_email_error\n end\n\n if password == false\n message << user_password_error\n end\n \n\n return message\n end", "def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = validate_if_st_default_client\n return r unless r.success?\n\n return error_with_data(\n 'sm_gud_vas_1',\n 'Please enter a valid user id',\n 'Please enter a valid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user_id.to_i.blank?\n\n success\n end", "def validate\n end", "def check_if_input_is_valid\n if params[:user] && warn_for_special_chars(params[:user][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n elsif params[:impersonate] && warn_for_special_chars(params[:impersonate][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n end\n end", "def validator; end", "def validate\n end", "def validate\n end", "def validate\n end", "def valid_user\n # unless @user\n # redirect_to root_url\n # end\n end", "def require_valid_user!\n return true\n end", "def validate_user \n errors.add(:user_id, 'user not presence') if User.find_by_id( self[:user_id] ) == nil\n end", "def create\n # raise \"hell\"\n @user = User.create(user_params)\n @errors = []\n if @user.email.include? \".\"\n\n if @user.first_name.length > 1 && @user.last_name.length > 1\n #true - check for no special characters and no numbers\n special = \"?<>',?[]}{=-)(*&^%$#`~{}\"\n regex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n if @user.first_name =~ regex || @user.last_name =~ regex\n # contains special char\n @errors << \"Your name cannot contain special characters\"\n session[:errors] = @errors\n redirect_to root_path\n else\n\n def has_digits?(str)\n str.count(\"0-9\") > 0\n end\n\n if has_digits?(@user.first_name)\n @errors << \"Your first name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n if has_digits?(@user.last_name)\n @errors << \"Your last name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n @user.save\n session[:user] = @user.id\n clear_session(:errors)\n if params[:commit] == 'Sign me up'\n redirect_to success_path\n elsif params[:commit] == 'Build your own newsletter'\n redirect_to build_path\n end\n end\n end\n\n\n end\n else\n @errors << \"Both first and last name must at least be 2 characters long\"\n session[:errors] = @errors\n redirect_to root_path\n end\n else\n @errors << \"An email must contain at least one full stop (.)\"\n session[:errors] = @errors\n redirect_to root_path\n\n end\n end", "def validate_user\n if @user.nil? or @user.reset_digest.nil? or \n not @user.authenticated?(:reset, params[:id])\n if @user.nil? \n Rails.logger.info(\"validate_user failed: @user nil.\")\n elsif @user.reset_digest.nil?\n Rails.logger.info(\"validate_user failed: reset_digest is nil.\")\n else\n Rails.logger.info(\"validate_user failed: authentication failed.\")\n end\n\n flash[:danger] = \"Your request could not be completed.\"\n redirect_to root_url\n end\n end", "def valid_user\n unless (@user && @user.activated? &&\n @user.authenticated?(:email_change, params[:id]))\n flash[:danger] = \"Invalid credentials\"\n redirect_to root_path\n end\n end", "def validate\n\n end", "def verify\n params[:username] ||= ''\n User.with_master do\n @user = User.find_by_username(params[:username])\n end\n if @user && @user.active\n flash[:notice] = I18n.t(:user_already_active_notice)\n redirect_to login_path\n elsif @user && @user.validation_code == params[:validation_code] && ! params[:validation_code].blank?\n @user.activate\n Notifier.deliver_account_activated(@user)\n redirect_to activated_user_path(@user)\n elsif @user\n @user.validation_code = User.generate_key if @user.validation_code.blank?\n send_verification_email\n flash[:error] = I18n.t(:user_activation_failed_resent_validation_email_error)\n redirect_to pending_user_path(@user)\n else\n flash[:error] = I18n.t(:user_activation_failed_user_not_found_error)\n redirect_to new_user_path\n end\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def signup_with_email\n @status, @msg, @data = UserValidator.signup_with_email(params)\n @status, @msg, @data = UserManager.signup_with_email(params) if @status\n end", "def is_valid\n\tend", "def is_valid\n\tend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def before_POST(req)\n super\n @errors = validate_signup(@posted)\n get_signup(req) if has_errors?\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def signup\n\n\t\temail = params[:email] # Extract the email from the params of the signup form\n\t\ttimezone = params[:timezone] # Extract the timezone from the params of the signup form\n\n\t\t@url = uniqueUrlKeyGenerator # Generate a unique url key\n\t\told_user = User.find_by_email(email)\n\n\t\t# If user exists\n\t\tif !old_user.nil?\n\t\t # If user is not registered\n\t\t if !old_user.registered?\n\t\t # Send welcome email again and save him\n\t\t old_user.sendWelcomeEmail\n\t\t old_user.save\n\t\t end\n\t\tend\n\n\t\t# Find the user in the user db with the same email as extracted in the params\n\t\tcheck_users = User.find_by_email(email)\n\n\t\t#create a new PotentialUser object with the extarcted email, timezone and url key\n\t\tuser = User.new(email: email, url: @url, timezone: timezone, day: 1, registered: false)\n\n\t\t# If no such user exists\n\t\tif check_users.nil?\n\n\t\t#If the new user is valid and can be saved\n\t\t if user.save\n\t\t user.sendWelcomeEmail\n\t\t @title = \"Thank you for signing up\"\n\t\t @result = \"A confirmation email with instructions has been sent to you\"\n\t\t @result2 = \"Your unique access key is: \" + @url\n\n\t\t#If not valid\n\t\t else\n\t\t #Set @result as the error message\n\t\t @title = \"Looks like something went wrong ...\"\n\t\t @result = \"Email #{user.errors[:email][0]}.\".html_safe\n\t\t end\n\n\t\t#User by this email already exists\n\t\telse\n\n\t\t if !check_users.registered?\n\t\t\t # Result instance variable for the view\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists, but we sent another confirmation email just in case\"\n\t\t\t else\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists\"\n\t\t end\n\n\tend\n\n\t\t# Respond to only javascript, set for AJAX\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def validate_user\n errors.add(:user_id, 'not presence') if User.find_by_id( self[:user_id] ) == nil\n end", "def checkadduser\n \tfirstname = params[:firstname]\n lastname = params[:lastname]\n email = params[:email]\n password = params[:password]\n re_email = params[:retyped_email]\n if firstname.length == 0 or lastname.length == 0 or email.length == 0 or password.length == 0 or re_email.length == 0 \n \t@msg = \"Required fields cannot be empty\"\n \trender :adduser\n \treturn\n end\n if password.length < 8 or password.length > 10 \n\n @msg = \"Password length has to be min 8 chars max 10 chars\"\n render :adduser\n return\n end\n if re_email != email \n\n @msg = \"Both emails has to match\"\n render :adduser\n return\n end\n user_db = User.find_by(email: email)\n\n unless user_db.nil? \n\n @msg = \"Failed to add user email already exists\"\n render :adduser\n else \n User.create(firstname: firstname,lastname: lastname,email: email,password: password)\n\n @msg = \"Successfully added the user. Please login.\"\n render :adduser\n end\n end", "def validate_input\n\t\tif params['homepage']['email'].present? && params['homepage']['password'].present?\n\t\t\ttrue\n\t\telse\n\t\t\tflash.now[:danger] = 'Some fields are not filled properly'\n\t\t\trender 'index'\n\t\t\tfalse\n\t\tend\n\tend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end", "def validate_usuario\n if current_usuario.tipo!='Administrador' || !current_usuario.activo\n redirect_to root_path\n end\n end", "def is_valid?\n end", "def validate_form(formdata: {})\n uid = formdata['availid']\n chk = ASF::Person[uid]&.asf_member?\n chk.nil? and return \"Invalid availid: #{uid}\"\n chk and return \"Already a member: #{uid}\"\n already = ASF::MemberFiles.member_nominees\n return \"Already nominated: #{uid} by #{already[uid]['Nominated by']}\" if already.include? uid\n return 'OK'\nend", "def validate_params\n @user = Validation::LogIn.new(params[:session])\n if [email protected]?\n render :new \n end\n end", "def user_signup_finished?\n unless is_guest?\n if current_user == User.friendly.find(params[:id])\n @user = current_user\n if @user.valid? == false # If user's attributes are missing, sends them to 'Finish Profile Page'\n flash[:alert] = \"Please finish signing up for Ossemble by entering your First Name, Last Name, Birth Date, Address, and ensuring your location is correct.\"\n redirect_to edit_user_registration_path # Finish Profile Page Setup with form\n end\n end\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate_user_authorization\n user = User.find_by_id(params[:id])\n require_valid_user user\n end", "def fetch_and_validate_user\n @user = User.using_client_shard(client: @client).where(client_id: @client_id, email: @email).is_active.first\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_2',\n ['user_already_present']\n ) if @user.present?\n\n success\n end", "def respond_with_user(user)\n if user.valid?\n respond_with_valid_user(user)\n else\n render :new\n end\n end", "def validate_me\n @member = Member.find(params[:id])\n @member.send_validation_email\n respond_to do |format|\n format.html\n end\n end", "def validate_on_update\n if self.manager_signed?\n errors.add_to_base(\"CANNOT re-sign this form once it is signed!\") if !self.manager_sign_username.blank?\n else\n manager = User.authenticate(self.manager_sign_username, self.manager_sign_password, Thread.current['user'].domain)\n errors.add(:store_manager, \"signature must be a store manager.\") if !manager.nil? && !manager.is_store_admin?\n errors.add(:store_manager, \"could not be validated. Please check your username and password and try again.\") if !manager && !self.manager_sign_username.blank?\n errors.add(:social_security_number, \"needs to be set in #{self.manager_sign_username}'s profile to be able to sign.\") if !manager.nil? && manager.social_security_number.blank?\n end\n if self.regional_signed?\n errors.add_to_base(\"CANNOT re-sign this form once it is signed!\") if !self.regional_sign_username.blank?\n else\n regional = Admin.authenticate(self.regional_sign_username, self.regional_sign_password)\n errors.add(:regional_manager, \"could not be validated. Please check your username and password and try again.\") if !regional && !self.regional_sign_username.blank?\n errors.add(:social_security_number, \"needs to be set in #{self.regional_sign_username}'s profile to be able to sign.\") if !regional.nil? && regional.social_security_number.blank?\n end\n end", "def create\n @user = User.new(params[:user])\n @user.firm = current_firm\n @users = current_firm.users\n @model = \"user\"\n @model_instanse = @user\n respond_to do |format|\n if @user.save\n flash[:notice] = flash_helper(\"Registration successful.\")\n format.html {redirect_to(users_path())}\n format.js\n else\n format.js { render \"shared/validate_create\" }\n end\n end\n end", "def validate_name?\n # if you create user from admin interface(or as a team member), then \"name\" param is provided, it is present or blank - not nil\n !name.nil?\n end", "def validate_and_sanitize\n r = super\n return r unless r.success?\n\n @email = @email.to_s.downcase.strip\n @name = @name.to_s.downcase.strip\n\n return error_with_data(\n 'am_au_i_vas_1',\n 'Invite User Error',\n 'Please enter a valid email address',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !Util::CommonValidateAndSanitize.is_valid_email?(@email)\n\n return error_with_data(\n 'am_au_i_vas_2',\n 'Invite User Error',\n 'Name cannot be blank',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @name.blank?\n\n return error_with_data(\n 'am_au_i_vas_3',\n 'Invite User Error',\n 'Name can be of maximum 100 characters',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @name.length > 100\n\n success\n end", "def valid_for_params_auth?; end", "def validate_all\n current_user.valid?(:save) && valid?(:create) && address_valid?(:save)\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def attemp_signup\n\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def create\n if ( User.find_by_email(params[:user].email) || User.find_by_user_code(params[:user.user_code]) )\n format.html { redirect_to administrators_url, alert: 'Duplicate email or user name detected.' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n else\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to administrators_url, notice: 'User was successfully created.' }\n format.json { render json: administrators_url, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def validate\n hash={:valid => valid?}\n\n # make sure no authentication information is left by\n # this validation \n reset_session\n cookies[:auth_token]\n\n respond_to do |format|\n format.json { render :json => jsonp(hash) }\n format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'authentication') }\n format.text { render :text => text_not_supported }\n end\n end", "def validate_user\n #Validate rut and form\n user = rut_verification(params[:user_rut])\n form = params[:request_type]\n # Redirect to correct form\n if user != 0 and user != -1\n if user\n # User data\n session[:user] = user.attributes\n # selected request and item data\n session[:user][\"request\"] = params[:request_type]\n\n if params[:request_type] == 'renew' || params[:request_type] == 'technical service'\n session[:user][\"item\"] = params[:request_hw_renew_tech]\n elsif params[:request_type] == 'new'\n session[:user][\"item\"] = params[:request_hw_new]\n elsif params[:request_type] == 'stolen/lost'\n session[:user][\"item\"] = params[:request_hw_lost]\n else\n session[:user][\"item\"] = \"smartphone line\"\n end\n\n # Transfer Line\n if form == 'transfer line'\n redirect_to '/requests/forms/transferline'\n # New Request\n elsif form == 'new'\n redirect_to '/requests/forms/new'\n # Renew Request\n elsif form == 'renew'\n # check if selected item is owned by user\n # item = item_verification(params[:request_hw])\n redirect_to '/requests/forms/renew'\n # Stolen or Lost\n elsif form == 'stolen/lost'\n redirect_to '/requests/forms/stolenlost'\n # Technical service\n elsif form == 'technical service'\n redirect_to '/requests/forms/technicalservice'\n end\n\n else\n redirect_to '/requests/home/menu', alert: 'El usuario con Identificador nacional: '+params[:user_rut].to_s+ ' No se encuentra en la Base de datos de CCU'\n end\n\n elsif user == 0\n redirect_to '/requests/home/menu', alert: 'El usuario con Identificador nacional: '+params[:user_rut].to_s+ ' No se encuentra en la Base de datos de CCU'\n else\n redirect_to '/requests/home/menu', alert: 'No se puede conectar a la Base de datos de CCU, intente mas tarde'\n\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend", "def fValidateEmail (email)\n @users.validateEmail(email)\n end", "def validate\n errors.add_to_base('password', 'and confirmation do not match') unless password_confirmation == password\n errors.add_to_base(\"Your User ID is to long, can only store 4 characters!\") if self.userId.to_s.length > 4\n errors.add_to_base(\"Your User Name is to long, can only store 50 characters!\")if self.userName.to_s.length > 50\n errors.add_to_base(\"Your First Name is to long, can only store 50 characters!\")if self.firstName.to_s.length > 50\n errors.add_to_base(\"Your Last Name is to long, can only store 50 characters!\")if self.lastName.to_s.length > 50\n errors.add_to_base(\"Your Title is to long, can only store 50 characters!\") if self.title.to_s.length > 50\n errors.add_to_base(\"Your Photo is to long, can only store 50 characters!\") if self.photo.to_s.length > 50\n errors.add_to_base(\"Your Email is to long, can only store 30 characters!\") if self.email.to_s.length > 30\n errors.add_to_base(\"Your Byline ID is to long, can only store 11 characters!\") if self.bylineID.to_s.length > 11\n end", "def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end", "def valid_principals; end", "def valid_for_authentication?; end", "def valid_for_authentication?; end", "def valid_user\n\t\t\tunless (@user && @user.activated? && \n\t\t\t\t\t\t\[email protected]?(:reset, params[:id]))\n\t\t\t\tredirect_to root_url\n\t\t\tend\t\n\t\tend", "def valid_user_or_email!\n return unless @user.blank? && @extra['email'].blank?\n\n @success = false\n @error = 'Error: user name or extra email must be present'\n end", "def check_user_elibility\n service = UserEligibility.new(params[:id])\n result = service.check_eligibility\n render_error(result) unless result == 'CUSTOMER_ELIGIBLE'\n end", "def validate_profile_edit_post(params)\n params[\"username\"] and params[\"password\"] and params[\"id\"]\n end", "def subclass_validations ; true ; end", "def validated; end", "def valid_user\n User.new(name: \"John Smith\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\")\nend", "def create\n checkexists = User.find_by(email: user_params[:email], organization_id: user_params[:organization_id])\n\tif checkexists\n\t\tflash[:danger] = 'A user with this email address already exists within the specified organization'\n\t\tredirect_to '/signup.html'\n\telse\n\t\t@user = User.new(user_params)\n\t\[email protected]_attribute(:is_admin, false)\n\t\tif @user.save\n\t\t\trender 'show'\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend\n end", "def validateUser valid_data\r\n begin \r\n user_email = valid_data['user']\r\n logger.info(\"Authentication::ValidateUser:---#{user_email}\")\r\n @userValid = smvIsUserExist(user_email, request.env) \r\n smv_status = {\r\n :statusCode => @userValid.statusCode,\r\n :value => @userValid.value, \r\n :msg => @userValid.message\r\n }\r\n logger.info(\"Authentication::ValidateUser::smvIsUserExist:---#{smv_status}\")\r\n return smv_status\r\n rescue Exception => exc\r\n logger.error(\"validateUser::Message for the log file #{exc.message}\")\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n\t :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n return smv_status \r\n end \r\n end", "def set_username_validation\n\t if @do_username_validation != false\n\t\t @do_username_validation = true\n\t end\n end", "def validate_email\n @user = User.find(params[:id])\n if @user.check_verification(params[:code])\n render :json => {:message => :validation_success }\n else\n render :json => {:message => :validation_failed}, :status => :unprocessable_entity\n end\n end", "def valid_user\n \tunless(@user && @user.activated? && @user.authenticated?(:reset, params[:id]))\n \t\tredirect_to root_url\n \tend\n end" ]
[ "0.6514632", "0.65083987", "0.647919", "0.6377082", "0.6363155", "0.6363155", "0.63613397", "0.6358674", "0.6352912", "0.62247676", "0.62046915", "0.6192589", "0.61915326", "0.6172483", "0.61429745", "0.61429745", "0.61429745", "0.61429745", "0.61373276", "0.6115037", "0.61107606", "0.608493", "0.6070785", "0.6052563", "0.6048521", "0.60141426", "0.60095537", "0.60021013", "0.59976786", "0.59916574", "0.5982388", "0.5982388", "0.5982388", "0.59798497", "0.5975767", "0.59594697", "0.5953758", "0.5941088", "0.593877", "0.5937304", "0.59368986", "0.5935446", "0.5935446", "0.5935446", "0.5928348", "0.59257585", "0.59257585", "0.5924618", "0.5919411", "0.5915969", "0.59159505", "0.58892906", "0.5885918", "0.5883415", "0.5875944", "0.5875414", "0.5872215", "0.5866159", "0.5858441", "0.58552223", "0.5846413", "0.5842988", "0.58239365", "0.5816073", "0.5812927", "0.58007795", "0.5800555", "0.5798122", "0.57980925", "0.5796044", "0.57928735", "0.57908213", "0.5786792", "0.5786792", "0.5785258", "0.5785257", "0.5785257", "0.5785257", "0.5785233", "0.5775229", "0.5773461", "0.5745602", "0.57442194", "0.57328403", "0.5731178", "0.57199216", "0.5718447", "0.57149136", "0.57149136", "0.57122254", "0.5707838", "0.57000077", "0.56968534", "0.5696117", "0.5688209", "0.56862444", "0.56851107", "0.56844705", "0.5682244", "0.56764525", "0.5675633" ]
0.0
-1
create a new timeline event association, with options to create the event and first source comment from scratch N.B. handles both create and update calls TODO. should be checking if save succeeds
def create @timeline_event = TimelineEvent.find(timeline_event[:id]) || TimelineEvent.new(params[:timeline_event]) @event = Event.find(timeline_event[:event_id]) if @event.nil? # create event @event = Event.new(params[:event]) @event.user = current_user @event.title = nil if @event.title.blank? # fix optional fields @event.finish = nil if @event.finish.blank? @event.save || raise("Could not save event #{@event}") # # create source comment (if exists)... should have more explicit # if event_comment && !event_comment[:text].empty? # @event_comment = EventComment.new(event_comment) # @event_comment.event = @event # @event_comment.user = current_user # @event_comment.user_ip = request.remote_ip # @event_comment.save # validation required # end end # tie timeline entry to event @timeline_event.id = nil if @timeline_event.id.blank? @timeline_event.event = @event @timeline_event.interpretation = timeline_event[:interpretation] @timeline_event.save || raise("Could not save #{@timeline_event}: #{@timeline_event.errors.join(', ')}") @timeline = @timeline_event.timeline redirect_to resource(@timeline.user, @timeline, :cue => @event.id), :message => { :notice => 'Updated your event entry' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n build_event\n if save_event_and_timeline\n format.html { redirect_to_event_or_timeline }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event_comment\n \tEventComment.create(user_id: user_id, event_id: event_id, comment_id: id)\n end", "def create_event(options={})\n\t\t\tEvent.create({\n\t\t\ttitle: \"Event's name\",\n\t\t\tlocal: \"Event's local\",\n\t\t\tdescription: \"Event's test description\",\n\t\t\tstart_time: DateTime.now,\n\t\t\tend_time: 2.days.from_now\n\t\t\t}.merge(options))\n\t\tend", "def create_events\n end", "def create\n\t\t@event = Event.new(params[:event])\n\t\t#set the recurring fields to \"not recurring\" when the recurrance is not selected\n\t\tif !params[:event][:recurring]\n\t\t\[email protected] = Event::NOT_RECURRING\n\t\tend\t\t\n\t\t@branch = Branch.find(params[:branch_id])\n\t\tt_ids = params[:teachers].split(\",\") || []\n\t\tsec_ids = params[:section_ids] || []\n\t\tteachers = []\n\t\tsections = []\n\t\tbranches = []\n\t\tif t_ids.include?(\"0\")\n\t\t\tteachers = Branch.find(params[:branch_id]).teachers\n\t\telse\n\t\t\tt_ids.each do |tid|\n\t\t\t\tteachers << Teacher.find(tid)\n\t\t\tend\n\t\tend\n\t\tsec_ids.each do |sid|\n\t\t\tsections << Section.find(sid)\n\t\tend\n\t\tif params[:branch_event]\n\t\t\tbranches << Branch.find(params[:branch_id])\n\t\tend\n\n\t\[email protected] = teachers\n\t\[email protected] = sections\n\t\[email protected] = branches\n\n\t\tif @event.valid? && @event.schedules.all?(&:valid?)\n\t\t\[email protected]!\n\t\t\[email protected](&:save!)\t\n\t\t\tredirect_to(@event, :notice => 'Event was successfully created.')\n\t\telse\n\t\t\tflash[:notice] = 'Cannot create Event'\t\t\t\n\t\t\trender :action => \"new\"\n\t\tend\n\tend", "def create\n @event = Event.new(event_params)\n #Makes so that the created event is tied to the active user\n @event.user = current_user\n respond_to do |format|\n if @event.save\n # Event owner must join the event\n event = Event.last\n event_id = event.id\n event_user_id = event.user_id\n event_obs = 'I am the owner of this event'\n event_status = true\n act = Active.new(user_id: event_user_id, event_id: event_id, status: event_status, obs: event_obs)\n act.save\n save_events_file(\"eventlist.txt\")\n # end of joining event\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.set_time\n @event.className = current_user.class_name\n \n @entry = Entry.new\n @entry.description = @event.title\n @entry.user_id = current_user.id\n @entry.family_id = current_user.family.id\n @entry.save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(events_path, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @creator = User.find(session[:user_id])\n\n @event.creator_id = @creator.id\n\n if @event.save\n\t\t\tEventCommitment.create(:user => @creator, :event => @event, :description => \"attend\")\n flash[:notice] = 'Event created.'\n redirect_to event_path(@event.id)\n else\n render(\"new\")\n end\n end", "def create\n\n @event = Event.new\n\n @event.name = params[:event][:name]\n @event.begin_date = params[:event][:begin_date]\n @event.end_date = params[:event][:end_date]\n @event.subscibe_limit_date = params[:event][:subscibe_limit_date]\n @event.description = params[:event][:description]\n @event.attendance = params[:event][:attendance]\n @event.contacts = params[:event][:contacts]\n @event.how_to_participate = params[:event][:how_to_participate]\n @event.registration_fees = params[:event][:registration_fees]\n @event.participants = params[:event][:participants]\n @event.related_events = params[:event][:related_events]\n @event.infos_extra = params[:event][:infos_extra]\n\n # address_attributes\n @event.build_address\n @event.address.update_attributes params[:event][:address_attributes]\n\n @event.theme_list = params[:event][:theme_list]\n @event.typology_list = params[:event][:typology_list]\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end", "def insert_event(event)\n\t\t\n\t\tstart_date =timeparse(event[:start_date], event[:start_time])\n\t\tend_date =timeparse(event[:end_date], event[:end_time])\n\t\t#is_valid_time?(start_date,end_date)\n\n\t\tnew_event = {\n\t\tsummary: event[:title],\n\t \tlocation: event[:location],\n\t \tdescription: event[:description],\n\t \tstart: {\n\t\tdateTime: start_date,\n\t \ttimeZone: 'America/Chicago'\n\t \t},\n\t \tend: {\n\t\tdateTime: end_date,\n\t \ttimeZone: 'America/Chicago'\n\t \t},\n\t \trecurrence: [\n\t \t#'RRULE:FREQ=DAILY;COUNT=1'\n\t \t],\n\t \tattendees: [\n\t \t# {'email': '[email protected]'}\n\t \t# {email: '[email protected]'},\n\t \t],\n\t \treminders: {\n\t \tuseDefault: 'true',\n\t \t#overrides: [\n\t \t#{method: 'email', minutes: '10'}\n\t # \t{method' => 'popup', 'minutes: 10},\n\t \t#]\n\t \t}\n\t\t}\n\t\tresponse = @client.execute(api_method: @service.events.insert,\n\t\tparameters: {'calendarId' => ENV['NSCS_Calendar_ID']}, body: JSON.dump(new_event), headers: {'Content-Type' => 'application/json'})\n\t\t\n\t\t#Todo Method For checking dropped.\n\t\tresponse = JSON.parse(response.body)\n\t\t\n\t\n\t\tevent[:event_id]= response[\"id\"]\n\t\tevent[:creator_name]= response[\"creator\"][\"displayName\"]\n\t\tevent[:creator_email]= response[\"creator\"][\"email\"]\n\t\t#These make the date look less brittle.\n\t\t#event[:start_time]= DateTime.parse(response[\"start\"][\"dateTime\"]).strftime('%I:%M:%S %p')\n\t\t#event[:end_time]= DateTime.parse(response[\"end\"][\"dateTime\"]).strftime('%I:%M:%S %p')\n\t\t#However time requires date as well in Ruby but SQL Does not persists it.\n\t\tevent[:start_time]= Time.parse(response[\"start\"][\"dateTime\"])\n\t\tevent[:end_time]= Time.parse(response[\"end\"][\"dateTime\"])\t\n\t\[email protected]!\n\tend", "def create\n calendar = Calendar.where(default: true, user_id: current_user.id)[0]\n @event = calendar.events.build(params[:event])\n\n parse_params\n if @event.save\n redirect_to request.referer\n else\n flash[:error] = \"Event creation failed!\"\n redirect_to request.referer\n end\n end", "def create\n\n @event = Event.new(event_params)\n\n # if @event.cloudy already exist => duplicate else create from scratch\n @cloudy = @event.cloudy ? @event.cloudy : Cloudy.create\n @save_is_ok = true\n\n # dates is range\n if @event.calendar_range_string.size > 0\n\n @event = Event.new(event_params)\n @event.organizer = ( current_member.has_role?(ROLE_ADMIN) && @event.teacher) ? @event.teacher : current_member\n @event.cloudy = @cloudy\n @event.duration = @event.end_at - @event.begin_at\n # force image to avoid uplaod a new image per event created\n @save_is_ok &&= @event.save\n\n if @save_is_ok\n ContactMailer.new_user_action('Nouvel évènement', @event.url).deliver_now\n @event.reload\n @cloudy.identifier = @event.image.filename\n @cloudy.prefix_cloudinary = 'http://res.cloudinary.com/' + YAML.load_file('config/cloudinary.yml')['production']['cloud_name'] + '/'\n @cloudy.save\n @event.index!\n end\n\n elsif @event.calendar_string.size > 0\n\n # multi_dates_id = Time.new is Id group of all items\n tab_dates = @event.calendar_string.split(',')\n time_stamp = Time.new\n\n @save_is_ok = tab_dates.count > 0\n\n flash[:alert] = \"Il faut choisir une ou plusieurs dates\" unless @save_is_ok\n\n tab_dates.each do |d|\n @event = Event.new(event_params)\n @event.multi_dates_id = time_stamp if tab_dates.count > 1\n @event.organizer = ( current_member.has_role?(ROLE_ADMIN) && @event.teacher) ? @event.teacher : current_member\n\n @event.cloudy = @cloudy\n # if local zone = Paris, the 2 instruction follow add + hours in execution but not in debug\n # so DO NOT CHANGE LOCAL ZONE\n time_at = I18n.l(@event.begin_at, format: '%H:%M')\n @event.begin_at = DateTime.strptime(d+' '+time_at, '%d/%m/%Y %H:%M')\n time_at = I18n.l(@event.end_at, format: '%H:%M')\n @event.end_at = DateTime.strptime(d+' '+time_at, '%d/%m/%Y %H:%M')\n @event.duration = @event.end_at - @event.begin_at\n\n # save once to get cloudinary infos, break if save not ok\n break unless @save_is_ok &&= @event.save\n\n if @save_is_ok\n ContactMailer.new_user_action('Nouvel évènement', @event.url).deliver_now\n if [email protected]\n @event.reload\n @cloudy.identifier = @event.image.filename\n @cloudy.prefix_cloudinary = 'http://res.cloudinary.com/' + YAML.load_file('config/cloudinary.yml')['production']['cloud_name'] + '/'\n @cloudy.save\n params[:event].delete(:image)\n end\n @event.index!\n end\n end\n end\n\n respond_to do |format|\n if @save_is_ok\n format.html { redirect_to @event}\n format.json { render :show, status: :created, location: @event }\n else\n # simple_form doesn t show errors for :begin_at & :end_at because\n flash[:alert] = \"Problème dans la création de l événement\"\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @event = Event.new(event_params)\n if @event.cost == nil?\n @event.cost = 0\n end\n if params[:event][:track_id]\n @track = Track.find(params[:event][:track_id])\n @cohort = @track.cohort\n @event.cohort = @cohort\n end\n if params[:event][:side_trip_id]\n @side_trip = SideTrip.find(params[:event][:side_trip_id])\n @event.side_trip = @side_trip\n end\n respond_to do |format|\n if @event.save\n unless @track.nil?\n update_users\n end\n send_notifications\n create_chat_room\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event(action, todo, meta={})\n Event.create(\n user_id: todo.creator_id,\n action: action,\n target: todo,\n project_id: todo.project_id,\n meta: meta,\n )\n end", "def create\n #if selected_courses_course_path\n # @event = current_user.events.build(params.require(:event).permit(:title, :starts_at, :ends_at,\n # :all_day, :description))\n #end\n\n @event = current_user.events.build(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = current_user.events.new(params[:event])\n @presentation_picture = PresentationPicture.find_by_id(params[:event][:presentation_picture_id])\n # @event.categories.build params[:event][:category_ids]\n # @event.event_start_date = Timeliness.parse(@event.event_start_date, :format => 'dd/mm/yyyy')\n\n respond_to do |format|\n if @event.save\n if @presentation_picture.present?\n manage_presentation_picture(@event, params[:event][:presentation_picture_id])\n end\n @event.moderation_setting = ModerationSetting.create(:published => true, :moderated => false, :refuse_cause => \"-\")\n format.html { redirect_to(@event, :notice => \"L'évènement a été crée avec succès !\") }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n if params[:event][:presentation_picture_id].present?\n @presentation_picture = PresentationPicture.find_by_id(params[:event][:presentation_picture_id])\n else\n @presentation_picture = PresentationPicture.new\n end\n flash.now[:alert] = t(:form_record_fail, :model => \"'évènement\", :scope => [:errors])\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\t\t@event_helper = @event.event_helpers.build\n @event_helper.user = current_user # current_user not available in model\n @event_helper.orga = true\n @event_helper.save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n @event.save\r\n end", "def create\n @event = Event.find(params[:event_id])\n @event_entry = @event.event_entries.build(params[:event_entry])\n\n respond_to do |format|\n if @event_entry.save\n format.html { redirect_to @event, :notice => 'Event entry was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_event( event )\n body = {:summary => event.summary.force_encoding('UTF-8')}\n body.merge!(:description => event.description.force_encoding('UTF-8')) if event.description\n body.merge!(:location => event.location.force_encoding('UTF-8')) if event.location\n\n if all_day?(event)\n start_date = event.dtstart.to_s\n end_date = event.dtend.to_s\n\n body.merge!(\n :start => {:date => start_date},\n :end => {:date => end_date.size > 0 ? end_date : (Date.parse(start_date) + 1).to_s})\n else\n body.merge!(\n :start => {:dateTime => localtime(event.start_time)},\n :end => {:dateTime => localtime((event.respond_to? :end_time) ? event.end_time : event.start_time)})\n end\n\n client.execute(\n :api_method => calendar.events.insert,\n :parameters => {:calendarId => calendar_id},\n :headers => {'Content-Type' => 'application/json'},\n :body => JSON.dump(body)).response.body\n end", "def create\n @event_params = event_params\n @start_date = @event_params.select {|k, _| k.include? \"event_start_date\"}.values.join('-').to_date\n\t\t@event = current_user.events.create(\n name: @event_params[:name],\n event_detail: @event_params[:event_detail],\n event_start_date: @start_date,\n )\n\t\tif @event.save\n redirect_to event_path(@event.id), :flash => { :success => \"Your event has been succesfully created\" }\n\t\telse\n\t\t\trender 'new'\n\t\tend\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n # Very bad coding but when you create an event, you are automatically made an attendee.\n @attendee = Attendee.create(user_id: current_user.id, event_id: @event.id)\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n event = Event.new(event_params)\n event.creator_id = @creator_id\n tag = Tag.new(tag_params)\n position = Position.new(position_params)\n\n if Tag.find_by_name(tag.name.downcase).present?\n tag = Tag.find_by_name(tag.name.downcase)\n end\n\n event.tags << tag\n event.position = position\n if event.save && tag.save && position.save\n respond_with event, location: url_for([:api, event]), status: :created\n else\n error = ErrorMessage.new(\"Could not create the Event\", \"Something went wrong\")\n respond_with error, status: :bad_request\n end\n end", "def create\n user = current_user\n if(params[:usemap] == \"true\")\n event = Event.create(title: params[:title],\n summary: params[:summary],\n description: params[:description],\n time: makeDate(params[:date], params[:time]),\n venue: params[:venue],\n host: user.name,\n lat: params[:map_lat],\n lng: params[:map_lng])\n else\n event = Event.create(title: params[:title],\n summary: params[:summary],\n description: params[:description],\n time: makeDate(params[:date], params[:time]),\n venue: params[:venue],\n host: user.name)\n end\n if event.valid?\n part = Participant.create(user_id: user.id,\n event_id: event.id,\n role: \"host\")\n if part.valid?\n flash[:event_succ] = \"You have successfully created #{event.title}\"\n else\n event.delete\n flash[:event_fail] = \"You have failed to create #{event.title}:(\"\n end\n else\n flash[:event_fail] = \"You have failed to create #{event.title}:(\"\n end\n redirect_to root_url\n end", "def create\n event = Event.new(event_params.except(:tags, :position))\n\n event.creator = Creator.find_by creatorname: @creator_name\n\n if event_params[:tags].present?\n tags_params = event_params[:tags]\n tags_params.each do |tag|\n #If tag exists in database, associate this tag, else create a new tag\n if Tag.exists?(tag)\n event.tags << Tag.find_by(tag)\n else\n event.tags << Tag.new(tag)\n end\n end\n end\n\n if event_params[:position].present?\n\n position = event_params[:position]\n\n if Position.find_by(position)\n event.position = Position.find_by(position)\n else\n new_position = Position.create(position)\n event.position = new_position\n end\n end\n\n if event.save\n render json: event, include: [:tags, :creator, :position], status: :created\n else\n render json: event.errors, status: :unprocessable_entry\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do | format |\n if @event.save\n if(params.require(:event).key?(\"tags\"))\n tags = Tag.find(params.require(:event)['tags'])\n else\n tags = Tag.find_by(name: \"Other\") # Set default tag if none was selected\n end\n @event.tags << tags\n UserEventRelationship.create(event_id: @event.id, user_id: current_user.id, role_type_id: 0)\n format.html { redirect_to @event }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html {render 'new'}\n format.json {render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do | format |\n if @event.save\n if(params.require(:event).key?(\"tags\"))\n tags = Tag.find(params.require(:event)['tags'])\n else\n tags = Tag.find_by(name: \"Other\") # Set default tag if none was selected\n end\n @event.tags << tags\n UserEventRelationship.create(event_id: @event.id, user_id: current_user.id, role_type_id: 0)\n format.html { redirect_to @event }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html {render 'new'}\n format.json {render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\n @event = Event.new(params[:event])\n \n\n @event.created_by = current_user.id\n\n \n if params[:type] != 'user_event'\n #associate event to eventual publishers\n contributors = Organism.find(params[:contributions][:publisher_ids])\n contributors.each do |contributor|\n contribution = Contribution.new\n [email protected]\n contribution.organism_id=contributor.id\n contribution.role=\"publisher\"\n @event.contributions << contribution\n end\n end\n\n set_session_parent_pictures_root_path(@event)\n\n #FIXME : put these default parameters in table structure instead\n @event.is_charged=false\n @event.is_private=false\n\n #add the categories not to display in the list of categories of the event\n add_categories_not_to_display(@event)\n\n\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:event][:source]=='facebook')\n @event = Event.new(get_event_info_facebook)\n else\n @event = Event.new(event_params)\n end\n @event.is_approved = false\n respond_to do |format|\n if @event.save\n if params[:event][:source]=='facebook'\n format.html { redirect_to \"/events/#{@event.id}/edit\"}\n else \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n end\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n respond_to do |format|\n if @event.save\n cal = Google::Calendar.new(:username => '[email protected]',\n :password => 'iloverails',\n :app_name => 'GDG-Aracaju')\n\n event = cal.create_event do |e|\n e.title = \"#{@event.description} criado por: #{@event.user.email}\"\n e.start_time = @event.dt_begin\n e.end_time = @event.dt_end\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event(title, start, duration = nil, description = \"\", particular = false)\n finish = set_finish_date(start, duration)\n return if finish.nil? or not events_in_period(start, finish).empty?\n\n event_class = ModelFabric.get_class(SocialFramework.event_class)\n event = event_class.create(title: title, start: start, finish: finish,\n description: description, particular: particular)\n\n unless event.nil?\n participant_event_class.create(event: event, schedule: self, confirmed: true, role: \"creator\")\n end\n\n return event\n end", "def create\n assign_new_event\n if @event.save\n expire_cache\n flash[:notice] = \"Created #{@event.name}\"\n redirect_to edit_admin_event_path(@event)\n else\n flash[:warn] = @event.errors.full_messages.join\n render :edit\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n #create the default event roles for the current_user that created the event\n @event.participants.create(user_id: current_user.id)\n Event::Creator.create(user_id: current_user.id, event_id: @event.id)\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.create(params[:event])\n respond_to do |format|\n if @event.save\n current_project.events<<@event\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events!(opts={})\n cutoff = Time.now.yesterday # All events before this date will be skipped\n events = []\n transaction do\n for event in self.to_events(opts)\n if opts[:skip_old]\n next if event.title.blank? && event.description.blank? && event.url.blank?\n next if event.old?\n end\n \n # Skip invalid events that start after they end\n next if event.end_time && event.end_time < event.start_time\n \n # convert to local time, because time zone is simply discarded when event is saved\n event.start_time.localtime\n event.end_time.localtime if event.end_time\n \n # clear duplicate_of_id field in case to_events picked up orphaned duplicate\n # TODO clear the duplicate_of_id at the point where the object is created, not down here\n event.duplicate_of_id = nil if event.duplicate_of_id\n event.save!\n if event.venue\n event.venue.duplicate_of_id = nil if event.venue.duplicate_of_id\n event.venue.save! if event.venue\n end\n events << event\n end\n self.save!\n end\n return events\n end", "def create_new_event\n @event = Event.new\n @event.name = params[\"event_name\"]\n# @event.random_number = rand(100000)\n @event.date_of_event = params[\"event_date\"]\n @event.quote_message = Florist.find(session[\"found_florist_id\"]).quote_message_default\n @event.show_product_image = Florist.find(session[\"found_florist_id\"]).show_product_image_pref\n @event.show_display_name = 1\n if params[\"lead_designer\"] != \"\"\n @event.employee_id = Employee.where(name: params[\"lead_designer\"]).where(florist_id: session[\"found_florist_id\"]).first.id \n else\n @event.employee_id = nil\n end\n @event.florist_id = session[\"found_florist_id\"] \n @event.customer_id = params[\"customer_id\"]\n @event.event_status = \"Open Proposal\"\n if @event.save\n redirect_to \"/event_edit/#{@event.id}\" and return\n else\n @customer = Customer.where(id: params[\"customer_id\"]).first\n @employee_list = [\"\"] + Employee.where(florist_id: session[\"found_florist_id\"]).where(status: \"Active\").uniq.pluck(:name)\n render(:event_new) and return\n end\n end", "def create\n key = params[:event][:contact].delete(:key).parameterize\n @contact = @user.contacts.where(key: key).first_or_initialize\n @contact.update_attributes(data: @contact.data.merge(params[:event].delete(:contact)))\n @event = @contact.events.new\n @event.created_at = Time.zone.at(params[:event].delete(:remetric_created_at).to_i) if params[:event].has_key? :remetric_created_at\n @event.description = params[:event].delete(:description)\n @event.data = params[:event]\n @event.user = @user\n @event.contact_snapshot = @contact.data\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to contact_event_url(@contact, @event), notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: contact_event_url(@contact, @event) }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_google_calendar_event(params)\n event = cal.create_event do |e|\n e.title = params[:title]\n e.start_time = params[:start_time]\n e.end_time = params[:end_time]\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n @event.tickets_remaining = @event.max_tickets\n @contstr = \"New Event \" + @event.title + \" created. Date : \" + @event.start_time.to_s\n \n\n respond_to do |format|\n if @event.save\n Annoucement.create(contents: @contstr, event_id: @event.id, society_id: @event.society_id)\n Join.create(user_id: current_user.id, event_id: @event.id)\n Report.create(event_id: @event.id)\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def createEvent(eventData)\n rpgEvent = RPG::Event.new(eventData[3],eventData[4])\n rpgEvent.id = eventData[1]\n if eventData[9]\n # Must setup common event list here and now\n commonEvent = Game_CommonEvent.new(eventData[9])\n rpgEvent.pages[0].list = commonEvent.list\n end\n if eventData[8][/FollowerPkmn/]\n newEvent = Game_FollowerEvent.new(eventData[0],rpgEvent,$MapFactory.getMap(eventData[2]))\n else\n newEvent = Game_Event.new(eventData[0],rpgEvent,$MapFactory.getMap(eventData[2]))\n end\n newEvent.character_name = eventData[6]\n newEvent.character_hue = eventData[7]\n case eventData[5] # direction\n when 2 then newEvent.turn_down\n when 4 then newEvent.turn_left\n when 6 then newEvent.turn_right\n when 8 then newEvent.turn_up\n end\n return newEvent\n end", "def create_event(doc)\n attach_user_id doc\n attach_storage_id doc\n new_event = Event.new(doc)\n new_event.save!\n end", "def create\n \n params[:event][:start_date] = params[:event][:start_date].present? ? DateTime.parse(params[:event][:start_date]) : nil\n params[:event][:finish_date] = params[:event][:finish_date].present? ? DateTime.parse(params[:event][:finish_date]) : nil\n\n categories = params[:category_ids] or []\n @event = Event.new(params[:event].merge(:user_id => current_user.id, :category_ids => categories))\n \n respond_to do |format|\n if @event.save\n #Mailer to seek appoval\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n #transform address to lat+long\n address = \"#{event_params[:address]} #{event_params[:state]} #{event_params[:city]} #{event_params[:zip_code]}\"\n coordinates = GoogleGeocoder.geocode(address)\n #transform datetime_select form field to a datetime object\n\n start_t = DateTime.new(event_params[\"start_time(1i)\"].to_i, \n event_params[\"start_time(2i)\"].to_i,\n event_params[\"start_time(3i)\"].to_i,\n event_params[\"start_time(4i)\"].to_i,\n event_params[\"start_time(5i)\"].to_i)\n end_t = DateTime.new(event_params[\"end_time(1i)\"].to_i, \n event_params[\"end_time(2i)\"].to_i,\n event_params[\"end_time(3i)\"].to_i,\n event_params[\"end_time(4i)\"].to_i,\n event_params[\"end_time(5i)\"].to_i)\n \n #MANUALLY add field values to event - using a Hash caused a ton of errors\n @event = Event.new(title:event_params[:title],\n description:event_params[:description], \n event_tag_id:event_params[:event_tag_id],\n \n address:event_params[:address],\n state:event_params[:state],\n city:event_params[:city],\n zip_code:event_params[:zip_code],\n \n start_time: start_t,\n end_time: end_t,\n \n longitude:coordinates.longitude, \n latitude:coordinates.latitude,\n person_count_cap:event_params[:person_count_cap],\n user_id: current_user.id)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.conference = @conference\n @event.event_people << EventPerson.new(:person => current_cfp_user.person, :event_role => \"submitter\")\n @event.event_people << EventPerson.new(:person => current_cfp_user.person, :event_role => \"speaker\")\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(cfp_person_path, :notice => t(\"cfp.event_created_notice\")) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #debugger\n @event = Event.new(params[:event])\n @event.owner = current_user.id\n #@event.update_attribute(:owner,@current_user.id)\n @current_user.events << @event\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n @event.user_id = current_user.id\r\n\r\n respond_to do |format|\r\n if @event.save\r\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @event }\r\n @event.attend!(current_user)\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @activity = CareerPlanOutcome.where(\"activity = 4 \").first\n\n @work_site_planner = WorkSitePlanner.new(work_site_planner_params)\n @work_site_planner.career_plan_outcome_id = @activity.id\n @work_site_planner.job_seeker_id = current_client.id\n @event = Event.new\n @event.title = @activity.activity\n @event.start = Date.today\n @event.end = Date.today\n @event.resource_id = 1\n @event.job_seeker_id = current_client.id\n @event.save\n respond_to do |format|\n if @work_site_planner.save\n format.html { redirect_to @work_site_planner, notice: 'Work Experience Activity was successfully created.' }\n format.json { render :show, status: :created, location: @work_site_planner }\n else\n format.html { render :new }\n format.json { render json: @work_site_planner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_agenda_entry_path(:event_id => @event.id), notice: 'Evento creado, proceda a llenar la agenda'}\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event(event_type, timestamp=nil, event_rec)\n save_event event_type, timestamp, Event.new(event_rec)\n end", "def create\n @event = Event.create(creator: current_user.id,title: params[:event][:title], cover: params[:event][:cover], date: params[:event][:date], description: params[:event][:description], latitude: params[:event][:latitude], longitude: params[:event][:longitude], address: params[:event][:location])\n redirect_to @event\n end", "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 create\n require_login!\n @graph = Koala::Facebook::API.new(current_user.oauth_token)\n\n @multiquery = @graph.fql_multiquery({\"event\"=>\"select eid, name, creator, privacy, pic_small, pic_big, location, description, venue, start_time, end_time from event where eid = #{params[:id]}\",\"creator\"=>\"select name, pic_small, profile_url from user where uid in (select creator from #event)\"})\n\n @event = FacebookEvent.new( @multiquery[\"event\"][0] )\n @creator = TransientUser.new( @multiquery[\"creator\"][0] )\n\n @event_db = Event.find_or_initialize_by_fid(params[:id])\n @event_db.attributes = {:user => current_user, :city => @city, :start_at => Time.zone.parse(@event.start_time.to_s), :end_at => Time.zone.parse(@event.end_time.to_s)}\n @event_db.tag_list = params[:event][:tag_list]\n\n if @event_db.save\n @event_db.update_attribute(:active, true)\n flash[:notice] = \"Sucesso :)\"\n render :action => \"show\"\n else\n #OPTIMIZE\n flash[:error] = \"Puts! Deu algum problema... tenta denovo, se não resolver me avise plz.\"\n render :action => \"import\"\n end\n end", "def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n set_event_unique_active @event if @event.active\n format.html { redirect_to team_events_url, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: team_events_url }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events\n Apartment::Tenant.switch @source_tenant.subdomain do\n @events = Event.all.includes(:event_categories, category: :translations, event_choices: :translations).load\n @categories = Category.all.includes(:translations).load\n end\n\n successes = 0\n errors = 0\n error_events = []\n\n @categories.each do |category|\n new_category = category.dup\n new_category.name = category.name\n new_category.save\n end\n\n @events.each do |event|\n new_event = event.dup\n new_event.category = Category.find_by(name: event.category.name)\n if new_event.save\n event.event_choices.each do |ec|\n new_ec = ec.dup\n new_ec.label = ec.label\n new_ec.tooltip = ec.tooltip\n new_event.event_choices << new_ec # this causes the save\n end\n\n event.event_choices.each do |ec|\n new_ec = new_event.event_choices.find { |search_ec| search_ec.label == ec.label }\n if ec.optional_if_event_choice_id.present?\n optional_ec = event.event_choices.find { |search_ec| search_ec.id == ec.optional_if_event_choice_id }\n new_ec.optional_if_event_choice = new_event.event_choices.find_by(label: optional_ec.label)\n new_ec.save\n end\n if ec.required_if_event_choice_id.present?\n required_ec = event.event_choices.find { |search_ec| search_ec.id == ec.required_if_event_choice_id }\n new_ec.required_if_event_choice = new_event.event_choices.find_by(label: required_ec.label)\n new_ec.save\n end\n end\n\n event.event_categories.each do |ec|\n new_event.event_categories << ec.dup # this causes the save\n end\n successes += 1\n else\n errors += 1\n error_events << event.name\n end\n end\n flash[:notice] = \"#{successes} events copied, #{errors} errors (#{error_events.join(', ')}).\"\n redirect_to migrate_index_path\n end", "def create_event options\n options[:input]=body if task.input_type==\"link\"\n super options\n end", "def create\n @event = current_user.created_events.build(event_params)\n @upcoming_events = Event.upcoming_events.order('created_at DESC')\n @past_events = Event.past_events.order('created_at DESC')\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_path(@event), notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :index, alert: 'Event was not created. Please try again!' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n # Make picture\n @picture = Picture.new\n unless params[:internet_url_path].empty?\n @picture.set_photo_from_url(params[:internet_url_path])\n end\n unless params[:picture].nil?\n @picture.picture = params[:picture]\n end\n\n unless @picture.save!\n puts \" TRACE: EventsController:create - saving picture failed\"\n end\n\n respond_to do |format|\n if @event.save\n \n # Link picture to event \n @event_picture = EventPicture.new\n @event_picture.event_id = @event.id\n @event_picture.picture_id = @picture.id\n \n unless @event_picture.save!\n puts \" TRACE: EventsController:create - saving event picture link failed\"\n end\n\n # Create user_event object with status of owner\n unless UserEvent.create!(:user_id => current_user.id, :event_id => @event.id, :status => USER_EVENT_STATUS_ADMIN)\n puts \" TRACE: EventsController:create - error creating UserEvent object\"\n end\n \n unless IdeaEvent.create!(:idea_id => params[:idea_id], :event_id => @event.id)\n puts \" TRACE: EventsController:create - error creating IdeaEvent object\"\n end\n \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def gcmake_event\n Event.create :user_id => self.user_id, :gamecall_tag => self.id, :installgc_event_id => self.event_id, :title => self.title, :start_time => self.start_time, :end_time => self.end_time, :event_type => \"Gamecall\"\n end", "def create\n is_facebook_event = params.delete(\"is_facebook_event\")\n facebook_cover_url = params.delete(\"facebook_cover_url\")\n\n categories = params[:event].delete(\"categories\")\n \n uploaded_flyer = params[:event].delete(:flyer_url)\n\n if is_facebook_event == \"true\" and facebook_cover_url != nil\n params[:event][:flyer_url] = facebook_cover_url\n elsif uploaded_flyer != nil\n flyer_buf = ''\n uploaded_flyer.read(uploaded_flyer.size(), flyer_buf)\n\n original = uploaded_flyer.original_filename\n response = dropbox_client().put_file(original, flyer_buf)\n logger.info response\n params[:event][:flyer_url] = original\n else\n params[:event][:flyer_url] = ''\n end\n\n @event = Event.new(params[:event])\n\[email protected] = current_user\n\n editEvent(@event, params, categories)\n end", "def create_event(event_object)\n\n response = nil\n\n if event_object['parent_event_id']\n # new section in existing event\n\n\n # we need to get the existing data to populate child events\n # lest it delete existing ones when we try to add one!\n request = Net::HTTP::Get.new(\n \"/api/v1/calendar_events/#{event_object['parent_event_id']}?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = JSON.parse response.body\n\n\n\n request = Net::HTTP::Put.new(\n \"/api/v1/calendar_events/#{event_object['parent_event_id']}\",\n initheader = {'Content-Type' => 'application/json'}\n )\n arg = {}\n arg['access_token'] = Rails.application.secrets.canvas_access_token\n\n # populate from old child events\n cedx = 0\n child_event_data = {}\n info[\"child_events\"].each do |ce|\n ced = {}\n ced['start_at'] = ce['start_at']\n ced['end_at'] = ce['end_at']\n ced['context_code'] = ce['context_code']\n child_event_data[cedx.to_s] = ced\n cedx += 1\n end\n\n ced = {}\n ced['start_at'] = event_object['start_at']\n ced['end_at'] = event_object['end_at']\n ced['context_code'] = event_object['context_code']\n child_event_data[cedx.to_s] = ced\n new_event_object = {}\n new_event_object['child_event_data'] = child_event_data\n arg['calendar_event'] = new_event_object\n request.body = arg.to_json\n response = open_canvas_http.request(request)\n else\n # new event\n\n request = Net::HTTP::Post.new(\n \"/api/v1/calendar_events\",\n initheader = {'Content-Type' => 'application/json'}\n )\n arg = {}\n arg['access_token'] = Rails.application.secrets.canvas_access_token\n arg['calendar_event'] = event_object.except('event_id')\n request.body = arg.to_json\n response = open_canvas_http.request(request)\n end\n\n response.body\n end", "def create\n title = params[:event][:title]\n desc = params[:event][:description]\n # get the start time of events creation\n start_time_str = params[:start_time]\n start_time = DateTime.strptime(start_time_str, \"%Y - %m - %d %I:%M %p\")\n\n # get the end time of events creation\n end_time_str = params[:end_time]\n endT = DateTime.strptime(end_time_str, \"%Y - %m - %d %I:%M %p\")\n\n # only create one event in this case\n if params[:event][:repeat] == \"Does not repeat\"\n @event = Event.new(:title => title, :description => desc, :start_time => start_time, :end_time => endT, :occupied => false)\n if @event.save\n redirect_to events_path\n #format.html { redirect_to @event, notice: 'Event was successfully created.' }\n #format.json { render :show, status: :created, location: @event }\n else\n render 'new'\n end\n\n # create multiple events in this case from start time to end time, by create each event one by one.\n else\n gap = 30.minutes\n if params[:event][:repeat] == \"Reapeat Every Hour\"\n gap = 1.hours\n end\n\n exception = params[:event][:exception]\n replication = params[:event][:replicate]\n\n # there is gap time for the creation of events in every day\n if exception == \"1\"\n except_start = params[:event][:except_time_start]\n except_end = params[:event][:except_time_end]\n\n # get the start and end time of the gap time\n except_from = DateTime.strptime(except_start, \"%I:%M %p\")\n except_to = DateTime.strptime(except_end, \"%I:%M %p\")\n end\n\n # get the start and end time in Time format\n start_hour_minute = start_time.strftime(\"%H:%M\")\n start_date = start_time.strftime(\"%Y - %m - %d\")\n end_hour_minute = DateTime.strptime(params[:end_time], \"%Y - %m - %d %I:%M %p\").strftime(\"%H:%M\")\n\n # find out whether the creation is under replicaiton condition\n if (replication == \"No Replication\")\n stop_time_str = params[:end_time]\n stop_time = DateTime.strptime(stop_time_str, \"%Y - %m - %d %I:%M %p\")\n else\n # get the stop date of the replication\n stop_time_str = params[:event][:stop_time] + \" \" + end_hour_minute\n stop_time = DateTime.strptime(stop_time_str, \"%Y - %m - %d %H:%M\")\n end\n\n # the default working time is from 9am to 8pm\n from = DateTime.strptime(start_hour_minute, \"%H:%M\")\n nine_oclock_am = DateTime.strptime(\"09:00\", \"%H:%M\")\n to = DateTime.strptime(end_hour_minute, \"%H:%M\")\n eight_oclock_pm = DateTime.strptime(\"20:00\", \"%H:%M\")\n\n # if the creation time is set out of the working time range, events will not be created out of the working time range\n if from < nine_oclock_am\n from = nine_oclock_am\n end\n if to > eight_oclock_pm \n \n to = eight_oclock_pm\n end\n\n # get the start time and end time of next event needs to be created\n nst = DateTime.strptime(start_time_str, \"%Y - %m - %d %I:%M %p\")\n net = nst + gap\n\n caliberate = 0\n \n # keep creating new events until the end time of next created event is out of the creating time range\n while net <= stop_time\n nst_hour_minute = DateTime.strptime(nst.strftime(\"%H\") + nst.strftime(\"%M\"), \"%H%M\")\n net_hour_minute = DateTime.strptime(net.strftime(\"%H\") + net.strftime(\"%M\"), \"%H%M\")\n nst_day = nst.strftime(\"%u\").to_i\n\n # make sure the the end time creating events is not out of working time range, nor in the gap time \n if (nst_hour_minute >= from && ((replication == \"No Replication\" && net_hour_minute <= eight_oclock_pm) || (replication != \"No Replication\" && net_hour_minute <= to))) && \n (replication == \"No Replication\" || (replication == \"Replicate On Weekdays\" && nst_day >= 1 && nst_day <= 5) || (replication == \"Replicate On Weekends\" && nst_day == 6)) \n if exception == \"1\"\n if net_hour_minute <= except_from\n @newEvent1 = Event.new(:title => title, :description => desc, :start_time => nst, :end_time => net, :occupied => false)\n @newEvent1.save\n elsif nst_hour_minute >= except_to\n @newEvent2 = Event.new(:title => title, :description => desc, :start_time => nst, :end_time => net, :occupied => false)\n @newEvent2.save\n end\n\n if nst_hour_minute >= except_from && nst_hour_minute < except_to && (nst_hour_minute + gap) > except_to\n caliberate = 1\n end\n else\n @newEvent = Event.new(:title => title, :description => desc, :start_time => nst, :end_time => net, :occupied => false)\n @newEvent.save\n end\n end\n\n # if the start time of a new created event of each new day is not start from 9am or the start time set by the tester, caliberate it to be the start time \n if caliberate == 0\n nst = net\n else\n nst = DateTime.strptime(nst.strftime(\"%Y\") + nst.strftime(\"%m\") + nst.strftime(\"%d\") + except_to.strftime(\"%H\") + except_to.strftime(\"%M\"), \"%Y%m%d%H%M\")\n caliberate = 0\n end\n\n if nst.strftime(\"%k\").to_i == 23 && (nst + gap).strftime(\"%k\").to_i == 0\n nst = (nst + gap).beginning_of_day\n end\n net = nst + gap\n end\n\n redirect_to events_path, notice: 'Events have been created successfully.'\n end\n\n end", "def create\n\t\t# redirect user if already logged in\n\t\tif current_user\n\t\t\tevent = Event.new(event_params)\n event.user_id = current_user.id\n # event.conference_id = 1\n\n\t\t\tif event.save\n\t\t\t\tflash[:notice] = \"Successfully saved event.\"\n\t\t\t\tredirect_to event_path(event)\n\t\t\telse\n\t\t\t\tflash[:error] = event.errors.full_messages.join(', ')\n\t\t\t\tredirect_to event_path\n\t\t\tend\n\t\telse\n flash[:error] = \"Need to login to create event.\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def record_event(type, target_obj)\n event_type_id = case type\n when :ask then 1\n when :answer then 2\n when :comment then 3\n when :compose then 4\n when :vote then 5\n when :downvote then 6\n when :watch then 7\n when :unwatch then 8\n when :follow then 9\n when :unfollow then 10\n when :update then 11\n when :accept then 12\n else 0\n end\n\n target_type_id = case\n when target_obj.is_a?(Question) then 1\n when target_obj.is_a?(Answer) then 2\n when target_obj.is_a?(Comment) then 3\n when target_obj.is_a?(Article) then 4\n when target_obj.is_a?(User) then 5 # update profile without param 'obj'\n else 0\n end\n\n event = self.events.build(\n event_type: event_type_id,\n target_type: target_type_id,\n target_id: target_obj.id\n )\n\n if event.valid?\n event.save\n else\n raise \"event_recording_error\"\n end\n end", "def create_event_create_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_event_create_rule_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::EventCreateRule.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def create\n\t\t@event = current_user.events.create(params[:event])\n\t\tcurrent_user.add_role :author, @event\n\t\t#@event = Beautorial.new(params[:event])\n\n\t\trespond_to do |format|\n\t\t\tif @event.save\n\t\t\t\tformat.html { redirect_to @event, notice: 'Event was successfully created.' }\n\t\t\t\tformat.json { render json: @event, status: :created, location: @event }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @event.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @event = Event.new(params[:event])\n @event.creator = current_user\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.find(params[:event_id])\n @eventtime = @event.eventtimes.create(params[:eventtime])\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Eventtime was successfully created.') }\n format.xml { render :xml => @eventtime, :status => :created, :location => @eventtime }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @eventtime.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n respond_to do |format|\n if @event.save\n # イベントのステータスで落選に変更されたら、企業のステータスを選考済みに変更\n if @event.is_passed == 'droped'\n company = Company.find(@event.company_id)\n company.is_active = false\n company.save\n end\n format.html { redirect_to @event, notice: \"イベントの作成に成功しました。\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.find_by(id: comment_params[:event_id])\n @cuid = isSignedIn ? current_user.id : nil\n if @event == nil\n redirect_to root_url, notice: \"This event does not exist.\"\n elsif !(@event.private ? (isInvited(@event.id, @cuid) || isAttending(@event.id, @cuid) || @event.user_id == @cuid) : true)\n redirect_to root_url, notice: \"You do not have the correct permissions to comment on this event.\"\n else\n @c = @event.comments.build(comment_params)\n @c.save\n #inform owner of event that there's a new comment, if the owner isn't the poster\n if current_user.id != @event.user_id\n @owner = User.find_by(id: @event.user_id)\n @n = @owner.notifications.build(:user_id => @owner, :title => \"New Comment\", :desc => getName(@event.user_id, @cuid) + \" has commented on your event \" + @event.name + \".\", :sender_id => @event.id, :notification_type => 4)\n @n.save\n end\n redirect_to \"/events/\" + @event.id.to_s + \"#comments\", notice: \"Your comment has been posted.\"\n end\n end", "def create_new( meeting_session_id, event_order, begin_time, event_type_id )\n add_to_log( \"MeetingEvent NOT found.\\r\\nCreating a new one as: n.#{ event_order }, session: #{ meeting_session_id }, type: #{ event_type_id }\" )\n result_meeting_event = MeetingEvent.new(\n meeting_session_id: meeting_session_id,\n event_order: event_order,\n begin_time: begin_time,\n event_type_id: event_type_id,\n heat_type_id: HeatType::FINALS_ID,\n is_out_of_race: false,\n is_autofilled: true,\n user_id: @current_user.id,\n has_separate_gender_start_list: true,\n has_separate_category_start_list: false\n )\n\n # Serialize the creation:\n super( result_meeting_event, self.class.name )\n result_meeting_event\n end", "def create\n name = params[:event][:location] || \"Unknown\"\n location = Location.name_search(Location.sanitize(name)).first\n location = Location.create!(:name => name, :gmaps => true) unless location\n\n @event = Event.new(params[:event].except(:location, :category_ids))\n @event.location = location\n # I know we do this for some particular reason but I forgot why...\n @event.start_at = params[:event][:start_at]\n @event.end_at = params[:event][:end_at]\n @event.set_categories params[:event][:category_ids]\n if @event.save\n render json: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.host = current_user\n\n respond_to do |format|\n if @event.save\n current_user.hosted_events.append @event\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.id = SecureRandom.uuid\n @event.phone_number = @the_user.phone_number\n Attendance.create(:id => @the_user.phone_number, :event_id => @event.id)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time => get_date_string_from_params(params[:event]['start_time(1i)'],params[:event]['start_time(2i)'],params[:event]['start_time(3i)'],params[:event]['start_time(4i)'],params[:event]['start_time(5i)']),\n :end_time => get_date_string_from_params(params[:event]['end_time(1i)'],params[:event]['end_time(2i)'],params[:event]['end_time(3i)'],params[:event]['end_time(4i)'],params[:event]['end_time(5i)']),\n :description => params[:event][:description],\n :location => params[:event][:location],\n :privacy_type => params[:event][:privacy_type]\n \n \n }\n \n @event = Event.new(params[:event])\n @event.status = true\n \n respond_to do |format|\n if @event.valid?\n faceresponse = @graph.put_object('me', 'events', params['facebook'] )\n if faceresponse\n @event.facebookID = faceresponse['id']\n @event.save\n \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event } \n else\n format.html { render action: \"new\", notice: 'Error on facebook occure.' }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @event = Event.new(event_params)\n \n if @event.save\n redirect_to @event, success: \"New #{@event.primaryType} event on #{@event.eventDate} has been successfully created.\"\n else\n redirect_to '/events/new', danger: \"Event not created.\"\n end\n \n @cadets = Cadet.where(approved: true).order(:lastName)\n @cadets.each do |cadet|\n if cadet.approved == true\n Attendance.create!(:attended => 1, :cadet_id => cadet.id, :event_id => @event.id)\n end\n end\n end", "def create\n @user = @current_user\n @title = 'Todays Events ('+ Time.now.to_date.to_s + ')'\n @current_event, @events = Event.find_todays_events( @user )\n @plans = @user.plans.find(:all, :order=>\"deadline ASC\")\n\n if params[:event]['end_time(4i)'].blank? and \n params[:event]['end_time(5i)'].blank?\n \n params[:event].delete('end_time(1i)') \n params[:event].delete('end_time(2i)') \n params[:event].delete('end_time(3i)') \n params[:event].delete('end_time(4i)') \n params[:event].delete('end_time(5i)') \n \n elsif params[:event]['end_time(4i)'].blank?\n params[:event]['end_time(4i)'] = params[:event]['start_time(4i)']\n elsif params[:event]['end_time(5i)'].blank?\n params[:event]['end_time(5i)'] = params[:event]['start_time(5i)']\n end\n\n @new_event = Event.new(params[:event])\n @new_event.user = @user\n @new_plan = Plan.new()\n\n respond_to do |format|\n if @new_event.save\n flash[:notice] = 'Event was successfully created.'\n if @current_event != nil\n @current_event.end_time = @new_event.start_time \n @current_event.save\n end\n format.html { redirect_to(events_path()) }\n format.xml { render :xml => @new_event, :status => :created, \n :location => @new_event }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @new_event.errors, \n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.find(params[:location_id])\n @event_types = EventType.all(:order => 'name') # strictly for display of error\n \n # sanitize and all that\n #params[:event][:event_details_attributes][:\"0\"][:desc] = format_content(params[:event][:event_details_attributes][:\"0\"][:desc])\n \n # format time from plugin\n params[:event][:event_details_attributes][:\"0\"][:time_from] = Time.parse(params[:event_data][:\"time_from(5i)\"])\n params[:event_data].delete([:\"time_from(5i)\"])\n params[:event][:event_details_attributes][:\"0\"][:time_to] = Time.parse(params[:event_data][:\"time_to(5i)\"])\n params[:event_data].delete([:\"time_to(5i)\"])\n \n @event = @location.events.create(params[:event])\n @event.location = @location\n @event.event_dates.each do |ed|\n ed.destroy unless ed.day || ed.date \n end\n \n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) } # for realz\n #format.html { render :action => \"new\" } # for test\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" } # index used to add events...sorry\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @adverse_event_comment = current_user.adverse_event_comments\n .where(project_id: @project.id, adverse_event_id: @adverse_event.id)\n .new(adverse_event_comment_params)\n if @adverse_event_comment.save\n @adverse_event.reload\n @last_seen_at = @adverse_event.last_seen_at current_user\n render :index\n else\n render :edit\n end\n end", "def create_event(params = {})\n event = if block_given?\n Event.create(params.merge({:calendar => self}), &Proc.new)\n else\n Event.create(params.merge({:calendar => self}))\n end\n event.save\n end", "def create\n @event = Event.new(event_params)\n# @event.create_eventbrite_event(event_params)\n# @event.create_eventbrite_tickets\n\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "def create\n @simple_event = Event.create(params[:event])\n #create a ci object\n ci = ContactInfo.create :name => @simple_event.contact_name, :phone => @simple_event.contact_phone, :email => @simple_event.contact_email\n\t @simple_event.contact_info = ci\n search_types = params[:search_request]['types']\n counter = 1\n search_types.each do | et |\n \t#create a race, and also add an event type\n \tev_type = EventType.find(et)\n \t\n \trace = Race.new :start_time => @simple_event.event_date, :event_type => ev_type, :name => ev_type.name, :event => @simple_event\n \trace.race_group = @simple_event.race_groups.first\n \trace.race_group_order = counter\n \tcounter += 1\n \t#set the name, and start date according to the parent event\n \t@simple_event.races << race\n \t@simple_event.event_types << ev_type\n end\n #set the event to be approved\n @simple_event.approved = true\n @simple_event.manage_type = current_user.id\n\tif @simple_event.save\n flash[:notice] = 'event was successfully created.'\n redirect_to :action => \"new\"\n end \n end", "def set_timeline_event\n @timeline_event = TimelineEvent.find(params[:id])\n end", "def create\n @event = Event.new(event_params)\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @participation = @event.participations.build(:is_host => true, :user=>@current_user)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n\n #Create Participation\n\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event(organizer, event_params)\n event = organizer.events.new(event_params)\n event.process_timezone.save\n event\n end", "def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Set foreign key based on direction\n if params[:direction] == 'out'\n user_id = SmsNumber.find_by(number: params[:from].delete('+')).user_id\n team_athlete_id = TeamAthlete.find_by(phone: params[:to].delete('+')).id\n elsif params[:direction] == 'in'\n user_id = SmsNumber.find_by(number: params[:to].delete('+')).user_id\n team_athlete_id = TeamAthlete.find_by(phone: params[:from].delete('+')).id\n end\n\n @sms_event = SmsEvent.new(\n event_type: params[:eventType],\n direction: params[:direction],\n from: params[:from].delete('+'),\n to: params[:to].delete('+'),\n message_id: params[:messageId],\n message_uri: params[:messageUri],\n text: params[:text],\n application_id: params[:applicationId],\n time: params[:time],\n state: params[:state],\n delivery_state: params[:deliveryState],\n delivery_code: params[:deliveryCode],\n delivery_description: params[:deliveryDescription],\n media: params[:media],\n tag: params[:tag],\n segment_count: params[:segmentCount],\n user_id: user_id,\n team_athlete_id: team_athlete_id\n )\n\n if @sms_event.save!\n head :ok\n else\n p @sms_event.errors\n head :unprocessable_entity\n end\n end", "def create\n setup_variables\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # @timeline = Timeline.new(params[:timeline]) (done in load_and_authorize_resource)\n \n if signed_in? and !current_user.nil?\n @timeline.owner_id = current_user.id\n end\n\n # If no image, put one of the default images randomly\n if @timeline.imgurl.nil? or @timeline.imgurl == \"\"\n offset = rand(TlImage.count)\n rand_image = TlImage.first(:offset => offset)\n @timeline.imgurl = \"/uploads/#{rand_image.fname}\"\n end\n\n # By default, set it to private visibility\n @timeline.visibility = VIS_PRIVATE\n\n if @timeline.save\n record_activity(\"t=#{@timeline.title}\")\n flash[:notice] =\n \"<strong>#{@timeline.title}</strong> was successfully created\".html_safe\n #redirect_to timeline_path(@timeline)\n redirect_to edit_timeline_path(@timeline)\n else\n setup_vars_for_edit(@timeline)\n render :template => \"timelines/new\", :formats => [:html], :handlers => :haml\n end\n end", "def create_event(event_info, multipart_post_file = nil)\n if defined?(ActiveSupport::TimeWithZone) && defined?(ActiveSupport::TimeZone)\n # Facebook expects all event local times to be in Pacific Time, so we need to take the actual local time and \n # send it to Facebook as if it were Pacific Time converted to Unix epoch timestamp. Very confusing...\n facebook_time = ActiveSupport::TimeZone[\"Pacific Time (US & Canada)\"]\n \n start_time = event_info.delete(:start_time) || event_info.delete('start_time')\n if start_time && start_time.is_a?(ActiveSupport::TimeWithZone)\n event_info['start_time'] = facebook_time.parse(start_time.strftime(\"%Y-%m-%d %H:%M:%S\")).to_i\n else\n event_info['start_time'] = start_time\n end\n \n end_time = event_info.delete(:end_time) || event_info.delete('end_time')\n if end_time && end_time.is_a?(ActiveSupport::TimeWithZone)\n event_info['end_time'] = facebook_time.parse(end_time.strftime(\"%Y-%m-%d %H:%M:%S\")).to_i\n else\n event_info['end_time'] = end_time\n end\n end\n \n post_file('facebook.events.create', :event_info => event_info.to_json, nil => multipart_post_file)\n end", "def create\n begin\n start = DateTime.parse(params[:start]) \n rescue\n return redirect_to new_event_path, alert: \"Incorrect start time\"\n end\n endTime = start + parseDuration(params[:time]).minutes\n @event = Event.new(start: start, end: endTime, project_id: params[:project])\n\n respond_to do |format|\n if @event.save\n current_user.events << @event\n render_success(format, 'created', :created)\n else\n render_errors(format, @event.errors, :new)\n end\n end\n end", "def create\n user = principal\n @event = user.events.build(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\r\n @event = Event.new(event_params)\r\n \r\n if(@event.category_id == nil)\r\n @event.category_id = 1\r\n end\r\n\r\n respond_to do |format|\r\n if @event.save\r\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\r\n format.json { render :show, status: :created, location: @event }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def save_event(event)\n Event.create do |t|\n t.place = event[:place]\n t.date = event[:date]\n t.time = event[:time]\n t.keywords = event[:keywords]\n t.username = event[:username]\n t.tweet_id = event[:id]\n end\n end", "def create_event(id, category, text, extras)\n event = {}\n event['id'] = id\n event['ctime'] = Time.now.to_i * 1000\n event['category'] = category\n event['text'] = text\n event.merge!(extras) { |_key, v1, _v2| v1 }\n\n http_post('/events', event)\n end", "def create\n @event = Event.new(params[:event])\n @event.associate_with_venue(params[:venue_name])\n has_new_venue = @event.venue && @event.venue.new_record?\n\n @event.start_time = params[:start_date], params[:start_time]\n @event.end_time = params[:end_date], params[:end_time]\n\n if evil_robot = !params[:trap_field].blank?\n flash[:failure] = \"<h3>Evil Robot</h3> We didn't create this event because we think you're an evil robot. If you're really not an evil robot, look at the form instructions more carefully. If this doesn't work please file a bug report and let us know.\"\n end\n\n respond_to do |format|\n if !evil_robot && @event.save\n flash[:success] = 'Your event was successfully created. '\n format.html {\n if has_new_venue && !params[:venue_name].blank?\n flash[:success] += \" Please tell us more about where it's being held.\"\n redirect_to(edit_venue_url(@event.venue, :from_event => @event.id))\n else\n redirect_to(@event)\n end\n }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6376828", "0.6338077", "0.6225694", "0.61485136", "0.61115104", "0.6054261", "0.6051299", "0.6044304", "0.5968706", "0.59630054", "0.59408003", "0.59196395", "0.5893929", "0.5892642", "0.5828306", "0.58242583", "0.58183265", "0.5799335", "0.5798154", "0.57953775", "0.5778128", "0.5776581", "0.5765894", "0.5759522", "0.5758157", "0.57379115", "0.57258356", "0.57258356", "0.57257855", "0.57176125", "0.5714166", "0.57029396", "0.5702775", "0.5694946", "0.5690658", "0.5682112", "0.5678967", "0.5673846", "0.5673635", "0.5660366", "0.5659422", "0.5657525", "0.5650209", "0.5649849", "0.5647947", "0.5642536", "0.5620847", "0.5611011", "0.5594015", "0.558901", "0.5583055", "0.55787313", "0.5578583", "0.5576601", "0.55708784", "0.5570845", "0.55688405", "0.5563588", "0.5561913", "0.5554791", "0.5554568", "0.55502754", "0.5549104", "0.55471754", "0.5543756", "0.5530823", "0.5525697", "0.55191445", "0.5518437", "0.551635", "0.55139405", "0.5510111", "0.5505687", "0.5497196", "0.5496049", "0.54945284", "0.5493778", "0.5492395", "0.54878324", "0.5487809", "0.54865426", "0.5480557", "0.5470331", "0.5470244", "0.5466579", "0.5466176", "0.54597056", "0.5459278", "0.544841", "0.544772", "0.5428879", "0.5424616", "0.5423694", "0.54191405", "0.54177743", "0.5414254", "0.5410179", "0.54099226", "0.5406725", "0.54054445" ]
0.77653253
0
Use callbacks to share common setup or constraints between actions.
def set_shift @shift = Shift.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 shift_params params.require(:shift).permit(:assignment_id, :date, :status, :start_time, :end_time, :notes, job_ids: []) 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
GET /user GET /user.json
def index params[:id] = session_user_id show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def show\n render json: @user\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n render json: @user\n end", "def show\n\t\trender json: @user\n\tend", "def show\n json_response(@user)\n end", "def user(options={})\n get('/user', options)\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n render json: user_json(@user)\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @user }\n\t\tend\n\tend", "def show\n render json: @user, serializer: UserSerializer, status: 200\n end", "def show\n @user = User.find(current_user.id)\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n respond_to do |format|\n format.json {\n render json: @user\n }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.7747033", "0.77319795", "0.7724842", "0.7716754", "0.7713406", "0.7693864", "0.76856244", "0.76856244", "0.76856244", "0.76856244", "0.76856244", "0.76856244", "0.76856244", "0.76796955", "0.76796955", "0.76796955", "0.76796955", "0.76796955", "0.76796955", "0.76796955", "0.76796955", "0.7672409", "0.76709944", "0.76617795", "0.7658393", "0.7654767", "0.7636941", "0.7636941", "0.76150346", "0.756811", "0.75492984", "0.7531313", "0.75284135", "0.7517823", "0.75152785", "0.75095564", "0.749652", "0.74849844", "0.7482467", "0.74757665", "0.7426622", "0.742341", "0.74134755", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7400474", "0.7399655", "0.73977727", "0.73936176", "0.7393317", "0.73880357", "0.73700875", "0.7358364", "0.7352392", "0.73437387", "0.73403096", "0.7339585", "0.7334448", "0.7326955", "0.7324282", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396", "0.73163396" ]
0.0
-1
GET /user/1 GET /user/1.json
def show if check_user_read_access respond_to do |format| format.html { render :show } format.json { render json: user || {} } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get \n render :json => User.find(params[:id])\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def show\n render json: User.find(params[:id])\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def show\n render :json => User.find(params[:id])\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end", "def show\n @user = User.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user_id = UserId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_id }\n end\n end", "def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.7686378", "0.76058596", "0.75289893", "0.7445196", "0.73769677", "0.7370753", "0.73654354", "0.7356639", "0.7352479", "0.7345809", "0.73406947", "0.7334447", "0.7290761", "0.72809815", "0.72809815", "0.72809815", "0.72809815", "0.72809815", "0.72809815", "0.72809815", "0.7272154", "0.7272154", "0.7272154", "0.7272154", "0.7272154", "0.7272154", "0.7272154", "0.7272154", "0.72614384", "0.7260731", "0.7256296", "0.7255645", "0.7252101", "0.7252101", "0.71894246", "0.7175725", "0.71427935", "0.71329606", "0.7128278", "0.7112432", "0.710739", "0.7104523", "0.70992863", "0.70924574", "0.70633924", "0.70522743", "0.7041891", "0.70227206", "0.70116246", "0.70060176", "0.6980586", "0.69765973", "0.697283", "0.6953838", "0.6945756", "0.69455326", "0.69244", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857", "0.6910857" ]
0.0
-1
PUT /user/1 PUT /user/1.json
def update if check_user_write_access respond_to do |format| if user.update_attributes(params[:user]) format.html { redirect_to user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render :edit } format.json { render json: user.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n @user = User.find(params[:id])\n authorize @user\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update_user(user_name:, user:)\n validate_user_name(:user_name, user_name)\n response = wrap_response(@connection.put(user_path(user_name), user))\n\n response.fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @user = User.update(params[:user])\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n #head :no_content\n render json: @user, status: :accepted, location: @user #sera? status accepted? \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n user = User.find(params[:id])\n authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend", "def change_status\n @user = User.find(params[:data])\n\n respond_to do |format|\n if @user.update_attributes(status: params[:status])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end", "def update\n begin\n if request.content_type == \"application/json\" # Validamos el formato\n if @user.update(user_params)\n render json: @user\n else\n render status: :bad_request\n end\n else\n render status: :bad_request\n end\n rescue => exception\n # En caso de cualquier error que pueda ocurrir de formato u otro no capturado, devolveremos un status 400\n render status: :bad_request\n end\n \n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.73455113", "0.73446214", "0.73364615", "0.7214033", "0.7098887", "0.7086871", "0.70202243", "0.698461", "0.6980588", "0.696262", "0.69532824", "0.69461435", "0.69405437", "0.68969226", "0.68201804", "0.68201494", "0.67679197", "0.6765442", "0.67514455", "0.6744225", "0.6713854", "0.6713419", "0.6713419", "0.67132616", "0.66994876", "0.66920274", "0.66884476", "0.66884476", "0.6686475", "0.6675628", "0.66704786", "0.6625577", "0.6612153", "0.6612133", "0.6612133", "0.6596221", "0.6591756", "0.658668", "0.6568678", "0.6565044", "0.65560603", "0.6553557", "0.6553049", "0.6550966", "0.6550966", "0.6537936", "0.6530183", "0.6530183", "0.6529146", "0.6528575", "0.6528575", "0.65197974", "0.65169847", "0.651325", "0.6513074", "0.65095735", "0.65039915", "0.6503781", "0.6484791", "0.64783144", "0.6477937", "0.64495313", "0.6445155", "0.6439557", "0.64378494", "0.6433181", "0.641599", "0.6410586", "0.63969857", "0.6380374", "0.638001", "0.63753694", "0.6371087", "0.63409054", "0.6338444", "0.6322615", "0.63205916", "0.63164145", "0.63082707", "0.63027865", "0.63005847", "0.62965083", "0.62922096", "0.6287483", "0.6280707", "0.62780803", "0.62764215", "0.6273606", "0.62720776", "0.62711674", "0.6268828", "0.62679046", "0.62527454", "0.62469393", "0.6245356", "0.62382716", "0.62382716", "0.62382716", "0.62382716", "0.62382716", "0.62382716" ]
0.0
-1
DELETE /user/1 DELETE /user/1.json
def destroy if check_user_write_access user.destroy respond_to do |format| format.html { redirect_to :root } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:user_uuid])\n @user.destroy\n head :ok\n end", "def destroy\n @user = User.find(params[:user_id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "def destroy\n @user = User.find(params[:id])\n User.cascade_delete(@user)\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.status = 'deleted'\n @user.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n user = User.find(params[:id])\n if user.destroy\n render json: user\n else\n render json: user.errors\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to root }\n format.json { head :no_content }\n end\n end", "def delete_user\n client.delete(user)\n end", "def delete_user(user)\n delete user_path(user)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to user_index_url }\n format.json { head :ok }\n end\n end", "def delete\n params = self.class.prepare_params_for(:delete, \"userName\" => user_name)\n response = self.class.perform(params)\n self.class.check_response(response)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user=User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7690093", "0.7593447", "0.73640305", "0.7345832", "0.7345277", "0.73258495", "0.73258495", "0.7278566", "0.72723216", "0.726289", "0.7262046", "0.7252789", "0.7229248", "0.72095776", "0.71988076", "0.7183531", "0.7183378", "0.71713036", "0.7166104", "0.71507317", "0.7136733", "0.7130304", "0.7119678", "0.7115253", "0.71099925", "0.7103041", "0.7099007", "0.7098298", "0.70904917", "0.7089659", "0.7087131", "0.7085611", "0.70808005", "0.707433", "0.7070148", "0.7067902", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.70652986", "0.7061658", "0.7057566", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062", "0.7051062" ]
0.0
-1
Used in the Precinct show
def precinctsShowLink "#{firstname} #{lastname}, #{office.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_first_unique()\n \n end", "def show\n # TODO put computation here for displaying alternate values?\n end", "def displayed?; end", "def show \r\n end", "def tool_tip\n\t\treturn \"Delimited list of custodian and path of each duplicate of a given item.\"\n\tend", "def show\n header(@keyword)\n counter(list).each_with_index do |el, index|\n print \"#{index + 1} - #{el.first}\"\n (20 - el.first.length).times { print '-' }\n print \"#{el[1]} views\"\n puts\n end\n end", "def show\n total_visit_hsh = Hash.new(:total_visit)\n total_visit_hsh[:total_visit] = total_visit\n unique_visit_hsh = Hash.new(:unique_visit)\n unique_visit_hsh[:unique_visit] = unique_visit\n [total_visit_hsh,unique_visit_hsh].map do |visiter|\n PrettyOutput.new(visiter.keys.first, visiter.values.first).formatted_result\n end\n end", "def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \"&nbsp;<b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \"&nbsp;&nbsp;#{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\"&nbsp;&nbsp;\" + (l == 'unknown' ? \"<i>repository not given</i>\" : \"&nbsp;&nbsp;#{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"&#9792;\"\r\n when 'male'\r\n \"&#9794\"\r\n when 'gynadropmorph'\r\n \"[&#9792;&#9794;]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def show ; end", "def visibilities; end", "def example\n display [1, 3, 2, 4, 3, 4, 2 , 4, 1]\n end", "def show_prime\n @prime_numbers.uniq.to_s\n end", "def show() end", "def show() end", "def show() end", "def desc() summary; end", "def display_data_universe\n\n end", "def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end", "def show\n underlying_array.dup\n end", "def to_show *ignore\n ignore.map! &:to_name\n\n show_parts = parts.map do |part|\n reject = ( part.empty? or part =~ /^_/ or ignore.member? part.to_name )\n reject ? nil : part\n end\n\n show_name = show_parts.compact.to_name.s\n \n case\n when show_parts.compact.empty?; self\n when show_parts[0].nil? ; self.class.joint + show_name\n else show_name\n end\n end", "def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend", "def prepare_for_display\n [\"#{film_title.title} #{speech} #{format.name}\", \"#{id}\"]\n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show_full\n @show_full=true\n end", "def show\n\t\t#no need b/c we just show all at once\n\tend", "def to_display\n raise NotImplementedError\n end", "def to_s\n @seen ? @graphic + ' ' : ' '\n end", "def desc=(_); end", "def details\n #\"#{title} #{active} x: #{ x },q: #{ q },z: #{ z },r: #{ r },y: #{ y }\"\n \"#{title} #{active} , q: #{ q },z: #{ z },r: #{ r } \"\n end", "def display\n # Don't no why i thought i would need that. or if i need this.\n end", "def show\n data, format = [], []\n \n update(:elapsed, (Time.now - @start_time).to_i)\n \n sorted = @data.sort { |a,b| a[1][:order]<=>b[1][:order] }\n sorted.each do |item|\n format << \"#{item[0].to_s.capitalize}: #{item[1][:format]}\"\n data << item[1][:value] \n end\n \n $stdout.printf(format.join(' | ') + \"\\r\", *data)\n $stdout.flush\n end", "def offences_by; end", "def show\n @data.each do | row |\n row.each do | cell |\n if cell.infected?\n print \"%3s\" % cell.virus.generation\n else\n print \" #{cell.content} \"\n end\n end\n puts\n end\n end", "def display\n tp self\n end", "def _display(replace)\n\t\treturn @contents._display(replace)\n\tend", "def visibilities=(_arg0); end", "def inspect\n out = \"RMQ #{self.object_id}. #{self.count} selected. selectors: #{self.selectors}. .log for more info\"\n out << \"\\n[#{selected.first}]\" if self.count == 1\n out\n end", "def show\n author_count = @journal.journal_authors.count\n author_map = @journal.journal_authors.each_with_index.map{|a, i|\n if i == 0\n if a.first_name.blank?\n \"#{a.last_name}\"\n else\n \"#{a.last_name}, #{a.first_name.strip.first}.\"\n end\n elsif i < author_count -1\n if a.first_name.blank?\n \", #{a.last_name}\"\n else\n \", #{a.last_name}, #{a.first_name.strip.first}.\"\n end\n else\n if a.first_name.blank?\n \"&nbsp;& #{a.last_name},\"\n else\n \"&nbsp;& #{a.last_name}, #{a.first_name.strip.first}. \"\n end\n end\n }.compact\n @author_string = author_map.join(\"\")\n top = @journal.page_range_end\n vol = \"&nbsp;vol. #{@journal.journal_volume},\" unless @journal.journal_volume.blank?\n jo = \"&nbsp;no. #{@journal.journal_number},\" unless @journal.journal_volume.blank?\n #@first = \"#{@author_string} #{@journal.publication_year.strftime('%Y')}, '#{@journal.article_title}',\"\n #@ital = \"#{@journal.journal_title},\"\n #@rest = \"vol. #{@journal.journal_volume}, no. #{@journal.journal_number}, pp. #{@journal.page_range_start}-#{top}.\"\n @ref = \"#{@author_string} #{@journal.publication_year.strftime('%Y')}, '#{@journal.article_title}', <i>#{@journal.journal_title}</i>,#{vol}#{jo} pp. #{@journal.page_range_start}-#{top}.\"\n end", "def show # shows the selected word of the day (redundant)\n end", "def colorized?; end", "def display_presenters\n out = \"\"\n self.presenters.each do |p|\n out += p.display_name + \", \"\n end\n out = out[0,out.length-2]\n end", "def labels; end", "def show\n @pixels.map(&:join).join(\"\\n\")\n end", "def show (i)\n puts \"@#{@line}:\" \\\n \"\\t#{@output[i].scan(/.{4}|.+/).join(\"_\") unless @instruction.nil?}\" \\\n \"\\t#{@cmd[:comments]}\"\n end", "def show_qualified\n pp ordered_by_qualifications\nend", "def dump\r\n super + \"##{@first_index};\\t// #{to_s}\"\r\n end", "def show\n @preliminaries = Match.preliminary.group_by { |m| m.group.to_s }.sort_by { |group, m| group }\n @finals = Match.final.group_by { |m| m.round }\n @tips = current_user.tips\n @user = current_user\n end", "def formation; end", "def visualize_global\n protein_str = \"\"\n genome_str = \"\"\n\n x = @protein.sequence.size\n y = @genome.sequence.size\n\n while x > 0 and y > 0\n score = @table[x][y]\n score_diag = @table[x-1][y-1]\n #score_up = @table[x][y-1]\n score_left = @table[x-1][y]\n\n if score == (score_diag + match(x, y, @protein))\n protein_str = @protein.sequence[x-1].concat(protein_str)\n genome_str = @genome.sequence[y-1].concat(genome_str)\n x -= 1\n y -= 1\n elsif score == (score_left + @@d)\n protein_str = @protein.sequence[x-1].concat(protein_str)\n genome_str = \"-\".concat(genome_str)\n x -= 1\n else\n protein_str = \"-\".concat(protein_str)\n genome_str = @genome.sequence[y-1].concat(genome_str)\n y -= 1\n end\n end\n\n while x > 0\n protein_str = @protein.sequence[x-1].concat(protein_str)\n genome_str = \"-\".concat(genome_str)\n x -= 1\n end\n\n while y > 0\n protein_str = \"-\".concat(protein_str)\n genome_str = @genome.sequence[y-1].concat(genome_str)\n y -= 1\n end\n\n [protein_str, genome_str]\n end", "def print_feedback\n\t\ttemp_array = []\n\t\[email protected] do |x|\n\t\t\tif x[1]\n\t\t\t\ttemp_array << x[0]\n\t\t\telse\n\t\t\t\ttemp_array << '_'\n\t\t\tend\n\t\tend\n\t\ttemp_array.join(' ')\n\tend", "def probers; end", "def show\n\t\t end", "def list\n @show.uniq - @blacklist\n end", "def display #or name it to_s #puts searches for this when you call method\n\t\t\"(#{@x}, #{@y})\" #makes it look nicer when setting it to string when calling initialize method\n\tend", "def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@spaces[8]}\"\n\tend", "def desc; end", "def showHands\n @players.times do |p|\n i=p + 1\n print \"\\nPlayer #{i}:\"\n # DJBHERE DJB HERE str = \"file_\" + i.to_s.rjust(n, \"0\")\n @playersCards[i].each do |c|\n print \" #{c.visible}\"\n end\n end\n end", "def display(frame)\n return unless frame\n s = []\n sig = display_signature(frame)\n @list.each do |display|\n if display.enabled # && display.signature == sig\n s << display.to_s(frame)\n end\n end\n return s\n end", "def show\n #not needed for our implementation\n end", "def visible\n\t\tres = []\n\t\ti = 0\n\t\twhile i < @lines.size\n\t\t\tres << i\n\t\t\ti += @lines[i].folded_lines + 1\n\t\tend\n\t\tres\n\tend", "def display\n puts @o\n puts @a\n puts @b\n puts @c\n puts @d\n puts @e\n puts @f\n puts @g\n puts @h\n puts @i\n puts \" \"\n end", "def print\n added .sort.each { |pod| UI.message('A'.green + \" #{pod}\", '', 2) }\n deleted .sort.each { |pod| UI.message('R'.red + \" #{pod}\", '', 2) }\n changed .sort.each { |pod| UI.message('M'.yellow + \" #{pod}\", '', 2) }\n unchanged.sort.each { |pod| UI.message('-' + \" #{pod}\", '', 2) }\n end", "def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\n end\n end", "def printQuestionOnScreen()\n $lblQuestionNumber.grid :column => 0, :row => 0\n $lblQuestionNumber['text'] = $intQuestionOnScreen.to_s + \".\"\n $lblQuestion.grid :column => 1, :row => 0\n $lblQuestion['text'] = $arrQuestions[$intQuestionOnScreen - 1]\nend", "def display\n\t\t\"\"\n\tend", "def legionnairs\n\n end", "def copies_printed\n return @copies_printed\n end", "def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend", "def summary\n end", "def summary\n end", "def show\n\t\[email protected](' ')\n\tend", "def show_word()\n puts $hidden_word_arr.join(\" \")\n end", "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 print_prefs\n puts \"____________\"\n puts \"Reduced Sets\"\n @people_prefs.each_with_index do |prefs, i|\n puts \"#{i}| #{prefs.join(' ')} \"\n end\n puts \"____________\"\n end", "def printable\n\t\[email protected] do |key, value|\n\t\t\t\"[#{key}] \\\"#{value}\\\"\"\n\t\tend.join(\"\\n\")\n\tend", "def display()\r\n #final presenter as a string spaced out\r\n presentWord = \"\"\r\n #iterate the shadow word\r\n @shadowWord.each { |x| \r\n #add a space in the letters\r\n presentWord += x + \" \"\r\n }\r\n #remove the trailing spaces as spec\r\n presentWord.rstrip\r\n end", "def visible\n \"#{@value}#{@suit}\"\n end", "def inspect; \"V[#{self.to_a * \",\"}]\"; end", "def inspect; \"V[#{self.to_a * \",\"}]\"; end", "def ab_show(_experiment, _identity, _alternative)\n raise \"Not implemented\"\n end", "def showrecord(record, &pregrid)\n color, normal = getcolors(record)\n @grids.each do |grid|\n pregrid and pregrid.call( grid )\n rowstr = grid.rowstr { |col|\n value = ( record[col.shortname] || '' )\n value = value.gsub(/\\s+/, ' ').strip\n }\n puts [color, rowstr, normal].join\n end\n puts if @grids.length > 1\n return true\n end", "def show; @showing = false; end", "def show(arr, desc)\n printf \"%20s:\", desc;\n arr.each { |v| printf \" %d\", v }\n printf \"\\n\";\nend", "def questions_formated\n questions_ids_2_display.collect{ |qid| Question.new(self, qid).output }.join('')\n end", "def summary\n \n end", "def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\n sio.gsub(/0x[^\\s]*/,'').gsub(/@/,'')\n end", "def display_str\n \"#{objective.code} - #{short_desc}\"\n end", "def print_tile_selection ( array_of_tiles)\n print \"|\" \n array_of_tiles.each do |tile|\n print \" #{tile.print_tile_display_value} | \"\n end\n print \"\\n\" \n end" ]
[ "0.65407723", "0.62932587", "0.6099658", "0.59757185", "0.5920199", "0.57752395", "0.5759011", "0.569821", "0.5683073", "0.5683073", "0.5683073", "0.5683073", "0.56808054", "0.5669916", "0.5622271", "0.56201625", "0.5600334", "0.5600334", "0.5600334", "0.5585531", "0.55808395", "0.55772144", "0.5570375", "0.55531496", "0.5544112", "0.5541721", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5497175", "0.5491965", "0.54884815", "0.54868585", "0.54707164", "0.5435286", "0.5434578", "0.54294926", "0.54277", "0.54204357", "0.5414335", "0.54073423", "0.53973323", "0.53971374", "0.53909624", "0.5386975", "0.5380356", "0.53750813", "0.5374296", "0.5369432", "0.5368254", "0.5365746", "0.5363753", "0.5340959", "0.5329862", "0.5328995", "0.53194916", "0.5319288", "0.5316727", "0.5313022", "0.5312898", "0.53106153", "0.5309212", "0.53086364", "0.5307383", "0.5303747", "0.53006023", "0.52880555", "0.5282112", "0.52772105", "0.52767324", "0.5275623", "0.5275184", "0.52574134", "0.52568394", "0.5253015", "0.52526", "0.52526", "0.52449054", "0.52410537", "0.5234792", "0.523423", "0.5232745", "0.52221787", "0.5218331", "0.5212667", "0.5212667", "0.5210682", "0.5208179", "0.5206853", "0.5205576", "0.52051073", "0.5202229", "0.51916826", "0.51908183", "0.5189993" ]
0.5435073
40
Call a JavaScript function: proxy.myFunction('arg1').call
def call(method = nil, &block) if @crumbs.empty? raise "No method provided" end string = to_s string << "()" unless string.last == ")" Bowline::Desktop::JS.eval( @window, "Bowline.invokeJS(#{string.inspect});", method, &block ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_as_function(ctx,object,thisObject,argumentCount,arguments,exception)\n JS::Lib.JSObjectCallAsFunction(ctx,object,thisObject,argumentCount,arguments,exception)\n end", "def js_call(obj, *args)\n js_apply(obj,args)\n end", "def call(context, scope, this, args)\n args = args.to_a # java.lang.Object[] -> Array\n # JS function style :\n if ( arity = @callable.arity ) != -1 # (a1, *a).arity == -2\n if arity > -1 && args.size > arity # omit 'redundant' arguments\n args = args.slice(0, arity)\n elsif arity > args.size || # fill 'missing' arguments\n ( arity < -1 && (arity = arity.abs - 1) > args.size )\n (arity - args.size).times { args.push(nil) }\n end\n end\n rb_args = Rhino.args_to_ruby(args)\n begin\n callable = \n if @callable.is_a?(UnboundMethod)\n @callable.bind(Rhino.to_ruby(this))\n else\n @callable\n end\n result = callable.call(*rb_args)\n rescue => e\n raise Ruby.wrap_error(e) # thus `try { } catch (e)` works in JS\n end\n Rhino.to_javascript(result, scope)\n end", "def call_function(name, *arguments)\n arguments.map!{ |arg| to_json(arg) }\n execute_script(\"#{name}(#{arguments.join(\", \")});\")\nend", "def call\n __proxied_call\n end", "def call_function(function_name, args)\n function_name = Saxon::QName.resolve(function_name).to_java\n transformation_invocation(:callFunction, function_name, function_args(args))\n end", "def proxy; end", "def proxy; end", "def proxy; end", "def call(*) end", "def call(*) end", "def my_function(param)\n param.call\n end", "def call_function(function_name, *args, &block)\n internal_call_function(closure_scope, function_name, args, &block)\n end", "def call_function( function, *args )\r\n # Just a simple conversion, which ensures strings are escaped.\r\n arguments = args.map { |value|\r\n if value.is_a?( Hash )\r\n hash_to_json( value )\r\n else\r\n value.inspect\r\n end\r\n }.join( ',' )\r\n function = \"#{function}(#{arguments});\"\r\n execute_script( function )\r\n end", "def call_me(some_code)\n some_code.call\nend", "def call_function(function_name, *args, &block)\n # TRANSLATORS: do not translate variable name strings in these assertions\n Pal::assert_non_empty_string(function_name, 'function_name', false)\n Pal::assert_type(Pal::T_ANY_ARRAY, args, 'args', false)\n internal_evaluator.evaluator.external_call_function(function_name, args, topscope, &block)\n end", "def call() end", "def call\n @func[*@args]\n end", "def method_missing( sym, *args )\n JS_Object.new( $window.call( sym, *args ) )\nend", "def define_proxy_call(include_private, code_generator, name, target, *extra)\n defn = if NAME_COMPILABLE_REGEXP.match?(name)\n \"def #{name}(*args)\"\n else\n \"define_method(:'#{name}') do |*args|\"\n end\n\n extra = (extra.map!(&:inspect) << \"*args\").join(\", \")\n\n body = if CALL_COMPILABLE_REGEXP.match?(target)\n \"#{\"self.\" unless include_private}#{target}(#{extra})\"\n else\n \"send(:'#{target}', #{extra})\"\n end\n\n code_generator <<\n defn <<\n body <<\n \"end\" <<\n \"ruby2_keywords(:'#{name}') if respond_to?(:ruby2_keywords, true)\"\n end", "def proxy meth\n Proxy.new self, meth\n end", "def process_call(exp)\n receiver = exp.shift\n method = exp.shift\n args = exp.shift\n\n iter = get_iter()\n\n #\n # RubyJS::inline(\"str\")\n #\n # A different form of Javascript inline. We have this form\n # because ``-style Javascript-inline has a different esacping\n # of \\. Sometimes we want no escaping, so\n #\n # RubyJS::inline %q(...) could be used.\n #\n if receiver == [:const, :RubyJS] and method == :inline and\n args[0] == :array and args.size == 2 and args[1].size == 2 and args[1][0] == :str and iter.nil?\n raise if @want_expression\n return @model.interpolate(args[1][1])\n end\n\n str = \n if $RUBYJS__OPTS.include?('OptimizeArithOps') and %w(> >= < <= + - * /).include?(method.to_s) and\n iter.nil? and args and args[0] == :array and args.size == 2\n without_result do \n want_expression do\n \"(#{process(receiver)})#{method.to_s}(#{process(args[1])})\"\n end\n end\n else\n without_result do \n generate_method_call_receiver_exp(receiver, method, iter, args)\n end\n end\n resultify(str)\n end", "def proxy; self end", "def FunctionCall(rest, parsed); end", "def invokeUndefinedMethodFromWebScript(name, withArguments:args)\n if respond_to? name\n send(name, *args)\n elsif Kernel.respond_to? name\n Kernel.send(name, *args)\n elsif name =~ /^([A-Z][A-Za-z]+)_(.+)/\n const = Kernel.const_get($1)\n method = $2\n\n if const.respond_to? method\n const.send(method, *args)\n elsif const.respond_to?(\"#{method}?\")\n const.send(\"#{method}?\", *args)\n elsif const.respond_to?(\"#{method}!\")\n const.send(\"#{method}!\", *args)\n end\n end\n end", "def call(function, *args)\n context.call(function, *args)\n end", "def call(fun, *args)\n call2(nil, fun, *args)\n end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call(method, *args) rpc_execute(method, *args) end", "def call(object); end", "def call(*args); end", "def __proxy_result__\n @proxy_result = @method_call.call unless defined?(@proxy_result)\n @proxy_result\n end", "def call(*args, **kwargs, &block)\n forward(*args, **kwargs, &block)\n end", "def proxy (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_proxy(to_native, value)\n\t\telse\n\t\t\tto_native[:proxy]\n\t\tend\n\tend", "def call (function, *args)\n\treturn[\n\t\"POP ECX\",function,\n\t\"MOV EAX, [ECX]\",\n\t\"PUSH EAX\", \"NOP\"\n\t].concat(args)\nend", "def call(sexp, level)\n recv, meth, arglist, iter = sexp\n @calls << meth.to_s unless @calls.include? meth.to_s\n\n return js_operator_call(sexp, level) if CALL_OPERATORS.include? meth.to_s\n return js_block_given(sexp, level) if meth == :block_given?\n return \"undefined\" if meth == :undefined\n\n if Sexp === arglist.last and arglist.last.first == :block_pass\n block_pass = process arglist.pop, :expression\n end\n\n args = \"\"\n splat = arglist[1..-1].any? { |a| a.first == :splat }\n tmprecv = @scope.new_temp\n tmpproc = @scope.new_temp if iter or block_pass\n\n if recv.nil?\n recv_code = \"self\"\n recv_arg = \"self\"\n else\n recv_code = \"(#{tmprecv} = #{process recv, :expression})\"\n recv_arg = tmprecv\n end\n\n arglist.insert 1, s(:js_tmp, recv_arg), s(:js_tmp, meth.to_s.inspect)\n\n args = process arglist, :expression\n\n mid = mid_to_jsid meth\n dispatch = \"(#{recv_code}, (#{recv_arg} == null ? $nilcls : #{recv_arg})\"\n dispatch += \"#{mid})\"\n\n if iter\n dispatch = \"(#{tmpproc} = #{dispatch}, (#{tmpproc}.$B = #{iter}).$S \"\n dispatch += \"= self, #{tmpproc})\"\n elsif block_pass\n dispatch = \"(#{tmpproc} = #{dispatch}, #{tmpproc}.$B = #{block_pass}, #{tmpproc})\"\n end\n\n @scope.queue_temp tmprecv\n @scope.queue_temp tmpproc if tmpproc\n\n if splat\n \"#{dispatch}.apply(null, #{args})\"\n else\n \"#{dispatch}(#{args})\"\n end\n end", "def call(method, arguments=[], context)\n value = (@runtime_class.lookup(method) || context.locals[method])\n if value.nil?\n fail 'Undefined method or function. Maybe function was defined after?'\n else\n value.call(self, arguments)\n end\n end", "def proxy(return_type); end", "def call(*args)\n self.exec(*args)\n end", "def callExtension _obj, _args\n \"_obj callExtension _args;\" \n end", "def exec_in_proxy_context(dsl, proxy_type, *args, **_arg3, &block); end", "def http_proxy=(_arg0); end", "def send_as_function arg\n case arg\n when Symbol then __send__ arg\n when Array then __send__(*arg)\n else yield_or_eval(&arg)\n end\n end", "def run_function(name, params)\n payload = Payload.new\n payload.function_name = name\n payload.params = params\n call_route(:function, name, payload)\n end", "def [] (arg)\n if arg.is_a?(::Numeric) #take care of the case where arg is a number\n self.call(arg)\n else\n FunctionWrapper.new(arg, self)\n end\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 sub(*args, &block)\n __proxy_method__(:sub, *args, &block)\n end", "def method_missing (method, *args, &block)\n __proxy_result__.send(method, *args, &block)\n end", "def call(method, args)\n send(method, *args)\n end", "def invoke(dst, rpc_method, *args)\n n = get_node(dst)\n # TODO raise exception if n.nil?\n n.invoke dst, rpc_method, *args\n end", "def method_missing(method, *args, &block)\n __proxy_result__.send(method, *args, &block)\n end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def call(method, *args)\n self.class.rpc_execute(method, *args)\n end", "def call(value)\n fn[value, *args]\n end", "def call(*args)\n @args[:communicator].communicate(\n type: :call_created_func,\n id: @args[:id],\n args: @args[:php_process].parse_data(args)\n )\n end", "def double(callable)\n callable.call * 2\nend", "def eval script\n # native function. this stub is for documenting only\n end", "def deny_js_call(*args)\n path, arg1, arg2, diagnostic = calling_js_path(args)\n # ERGO do something with arg1 and arg2\n deny_xpath path, diagnostic\n end", "def js_apply(obj,args)\n arguments=args.dup\n # Modify numbers of args to works with arity\n min_args=self.arity > 0 ? self.arity : (-self.arity)-1\n \n if args.size > min_args and self.arity>0\n arguments=arguments[0,self.arity]\n elsif args.size < min_args\n arguments+=[nil]*(min_args-args.size)\n end\n #puts \"#{args}->#{arguments} (#{self.arity})\"\n if self.arity==0\n obj.instance_exec(&self)\n else\n obj.instance_exec(*arguments, &self)\n end\n end", "def foo (a, b)\n a.call(b)\nend", "def call_js(pattern, &block)\n return CallJS.new(pattern, self, &block)\n end", "def method_missing(method, *args, &block)\n @delegate.send(method, *args, &block)\n rescue NoMethodError => e\n raise e, e.message.sub(/ for #<.*$/, \" via proxy for #{@delegate}\")\n end", "def call\n func = get_func(Fiddle::TYPE_VOID)\n if func\n func.call(*@args)\n end\n end", "def call(callable, *args)\n if callable.is_a?(String) || callable.is_a?(Symbol)\n proc = @library.macros(true)[callable.to_sym]\n fun = @library.functions(true)[callable.to_sym]\n if proc\n count = proc.arity >= 0 ? proc.arity : 0\n if args.count != count\n raise ArgumentError, \"Wrong number of arguments passed to macro (#{args.count} for #{count})\" \n end\n self.instance_exec(*args, &proc)\n elsif fun\n @builder.call(fun, *args.map{|arg| Convert(arg, fun.arg_types[args.index(arg)])})\n else\n raise NoMethodError, \"Function or macro, '#{function.to_s}', does not exist.\"\n end\n elsif callable.kind_of?(LLVM::Script::Function)\n @builder.call(callable, *args.map{|arg| Convert(arg, callable.arg_types[args.index(arg)])})\n elsif callable.kind_of?(LLVM::Value) && (callable.type.kind == :function || callable.type.kind == :pointer)\n @builder.call(callable, *args.map{|arg| Convert(arg)})\n else\n raise ArgumentError, \"Callable passed to call must be a LLVM::Value or a name of a Library function or macro.\"\n end\n end", "def test_can_send_0_args_to_method_call\n result = interpret 'm=~{foo: ->() { 99 }};%m.foo()'\n assert_eq result, 99\n end", "def call(script, *args)\n r_eval(script.to_s, *args) do |req|\n req.errback do |err|\n fiber.resume nil\n end\n\n req.callback do |msg|\n unless msg\n fiber.resume nil\n next\n end\n root = msg.parameters.first\n if root\n fiber.resume EM::Rserve::R::RtoRuby::Translator.r_to_ruby(root) \n else\n fiber.resume nil\n end\n end\n end\n\n Fiber.yield\n end", "def translate_call(sexp)\n raise NotInlineableError unless inlineable? sexp\n arg1 = translate_generic_sexp sexp[1]\n arg2 = translate_generic_sexp sexp[3][1]\n res_type = ([arg1.value_type, arg2.value_type].include? :Float) ? :Float : :Fixnum\n s().with_value(s(:binary_oper,\n sexp[2], arg1.value_sexp, arg2.value_sexp), res_type)\n end", "def getObjectProxy _obj, _args\n \"_obj getObjectProxy _args;\" \n end", "def double(callable_object)\n callable_object.call * 2\nend", "def call\n end", "def invoke(optional_destination, rpc_method, *args)\n # TODO\n end", "def call(node); end", "def new_function_call\n\t\t\t return create_function_call(SAPNW::RFC::FunctionCall)\n\t\t\tend", "def proxy(value)\n update_query(:proxy => value)\n end", "def double(callable_object)\n callable_object.call * 2\nend", "def double(callable_object)\n callable_object.call * 2\nend", "def double(callable_object)\n callable_object.call * 2\nend", "def invoke; end", "def using_proxy?; end", "def method_missing(m, *args, &block) \n \t\t@proxy_servlet.send(m, *args, &block)\n \t\tend", "def method_missing(sym, *args, &block)\n proxy_target.__send__(sym, *args, &block)\n end", "def proxy=(new_value); end", "def process_fcall(exp)\n method = exp.shift\n args = exp.shift\n\n str = without_result do\n generate_method_call(@model.encode_self, method, get_iter(), args)\n end\n\n resultify(str)\n end", "def make_call(*args)\n raise \"No connection established on #{@hostname}.\" unless connected?\n \n debug(\"Remote call: #{args.first} (#{args[1..-1].inspect})\")\n result = connection.call(*args)\n debug(\"Result: #{result}\\n\")\n result\n end", "def call\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 method_missing(sym, *args, &block)\n proxy_target.__send__(sym, *args, &block)\n end", "def call(*args)\n __call__( args )\n end", "def invoke(args)\n @call_back.call *args\n end", "def method_missing(method, *args)\n Call.new(self, method, args)\n end", "def send_as_functions *args\n args.each {|arg| send_as_function arg}\n self\n end", "def call(*args)\n args.push(*@callback_args)\n @callback_object.send(@callback_id, *args)\n end", "def define_python_methods\r\n @p.Execute(\"\r\ndef foo(x):\r\n return x + x\r\n\r\ndef bar(x):\r\n return x * x\r\n\"\r\n )\r\nend" ]
[ "0.65428954", "0.6345606", "0.62751395", "0.6176062", "0.61174107", "0.60070527", "0.59175843", "0.59175843", "0.59175843", "0.5837486", "0.5837486", "0.5722605", "0.55574095", "0.5532517", "0.5524574", "0.5524103", "0.55171025", "0.5511863", "0.5510786", "0.5503727", "0.5467358", "0.546194", "0.54321945", "0.5415751", "0.5399001", "0.5387809", "0.53845966", "0.53842884", "0.53842884", "0.53842884", "0.53842884", "0.53842884", "0.53842884", "0.53842884", "0.53842884", "0.5360668", "0.53571624", "0.5355496", "0.5304999", "0.52979964", "0.528631", "0.5254181", "0.5227468", "0.5194789", "0.51815283", "0.51806694", "0.51791865", "0.516674", "0.51046616", "0.509467", "0.5093046", "0.5084208", "0.5078722", "0.5078195", "0.50738585", "0.50670993", "0.50653666", "0.5054175", "0.5044601", "0.50431293", "0.504121", "0.50339466", "0.5033848", "0.5033573", "0.5030113", "0.5025675", "0.5024818", "0.50170773", "0.5005268", "0.49969804", "0.4991187", "0.4990017", "0.4989104", "0.49881288", "0.49840257", "0.49729013", "0.49622005", "0.4961346", "0.49408752", "0.49399295", "0.49371696", "0.49274758", "0.49274758", "0.49274758", "0.49253067", "0.4916317", "0.49153572", "0.48862603", "0.4884503", "0.48842818", "0.48703203", "0.48682466", "0.4853522", "0.48514396", "0.48472765", "0.4836305", "0.48337695", "0.48271853", "0.48133907", "0.48040366" ]
0.51191896
48
Return the JavaScript that is to be evaluated
def to_s (@crumbs || []).inject([]) do |arr, (method, args)| str = method if args.any? str << "(" + args.to_json[1..-2] + ")" end arr << str end.join(".") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def j(javascript); end", "def javascript\n if @js_output_file\n file_js = File.read(@js_output_file) rescue ''\n ([file_js] + @javascript).join nil\n else\n @javascript.join nil\n end\n end", "def eval(js_code)\n full_cmd = @cmd % [escape_js(js_code)]\n `#{full_cmd}`\n end", "def compile()\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n var rc;\n #{code.join(' ')}\n repl.rc_ok(rc);\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n self._code = []\n end", "def process_special_inline_js_value(exp)\n return exp.shift\n end", "def script(text)\n \"<script type=\\\"text/javascript\\\">jQuery(document).ready(function() {#{text};});</script>\"\n end", "def js_code\n '<script type=\"text/javascript\">' <<\n asset('webconsole.js') <<\n '</script>'\n end", "def js_func(*jsstmts) js_value %Q|function(rc) { #{jsstmts.join(COLON)}; }| end", "def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end", "def js(*code)\n JS.new(*code)\nend", "def inject_js; end", "def content\n function = <<~JAVASCRIPT\n () => {\n let retVal = '';\n if (document.doctype)\n retVal = new XMLSerializer().serializeToString(document.doctype);\n if (document.documentElement)\n retVal += document.documentElement.outerHTML;\n return retVal;\n }\n JAVASCRIPT\n evaluate_function(function).value\n end", "def jmaki_generate_script(script)\n \"<script type='text/javascript'>\" + script + \"</script>\\n\"\n end", "def javascript(js=nil)\n @javascript ||= []\n @javascript << js\n @javascript.join(\"\\n\")\n end", "def extract_js(body)\n js = body.match(%r{setTimeout\\(function\\(\\)\\{\\s+(var s,t,o,p,b,r,e,a,k,i,n,g,f.+?\\r?\\n[\\s\\S]+?a\\.value =.+?)\\r?\\n})[1]\n js = js.gsub(%r{a\\.value = (parseInt\\(.+?\\)).+}, \"\\\\1\")\n js = js.gsub(%r{\\s{3,}[a-z](?: = |\\.).+}, \"\")\n js = js.gsub(%r{[\\n\\']}, \"\")\n\n js = js.sub(%r{(parseInt)}, 'return \\1')\n end", "def evaluate_compiled_script(script)\n raise NotImplementedError\n end", "def lotus_javascript(resource, target_id, qb_name, condition = nil)\n unicorn = Lotus.unicorns.find { |u| u.name == resource }\n unicorn.criteria.each(&:preload!)\n \n str = \"<script type=\\\"text/javascript\\\">\n var #{qb_name} = new QueryBuilder(\n {root: $('#{target_id}'),\n criteria: #{unicorn.criteria.to_json}\"\n if(condition)\n str << \", condition: new Condition(#{condition.to_json})\"\n end\n \n unicorn.criteria.each(&:unload!)\n \n str << \"});\n </script>\"\n return str\n end", "def script\n @elements.map { |e|\n (e && !e.hidden? && !e.readonly? && e.respond_to?(:script))? e.script : ''\n }.join(\"\")\n end", "def inject_js=(_arg0); end", "def content_as_js_var(varname,value=nil,&block)\r\n return \"<script>#{varname}='#{escape_javascript(value)}';</script>\" unless block_given?\r\n concat(\"<script>#{varname}='#{escape_javascript(capture(&block))}';</script>\",block.binding)\r\n end", "def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end", "def eval script\n # native function. this stub is for documenting only\n end", "def to_development_html\n hrefs.map { |href| \"<script type='text/javascript' src='#{href}'></script>\" }.join(\"\\n\")\n end", "def javascript!\n @coffeescript = false\n end", "def evaluate_erb; end", "def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n text \"\\n\"\n end", "def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{Netzke.RelativeUrlRoot = '#{ActionController::Base.config.relative_url_root}';}\n res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}\n\n res << %{Netzke.core.directMaxRetries = '#{Netzke::Core.js_direct_max_retries}';}\n\n res.join(\"\\n\")\n end", "def build_load_func\n return_string = \"\"\n return_string << @onload_func[:head]\n return_string << to_javascript\n return_string << map_onload_func_body\n return_string << @onload_func[:tail]\n end", "def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n rawtext \"\\n\"\n end", "def evaluate(template, locals = {}, options = {})\n require \"execjs\"\n context = ExecJS.compile(\"var evaluate = #{compile(template, options)}\")\n context.call(\"evaluate\", locals)\n end", "def scripts\n @content_for_scripts.to_s\n end", "def eval_code(js_code)\n retval = nil\n error = nil\n\n begin\n retval = `eval(js_code)`\n retval = retval ? retval.to_s : ''\n print_to_output(retval) if @output_buffer.length == 0 && !retval.empty?\n rescue => err\n error = err\n log_error(err)\n end\n\n # Do not check the answer if there is no regexp matcher\n if @current_item && @current_item.answer\n # Get last line of output\n value_to_check = @output_buffer.length > 0 && !@output_buffer.last.empty? ? @output_buffer.last.chomp : ''\n\n # Check if output matches the defined answer regexp\n # and print status message\n print_to_output(\"\\n\")\n from = count_lines\n\n if !value_to_check.empty? && value_to_check.chomp.match(@current_item.answer)\n @current_item.ok.each do |line|\n print_to_output(line)\n end\n @output.mark_ok(from, count_lines)\n else\n @current_item.error.each do |line|\n print_to_output(line)\n end\n @output.mark_error(from, count_lines)\n end\n end\n end", "def build_js_funcs()\n\n js_out = \"\"\n @include_funcs.each do |fname|\n js_out << \"// #{fname}\\n\"\n raise NonExistantMJSError, \"_#{fname}.mjs does not exist in #{@mjs_path}.\" if @js_funcs[fname].nil? \n js_out << @js_funcs[fname].join()\n js_out << \"//\\n\"\n \n end\n return js_out\n end", "def condition_handler_js\n # what is our current value?\n js = <<-JS\n response = $F('#{dom_id(self)}')\n JS\n \n # use response to trigger pages and elements that are dependent on this question\n self.dependents.find(:all) { |d| js = js + d.trigger_js }\n js\n end", "def to_js(code)\n raise ArgumentError, 'code required' if code.nil? || code.strip.empty?\n expr = VinesQL.parse(code.strip)\n %Q{\n function(doc) {\n if (doc.type != 'System') return;\n try {\n var match = #{expr.js};\n if (match) {\n var name = doc['_id'].replace('system:', '');\n var os = doc.ohai.kernel.os.toLowerCase().replace('gnu/', '');\n emit(name, os);\n }\n } catch(e) {\n log(e.message);\n }\n }\n }\n end", "def injected_javascripts\n @javascript_codes || []\n end", "def js_get(js_string)\n return @selenium.js_eval($window + js_string)\n end", "def code(env)\n html_code <<\n css_code <<\n render(js_code,\n :TOKEN => Webconsole::Repl.token,\n :KEY_CODE => Webconsole.key_code,\n :CONTEXT => env['SCRIPT_NAME'] || \"\")\n end", "def context\n @context ||= ExecJS.compile source\n end", "def compile_callback(meth, args = {})\n code( js_repl meth, js_json_parms(args) )\n\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n #{code.join(' ')}\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n\n self._code = []\n end", "def escape_javascript(raw)\n if raw\n quote = raw.count(%{'}) >= raw.count(%{\"}) ? %{\"} : %{'}\n escaped = raw.gsub(/(\\\\|\\r\\n|[\\n\\r#{quote}])/u) {|match| JS_ESCAPE_MAP[match] }\n \"#{quote}#{escaped}#{quote}\"\n else\n '\"\"'\n end\n end", "def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end", "def script\n @script || JavascriptObject.global_script\n end", "def to_production_html\n \"<script type='text/javascript' src='%s?%s'></script>\" % [path, mtime.to_i]\n end", "def compile_script_string\n @sources.string\n end", "def ajax_action_code\n js = Waw::ActionController::JSGeneration.new\n code = js.generate_js_for_action(Waw::kernel, self, \"\")\n <<-EOF\n <script type=\"text/javascript\">\n #{code}\n </script>\n EOF\n end", "def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend", "def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend", "def evaluate_remote_response\n \"eval(request.responseText)\"\n end", "def script_content \n return_val = %{\n $(document).ready(function() {\n var ctx = $(\"##{@chart_id}\");\n var content = #{@content.to_json}\n content[\"options\"][\"tooltips\"] = { \n callbacks: {\n label: function(tooltipItem, data) {\n\n var dataset_label = data.datasets[tooltipItem.datasetIndex].label;\n var data_point = data.datasets[tooltipItem.datasetIndex][\"data\"][tooltipItem.index];\n var array = [];\n\n if (typeof data_point == \"number\") { // bar chart\n dataset_label = dataset_label + \":\" + data_point ;\n }\n else if (data_point.hasOwnProperty(\"y\")) { // line graph\n dataset_label = dataset_label + \":\" + data_point[\"y\"] ;\n if (data_point.hasOwnProperty(\"c\") && (!(data_point[\"c\"] === null))) { // special comment field for json viewer that we can add to tooltip\n array.push(data_point[\"c\"]);\n }\n }\n array.unshift(dataset_label);\n var aggregate_string = \"\"\n for (var i in array) {\n aggregate_string += array[i] + \" \";\n }\n var output_string = \"(\" + aggregate_string + \")\"\n $(this).offsetParent().find(\"#tooltip_info\").text(output_string); // find the current charts tooltip <span> using relative path\n // however, this still doesn't work when you have multiple charts\n // at the same time\n return array; // each item is a new line on tooltip\n }\n }\n }\n var myLineChart = new Chart(ctx, content);\n });\n }\n return_val \n end", "def evaluate_script(script)\n current_frame.executeJavaScript(script).getJavaScriptResult\n end", "def call_js_init(something_js)\n content_for :javascript do\n \"<script type='text/javascript'>\n $(document).ready(function(){\n #{something_js}\n });\n </script>\".html_safe\n end\n end", "def evaluate(expression)\n eval(expression).inspect\nend", "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 to_js_full_script(element_id=SecureRandom.uuid)\n js = ''\n js << '\\n<script type=\\'text/javascript\\'>'\n js << load_js(element_id)\n js << draw_js(element_id)\n js << '\\n</script>'\n js\n end", "def make_js_template(raw_string)\n \"`#{raw_string.gsub('`', '\\\\\\\\`')}`\"\n end", "def context\n @context ||= ExecJS.compile(source)\n end", "def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end", "def escape_javascript(raw)\n if raw\n quote = raw.count(%{'}) >= raw.count(%{\"}) ? %{\"} : %{'}\n escaped = raw.gsub(/(\\\\|\\r\\n|[\\n\\r#{quote}])/u) {|match| JS_ESCAPE_MAP[match] }\n \"#{quote}#{escaped}#{quote}\"\n else\n '\"\"'\n end\n end", "def compile_to_ruby\n operator_ruby_string + \"(\" + @expression.compile_to_ruby + \")\"\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 path_to_javascript(source, options = T.unsafe(nil)); end", "def escape_javascript\n self.gsub(/(\\\\|<\\/|\\r\\n|[\\n\\r\"'])/) { JS_ESCAPE_MAP[$1] }\n end", "def inline_code; end", "def url_to_javascript(source, options = T.unsafe(nil)); end", "def view_source\n File.read(@script)\n end", "def script\n scr = js_initialize \n # Method #each is delegated to element \n scr << \"\\n\"\n each { |c| \n # Note that Array#script is defined \n # in element.rb\n if c.respond_to?(:script) then\n scr << c.script \n end\n }\n scr << js_finalize\n scr\n end", "def js_generator\n Apotomo.js_generator\n end", "def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end", "def scaffold_javascript_tag(javascript)\n \"<script type='text/javascript'>\\n//<![CDATA[\\n#{javascript}\\n//]]>\\n</script>\"\n end", "def js(page_js) \n page_js.split(' ').each do |item|\n content_for(:js) do\n \"<script src=\\\"/javascripts/#{item}.js\\\" type=\\\"text/javascript\\\"></script>\\n\" \n end\n end \n end", "def to_s\n @js\n end", "def javascript(value = nil, attributes = {})\n if value.is_a?(Hash)\n attributes = value\n value = nil\n elsif block_given? && value\n raise ArgumentError, \"You can't pass both a block and a value to javascript -- please choose one.\"\n end\n\n script(attributes.merge(:type => \"text/javascript\")) do\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n output << raw(\"\\n// <![CDATA[\\n\")\n if block_given?\n yield\n else\n output << raw(value)\n end\n output << raw(\"\\n// ]]>\")\n output.append_newline # this forces a newline even if we're not in pretty mode\n end\n\n output << raw(\"\\n\")\n end", "def java_script_object\n @js_wrapper\n end", "def jquery_script_declaration\n unless jqv_form_names.nil? || jqv_form_names.empty?\n @jqv_form_names.reduce(\":javascript\\n\") do |mem,name|\n mem + <<STR\n $().ready(function(){\n $(\"##{name}\").validate({\n #{JQueryValidation::Rules.render}\n });\n });\nSTR\n end\n else\n \"\" # just in case there are no forms for some reason\n end\n end", "def printEffectJS\r\n effectJS = \"//Effects Logic\\n\"\r\n @effectIds.each do\r\n |effectId|\r\n effect = SWUI::Effect.find_by.effect_name(effectId).execute.first\r\n unless effect.nil?\r\n functionName = \"swui_Effect_#{effectId.gsub(/-/,\"_\")}\"\r\n effectJS << \"function #{functionName}(widgetA, widgetB, parameters) {\\n\"\r\n effectJS << effect.jsCode.first\r\n effectJS << \"\\n\"\r\n effectJS << \"}\\n\"\r\n end\r\n end\r\n effectJS << \"\\n\"\r\n return effectJS\r\n end", "def appoxy_javascripts\n '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi?key=ABQIAAAAhes0f80sBcwL-h5xCNkkgxQBmiBpQeSpIciQPfZ5Ss-a60KXIRQOVvqzsNpqzhmG9tjky_5rOuaeow\"></script>\n <script type=\"text/javascript\">\n google.load(\"jquery\", \"1\");\n google.load(\"jqueryui\", \"1\");\n </script>\n '.html_safe\n end", "def evaluate\n super\n content\n end", "def javascript(s)\n convert(s, mime: 'application/javascript')\n end", "def desired_result\n CodeEvaluator.evaluate(result)\n end", "def javascript_doc_ready(&block)\n content = capture(&block)\n javascript_tag(\"$(document).ready(function(){#{content}});\")\n end", "def get_profile_script(env)\n\t\t\tids = \"[\\\"%s\\\"]\" % current['page_struct']['Id'].to_s\n\t\t\tpath = @options[:base_url_path]\n\t\t\tversion = MiniProfiler::VERSION\n\t\t\tposition = 'left'\n\t\t\tshowTrivial = false\n\t\t\tshowChildren = false\n\t\t\tmaxTracesToShow = 10\n\t\t\tshowControls = false\n\t\t\tcurrentId = current['page_struct'][\"Id\"]\n\t\t\tauthorized = true\n\t\t\t# TODO : cache this snippet \n\t\t\tscript = IO.read(::File.expand_path('../html/profile_handler.js', ::File.dirname(__FILE__)))\n\t\t\t# replace the variables\n\t\t\t[:ids, :path, :version, :position, :showTrivial, :showChildren, :maxTracesToShow, :showControls, :currentId, :authorized].each do |v|\n\t\t\t\tregex = Regexp.new(\"\\\\{#{v.to_s}\\\\}\")\n\t\t\t\tscript.gsub!(regex, eval(v.to_s).to_s)\n\t\t\tend\n\t\t\t# replace the '{{' and '}}''\n\t\t\tscript.gsub!(/\\{\\{/, '{').gsub!(/\\}\\}/, '}')\n\t\t\tcurrent['inject_js'] = false\n\t\t\tscript\n\t\tend", "def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end", "def match_javascript_refresh(line)\n line =~ /window.location\\s*=\\s*([\"'].*)$/i ? \"#{$1.sub(/\\/\\/.*$/, \"\").sub(/\\s*-->.*$/, \"\").sub(/\\s*<\\/script>.*$/, \"\")} [javascript]\" : nil\n end", "def javascript_path; end", "def to_php\n body = children? ? ('{ ' << children.map(&:to_php).join('; ') << ' }') : '{}'\n if anonymous?\n \"function(#{parameters.join(', ')}) \" << body # FIXME\n else\n \"function #{name}(#{parameters.join(', ')}) \" << body # FIXME\n end\n end", "def render(javascript, variables = {})\n javascript_with_variables = javascript.dup\n variables.each_pair do |variable, value|\n javascript_with_variables.gsub!(\"$#{variable}\", value)\n end\n javascript_with_variables\n end", "def html_output_for(script_url, code)\n code = CGI.escapeHTML code\n <<-HTML\n <div><script src='#{script_url}'></script>\n <noscript><pre><code>#{code}</code></pre></noscript></div>\n HTML\n end", "def escape_javascript(javascript)\n if javascript\n javascript.to_s.gsub(/(\\\\|<\\/|\\r\\n|\\342\\200\\250|\\342\\200\\251|[\\n\\r\"'])/u) { |match| JS_ESCAPE_MAP[match] }\n else\n ''\n end\n end", "def script(src)\n if src =~ /\\s/\n %(<script type='text/javascript'>#{src}</script>)\n else\n src = \"/js/#{src}.js\" unless src =~ /\\.js$/\n timestamp! src\n %(<script type='text/javascript' src='#{src}'></script>)\n end\n end", "def web_browser_block_java_script\n return @web_browser_block_java_script\n end", "def base_script\n base_language.standard_script\n end", "def rendered_content(content)\n escape_javascript(content.is_a?(Hash) ? render(content) : content)\n end", "def test_if\n code = <<CODE\na = 1\nif a\n b = 2\nend\nCODE\n \n js = <<JS\nvar a, b;\na = 1;\nif (a) {\nb = 2;\n};\nJS\n \n assert_equal js, @compiler.compile(code)\n end", "def render_deferred_javascript_files\n #write any deffered javascript files\n return '' if @content_for_javascript_files.blank?\n js_code = \"\\n<!-- DEFFERRED Javascripts -->\\n#{@content_for_javascript_files}\"\n end", "def expressions; end", "def script\n @value[:text]\n end", "def script\n @value[:text]\n end", "def render_javascript(template)\n assign(template: template)\n assign(nonce: @env[\"action_dispatch.content_security_policy_nonce\"])\n render(template: template, layout: \"layouts/javascript\")\n end", "def mgs_qualtrics_script\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(div.id(\"qualtrics\").script, __method__, self)\n\tend", "def hashed_javascript_tag(raise_error_on_unrecognized_hash = nil, &block)\n hashed_tag(\n :script,\n :script_src,\n Configuration.instance_variable_get(:@script_hashes),\n raise_error_on_unrecognized_hash,\n block\n )\n end" ]
[ "0.7037622", "0.67272514", "0.669885", "0.6546468", "0.64927936", "0.64354724", "0.64269394", "0.6333323", "0.62840813", "0.62794304", "0.62790096", "0.6270115", "0.6235626", "0.622848", "0.6186857", "0.6173779", "0.61698043", "0.6156506", "0.6121771", "0.61055005", "0.6062303", "0.60617346", "0.60573107", "0.6047563", "0.60090417", "0.59817064", "0.5960293", "0.59594774", "0.5954674", "0.5948118", "0.5929848", "0.59293646", "0.5926394", "0.5920824", "0.5901562", "0.58982897", "0.58810526", "0.5879119", "0.5870302", "0.5870211", "0.58618426", "0.58586955", "0.5858504", "0.5858147", "0.5856151", "0.5853504", "0.5846698", "0.5846698", "0.5834737", "0.58321536", "0.58291656", "0.58191603", "0.581695", "0.58075345", "0.5803005", "0.57973635", "0.5785571", "0.5781926", "0.5780518", "0.5754646", "0.5752066", "0.5728624", "0.57216394", "0.57179207", "0.571035", "0.56806993", "0.5680005", "0.56791943", "0.5662428", "0.5652573", "0.5651256", "0.5636835", "0.5632623", "0.5612637", "0.5610628", "0.5608143", "0.56050974", "0.5596871", "0.55906034", "0.5582775", "0.55796576", "0.5578797", "0.5571005", "0.5559594", "0.5556274", "0.5554683", "0.55499357", "0.5545389", "0.5534189", "0.55229133", "0.5521395", "0.5514217", "0.5513072", "0.55077106", "0.5505852", "0.55017644", "0.5496828", "0.5496828", "0.5496181", "0.5493337", "0.5487745" ]
0.0
-1
GET /cattle_ids/1 GET /cattle_ids/1.xml
def show @cattle_id = CattleId.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cattle_id } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def new\n @cattle_id = CattleId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def incident_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'incidents/' + statuspage_id\n end", "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def create\n @cattle_id = CattleId.new(params[:cattle_id])\n\n respond_to do |format|\n if @cattle_id.save\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') }\n format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def inst_list(inst_id)\n uri = URI.parse(@url + '/' + inst_id) \n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def get_triggered_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"triggered\", :fields => \"incident_number\" }\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end", "def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end", "def get_pophealth_xml(ids, args = nil)\n opts = args ? @options.merge(args) : @options\n url = opts[:pophealth_url]\n pophealth_user = opts[:pophealth_user]\n pophealth_password = opts[:pophealth_password]\n bundle = opts[:version] ? Bundle.where({version: opts[:version]}).first : Bundle.first\n\n # As it turns out, we need to wait for the queries in popHealth to complete before we grab the XML, or else we just get an error page.\n # Also, this lets us grab the measure HQMF IDs (in the mids array)\n complete = false\n mids = []\n while (!complete)\n sleep(2)\n mids = []\n complete = ids.inject(true) do |memo, id|\n res = JSON.parse(`curl -X GET -u #{pophealth_user}:#{pophealth_password} #{url}/api/queries/#{id}`)\n mids << res['measure_id']\n res['status']['state'] == \"completed\" && memo\n end\n end\n\n `curl -X GET -u #{pophealth_user}:#{pophealth_password} --header \"Content-Type:application/x-www-form-urlencoded\" --data \"effective_date=#{bundle.effective_date}&#{measure_ids(mids)}\" #{url}/api/reports/qrda_cat3.xml`\n end", "def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end", "def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end", "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def show\n @agent = @habitat.agents.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @agent.to_xml }\n end\n end", "def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end", "def show\n @client_app = ClientApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seed }\n end\n end", "def update\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n if @cattle_id.update_attributes(params[:cattle_id])\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @county }\n format.xml { render :xml => @county.to_xml(:include => { :libraries => { :include => :departments } }) }\n end\n end", "def id\n attr_val('cda:act/cda:id/@root')\n end", "def show\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "def index\n @coatings = do_index(Coating, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @coatings }\n end\n end", "def get_resolved_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"resolved\", :fields => \"incident_number\" }\n end", "def show\n @occurence = Occurence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end", "def get_incident_by_problemid(problemid)\n # use problemid from nagios as a filter passed as incident_key\n res = RestClient.get INCIDENT_QUERY_URL, :params => {:fields => \"#{problemid}\"} \n end", "def flight(id)\n perform_get(\"/flights/#{id}.xml\")\n end", "def show\n @haiku = Haiku.find(params[:id])\n\n respond_to { |format|\n format.html # show.rhtml\n format.xml {\n\trender :xml => @haiku.to_xml\n }\n }\n end", "def get_nics(token, nics_url)\n nic_ids = Array.new \n endpoint = nics_url.scan(/\\/organizations.*nics/)\n resp_hash = get_url(token, endpoint[0], {})\n resp_hash[:embedded][:nics].each do |nic|\n nic_ids.push extract_id(nic[:_links][:self][:href], 'nics')\n end\n return nic_ids, resp_hash\nend", "def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end", "def get_ids(api_key)\n old_ids_url = \"https://na.api.pvp.net/api/lol/na/v1.2/champion?api_key=\" + api_key\n ids_url = \"https://na1.api.riotgames.com/lol/platform/v3/champions?api_key=\" + api_key\n response = HTTParty.get(ids_url)\n ids = [13]\n case response.code\n when 200\n response_hash = response.parsed_response\n champions = response_hash[\"champions\"]\n champions.each do |champ|\n ids += [champ[\"id\"]]\n end\n when 404\n puts \"404 - could not find champion list\"\n end\n return ids\nend", "def show\n @countries = Countries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end", "def index\n @incidents = Incident.where(\"project = ?\", session[:project]).order( \"reference DESC\").\\\n\t paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @incidents }\n end\n end", "def show\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end", "def get(username, password, ids)\n # TODO: Flesh this out\n Category.find(ids).map do |category|\n WebServiceStructs::CategoryStruct.new(\n :id => category.id,\n :parent_id => category.parent_id,\n :name => category.name,\n :description => category.description,\n :user_id => category.user_id,\n :public => category.public,\n :permanent => category.permanent\n )\n end\n end", "def client(client_id, options={})\n params = { :klass => Invoicexpress::Models::Client }\n\n get(\"clients/#{client_id.to_s}.xml\", params.merge(options))\n end", "def get_friend_id \n uri = \"https://api.twitter.com/1/friends/ids.json\" \n \n #http request for friend search start\n req = Typhoeus::Request.new(uri,\n :method =>\"get\",\n :params =>{:cursor=>\"-1\", :screen_name=>crt_user.handler}) \n #sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)[\"ids\"]\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end", "def show\n @occurrence = Occurrence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurrence }\n end\n end", "def extract_ids\n # no-op\n end", "def index\n @registrations = Registration.find(:all, :order => \"camp_id ASC\")\n \n @registration = Registration.find(params[:id]) unless params[:id].blank?\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "def show\n @patient_encounter = PatientEncounter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient_encounter }\n end\n end", "def index\n @occupancies = @location.occupancies\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @occupancies }\n end\n end", "def index\n authenticate_admin!\n \n @candies = Candy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candies }\n end\n end", "def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @ingredient }\n end\n end", "def show\n @browsenodeid = Browsenodeid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end", "def show\n @last_id = LastId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @last_id }\n end\n end", "def id\n Resource::ALL\n end", "def id\n Resource::ALL\n end", "def identifiers\n request[:ids]\n end", "def GetView id\n\n APICall(path: \"views/#{id}.json\")\n\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end", "def show\n @encounter_enemy = EncounterEnemy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_enemy }\n end\n end", "def index\n @ids = Id.all\n end", "def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def catalog_dcat()\n return uri(\"api/dcat.json\")\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end", "def show\n @capp = Capp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @capp }\n end\n end", "def url(item)\n 'http://mit.worldcat.org/oclc/' + \\\n item.xpath('oclcterms:recordIdentifier[not(@xsi:type)]').text.strip\n end", "def index\n @agents = @habitat.agents.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @agents.to_xml }\n end\n end", "def show\n @ccl = Ccl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def show\n @odc_i = OdcI.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @odc_i }\n end\n end", "def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end", "def get_results_from_ids\n @response = Entrez.ESummary(ncbi_database_name, id: @ids)\n # URL is too long, probably because there are too many results for NCBI server.\n raise SearchTooBroad.new(@ids) if @response.code == 414\n @results = parent::SearchResult.new_from_splitting_xml(xml)\n end", "def show\n @cybercontrol = Cybercontrol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cybercontrol }\n end\n end", "def show\n @encounter_type = EncounterType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_type }\n end\n end", "def show\n @i_c = IC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @i_c }\n end\n end", "def path\n \"/onca/xml\"\n end", "def xml_args\n [{\"rdf:nodeID\" => self.identifier}]\n end", "def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end", "def show\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def show\n @caterogy = Caterogy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caterogy }\n end\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def url\n \"/#{self.class.rest_name}s/#{id}\"\n end", "def show\n @agent = Agent.find(params[:id], query)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n end\n end", "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end" ]
[ "0.6187639", "0.603138", "0.5885424", "0.5859145", "0.5821323", "0.56640404", "0.55595297", "0.5527944", "0.55165344", "0.54872257", "0.5451889", "0.5448276", "0.5448276", "0.5446519", "0.5443534", "0.53496903", "0.53216296", "0.52771664", "0.5257281", "0.52514046", "0.5233342", "0.5211455", "0.51458204", "0.5117909", "0.5114074", "0.51074004", "0.50961405", "0.5096054", "0.50956845", "0.50796956", "0.5077003", "0.5075496", "0.50669485", "0.50564504", "0.5051545", "0.50306314", "0.5027371", "0.50218886", "0.50205344", "0.50109285", "0.500577", "0.5002539", "0.49944288", "0.49866977", "0.49859706", "0.49782455", "0.49730605", "0.49725354", "0.49711245", "0.49685058", "0.49670023", "0.49667802", "0.49656305", "0.49586937", "0.49586105", "0.4940552", "0.4939231", "0.49324584", "0.49271357", "0.49263558", "0.4918136", "0.49092874", "0.4904547", "0.49035397", "0.489933", "0.48926303", "0.48905697", "0.48905697", "0.48898074", "0.48896173", "0.48881534", "0.48877776", "0.48877776", "0.48858675", "0.48838627", "0.48787537", "0.48783666", "0.48720357", "0.48716128", "0.48698196", "0.48675868", "0.48639345", "0.485077", "0.4850379", "0.48484522", "0.48450208", "0.4844886", "0.48440936", "0.4843845", "0.48427814", "0.4839293", "0.48386598", "0.48370507", "0.48321265", "0.4831406", "0.48285505", "0.4823356", "0.4822597", "0.482197", "0.48193935" ]
0.70049953
0
GET /cattle_ids/new GET /cattle_ids/new.xml
def new @cattle_id = CattleId.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cattle_id } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cattle_id = CattleId.new(params[:cattle_id])\n\n respond_to do |format|\n if @cattle_id.save\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') }\n format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @last_id = LastId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @last_id }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @id = Id.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @id }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @browsenodeid = Browsenodeid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end", "def show\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def new\n @client_app = ClientApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seed }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @incidenttype = Incidenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end", "def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "def new\n @identity = Identity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @identity }\n end\n end", "def create\n returning connection.post(collection_path, to_xml) do |response|\n self.id = id_from_response(response)\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @clenum = Clenum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end", "def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @client = Client.new\n respond_to do |format|\n format.html #new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def create\n @clenum = Clenum.new(params[:clenum])\n\n respond_to do |format|\n if @clenum.save\n flash[:notice] = 'Clenum was successfully created.'\n format.html { redirect_to(:action=>'show', :ids=>@clenum) }\n format.xml { render :xml => @clenum, :status => :created, :location => @clenum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @clenum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @client = Client.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @collective = Collective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collective }\n end\n end", "def new\n @uniqueid = Uniqueid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @uniqueid }\n end\n end", "def new\n @ident = Ident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ident }\n end\n end", "def new\n @contexts = SHDM::Context.find_all.map{ |v| [ v.context_name.first, v.uri ] }.delete_if{|v| v.first == \"Any\"}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @kid = Kid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kid }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @encounter_enemy = EncounterEnemy.new\n @encounter_enemy.encounter_id = params[:encounter_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_enemy }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @encounter_type = EncounterType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_type }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end", "def new\n @lid = Lid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lid }\n end\n end", "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @ccl = Ccl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def create\n @id = Id.new(params[:id])\n\n respond_to do |format|\n if @id.save\n format.html { redirect_to @id, :notice => 'Id was successfully created.' }\n format.json { render :json => @id, :status => :created, :location => @id }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\n end\n end", "def new\n @location_tag = LocationTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location_tag }\n end\n end", "def new\n @client = Client.new\n @client.event_id = @event.id\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end", "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @encounter_event = EncounterEvent.new\n @encounter_event.encounter_id = params[:encounter_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_event }\n end\n end", "def new\n @dining = Dining.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dining }\n end\n end", "def new\n @query = Query.new\n @discActions = DiscoveryActions.new\n $DATA_SERVICES ||= @discActions.getDataServices\n @services = $DATA_SERVICES\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @tag = @category.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @cadd = Cadd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cadd }\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "def new\n @club = Club.new(:city_id => params[:id])\n\n puts \"Klub: \" + @club.city_id.to_s();\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @club }\n end\n end", "def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @tag_identity = Identity.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_tag_identity_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag_identity }\n end\n end", "def new\n @i_c = IC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @i_c }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classroom }\n end\n end", "def new\n @odc_i = OdcI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @odc_i }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @identifier = Identifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identifier }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @collection = Collection.find(params[:collection_id])\n @category_collection = CategoryCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category_collection }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @capp = Capp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @capp }\n end\n end", "def new\n #1st you retrieve the customer thanks to params[:customer_id]\n customer = Customer.find(params[:customer_id])\n #2nd you build a new one\n @site = customer.sites.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end" ]
[ "0.69000083", "0.6189207", "0.61854494", "0.61854494", "0.6083155", "0.6023298", "0.5991507", "0.5971991", "0.593537", "0.59060246", "0.5893964", "0.5855239", "0.5799521", "0.5794669", "0.57671845", "0.5765086", "0.57640314", "0.57567173", "0.57349324", "0.5724168", "0.57009405", "0.57003826", "0.56798595", "0.5668595", "0.5658265", "0.56569475", "0.56537354", "0.56482506", "0.5642327", "0.5642327", "0.56324667", "0.5632271", "0.562593", "0.5620299", "0.562008", "0.56148905", "0.5614766", "0.5604049", "0.5603788", "0.56019074", "0.5598535", "0.5590088", "0.5585197", "0.55819535", "0.5581493", "0.5573899", "0.5567317", "0.55603814", "0.5558529", "0.5545075", "0.5544175", "0.5539141", "0.55331475", "0.5532843", "0.5532447", "0.5532099", "0.55313796", "0.5528766", "0.55252343", "0.5522556", "0.55153483", "0.55146074", "0.5513688", "0.5509536", "0.5507699", "0.5501135", "0.549483", "0.5483004", "0.54810756", "0.5479179", "0.5479153", "0.54789317", "0.54761887", "0.54730093", "0.5469695", "0.54661024", "0.546094", "0.5457567", "0.54570276", "0.5456585", "0.5454645", "0.545348", "0.54502726", "0.5447937", "0.54474497", "0.54473215", "0.5446406", "0.54420584", "0.544014", "0.544014", "0.544014", "0.544014", "0.544014", "0.544014", "0.5439496", "0.5438544", "0.5435229", "0.54343975", "0.5434063", "0.5431329" ]
0.7421669
0
POST /cattle_ids POST /cattle_ids.xml
def create @cattle_id = CattleId.new(params[:cattle_id]) respond_to do |format| if @cattle_id.save format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') } format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id } else format.html { render :action => "new" } format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def identifiers\n request[:ids]\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def new\n @cattle_id = CattleId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def create_new_tags\n if params[:commoner][:tag_ids].present?\n params[:commoner][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end", "def create\n returning connection.post(collection_path, to_xml) do |response|\n self.id = id_from_response(response)\n end\n end", "def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end", "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "def create_new_tags\n if params[:listing][:tag_ids].present?\n params[:listing][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end", "def create\n #@visit = params[:visits]\n Visit.collection.insert_many(params[:visits]) #save to batch to database mongoid awesome\n \n end", "def assign_tenants_to_circle(args = {}) \n body_put(\"/tenantcircles.json/tenants/#{args[:circleId]}\", args[:array_of_ids])\nend", "def update\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n if @cattle_id.update_attributes(params[:cattle_id])\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def idkey\n post('/api/1/generic/idkey')\n end", "def update_unique_ids(env, content); end", "def generate_ids\n hex_str = SecureRandom.hex(32)\n bytes = hex_str.scan(/.{1,2}/).map do |h|\n Integer(h, 16)\n end\n @doc_id = xtext(bytes[0, 16])\n @rev_id = xtext(bytes[16, 16])\n @attributes[:ID] = list([@doc_id, @rev_id])\n end", "def clean_ids(_node)\n _node.xpath(\".//*[@local_id]\").each do |node|\n parent_name = node.parent.node_name\n name = \"#{parent_name}\"\n if $id_counters[name]\n $id_counters[name] = $id_counters[name] + 1\n else\n $id_counters[name] = 1\n end\n node.set_attribute(\"local_id\", \"dyn_#{name}_#{$id_counters[name]}\")\n end\n _node.xpath(\".//*[@id]\").each do |node|\n node.set_attribute(\"id\", %x|uuidgen|.strip)\n end\nend", "def campaign_ids\n (params[:campaign_ids] || []).map(&:to_i)\n end", "def show\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def circus_params\n params.require(:circus).permit(:name, :flea_ids => [])\n end", "def post_bulkissuances(opts = {})\n data, _status_code, _headers = post_bulkissuances_with_http_info(opts)\n data\n end", "def create\n #returning connection.post(collection_path, to_xml, self.class.headers) do |response|\n returning connection.post(collection_path, to_ssj, self.class.headers) do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end", "def postCategoryMappings( category_id, type, id, name)\n params = Hash.new\n params['category_id'] = category_id\n params['type'] = type\n params['id'] = id\n params['name'] = name\n return doCurl(\"post\",\"/category/mappings\",params)\n end", "def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end", "def create\n PlaceVisit.collection.insert_many(params[:place_visits]) #save to batch to database mongoid awesome\n end", "def extract_ids\n # no-op\n end", "def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend", "def record_ids(opts = {})\n opts = opts.merge(@opts)\n client.list_identifiers(opts).full.lazy.flat_map(&:identifier)\n end", "def character_id(*names)\n response = request(:eve, :character_id, :names => names.flatten.join(','))\n result = {}\n [:characters, :corporations, :alliances].each do |field|\n if response.respond_to?(field)\n response.send(field).each { |row| result[row.name] = row.character_id }\n end\n end\n result\n end", "def update_services_ids_in_garage\n creator.services_ids << self.id\n creator.save\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def notify_clients\n http_post(body: {data: @pids.to_json})\n end", "def create\n @locationtour = Locationtour.new(locationtour_params)\n p '-------------modual_ids-------------'\n p @modual_ids = params[:h].split(',').map(&:to_i)\n p '-------------locationtour.hotel_ids-------------'\n #@add_hotel = HotelsLocationtours.create!(hotel_id: 1, locationtour_id: @locationtour.id) \n @locationtour.hotel_ids = @modual_ids\n respond_to do |format|\n if @locationtour.save \n format.html do\n flash[:AddLoc] = 'هتل اضافه شد'\n redirect_to :back\n end\n\n else\n if @locationtour.valid?\n p '----------errors-----'\n p @locationtour.errors.messages\n else\n p '----------no errors-----'\n p @locationtour.errors.messages\n end\n flash[:error] = 'خطا در ثبت اطلاعات رخ داده است' \n format.html { render :new }\n end \n end\n \n \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 create\n @kid = Kid.create(kid_params)\n @parent = Parent.find(params[:parent_id])\n @parent.kids << @kid\n redirect_to parent_kids_path\n # render json: @kid, status: 201\n end", "def test_find_categories\n @request.env[\"RAW_POST_DATA\"] = \"act\"\n xhr :post, :find_categories, :type => 1, :name => 'genre'\n assert_success\n assert @response.body.include?('add_genre(\\'' + categories(:action).id.to_s + '\\');')\n end", "def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end", "def move_users_to_group(group_id, set_of_user_ids)\n set_of_user_ids.each do |id|\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/memberships\"\n puts \"@url is #{@url}\"\n \n @payload={'user_id': id}\n puts(\"@payload is #{@payload}\")\n \n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to move user to group has Response.code #{@postResponse.code} and postResponse is #{@postResponse}\")\n end\nend", "def incident_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'incidents/' + statuspage_id\n end", "def create\n @recipe = Recipe.new(params[:recipe])\n #@recipe.ingrediences = Ingredience.find(@params[:ingredience_ids]) if @params[:ingredience_ids]\n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @categories = Category.find(:all, :conditions => [\"food = ?\", true])\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def client_params\n params.require(:client).permit(:name, :recruiter_id, :user_ids => [])\n end", "def save_ids\n File.write('id_store.yml', @ids.to_yaml)\n end", "def makeKeggTaxonId(file)\n out = File.new(file, \"w\")\n keggtaxurl = \"http://www.genome.jp/kegg-bin/get_htext?query=&htext=Organisms&filedir=&option=-e&extend=F65F548C25-2E42-3&uploadfile=&format=&wrap=&length=&open=&close=&hier=18&oneclick=on\"\n out = File.new(\"kegg_taxon_ids.txt\", \"w\")\n File.new(open(keggtaxurl)).each do |line|\n if line =~/([^\\>]*)<\\/I>.*id=([0-9]*).*>([a-z]*)</\n sp, taxid, name = $1, $2, $3\n out.printf(\"%s\\t%d\\t%s\\n\", name, taxid, sp)\n end\n end\n out.close\nend", "def modify_relationship action\n File.open(@user_id_list, 'r') do |file|\n file.each do |user_id|\n url = API + \"users/#{user_id.gsub(/(\\n|,)$/, \"\")}/relationship?access_token=\" + @access_token\n response = RestClient.post(url, access_token: @access_token, action: action)\n sleep(rand(3..6))\n\n puts response.code == 200 ? \"Successfully #{action}: #{user_id}\" : response\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n @catalogList = [['Tecnologia/Proyectores',1], ['Plomeria/Tuberias',2], ['Logistica/Bancos', 3], ['Tecnologia/IT',4]]\n\n begin\n id = ActiveRecord::Base.connection.execute(\"SELECT COUNT(*) FROM incidents;\")\n id.each do |row|\n id = row\n end\n id = id[0].to_i + 1\n sql = \"INSERT INTO incidents (incident_id, u_id, descripcion, prioridad, fecha_inicio, catalog) VALUES ('#{id}', '#{session[:user_id]}', '#{@incident.descripcion}', '#{@incident.prioridad}', #{Time.now.strftime(\"%Y%m%d\").to_i}, '#{@incident.catalog}');\"\n ActiveRecord::Base.connection.execute sql\n\n redirect_to incidents_url, notice: \"Gracias, el incidente será revisado\"\n rescue \n flash[:notice] = \"Error en la forma\"\n render :new\n end\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "def clinic_params\n params.require(:clinic).permit(:name, :address, entity_ids: [])\n end", "def assign_arrays_to_tenant(args = {}) \n body_put(\"/tenants.json/#{args[:tenantId]}/arrays\", args[:array_of_ids])\nend", "def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end", "def ids\n root.ids\n end", "def modify_identifier(identifier, metadata_hash)\n request_uri = '/id/' + identifier\n uri = URI(ENDPOINT + request_uri)\n request = Net::HTTP::Post.new uri.request_uri\n response = call_api(uri, request, metadata_hash)\nend", "def get_startups(ids)\n params = { :ids => ids.join(',') }\n get(\"1/startups/batch\", params)\n end", "def adquirir(id)\n @client.post(Route.new([ROTA_DID_ESTOQUE, id.to_s]))\n end", "def add_owner_ids(ids)\r\n return if ids.nil?\r\n \r\n ids = [ids] unless ids.respond_to?(:each)\r\n ids.each do | id |\r\n @request.OwnerIDList.Add(id)\r\n end\r\n end", "def id\n attr_val('cda:act/cda:id/@root')\n end", "def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end", "def ids\n @nodes.map(&:id)\n end", "def create\n\t\tif params[:tag] \n\t\t\ttag_ids = params[:tag][:id]\n\t\tend\n\n\t\ttourist_sight_id = params[:tourist_sight_id]\n\t\t@tourist_sight = TouristSight.find(tourist_sight_id)\n\n\t\tnew_tags = []\n\t\tif tag_ids and tag_ids.length > 0\n\t\t\ttag_ids.each do |id|\n\t\t\t\tnew_tags << Tag.find(id)\n\t\t\tend\n\t\tend\n\n\t\tif @tourist_sight.save_tags(new_tags)\n\t\t\tflash[:notice] = 'Tags adicionadas com sucesso.'\n\t\telse\n\t\t\tflash[:error] = 'Falha ao adicionar tags!'\n\t\tend\n\n\t\trespond_to do |format|\n\t format.html { redirect_to(@tourist_sight) } # tourist_sights/show.html.erb\n\t\tend\n\tend", "def target_id\n attr_val('./*/cda:id/@root')\n end", "def addid(uri, position = nil)\n command = 'addid \"%s\"' % uri\n command << ' %s' % position if position\n\n send_request(command).scan(/\\d+/).first.to_i\n end", "def incident_params\n params.require(:incident).permit(\n :id,\n :prisoner_id,\n :date_of_arrest,\n :prison_id,\n :date_of_release,\n *Incident.globalize_attribute_names,\n article_ids: [],\n tag_ids: []\n )\n end", "def datastore_ids\n array = Array.new\n\n self.each(\"DATASTORES/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def multi_ids\n params[multi_id_key].split(',')\n end", "def move_users_to_group(group_id, arr_of_user_ids)\n arr_of_user_ids.each { |id|\n populate_group = HTTParty.post(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/memberships\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" },\n body: {\n user_id: id\n } \n )\n }\nend", "def create\n @id = Id.new(params[:id])\n\n respond_to do |format|\n if @id.save\n format.html { redirect_to @id, :notice => 'Id was successfully created.' }\n format.json { render :json => @id, :status => :created, :location => @id }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end", "def test_ctid\n @inventory.should_receive(:ids).times(3).and_return([24], [100, 102], [100, 101, 102])\n\n # assertions\n %w(100 101 103).each do |id|\n assert_equal id, OpenVzDriver.ctid(@inventory)\n end\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def convert_id(opts)\n opts = opts.clone\n req = build_soap! do |type, builder|\n if(type == :header)\n else\n builder.nbuild.ConvertId {|x|\n }\n end\n end\n do_soap_request(req)\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def allocate_ids *incomplete_keys\n service.allocate_ids project_id: project, database_id: database, keys: incomplete_keys\n end", "def update \n if @locationtour.update(locationtour_params)\n p '-------------modual_ids-------------'\n p @modual_ids = params[:h].split(',').map(&:to_i)\n p '-------------locationtour.hotel_ids-------------'\n @locationtour.hotel_ids = @modual_ids\n @locationtour.save \n redirect_to :back\n end\n end", "def dids\r\n DidsController.instance\r\n end", "def fill_ids(_in_stream)\n end", "def create\n @clenum = Clenum.new(params[:clenum])\n\n respond_to do |format|\n if @clenum.save\n flash[:notice] = 'Clenum was successfully created.'\n format.html { redirect_to(:action=>'show', :ids=>@clenum) }\n format.xml { render :xml => @clenum, :status => :created, :location => @clenum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @clenum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @ids = Id.all\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def postToolsGooglesheetWorksheet_id( spreadsheet_key, worksheet_name)\n params = Hash.new\n params['spreadsheet_key'] = spreadsheet_key\n params['worksheet_name'] = worksheet_name\n return doCurl(\"post\",\"/tools/googlesheet/worksheet_id\",params)\n end", "def create\n\n @house = House.new(params[:house])\n @house.users_ids = current_user.id\n\n if @house.save\n redirect_to thanks_houses_url\n else\n render :new\n end\n\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end", "def approver_id_list(resource)\n id_list(resource, approver_request_ids)\n end", "def promotion_id_dump=(ids)\n @previous_promotion_ids = ids.map(&:to_i)\n end", "def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\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 @id = Id.new(id_params)\n\n respond_to do |format|\n if @id.save\n format.html { redirect_to @id, notice: 'Id was successfully created.' }\n format.json { render action: 'show', status: :created, location: @id }\n else\n format.html { render action: 'new' }\n format.json { render json: @id.errors, status: :unprocessable_entity }\n end\n end\n end", "def approver_id_list(resource)\n visible_request_ids = visible_request_ids_for_approver\n Rails.logger.debug { \"Final accessible request ids: #{visible_request_ids}\" }\n\n case resource\n when \"requests\"\n visible_request_ids\n when \"actions\"\n Action.where(:request_id => visible_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def wp_parse_id_list(list)\n list = wp_parse_list list\n list.map{|i| i.to_i.abs}.uniq\n end", "def get_triggered_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"triggered\", :fields => \"incident_number\" }\n end", "def incidents=(value)\n @incidents = value\n end", "def generate_ids\n uuid = UUID.new\n self.id = uuid.generate\n end", "def set_tag_ids nids\n # Ensure that the user's tags are all and only those in nids\n oids = tagging_tags.pluck :id\n\n # Add new tags as necessary\n (nids - oids).each { |tagid| assert_tagging tagid, @tagging_user_id }\n\n # Remove tags as nec.\n (oids - nids).each { |tagid| refute_tagging tagid, @tagging_user_id }\n end", "def incident_id\n @attrs['IncidentID']\n end", "def add_dummy_create_id\n params[:data] ||= {}\n params[:data][:id] ||= 0\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :recipe_ids => [])\n end", "def create\n @incident = Incident.new(incident_params)\n\n if @incident.save\n render json: @incident, status: :created, location: @incident\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def insert_and_tweet_incidents incidents\n client = get_twitter_client\n statuses = []\n\n incidents.reverse.each do |incident|\n incident_date = incident[0]\n state = incident[1]\n city_or_county = incident[2]\n address = incident[3]\n num_killed = incident[4].to_i\n num_injured = incident[5].to_i\n url = incident[6]\n\n begin\n Incident.create!(\n incident_date: incident_date,\n state: state,\n city_or_county: city_or_county,\n address: address,\n num_killed: num_killed,\n num_injured: num_injured,\n url: url\n )\n\n status = build_status(city_or_county, state, num_killed, num_injured, url)\n file_name = get_street_view(url)\n file_name.nil? ? client.update(status) : client.update_with_media(status, File.new(file_name))\n\n statuses << status\n rescue ActiveRecord::RecordNotUnique\n puts \"We've seen this incident before: #{url}\"\n end\n end\n\n if Incident.count >= 50\n Incident.order(:updated_at).limit(25).destroy_all\n end\n\n statuses\n end", "def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end", "def capturar_prox_indece_pdd_adm\n\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n uri = URI( 'http://162.243.215.24/PDV/COUNTERS_get_next')\n resp = Net::HTTP.post_form(uri,'counter'=>\"pdd\" )\n @record=JSON.parse(resp.body)\n @record['id']\n #metodo ok\n end", "def updategenres\n @album = Album.find(params[:id])\n album_param = params[:albums] \n album_param[:genres].each do |genre_id|\n genre = Genre.find(genre_id)\n @album.genres << genre \n end \n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end \n end" ]
[ "0.5561473", "0.53918487", "0.52918005", "0.516522", "0.5145279", "0.5108013", "0.5066391", "0.50253975", "0.5004684", "0.49882695", "0.49149573", "0.48990613", "0.48935995", "0.48564246", "0.48366874", "0.48346892", "0.48316315", "0.48136714", "0.47802246", "0.47463432", "0.47339395", "0.4719684", "0.4713835", "0.47137192", "0.47035402", "0.46943894", "0.46878737", "0.4657178", "0.46322262", "0.46313688", "0.46223363", "0.46137083", "0.45967317", "0.45945403", "0.45942408", "0.4586941", "0.4580933", "0.45722362", "0.45719695", "0.45675644", "0.45654848", "0.45633548", "0.45554283", "0.45550004", "0.45411342", "0.45406204", "0.45373777", "0.4524563", "0.45132673", "0.4506753", "0.4502266", "0.45009595", "0.44979334", "0.44967872", "0.44948223", "0.44835222", "0.44776198", "0.4474513", "0.44720832", "0.4469292", "0.44677785", "0.44654116", "0.44622827", "0.44537908", "0.44492987", "0.44489563", "0.4446795", "0.4441475", "0.4440206", "0.4437786", "0.44300407", "0.4423983", "0.4419083", "0.4418689", "0.44173932", "0.4402474", "0.44002268", "0.4383971", "0.4379281", "0.43761444", "0.43655765", "0.43653092", "0.43643993", "0.43636006", "0.43629977", "0.4361699", "0.43452954", "0.4342279", "0.4331259", "0.432954", "0.4324465", "0.4318032", "0.43177933", "0.43174815", "0.43137017", "0.4313033", "0.43125382", "0.43083453", "0.43073016", "0.43070364" ]
0.6074255
0
PUT /cattle_ids/1 PUT /cattle_ids/1.xml
def update @cattle_id = CattleId.find(params[:id]) respond_to do |format| if @cattle_id.update_attributes(params[:cattle_id]) format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def create\n @cattle_id = CattleId.new(params[:cattle_id])\n\n respond_to do |format|\n if @cattle_id.save\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') }\n format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cattle_id.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(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def show\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n if @clenum.update_attributes(params[:clenum])\n flash[:notice] = 'Clenum was successfully updated.'\n format.html { redirect_to(:action=>'show', :ids=>@clenum) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clenum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def new\n @cattle_id = CattleId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def assign_tenants_to_circle(args = {}) \n body_put(\"/tenantcircles.json/tenants/#{args[:circleId]}\", args[:array_of_ids])\nend", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def update(params={})\n raise ArgumentError, \"Error: ids is a required arg\" unless check_params([:ids], params)\n rpc_call :update, params\n end", "def update\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n if @discovery.update_attributes(params[:discovery])\n flash[:notice] = 'Discovery was successfully updated.'\n format.html { redirect_to(@discovery) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discovery.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @recipe = Recipe.find(params[:id])\n @recipe.ingrediences = Ingredience.find(params[:ingredience_ids]) if params[:ingredience_ids] \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\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_unique_ids(env, content); end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n if @incidenttype.update_attributes(params[:incidenttype])\n flash[:notice] = 'Incidenttype was successfully updated.'\n format.html { redirect_to(@incidenttype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incidenttype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_counters(id, counters)\n where(:_id => id).inc(counters)\n end", "def update\n @store = Store.find(params[:id])\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_incident(incident)\n update_object_xml('Incident', incident.id, incident.to_xml)\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n if @actuator.update_attributes(params[:actuator].each_value(&:strip!))\n format.html { redirect_to(@actuator, :notice => 'Actuator was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actuator.errors, :status => :unprocessable_entity }\n end\n end\n end", "def common_variable_relationships_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: CommonVariableRelationshipApi#common_variable_relationships_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling common_variable_relationships_id_put\" if id.nil?\n \n # resource path\n path = \"/commonVariableRelationships/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: CommonVariableRelationshipApi#common_variable_relationships_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end", "def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end", "def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end", "def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n @event.curryhouse_ids = params[:event][:curryhouse_ids]\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n @therapist.specialty_ids = params[:therapist][:specialty_ids]\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to root_path, notice: \"therapist was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def connections_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_put\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update \n if @locationtour.update(locationtour_params)\n p '-------------modual_ids-------------'\n p @modual_ids = params[:h].split(',').map(&:to_i)\n p '-------------locationtour.hotel_ids-------------'\n @locationtour.hotel_ids = @modual_ids\n @locationtour.save \n redirect_to :back\n end\n end", "def update\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n if @contacter.update_attributes(params[:contacter])\n format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def set_incident\n @incident = current_user.incidents.find(params[:id])\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end", "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def modify_identifier(identifier, metadata_hash)\n request_uri = '/id/' + identifier\n uri = URI(ENDPOINT + request_uri)\n request = Net::HTTP::Post.new uri.request_uri\n response = call_api(uri, request, metadata_hash)\nend", "def update_changeset(xml, changeset_id)\n xml_attr_rewrite(xml, \"changeset\", changeset_id)\n end", "def add_with_actor(ids)\n ids.each do |id|\n acquire_lock_for(id) do\n resource = ActiveFedora::Base.find(id)\n attributes = {\n \"preferred_representation_uri\" => resource.preferred_representation_uri,\n \"representation_uris\" => (resource.representation_uris + [curation_concern.uri])\n }\n actor = citi_resource_actor(resource)\n actor.update(attributes)\n end\n end\n end", "def update\n @agent = @habitat.agents.find(params[:id])\n\n respond_to do |format|\n if @agent.update_attributes(params[:agent])\n flash[:notice] = 'Agent was successfully updated.'\n format.html { redirect_to habitat_agent_url(@habitat, @agent) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @agent.errors.to_xml }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def bulk_update(ids, pairs)\n # Bulk load documents\n # Map to doc\n # Filter out errors, or none founds (compact)\n # Select the Couch objects\n docs = database.couchrest_database.bulk_load(ids)['rows'].map{|r| r['doc']}.compact.select{|d| d.is_a?(SimplyStored::Couch)}\n for doc in docs\n pairs.each_pair do |k, v|\n doc.send(\"#{k}=\", v) if doc.respond_to?(\"#{k}=\")\n end\n doc.save # Should become a bulk update in the future\n end\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def set_inciting_incident\n @inciting_incident = IncitingIncident.find(params[:id])\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @county = County.find(params[:id])\n\n respond_to do |format|\n if @county.update_attributes(params[:county])\n flash[:notice] = 'County was successfully updated.'\n format.html { redirect_to(@county) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @county.errors, :status => :unprocessable_entity }\n end\n end\n end", "def id=(new_id)\n @features.each do |feature| \n feature.id = feature.id.gsub(/#{@attributes[:ID]}/, new_id) if feature.id =~ /#{@attributes[:ID]}/\n \n # Update child parent attributes as well\n if feature.attributes[:Parent].is_a?(Array)\n feature.attributes[:Parent].each do |parent|\n parent.gsub!(/#{@attributes[:ID]}/, new_id) if parent =~ /#{@attributes[:ID]}/\n end\n elsif (parent = feature.attributes[:Parent]) =~ /#{@attributes[:ID]}/\n feature.attributes[:Parent] = parent.gsub(/#{@attributes[:ID]}/, new_id) \n end\n end\n \n @attributes[:ID] = new_id\n end", "def update\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, :notice => 'Incident was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @coating.update_attributes(params[:coating])\n format.html { redirect_to(@coating, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, opts)\n\t\t\t\turl = \"api/v2/interactions/#{id}\"\n\t\t\t\tget_object(:put, \"interaction\", url, {:interaction => opts})\n\t\t\tend", "def update \t\n\t @cinema = Cinema.find(params[:id])\n\t\t@cities = City.find(:all)\n\t\t\n\t respond_to do |format|\n\t if @cinema.update_attributes(params[:cinema])\n\t \n\t update_cinemas_xml()\n\t \n\t format.html { redirect_to(@cinema, :notice => 'Kino zostało pomyślnie zaktualizowane.') }\n\t format.xml { head :ok }\n\t else\n\t format.html { render :action => \"edit\" }\n\t format.xml { render :xml => @cinema.errors, :status => :unprocessable_entity }\n\t end\n\t end \n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n\[email protected] = session[:project]\n if @incident.update_attributes(params[:incident])\n flash[:notice] = t 'flash.incident_update'\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @campus_food = CampusFood.find(params[:id])\n\t@campus_food.location = params[:tags]\n respond_to do |format|\n if @campus_food.update_attributes(params[:campus_food])\n format.html { redirect_to campus_foods_path, notice: 'Campus food was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def modify_relationship action\n File.open(@user_id_list, 'r') do |file|\n file.each do |user_id|\n url = API + \"users/#{user_id.gsub(/(\\n|,)$/, \"\")}/relationship?access_token=\" + @access_token\n response = RestClient.post(url, access_token: @access_token, action: action)\n sleep(rand(3..6))\n\n puts response.code == 200 ? \"Successfully #{action}: #{user_id}\" : response\n end\n end\n end", "def set_incident\n @incident = @quote.incidents.find(params[:id])\n\n end", "def set_incident\n @incident = Incident.find_by_sql(\"SELECT * FROM incidents WHERE incident_id =#{params[:id]};\" )[0]\n end", "def set_incident\n @incident = Incident.includes(:images).find(params[:id])\n end", "def update\n @location_tag = LocationTag.find(params[:id])\n\n respond_to do |format|\n if @location_tag.update_attributes(params[:location_tag])\n flash[:notice] = 'Location tag was successfully updated.' \n format.html { redirect_to(location_tags_path(:farm_id => @farm.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location_tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def updategenres\n @album = Album.find(params[:id])\n album_param = params[:albums] \n album_param[:genres].each do |genre_id|\n genre = Genre.find(genre_id)\n @album.genres << genre \n end \n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end \n end", "def update\n @caterogy = Caterogy.find(params[:id])\n\n respond_to do |format|\n if @caterogy.update_attributes(params[:caterogy])\n flash[:notice] = 'Caterogy was successfully updated.'\n format.html { redirect_to(@caterogy) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @caterogy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend", "def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @browsenodeid = Browsenodeid.find(params[:id])\n\n respond_to do |format|\n if @browsenodeid.update_attributes(browsenodeid_params)\n format.html { redirect_to(@browsenodeid, :notice => 'Browsenodeid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @browsenodeid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @countries = Countries.find(params[:id])\n\n respond_to do |format|\n if @countries.update_attributes(params[:countries])\n flash[:notice] = 'Countries was successfully updated.'\n format.html { redirect_to(@countries) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @countries.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.5976889", "0.58678615", "0.58644557", "0.571639", "0.55510354", "0.5513215", "0.538994", "0.5369293", "0.5346908", "0.5341737", "0.5271538", "0.52299356", "0.5194838", "0.5134592", "0.5110783", "0.5110783", "0.5108735", "0.50597715", "0.5040271", "0.50361943", "0.5013634", "0.5013634", "0.5013634", "0.5013634", "0.5013634", "0.5013634", "0.5013634", "0.5013634", "0.50071025", "0.49825585", "0.4965092", "0.4960275", "0.49569806", "0.49444348", "0.4937708", "0.4924209", "0.4924209", "0.49104893", "0.4905776", "0.48986533", "0.48877773", "0.48653102", "0.48632583", "0.48545185", "0.4851804", "0.48481694", "0.48481694", "0.48481694", "0.48481694", "0.4836302", "0.48334104", "0.4833082", "0.48252222", "0.48203114", "0.4802015", "0.479618", "0.4795345", "0.4794973", "0.4792399", "0.4787656", "0.47854078", "0.4770359", "0.47628623", "0.47592252", "0.4742398", "0.47306538", "0.4729755", "0.47276628", "0.4723448", "0.4714122", "0.47047073", "0.47036", "0.46920046", "0.46891236", "0.4688748", "0.4687009", "0.46831912", "0.46736526", "0.4671375", "0.46671906", "0.46670243", "0.46654025", "0.46538642", "0.4645393", "0.46425337", "0.46411988", "0.46382993", "0.46360528", "0.46341828", "0.46221384", "0.46192977", "0.4618699", "0.46154416", "0.46152124", "0.4615017", "0.4612782", "0.4612782", "0.4612782", "0.46116865", "0.4611109" ]
0.6805595
0
DELETE /cattle_ids/1 DELETE /cattle_ids/1.xml
def destroy @cattle_id = CattleId.find(params[:id]) @cattle_id.destroy respond_to do |format| format.html { redirect_to(cattle_ids_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def delete_id(id)\n ids_in_doc = root.fetch(full_path, :single => true)\n raise TypeError, \"Expecting array\" unless ids_in_doc.kind_of? Array\n ids_in_doc.delete id\n root.save!\n ids.delete id\n save!\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def delete_by_id(ids)\n ids = [ids] unless ids.is_a?(Array)\n build do |xml|\n xml.delete do |delete_node|\n ids.each { |id| delete_node.id(id) }\n end\n end\n end", "def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidents_url) }\n format.xml { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def delete_all(xpath); end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def del_attribs_by_cid(id )\n url = \"#{self.url}/cid/#{id}?auth=#{self.authtoken}\"\n status, _ = rest_delete( url )\n return status\n end", "def deleteEntityAdvertiser( 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/advertiser\",params)\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "def destroy\n @storeloc = Storeloc.find(params[:id])\n @storeloc.itemlocs.each do |loc|\n loc.destroy\n end\n\n @storeloc.destroy\n\n respond_to do |format|\n format.html { redirect_to(storelocs_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def destroy\n @caterogy = Caterogy.find(params[:id])\n @caterogy.destroy\n\n respond_to do |format|\n format.html { redirect_to(caterogies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @cita = Cita.find(params[:id])\n [email protected]_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityCategory( 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/category\",params)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\n @agent = @habitat.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to habitat_agents_url }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def deleteEntityDocument( 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/document\",params)\n end", "def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @occurence = Occurence.find(params[:id])\n @occurence.destroy\n\n respond_to do |format|\n format.html { redirect_to(occurences_url) }\n format.xml { head :ok }\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 deleteEntityAssociation_membership( 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/association_membership\",params)\n end", "def destroy\n @cadd = Cadd.find(params[:id])\n @cadd.destroy\n\n respond_to do |format|\n format.html { redirect_to(cadds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n id = params[:id]\n src = Tagaly3::SRC\n # Code to connect with API\n @uri = URI.parse(src)\n http = Net::HTTP.start(@uri.host,@uri.port)\n request = Net::HTTP::Delete.new(\"/adexchange/advertiser/advertisement/#{id}\")\n response = http.request(request)\n http.finish\n redirect_to '/ads/'\n end", "def destroy\n @encounter = Encounter.find(params[:id])\n @encounter.destroy\n\n respond_to do |format|\n format.html { redirect_to(encounters_url) }\n format.xml { head :ok }\n end\n end", "def delete_ids(args)\n while !args[:ids].empty? and ids = args[:ids].shift(500)\n objs = self.list(args[:class], \"id\" => ids)\n self.deletes(objs)\n end\n\n return nil\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @candy = Candy.find(params[:id])\n @candy.destroy\n\n respond_to do |format|\n format.html { redirect_to(candies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to(gigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\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.xml { head :ok }\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete_course_with_id(id)\n doc_feed=get_doc_feed(@doc_client)\n doc_feed.elements.each('entry') do |entry|\n if entry.elements['id'].text==\"https://documents.google.com/feeds/documents/private/full/spreadsheet%3A#{id}\"\n @doc_client.headers['If-Match']=entry.attribute('etag').value\n puts \"Deletehere\"\n response=@doc_client.delete(\"https://documents.google.com/feeds/documents/private/full/document%3A#{id}\") \n end\n end\n end", "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n params[:id].each{|id| \n article_category = ArticleCategory.find(id.to_i)\n article_category.destroy\n }\n\n respond_to do |format|\n format.html { redirect_to(article_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n \n respond_to do |format|\n format.html { redirect_to clients_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @countries = Countries.find(params[:id])\n @countries.destroy\n\n respond_to do |format|\n format.html { redirect_to(countries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @locations_locationset = LocationsLocationset.find(params[:id])\n @locations_locationset.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_locationsets_url) }\n format.xml { head :ok }\n end\n end", "def delete_redirects\n WikiRedirect.where(:wiki_id => id).delete_all\n WikiRedirect.where(:redirects_to_wiki_id => id).delete_all\n end", "def destroy\n @patient_encounter = PatientEncounter.find(params[:id])\n @patient_encounter.destroy\n\n respond_to do |format|\n format.html { redirect_to(patient_encounters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to(neighborhoods_url) }\n format.xml { head :ok }\n end\n end", "def delete(id_to_delete)\n DATABASE.execute(\"DELETE FROM locations WHERE id = '#{id_to_delete}'\")\n end", "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end", "def delete(*uris); end", "def delete()\n\n client.delete(\"/stories/#{gid}\") && true\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete\n request(:delete)\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 deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def delete(*ids)\n ids.flatten!\n @write_connection.delete_by_id(ids)\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cycdatum = Cycdatum.find(params[:id])\n @cycdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to cycdata_url }\n format.json { head :ok }\n end\n end", "def delete(client_id)\n id = client_id.to_s\n Client.collection.filter(:id => id).delete\n AuthRequest.collection.filter(:client_id => id).delete\n AccessGrant.collection.filter(:client_id => id).delete\n AccessToken.collection.filter(:client_id => id).delete\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete_children(id, gel)\n element_dataset.filter(container_id_sym => id).delete\n end", "def destroy\n @cavalete = Cavalete.find(params[:id])\n @cavalete.destroy\n\n respond_to do |format|\n format.html { redirect_to(cavaletes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @affiliate = Affiliate.find(params[:id])\n @affiliate.destroy\n\n respond_to do |format|\n format.html { redirect_to(affiliates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domicile_type = DomicileType.find(params[:id])\n @domicile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ata = OrcAta.find(params[:id])\n @orc_ata.destroy\n @ata =\n respond_to do |format|\n format.html { redirect_to( home_path ) }\n\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def test_urls_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend", "def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.67052555", "0.6548932", "0.64589727", "0.645614", "0.6213299", "0.6184873", "0.61804336", "0.6166453", "0.6165071", "0.61151034", "0.6085725", "0.6080698", "0.6031887", "0.60253733", "0.5967029", "0.596064", "0.5934148", "0.5932685", "0.5932685", "0.5888405", "0.5848522", "0.5848522", "0.58215237", "0.580138", "0.57911974", "0.57836735", "0.5775506", "0.5760328", "0.5752769", "0.5748115", "0.5734704", "0.5705353", "0.57029456", "0.57000154", "0.56945586", "0.5693906", "0.56906056", "0.5678675", "0.5677714", "0.5663263", "0.56589365", "0.5644115", "0.56415004", "0.5641391", "0.56330705", "0.56262106", "0.5619983", "0.5614036", "0.56136584", "0.56131566", "0.5613071", "0.5609537", "0.56039417", "0.56018114", "0.55999285", "0.5592442", "0.55903596", "0.5585494", "0.55775714", "0.5577298", "0.557416", "0.55739176", "0.5569905", "0.5569403", "0.5569401", "0.5568181", "0.55681264", "0.55673385", "0.55658156", "0.5565003", "0.55631876", "0.55603373", "0.555972", "0.55582654", "0.55545026", "0.5554341", "0.5552634", "0.55512565", "0.5550601", "0.5549285", "0.55470544", "0.5546991", "0.55453676", "0.5544039", "0.55439246", "0.55391484", "0.5538369", "0.55336684", "0.5531245", "0.5530159", "0.5527736", "0.5527736", "0.55274576", "0.55268395", "0.55266637", "0.552631", "0.5523028", "0.5522926", "0.5522814", "0.5519758" ]
0.746578
0
methods are defined using the "def" keyword
def double(val) val * 5 # the return is te result of the last expression val * 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method\r\nend", "def methods=(_arg0); end", "def implementation; end", "def implementation; end", "def defs; end", "def defs; end", "def definitions; end", "def definitions; end", "def define; end", "def overrides; end", "def define\n end", "def define\n end", "def method_name\n end", "def functions\n\n end", "def proto\n \"def\"\n end", "def method1; end", "def internal_methods; end", "def hey_hey; end", "def runnable_methods; end", "def runnable_methods; end", "def whatever\n end", "def ...\nend", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def method\n\t\t# code code\n\tend", "def method_name\n\n end", "def method_name\n\n end", "def method_name\n\n end", "def definition\n super\n end", "def definition\n super\n end", "def operations; end", "def operations; end", "def custom; end", "def custom; end", "def calls; end", "def calls; end", "def defined_methods\n # TODO: check content type before scanning\n content.scan(/\\s*def\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def how_it_works\r\n end", "def abstract!; end", "def something\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def internal; end", "def who_we_are\r\n end", "def on_def(node); end", "def demoMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend", "def aaa\n\t\tdefine_method(\"aa\") {puts \"aa\"}\n\tend", "def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend", "def method2() end", "def stubs; end", "def method c\r\nend", "def method\r\n\t1\r\nend", "def hello; :hello; end", "def method_one; end", "def get_definition\n\n end", "def meth(arg1)\nend", "def def_method(object, method_name, filename=nil)\n\t\t\t\tm = object.is_a?(Module) ? :module_eval : :instance_eval\n\t\t\t\tobject.__send__(m, \"def #{method_name}; #{@src}; end\", filename || @filename || '(eruby)')\n\t\t\t\t#erb.rb: src = self.src.sub(/^(?!#|$)/) {\"def #{methodname}\\n\"} << \"\\nend\\n\" #This pattern insert the 'def' after lines with leading comments\n\t\t\tend", "def something\n\nend", "def public_method; end", "def interface; end", "def interface; end", "def my_method\n end", "def say_hello\nend", "def x; end", "def x; end", "def x; end" ]
[ "0.7989375", "0.7905343", "0.7905343", "0.7905343", "0.7905343", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.7480328", "0.725143", "0.72214293", "0.7200614", "0.7200614", "0.7143648", "0.7143648", "0.71238464", "0.71238464", "0.7111613", "0.69991827", "0.6954231", "0.6954231", "0.69381386", "0.6931401", "0.687599", "0.6853182", "0.68483806", "0.6813694", "0.678014", "0.678014", "0.67764133", "0.6690877", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6687077", "0.6682585", "0.6682585", "0.6682585", "0.6682585", "0.6682585", "0.6682585", "0.6682585", "0.6682585", "0.6680889", "0.66605264", "0.66605264", "0.66605264", "0.66486824", "0.66486824", "0.66423583", "0.66423583", "0.66051865", "0.66051865", "0.6588489", "0.6588489", "0.6547066", "0.6521547", "0.6514646", "0.65059614", "0.65020937", "0.65020937", "0.6423989", "0.6417792", "0.64140165", "0.64003253", "0.63931966", "0.63913995", "0.6390378", "0.63892174", "0.6381692", "0.6381049", "0.6375231", "0.6374876", "0.6373351", "0.63654953", "0.63606167", "0.63511276", "0.6349116", "0.63466835", "0.63466835", "0.633669", "0.6331483", "0.632929", "0.632929", "0.632929" ]
0.0
-1
The workhorse generate method. Defaults to one id, but up to 255 can be requested.
def generate(n=1, idspace=0) failures ||= 0 if failures > 0 disconnect connect elsif @socket.nil? connect end request_id(n, idspace) fetch_id(n) rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EPIPE failures += 1 retry if failures < MAX_RETRIES raise end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_id \n end", "def id_generator; end", "def generate_id\n id_generator.call\n end", "def generate_new_id()\n\t\tbegin\n\t\t\t(id = rand(9000)+1000)\n\t\tend while @objects[id]\n\t\treturn id\n\tend", "def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end", "def generate_machine_id()\n \n end", "def generate_id\n id = @id\n @id += 1\n id\n end", "def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end", "def set_id\n\t\t\trand(111111111...999999999)\n\t\tend", "def generate_id\n Util::UUID.generate\n end", "def generate_id\n SecureRandom.urlsafe_base64 21\n end", "def generate_id(_)\n accurate_timestamp = (Time.now.to_f * 1000).round\n time_part = (accurate_timestamp - DISCORD_EPOCH) << 22\n random_part = rand(0...2**22)\n\n time_part | random_part\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def basic_generate_id(str); end", "def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end", "def generate(game_id = nil)\n nil\n end", "def generate_id\n now = Time.now\n parts = [now.to_i, now.usec, $$, rand(16**8)]\n parts.map {|i| i.to_s(16)}.join('-')\n end", "def generate_new_id\n Util::UUID.generate\n end", "def generate; end", "def generate; end", "def generate_id\n # Max value is 9223372036854775807 (signed long in Java)\n rand(ID_RANGE)\n end", "def kid_generator; end", "def kid_generator; end", "def kid_generator; end", "def serial_generator\n \"OD#{id.to_s.rjust(10, \"0\")}\"\n end", "def generate_id(size = 1)\n Array.new(size) { rand(ID_RANGE) }\n .pack('q>*')\n .unpack('H*')\n .first\n end", "def create_guid\n self.id ||= UUIDTools::UUID.random_create.to_s\n end", "def create_job_id\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n Generators.generate_uuid(self)\n end", "def generate\n end", "def id() end", "def make_id\n \"#{self.class.name.downcase}#{id}\"\n end", "def generate_hash_code\n\t\tself.hash_code = rand(999999)\n\tend", "def random_id\n rand(1000000) + 20000\nend", "def rand_id\n rand(10**7...10**8).to_s\nend", "def generate\n Rlibidgen32.idgen32(@struct)\n end", "def id_hash_generator(number)\n{:id => number }\nend", "def rand_id\n rand(10**7...10**8).to_s\n end", "def generate_id(str); end", "def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end", "def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end", "def generate_unique_id\n \"1.3.6.1.4.1.21367.2009.5.14.#{id}.#{Time.now.to_i}\"\n end", "def generate_record_id\n @client_id + '-' + SecureRandom.uuid\n end", "def make_foreign_ID\r\n loop do\r\n ret = rand(2 ** 16) | rand(2 ** 16) << 16\r\n return ret if ret != @id\r\n end\r\n return 0\r\n end", "def generate\n raise \"must implement\"\n end", "def generate\n raise NotImplementedError\n end", "def generate\n raise NotImplementedError\n end", "def generateGuid\n def s4() ((1 + rand) * 0x10000).round.to_s(16)[1..-1] end\n \"#{s4}#{s4}#{s4}#{s4}\"\n end", "def generate_code\n self.code = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{user_id}--#{rand(256)}\")[0,32]\n end", "def generate\n end", "def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end", "def generate_key; end", "def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end", "def generate_id\n @mutex.synchronize { @current_id += 1 }\n end", "def generate_key\n proposed_key = nil\n\n loop do\n num_part = rand(10**7).to_s.rjust(7, \"0\")\n proposed_key = \"#{IDB_CONFIG[:key_prefix]}-#{num_part}\"\n break unless self.class.find_by(key: proposed_key)\n end\n proposed_key\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def generate_generation_id_(seckey)\n # NOTE: Do hsetnx with '-1' to detect weather the seckey is already set\n if @redis.hsetnx @url, seckey, '-1'\n max_genid = @redis.hincrby @url, 'max-genid', 1\n @redis.hset @url, seckey, max_genid.to_s\n return max_genid.to_s\n else\n return @redis.hget @url, seckey\n end\n end", "def generate_uuid(*args)\n\t\t\t\tnow = Time.now\n\t\t\t\t# Turn the time into a very large integer.\n\t\t\t\ttime = (now.to_i * 10_000_000) + (now.tv_usec * 10) + Epoch\n\n\t\t\t\t# Now break that integer into three chunks.\n\t\t\t\tt1 = time & 0xFFFF_FFFF\n\t\t\t\tt2 = time >> 32\n\t\t\t\tt2 = t2 & 0xFFFF\n\t\t\t\tt3 = time >> 48\n\t\t\t\tt3 = t3 & 0b0000_1111_1111_1111\n\t\t\t\tt3 = t3 | 0b0001_0000_0000_0000\n\n\t\t\t\ttime_string = TimeFormat % [t1,t2,t3]\n\t\t\t\targ_string = Digest::SHA1.hexdigest(args.collect {|arg| Proxy === arg ? arg.object_id.to_s : arg.to_s}.sort.to_s)\n\t\t\t\t\"#{time_string}-#{arg_string}-#{rand(RandHigh).to_s(16)}\"\n\t\t\tend", "def generate_ids\n uuid = UUID.new\n self.id = uuid.generate\n end", "def generate_id\n synchronize do\n n = (get_random() % @@MOD_LEN) + @@MOD_LEN\n time_val = Time.now.to_i\n t = ((time_val / 2) % @@MAX_TICKS) + @@MAX_TICKS\n if time_val != @@last_time_val\n @@session_count = 0\n @@last_time_val = time_val\n end\n @@session_count += 1\n \"#{n.to_s(36)[1..-1]}#{t.to_s(36)[1..-1]}#{@@session_count.to_s(36)}\"\n end\n end", "def generate_packet_id\n self.class.current_id ||= 0\n self.class.current_id += 1\n end", "def generate_temporary_id\n (Time.now.to_f*1000).to_i.to_s\n end", "def start_generation\n Nanite.request(\"/nanny/generate\", self.id)\n end", "def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end", "def id\n @id ||= Chunk.random_id\n end", "def generate_primary_key\n self[self.class.primary_key] ||= self.class.new_primary_key(10_000)\n end", "def generate_node_id\n # a little bit more creative\n if @registry.respond_to? :unique\n @registry.unique\n else\n digest = Digest::SHA512.new\n seed = Socket.gethostname + rand.to_s + Time.now.to_s + SecureRandom.hex\n digest.update(seed).to_s\n end\n end", "def assign_identifier\n self.id ||= SecureRandom.uuid\n end", "def generate_message_id\n @@next_message_id += 1\n end", "def generate_public_id\n self.public_id = Time.now.to_i.to_s 36\n end", "def generate_id(t=nil)\n t ||= Time.new.to_i\n buf = ByteBuffer.new\n buf.put_int(t & 0xffffffff)\n buf.put_array(MACHINE)\n buf.put_array(PID)\n i = index_for_time(t)\n buf.put(i & 0xff)\n buf.put((i >> 8) & 0xff)\n buf.put((i >> 16) & 0xff)\n\n buf.rewind\n buf.to_a.dup\n end", "def __id__() end", "def set_id\n self.id = SecureRandom.random_number(9223372036854775807)\n end", "def generate(name); end", "def identifier\n SecureRandom.hex(16)\n end", "def generate_int\n UUIDTools::UUID.random_create.to_i\n end", "def generate_gid(type, id)\n Base64.strict_encode64([\"0\", type.length, \":\", type, id.to_s].join)\nend", "def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end", "def new_id\n SecureRandom.uuid\n end", "def id; 1; end", "def id; 1; end", "def generate_id\n id = @ids.first[:count]\n @ids.where(:id => 1).update(:count => id + 1)\n id\n end", "def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end", "def create_uuid\n SecureRandom.uuid\n end", "def id()\n #This is a stub, used for indexing\n end", "def gen_small_uuid()\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end", "def id_generator\n @id_generator ||= proc { SecureRandom.uuid }\n end", "def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end", "def newrandombuildingid()\n while(true)\n if(@filename_pur.match(/^_/))\n id = \"\"\n else\n id = \"_\"\n end\n id += \"#{@filename_pur}_BD.#{@buildinggennr}\"\n if(@exportedid[id] == nil)\n break;\n end\n @buildinggennr += 1\n end\n return id\n end", "def code\n \"%05i\" % id unless new_record?\n end", "def kid_generator=(_arg0); end", "def kid_generator=(_arg0); end", "def id\n #NOOP\n end", "def generate_slug\n if self.id_changed? && !self.slug_changed?\n # this should not happen on regular DB setup, just a bit of insurance\n throw 'ID exceeded the storage limit' if self.id > TICKET_ID_LIMIT\n\n shifted_id = (Rails.application.secrets.ticket[:shift] + self.id) % TICKET_ID_LIMIT\n\n chunk1 = shifted_id / SLUG_FIRST_MULTIPLIER\n rest1 = shifted_id % SLUG_FIRST_MULTIPLIER\n\n chunk2 = rest1 / SLUG_SECOND_MULTIPLIER\n chunk3 = rest1 % SLUG_SECOND_MULTIPLIER\n\n slug = [\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk1.to_s(16).upcase().rjust(2, '0'),\n chunk2.b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk3.to_s(16).upcase().rjust(2, '0'),\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n ].join('-')\n\n self.update_attribute(:slug, slug)\n end\n end", "def identify!\n self.id ||= SecureRandom.uuid\n end", "def id\n\t\tbuild_id\n\tend", "def generate(time, counter = 0)\n [time, @machine_id, Process.pid, counter << 8].pack(\"N NX lXX NX\")\n end", "def gen_small_uuid\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end", "def get_next_uuid\n rand(8**32).to_s(36)\n end", "def uuid\n id = ''\n id << %w(0 1 2 3 4 5 6 7 8 9 a b c d e f).sample until id.size >= 32\n 4.times { |i| id.insert(8+i*5, '-') }\n id\nend" ]
[ "0.74072343", "0.71567", "0.70265627", "0.6996201", "0.67886555", "0.6742302", "0.6718515", "0.66472465", "0.66318536", "0.66259426", "0.662002", "0.6593436", "0.6578619", "0.65540904", "0.65482944", "0.65365094", "0.6515059", "0.6501585", "0.64746726", "0.64668524", "0.64668524", "0.6464436", "0.6462869", "0.6462869", "0.6462869", "0.64555675", "0.6453045", "0.64128745", "0.64128596", "0.63940644", "0.63842577", "0.637494", "0.6366939", "0.63555914", "0.6348475", "0.63363916", "0.6327517", "0.6326576", "0.6322706", "0.63224036", "0.6302946", "0.62977177", "0.62563694", "0.6230902", "0.6227226", "0.6219419", "0.62193096", "0.6211531", "0.6208634", "0.6198314", "0.61652946", "0.61623687", "0.6137211", "0.6131933", "0.61305153", "0.6123989", "0.6123989", "0.6089292", "0.6087733", "0.6086464", "0.6086078", "0.60799724", "0.60732526", "0.6068366", "0.6053067", "0.60372716", "0.6014257", "0.6013911", "0.601372", "0.60115916", "0.6010129", "0.60067856", "0.6005339", "0.5996925", "0.5995151", "0.59941876", "0.5992271", "0.59872836", "0.5985077", "0.5984686", "0.59808743", "0.5979755", "0.5973278", "0.59725386", "0.5969843", "0.59644717", "0.5961669", "0.59548557", "0.5953558", "0.59493554", "0.59463596", "0.5935743", "0.5935743", "0.5930143", "0.59300184", "0.5929544", "0.59293044", "0.5926502", "0.5912908", "0.59096104", "0.59089607" ]
0.0
-1
initialize runs whenever a new instance method has been initialized
def initialize() puts "Initializing new puppy instance ..." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize() end", "def initialize\n puts \"constructor is automatically called when we create object\"\n end", "def on_initialize\n end", "def initialize\n\n\n\n end", "def post_initialize\n end", "def initialize\n # complete\n end", "def post_initialize\n # raise NotImplementedError\n end", "def pre_initialize; end", "def before_initialize(&block); end", "def initialize\nend", "def init; end", "def init; end", "def init; end", "def init; end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n init\n end", "def on_init; end", "def on_init; end", "def at_init\n\n\t\tend", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize(...)\n super\n mon_initialize\n end", "def after_initialize(&block); end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def init\n\n end", "def after_initialize\n # noop\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n super\n @update_to_call = []\n Scheduler.start(:on_init, self.class)\n end", "def pre_initialize\n end", "def initialize\n\nend", "def init; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\r\n\r\n end", "def initialize\n\t\t\n\tend", "def initialize()\n\n end", "def initialize\n # nothing here for now\n end", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize()\n\t\tend", "def initialize # hook/callback/lifecycle event: because it is a method automatically fired by another method\n self.cry # explicit receiver of self - same as line below\n cry # implicit receiver of self - same as line above\n # Ruby will first check cry as a variable; when that fails, Ruby will assume it is a method on the class itself - implied \"self\"\n @birthdate = Time.now\n @@all << self # How does an object refer to itself? self! stores object ID\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def after_initialize\n end", "def after_initialize\n end", "def after_initialize\n end", "def initialize\n \n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize(*args)\n super\n mon_initialize\n end", "def initialize\n\tinit\n\tsuper\nend", "def initialize\n \n end", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def init\n\nend", "def initialize\n\t\nend", "def after_initialize(options={}) ; end", "def after_initialize(opts)\n end", "def initialize\n\n\nend", "def initialize\n end", "def initialize\r\n\r\n end", "def post_initialize\n # Base class does nothing\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 post_initialize( *args, & block )\n # call to super in case we extend Class or Module, so we can stack calls to post_initialize\n super if defined?( super )\n # nothing here - subclasses define\n end" ]
[ "0.78692746", "0.78692746", "0.7742165", "0.7662575", "0.76623636", "0.76442194", "0.7637747", "0.76287776", "0.7622394", "0.76196456", "0.7611271", "0.7609795", "0.7588874", "0.7588874", "0.7588874", "0.7588874", "0.7572814", "0.7572814", "0.7572814", "0.75631857", "0.7562628", "0.7562628", "0.7518662", "0.7504916", "0.7504916", "0.7504916", "0.7504916", "0.7504916", "0.7504916", "0.7504916", "0.7504916", "0.7500227", "0.74839187", "0.7475288", "0.74553305", "0.74553305", "0.74553305", "0.74553305", "0.7453162", "0.74471223", "0.7409073", "0.7409073", "0.740773", "0.7389972", "0.73803383", "0.7371607", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.7371447", "0.73653495", "0.7359044", "0.73573756", "0.73533946", "0.7348475", "0.7348475", "0.7342582", "0.7342582", "0.7331337", "0.732103", "0.73149985", "0.73149985", "0.73149985", "0.73149985", "0.73149985", "0.7313523", "0.7313523", "0.7307686", "0.7290514", "0.72844166", "0.7283631", "0.7283631", "0.7281188", "0.72688794", "0.72667", "0.72641706", "0.72614", "0.7237342", "0.723104", "0.72304213", "0.7215491", "0.7211758", "0.71956563", "0.7192841", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71878415", "0.71281874" ]
0.0
-1
class Dancer TEST CODE dancer = Dancer.new dancer.flip dancer.spin
def loop_into_data_structure(number_of_instances) array_moves = [] n = 0 while n < number_of_instances array_moves[n] = Dancer.new n += 1 end p array_moves end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trader; end", "def make_it_swim(duck)\n duck.swim\nend", "def test_can_create_instance_of_class_via_bang_method \n cars = Lumberjack.construct do\n vehicle :name => 'Prius (are owned by rich hippies)' do\n person! 'Ryan' do # i so put my foot in here, i'm not a rich hippy!\n age 25\n end\n end\n end\n assert_kind_of Person, cars[0].person\n assert_equal 'Ryan', cars[0].person.given_name\n assert_equal 25, cars[0].person.age\n end", "def spice; end", "def spouse; end", "def initialize\r\n puts \"Dealing Gsme\"\r\n @deck = Deck.new\t\r\n @player_hand = Hand.new\r\n @dealer_hand = Hand.new\r\n 2.times {@player_hand.hit!(@deck)}\r\n 2.times {@dealer_hand.hit!(@deck)}\r\n \r\n if @player_hand.value == 21\r\n puts \"BLACKJACK, You win!!\"\r\n :player\r\n end\r\n if @dealer_hand.value == 21\r\n puts \"Dealer has BLACKJACK\"\r\n :dealer\r\n end\r\n end", "def initialize(player)\n @en_passant = false\n super(player)\n end", "def initialize\n @turn = 0\n end", "def initialize(bowling)\n @bowling=bowling\n @game = bowling.game\n @first_roll = -1\n @second_roll = 0\n @frame = 0\n @valid_roll= 0\n end", "def drive\n # Exercise: Internal Methods\n ignite_engine\n # `self` is a keyword much like `this` that returns\n # the current object.\n # In an instance methods, that means the current instance\n puts \"#{self.class.to_s} is driving about...\"\n # You can access a class method inside of instance\n # by getting class itself through self with `self.class`\n puts \"with max speed of #{self.class.max_speed}\"\n end", "def d12\n if self == 1\n GamingDice::Dice.new(faces: 12)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: 12) }\n )\n end\n end", "def initialize\n @silent = false\n self.deck = create_deck\n self.player = Player.new\n self.player.strategy = Strategy.new(self) #default player strategy\n self.dealer = Dealer.new(\"Dealer\")\n self.dealer.strategy = DealerStrategy.new(self)\n\n @last_hand = false\n end", "def sandwich\n\tSandwich.new('delicious', [])\nend", "def d20\n if self == 1\n GamingDice::Dice.new(faces: 20)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: 20) }\n )\n end\n end", "def bake_n_eat\n # we can only call private methods from methods within the class\n # trying to call a private method on an instance will return an error\n p bake\n p eat\n end", "def initialize\n #add characters of object/ instance variable\n # drink amount is percentage of fill of\n @drink_amount = 0\n puts \"I'm alive!\"\n end", "def initialize(player)\n @player = player\n @state = 'draw'\n @swaps = []\n end", "def demon; end", "def setup\n @bike = @object = Mountainbike.new\n end", "def initialize\n puts \"Let's play a game of Black Jack.\"\n self.deck = Deck.new\n self.shoe = Shoe.new\n self.dealer = []\n self.player = []\n shoe.shuffle!\n self.dealer_score = 0\n self.player_score = 0\n self.game_counter = 0\n end", "def p_burglary\n flip(0.001, :B, :notB)\nend", "def bizet; end", "def d10\n if self == 1\n GamingDice::Dice.new(faces: 10)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: 10) }\n )\n end\n end", "def flip\n __flip__\n end", "def d8\n if self == 1\n GamingDice::Dice.new(faces: 8)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: 8) }\n )\n end\n end", "def take_a_drink\n soda.drink_a_soda\n puts \"You drank your soda!\"\n end", "def initialize\n shuffle\n end", "def flip!\n @flipped = !@flipped\n end", "def instantiate!; end", "def initialize(name, weapon)\n @name = name\n @weapon = weapon\nend", "def initialize\n @bet = 0.00\n @insurance_bet = 0.00\n @is_even_money = nil\n @stand = nil\n @is_split = nil\n @is_ace_split = nil\n @cards = []\n\n return self\n end", "def initialize(name, breed)\n @name = name\n @breed = breed\n @action_count = 0\n @laying = false\n end", "def d(faces = 1)\n if self == 1\n GamingDice::Dice.new(faces: faces)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: faces) }\n )\n end\n end", "def initialize\n @e_tanks = 4\n\n # alive (true) ; defeated (false)\n @bubble_man = false\n @air_man = false\n @quick_man = false\n @wood_man = false\n @crash_man = false\n @flash_man = false\n @metal_man = false\n @heat_man = false\n end", "def initialize\n @dice = []\n end", "def initialize(sim)\n @sim = sim\n @damage_dealt = 0\n end", "def bake\n @a = rand(100)\n prepare\n flip\n puts \"Baking the cookie\"\n end", "def of_spades\n GamingDice::Card.new(value: self, suit: :spades)\n end", "def initialize(name, height_in_cm, age)\n\t\tputs \"Initializing new dancer instance...\"\n\t\t@name = name\n\t\t@type = \"tango\"\n\t\t@height = height_in_cm\n\t\t@age = age\n\tend", "def start\n # Since I am not doing Deck.new.build, I am building the class itself, not an instance of it\n @cards = Deck.build # as_stubbed_const is what changes the calls from the Deck class to the double\n end", "def initialize(name)\n @name = name\n @lives = 3\n @turn = false\n end", "def flip\n @facing_up = !@facing_up\n self\n end", "def ravel; end", "def strain; end", "def initialize(name, age, skill, fear)\n # self is the instance being created\n @name = name\n @age = age\n @skill = skill\n @fear = fear\n @hair = \"Red\"\n # self.cure()\n end", "def initialize (sleep, frustration, willpower)\n @rested = rested\n @frustration = frustration\n @willpower = willpower\n\n end", "def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end", "def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end", "def initialize\n @shoe = @player_cnt = @dealer = nil\n @num_rounds = @num_shoes = 0\n @num_decks = 1\n @max_players = 4\n @min_bet = 1\n @max_bet = 100\n @bet_increment = 1\n @bankroll = 1000\n @hit_soft_17 = nil\n @even_money_offered = 1 # Hate when casinos don't offer this option\n @players = []\n @broke_players = []\n @io = BlackJackIO.new\n end", "def initialize (name) #when a fish is created in CL ie. f1 = Fish.new('nemo'), this method will autorun, and you have to give it a name\n puts 'new fish is born'\n # health = 10 # local\n @health = 10 # increases to an instance variable\n @speed = 5\n @name = name\n stomach = [ ]\n\n end", "def santa_machine(number)\r\n\t\r\n\texample_genders = [\"male\", \"female\", \"agender\", \"bigender\", \"gender fluid\", \"other\" ]\r\n\texample_ethnicities = [\"black\", \"white\", \"Japanese\", \"lizzard\", \"merpeople\" , \"plant\"]\r\n\tnumber.times do\r\n \t\tsanta = Santa.new(example_genders.sample, example_ethnicities.sample, rand(0..140))\r\n \t\tsanta.reindeer_shuffle\r\n \t\tsanta.about\r\n \t\tend\r\n\r\nend", "def initialize(gender, ethnicity)\n @gender = gender\n @ethnicity = ethnicity\n @age = rand(0..140)\n @reindeer_ranking = ['Rudolph', 'Dasher', 'Dancer', 'Prancer', 'Vixen', 'Comet', 'Cupid', 'Donner', 'Blitzen']\n #puts \"Initializing Santa instance...\"\nend", "def initialize(gender,ethnicity)\n print \"Initializing Santa instance ...\"\n @gender = gender\n @ethnicity = ethnicity\n @reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n @age=0\nend", "def test_brake\n @slow_car.accelerate # accelerate before brake +10\n @slow_car.accelerate # accelerate before brake +10\n @slow_car.brake\n assert_equal(10,@slow_car.speed)\n end", "def brake\n self.speed -= 5\n info\n end", "def brake\n self.speed -= 5\n info\n end", "def initialize\r\n shuffle\r\n end", "def jack_handey; end", "def initialize(player)\n puts \"Welcome to BlackJack!\"\n puts \"#{player.name} you have a balance of: #{player.wallet.amount}\"\n bet(player)\n end", "def initialize(dice)\n @value = rand(dice) + 1\n end", "def class() end", "def initialize\n\t\t@deaf = true\n\tend", "def initialize\n # puts \"Shuffling now!\"\n # puts Kernel.caller\n @cards = self.class.all.shuffle\n end", "def initialize\n @secret_code = Code::random\n @steps = 0\n @guess = nil\n @in_play = true\n end", "def initialize(fan)\n @fan = fan\n end", "def initialize(fan)\n @fan = fan\n end", "def initialize\r\n\t\t# Establish sample array of genders to pick from\r\n\t\tsanta_genders = [\"female\", \"male\", \"cisgender\", \"agender\", \r\n\t\t\t\"bigender\", \"N/A\", \"gender fluid\", \"transgender\"]\r\n\t\t# Establish sample array of ethnicities to pick from\r\n\t\tsanta_ethnicities = [\"Goddess\", \"Latino\", \"Centaur\", \"African-American\",\r\n\t\t\t\"German\", \"American\", \"Canadian\", \"Unicorn\", \"cat lady\", \"white\"]\r\n\t\t# Select random gender from sample genders for new instance\r\n\t\t@gender = santa_genders.sample\r\n\t\t# Select random ethnicity from sample ethnicities for new instance\r\n\t\t@ethnicity = santa_ethnicities.sample\r\n\t\tputs \"Initializing Santa instance...\"\r\n\t\t# Establishes a random age for each instance\r\n\t\t@age = Random.new.rand(140)\r\n\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \r\n\t\t\t\"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\r\n\t\tputs \"This new Santa is a(n) #{@gender} #{@ethnicity} and #{@age}\r\n\t\t\t\tyears old!\"\r\n\tend", "def make_rotting\n if age > 20 # Doesn't use 'self' because we are only reading\n self.rotting = true # Use 'self' because we are setting\n end\n # self.rotting = true if age > 20 <-- One line version\n end", "def test_bear_take_fish\n @bear1 = Bears.new(\"Nate\",\"brown\")\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n @river1.lose_fish(@fish1)\n assert_equal(1,@river1.check_fish)\n assert_equal(1,@bear1.check_stomach)\n end", "def play_dealer_hand(hand)\n\tputs \"stub: play_dealer_hand\"\nend", "def heroine; end", "def initialize(gender, ethnicity)\r\n puts \"Initializing Santa instance\"\r\n puts \"\"\r\n @gender = gender\r\n @ethnicity = ethnicity\r\n @age = 0\r\n\r\n end", "def initialize\n @deck = Array.new\n suits = ['Club', 'Diamond', 'Heart','Spades']\n cards = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']\n suits.each do |suit|\n cards.each do |card|\n @deck << Card.new(suit,card)\n end\n end\n @deck.shuffle!\n end", "def initialize\n @player1 = Player.new\n @player2 = Player.new\n @deck = Deck.new\n end", "def of_diamonds\n GamingDice::Card.new(value: self, suit: :diamonds)\n end", "def battler_flip\n (custom_flip? ? false : @flip)\n end", "def battler_flip\n (custom_flip? ? false : @flip)\n end", "def initialize(fan)\n\n @fan = fan\n end", "def d4\n if self == 1\n GamingDice::Dice.new(faces: 4)\n else\n GamingDice::DicePool.new(\n Array.new(self) { GamingDice::Dice.new(faces: 4) }\n )\n end\n end", "def sandwich\n\t@sandwich ||= Sandwich.new('delicious', [])\nend", "def setup\n @bike = @object = RoadBike.new(tape_color: 'red')\n end", "def initialize(name, breed)\n @name = name\n @breed = breed\n @age = 2\n end", "def dF\n Tabletop::DicePool.new(\"#{self}dF\")\n end", "def main()\n \n obj = RPS.new()\n obj.play_best_of()\n\nend", "def startNewGame ()\n #could have you enter your name\n newGame = Beyond_the_vale.new #this calls the new game class, whose init method calls the first card\nend", "def initialize(santa_number, name, age, cookie_preference, beard_style)\n @santa_number = santa_number # I add this feature so that the list of santas at the end are easier to keep track of\n @name = name.capitalize\n @age = age # unlike in prior releases, in this release I updated age upon initialization\n @cookie_preference = cookie_preference.capitalize\n @beard_style = beard_style.capitalize \n end", "def initialize(sugar=10, flour=15)\n # a Class variable is defined using @@ symbools\n # Every instance of this class and the class itself will have access to this class varaible.\n # use it to share data between instances of a class.\n @@color = 'Brown'\n @sugar = sugar\n @flour = flour\n p \"created a 🍪\"\n p eat\n end", "def create_weapon_show (mirror, x, y, z, angle)\n @spr = Sprite.new\n @spr.bitmap = Cache.character(FalInt::GunSnipe) \n dx = ($game_map.adjust_x($game_player.x)*32 ) + x\n dy = ($game_map.adjust_y($game_player.y)*32 ) + y \n @spr.x = dx \n @spr.y = dy \n @spr.z = z \n @spr.angle = angle \n @spr.mirror = mirror\n @spr.src_rect = Rect.new( 0 , 0 , 29, 10) \n end", "def test_rotate_f\n instance = Pentomino::FPiece.new\n assert_equal(0, instance.data[2][2])\n assert_equal(1, instance.data[0][2])\n instance.rotate!\n assert_equal(1, instance.data[2][2])\n assert_equal(0, instance.data[0][2])\n end", "def new\n @deck = Deck.new\n end", "def witcher; end", "def flip_coin\n @state.flip_coin(self)\n end", "def setup\n @bear = Bear.new(\"Charles\", [])\n\n\n#fish_1 = Fish.new(\"Tuna Turner\") need to define fish first, because you are putting it into the river later\n#@fish_2 = Fish.new(\"Margaret\")\n#fish = [fish_1, fish_2]\n#@river = River.new(\"Forth\", fish)\n#end\n\n end", "def herald; end", "def initialize (gender, ethnicity)\n puts \"initializing santa instance\"\n @gender = gender\n @ethnicity = ethnicity\n @reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \n \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n @age = rand(140)\n end", "def test_turn_putter_fake\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(0,1).eql? \"\\tFound 1 fake ruby in Enumerable Canyon\"\n end", "def init_deck\n @deck = Deck.new\nend", "def initialize\n\t\t@is_blown = false\n\n\t\t@x = @y = @angle = 0\n\tend", "def run #instance method, you chain it to an instance of a Dog\n # binding.pry\n puts \"#{@name} the #{@breed} is running fast as the wind\"\n end", "def sammy(vel)\nend", "def creature; end" ]
[ "0.6045489", "0.603592", "0.60065", "0.59862375", "0.58820945", "0.5873176", "0.5770947", "0.56854844", "0.56636184", "0.56503296", "0.5643422", "0.56414646", "0.5614625", "0.55851483", "0.5565934", "0.556436", "0.5536615", "0.55321133", "0.55316037", "0.55274624", "0.5521608", "0.5520734", "0.5516371", "0.55142665", "0.5488907", "0.5486347", "0.5478336", "0.5478124", "0.5464843", "0.5464571", "0.54569036", "0.5442726", "0.54247427", "0.54153633", "0.5414825", "0.54146874", "0.5413868", "0.5413224", "0.54051286", "0.53762174", "0.5367867", "0.5367161", "0.53635776", "0.5358545", "0.53581", "0.535681", "0.5355939", "0.5355939", "0.53557235", "0.5352336", "0.5352018", "0.53404826", "0.53383094", "0.5332584", "0.5324965", "0.5324965", "0.53194815", "0.5319185", "0.53163105", "0.5304896", "0.5299535", "0.5296087", "0.5288384", "0.52779853", "0.5270974", "0.5270974", "0.52616376", "0.5261043", "0.52595216", "0.5252798", "0.52502936", "0.5248096", "0.52375144", "0.52348715", "0.52330923", "0.5227997", "0.5227997", "0.52268064", "0.52211136", "0.5215689", "0.5213621", "0.5210659", "0.52063483", "0.52015686", "0.5197397", "0.5191553", "0.51915455", "0.51901406", "0.51870215", "0.5180304", "0.51780206", "0.5174692", "0.5173651", "0.51718366", "0.5168029", "0.51672566", "0.5162714", "0.5161244", "0.51590765", "0.5157368", "0.5153526" ]
0.0
-1
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: split argument string into individual items add items to a hash and add a quantity set default quantity to 1 print the list to the console [can you use one of your other methods here?] output: hash of items and quantities Method to add an item to a list input: item name and quantity and list steps: add the item and quantity to the list output: updated list with new item and quantity Method to remove an item from the list input: item name and list steps: remove the item and its quantity from the list output: updated list with item removed Method to update the quantity of an item input: item name and new quantity and list steps: update item's quantity with new quantity output: updated list with updated quantity Method to print a list and make it look pretty input: list hash steps: printing out the list output: printed list
def create_list(items) list = {} items = items.split(' ') items.each do |item| list[item] = 1 end print_list(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(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, 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 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 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 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 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_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 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(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 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(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 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 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 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_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 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 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 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 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 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 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 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 input (list, item, quantity)\n\tlist[item] = quantity\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, quantity = 0)\n list = {}\n items = items_string.split(\" \")\n items.each do |item|\n list[item] = quantity\n end\n 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,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 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 initial_list(string_of_items)\n grocery_list = {}\n quantity = 1\n items_array = string_of_items.split(\" \")\n items_array.each do |item|\n grocery_list.store(item, quantity)\n end\n grocery_list\nend", "def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend", "def add(input_list, item, quantity)\n input_list[item] = quantity\nend", "def create_list(list_name,list_of_items)\n # create empty array\n list_name = []\n # for each item in string, use add item method to add item to grocery list (set default quantity to 1)\n shopping_items = list_of_items.split(' ')\n shopping_items.each do |thing_to_add|\n add_item_to_list(list_name,thing_to_add,1)\n end\n # print the list to the console\n print_list(list_name)\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 create_list(item, quantity = 1)\n\tlist = {}\n\tsplit_item = item.split(\" \")\n\tsplit_item.each do |item_name|\n\t\tlist[item_name] = quantity\n\tend\n\treturn 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(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend", "def add_item(item, quantity, list)\r\n list[item] = quantity\r\n p list\r\n list\r\nend", "def new_list(item_String, quantity = 1)\n $list = []\n array_strings = item_String.split\n array_strings.each do |element|\n \tlist_item = {\n \t\tquantity: quantity,\n \t\titem: element\n \t}\n \t $list.push(list_item) \n \tend\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 create_list(items)\n\tlist = {}\n\titems = items.split(' ')\n\tquantity = 0\n\tlist = Hash.new\n\n\titems.each do |item| \n\t\tlist[item] = quantity\n\tend\n\tlist\nend", "def add_items(list, item_name, quantity=0)\r\n\tlist[item_name] = quantity\r\n\tlist\r\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(name, quantity, list)\n list[name] = quantity\n p list\n return list\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\tlist[item] = quantity\n\tp list\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(item, quantity, list)\n\tlist[item] = quantity\n\titem\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_item(list, item, quantity)\n list[item] = quantity\n p list\nend", "def list_create(items)\n hash_items = Hash.new\n default_quantity = 1\n\n # adding a slick way to initialize hash in one line, but not as readable\n # return items.split(' ').product([1]).to_h\n\n items.split(' ').each do |x|\n hash_items[x] = default_quantity\n end\n\n return hash_items\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 add_item(item,quantity,list)\n\tlist[item] = quantity\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(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 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_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def list_maker(items, *quantities)\r\n list_hash = {}\r\n list_array = items.split(' ')\r\n for i in 0..(list_array.length - 1)\r\n list_hash[list_array[i]] = quantities[i]\r\n end\r\n list_hash.map do |item, quantity|\r\n if quantity == nil \r\n list_hash[item] = 1 \r\n end\r\n end\r\n list_hash\r\nend", "def create_list(items, quantity=1)\r\n item_array = items.split(' ')\r\n item_hash = {}\r\n item_array.each do |items|\r\n item_hash[items] = quantity\r\n end \r\n p item_hash # p will both print and return # puts will print but will not return. It will return nil.\r\nend", "def add_new_items(list, item_name, quantity=1)\n list[item_name] = 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, quantity)\n list[item] = quantity\n list\nend", "def add_item(item, quantity=1, hash)\n# get item name and quantity\n# if there's no quantity, set it to 1\n\thash[item] = quantity\n\t# output: return the hash with updated key/value pairs\n\thash\nend", "def add_item(hash_list, new_item, quantity = 1)\n hash_list[new_item] = quantity\n p hash_list\nend", "def list_add(hash_items, item_name, quantity = 1)\n hash_items [item_name] = quantity\n return hash_items\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 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 add_item(item,quantity,first_list)\n if quantity == \"\"\n quantity = 1\n else\n quantity\n end\n first_list[item] = quantity\n\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(list, item, qty)\n list[item] = qty\n p list\nend", "def add_item(input_hash, item, qty = 0)\n# steps: use input item as key and input quantity as value \n input_hash[item] = qty\n# output: hash data structure of key/value pairs\n return input_hash\nend", "def add_list(item_name, item_list, quantity = 1)\n item_list[item_name] = quantity\nend", "def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \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 add(list, item, quantity)\r\n\tlist[item] = quantity\r\n\tlist\r\nend", "def add_item(item, list, quantity)\n list[item] = quantity\nend", "def create_a_list(name, quantity)\n #list = name.split(\", \")\n list_items = {}\n #list.each do |name|\n list_items[name] = quantity\n #end\n p list_items\n return list_items\nend", "def add_item(list, item, qty)\n list[item] = qty\n list\nend", "def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend", "def add_item(new_list, item_name, quantity=1)\r\n \r\n new_list[item_name] = quantity\r\n \r\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 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", "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 update_quantity(thingtochange)\n userinputarray=thingtochange.split(\",\")\n $list_hash.each do|current_item, qty| \n if current_item==userinputarray[0]\n $list_hash[current_item]=userinputarray[1]\n else\n end\n end\nend", "def add_item\n print \"What's the name of the item you would like to add?: \"\n name_of_item = gets.chomp\n puts \"\"\n # hash = {\"item name\"=> name_of_item}\n print \"Quantity: \"\n quantity = gets.chomp.to_i\n return [name_of_item, quantity]\nend", "def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend", "def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend", "def create_list(list)\n quantity = 1\n items = list.split(' ')\n grocery_list = { }\n\n items.each do |item|\n grocery_list[item] = quantity\n end\n grocery_list\nend", "def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend", "def list_add(list, item_name, quantity=1)\n list[item_name] = quantity\n p list\nend", "def shopping_list(string)\n\tgrocery_list = {}\n# steps: \n \t# separate string into array\n\tarray = string.split(' ')\n\t# loop through array to create hash with items in array as key and set default quantity to \"\"\n\tarray.map {|item| grocery_list[item] = \"\"}\n\t# print the list to the console [can you use one of your other methods here?]\n\t# output: [what data type goes here, array or hash?]\n\tputs grocery_list\n\treturn grocery_list\nend", "def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend", "def update_quantity_in_grocery_list(grocery_list, item_name, quantity)\n # steps: update quantity for item\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend", "def add_to_list(item,quantity,list)\n list[item]=quantity\nend", "def add(list, item, quantity)\r\n list[item] = quantity\r\n list\r\n\r\nend", "def add_item(shopping_list, item, quantity)\r\n\tshopping_list[item] = quantity\r\n\tshopping_list\r\nend" ]
[ "0.8167329", "0.7865558", "0.78439903", "0.78076077", "0.773816", "0.77037245", "0.7603531", "0.7583702", "0.75516015", "0.754918", "0.7519986", "0.750515", "0.7387811", "0.73566127", "0.73363376", "0.7333697", "0.7318244", "0.7307333", "0.726541", "0.72204775", "0.71956116", "0.7194179", "0.71636456", "0.71289223", "0.71196777", "0.7118409", "0.7101231", "0.7081127", "0.70720667", "0.70515627", "0.7045696", "0.70121014", "0.7005827", "0.70051044", "0.70032203", "0.69895065", "0.69767076", "0.69709563", "0.69677925", "0.69661534", "0.69633144", "0.69561064", "0.6940929", "0.6940662", "0.6927024", "0.6926713", "0.6925375", "0.6925331", "0.6921662", "0.6916397", "0.69078964", "0.69069356", "0.69043547", "0.6900775", "0.6900775", "0.6898245", "0.6895484", "0.6888245", "0.6885413", "0.68839765", "0.6883255", "0.6880514", "0.6880062", "0.6877175", "0.6875575", "0.6869727", "0.68691164", "0.6858671", "0.6846297", "0.68402225", "0.6828654", "0.68110794", "0.68096703", "0.68051475", "0.68038464", "0.679936", "0.67909646", "0.6790772", "0.6788318", "0.67877555", "0.6785713", "0.678483", "0.67814404", "0.67806387", "0.67799634", "0.67799634", "0.6777265", "0.6770467", "0.6767192", "0.67640156", "0.67583734", "0.67577684", "0.67503774", "0.67481196", "0.6746099", "0.6740103", "0.6738028", "0.6734164", "0.6728552", "0.6726597", "0.6721053" ]
0.0
-1
GET /dests GET /dests.json
def index @current_date = Date.today dated_params = {} @dests = Dest.all if params[:search].present? @dests = @dests.search(params[:search]) end if params[:closed] != 'true' @dests = @dests.non_closed end if params[:dest_type].present? @dests = @dests.where(dest_type: params[:dest_type]) end case params[:provisional]&.to_sym when :exclude @dests = @dests.where(provisional: false) when :only @dests = @dests.where(provisional: true) end if params[:company_id].present? @dests = @dests.where(company_id: params[:company_id]) end if params[:prefecture].present? @dests = @dests.where(prefecture: params[:prefecture]) end if params[:area_id].present? dated_params[:area_id] = params[:area_id] end # @dests = @dests.eager_load(:dest_dated_values) @dests = @dests.with_dated_values(@current_date, dated_params) if dated_params.present? @dests = @dests.page(params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\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 = ['Token']\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 => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end", "def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def index\n @destinations = Destination.all\n end", "def dest_get\n db_select 'destination'\n end", "def destinations\n @destinations ||= []\n end", "def index\n @destinations = current_user.destinations\n end", "def index\n query = params[:q].presence || \"*\"\n @destinations = Destination.search(query)\n end", "def dresses\n render json: { collections: Collection.published_dresses }\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def destinations\n bookmarks = @medium.manuscript.metadata['bookmarks'] || []\n bookmarks.map { |b| b['destination'] }\n end", "def index\n #@destinations = Destination.all\n\n if params[:name]\n @destinations = Destination.find_all_by_name(params[:name])\n else\n @destinations = Destination.all\n end\n\n @json = @destinations.to_gmaps4rails do |destination, marker|\n marker.infowindow render_to_string(:partial => \"/destinations/infowindow\",\n :locals => { :destination => destination})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def dlist\n @dests.keys\n end", "def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def create\n @dest = Dest.new(dest_params)\n\n respond_to do |format|\n if @dest.save\n format.html { redirect_to dests_path, notice: 'Dest was successfully created.' }\n format.json { render :show, status: :created, location: @dest }\n else\n format.html { render :new }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\r\n @destinations = Destination.all\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end", "def index\n @destination = Destination.new\n set_destinations\n end", "def show\n @destinations = [@destination]\n @trips = @destination.trips.order(:arrived_on).reverse\n @venues = @destination.venues.order(:name)\n @posts = @destination.posts.order(:created_at).reverse\n end", "def destroy\n @dest.destroy\n respond_to do |format|\n format.html { redirect_to dests_url, notice: 'Dest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destination(dest)\n @destination ||= {}\n @destination[dest] ||= begin\n path = site.in_dest_dir(dest, URL.unescape_path(url))\n path = File.join(path, \"index\") if url.end_with?(\"/\")\n path << output_ext unless path.end_with? output_ext\n path\n end\n end", "def index\r\n @destinations = Destination.order(\"ancestry ASC\").page(params[:page])\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @destinations }\r\n end\r\n end", "def set_dest\n @dest = Dest.find(params[:id])\n end", "def index\n @travel_destinations = TravelDestination.all\n end", "def index\n @user = current_user\n @destinations = Destination.search(params[:search])\n end", "def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend", "def index\n respond_with(sources)\n end", "def parse_dest(dest)\n case dest\n when Array\n dest.map { |address| parse_address(address) }\n else\n parse_address(dest)\n end\n end", "def show\n @destination = Destination.find(params[:id])\n setup_show_data\n\n client = TwitterHelper.get_client\n @twitter_data = client.search(\"to: #{@destination.city}, travel\", :result_type => \"recent\").take(3)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def active_remote_destinations; end", "def update\n respond_to do |format|\n if @dest.update(dest_params)\n format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' }\n format.json { render :show, status: :ok, location: @dest }\n else\n format.html { render :edit }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @line_destinations = LineDestination.all\n end", "def http_pull(dest_url)\n res = Net::HTTP.get_response(URI.parse(dest_url))\n self.fetched = res.body\n end", "def destination(dest); end", "def destination(dest); end", "def show\n @destination = Destination.find(params[:id])\n @rentals = @destination.rentals\n\n @json = @destination.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def get_destination_with_http_info(project_key, environment_key, destination_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.get_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.get_destination\"\n end\n # verify the required parameter 'destination_id' is set\n if @api_client.config.client_side_validation && destination_id.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_id' when calling DataExportDestinationsApi.get_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}/{destinationId}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'destinationId' + '}', destination_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 = ['Token']\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 => 'Destination')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def download(boards_json, destination, dry_run=false)\n content = @files_and_json.from_file(boards_json)\n email = content[\"leankit\"][\"email\"]\n password = content[\"leankit\"][\"password\"]\n account = content[\"leankit\"][\"account\"]\n\n board_locations = []\n content[\"boards\"].each do |board|\n if !dry_run\n board_locations << download_board(destination, email, password, account, board[0])\n else\n board_location = File.join(destination, board[0])\n if File.exist?(board_location)\n board_locations << board_location\n end\n end\n end\n board_locations\n end", "def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end", "def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end", "def index\n @consultant_customer_destinations = ConsultantCustomerDestination.all\n end", "def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend", "def index\n @destination_linksets = DestinationLinkset.all\n end", "def all\n render json: Url.all\n end", "def index\n @destination_types = DestinationType.all\n end", "def destinations\n [to_addrs, cc_addrs, bcc_addrs].compact.flatten\n end", "def show\n @copy_target = CopyTarget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @copy_target }\n end\n end", "def index\n @transfers = Transfer.all\n render json: @transfers\n end", "def get(destination)\n @rest_logger.info \"#{__method__.to_s.upcase} #{delay}\\t \" +\n \"#{self.class.get_href(destination)}\"\n sleep(delay)\n response = @site[get_nested_resource(destination)].get(\n Accept: ACCEPT,\n cookies: @cookies)\n @rest_logger.debug(response)\n wrap_response(response)\n end", "def gather\n if File.exist?(@location_dir) && File.directory?(@location_dir)\n if Dir.glob(File.join(@location_dir, '*')).size > 0 # avoid creating the dest directory if the source dir is empty\n unless File.exists? @destination_dir\n FileUtils.mkpath @destination_dir\n end\n @files.each do |f|\n Dir.glob(File.join(@location_dir, f)).each do |file|\n FileUtils.cp_r file, @destination_dir\n end\n end\n end\n else\n puts \"Error: #{@location_dir}, doesn't exist or not a directory\"\n end\n end", "def show\n\t\t@destination = Destination.find(params[:id])\n\t\t@itineraries = @destination.itineraries\n\t\tobject = {:destination => @destination, :itineraries => @itineraries}\n\t\tputs object\n\t\trespond_with @destination, object\n\tend", "def index\n @users = ::FindUsersForDestinationService.call(destination_id_params)\n end", "def index\n @relay_destinations = @relay.relay_destinations.order(base_url: :asc).all\n end", "def locations\n get('locations')\n end", "def destroy\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def list_assets\n get('/video/v1/assets')\n end", "def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end", "def show\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end", "def copy_and_move_info(request)\n # Collecting the relevant HTTP headers\n unless request.header('Destination')\n fail Exception::BadRequest, 'The destination header was not supplied'\n end\n\n destination = calculate_uri(request.header('Destination'))\n overwrite = request.header('Overwrite')\n\n overwrite = 'T' unless overwrite\n if overwrite.upcase == 'T'\n overwrite = true\n elsif overwrite.upcase == 'F'\n overwrite = false\n else\n # We need to throw a bad request exception, if the header was invalid\n fail Exception::BadRequest, 'The HTTP Overwrite header should be either T or F'\n end\n\n (destination_dir,) = Http::UrlUtil.split_path(destination)\n\n begin\n destination_parent = @tree.node_for_path(destination_dir)\n\n unless destination_parent.is_a?(ICollection)\n fail Exception::UnsupportedMediaType, 'The destination node is not a collection'\n end\n rescue Exception::NotFound => e\n # If the destination parent node is not found, we throw a 409\n raise Exception::Conflict, 'The destination node is not found'\n end\n\n begin\n destination_node = @tree.node_for_path(destination)\n\n # If this succeeded, it means the destination already exists\n # we'll need to throw precondition failed in case overwrite is false\n unless overwrite\n fail Exception::PreconditionFailed, 'The destination node already exists, and the overwrite header is set to false', 'Overwrite'\n end\n rescue Exception::NotFound => e\n # Destination didn't exist, we're all good\n destination_node = false\n end\n\n request_path = request.path\n if destination == request_path\n fail Exception::Forbidden, 'Source and destination uri are identical.'\n end\n if destination[0..request_path.length] == request_path + '/'\n fail Exception::Conflict, 'The destination may not be part of the same subtree as the source path.'\n end\n\n # These are the three relevant properties we need to return\n {\n 'destination' => destination,\n 'destinationExists' => !!destination_node,\n 'destinationNode' => destination_node\n }\n end", "def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\[email protected](File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end", "def dest; end", "def shortest_paths(source, dest)\n\t\t\t@source = source\n\t\t\tdijkstra source\n\t\t\tprint_path dest\n\t\t\treturn @distance[dest]\n\t\tend", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dir, @name )\n# path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def find_by_url\n @postings = SlashdotPosting.includes(:urls).where(urls: { target_url: params[:url] })\n render json: @postings\n end", "def shortest_path( dest, exclusions = [] )\n exclusions ||= []\n previous = shortest_paths( exclusions )\n s = []\n u = dest.hex\n while previous[ u ]\n s.unshift u\n u = previous[ u ]\n end\n s\n end", "def destinations(object, coord = nil)\n if coord\n AssociationMap.get_associated_data(object, DESTINATION, coord: opts[:coord])\n else\n AssociationMap.get_associated_data(object, DESTINATION)\n end\n end", "def destination\n @destination\n end", "def destination\n @destination\n end", "def get_destination_ids\n destination_ids = []\n get_choices.each do |choice|\n destination_ids << choice.destination_id\n end\n destination_ids\n end", "def index\n @origins = Origin.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @origins }\n end\n end", "def destination\r\n @destination\r\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dest_dir, @dest_name )\n path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end", "def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def index\n @dest_notes = DestNote.all\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def index\n locations = Location.all\n render json: locations\n end", "def read_all dest\n temp_dest = inflate_adapter(dest)\n\n @socket.read_all temp_dest\n end", "def urls\n @gapi.source_uris\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def download_all_files files,dest\n return if files.empty?\n RubyUtil::partition files do |sub|\n cmd = \"mv -t #{dest} \"\n cmd += sub.map { |f| \"\\\"#{f.full_path}\\\"\" }.join(' ')\n exec_cmd(cmd) \n end\n # update files object !\n files.map! { |f| f.path = dest; f }\n end", "def shortest_paths(dest)\n position = dest\n final = {}\n analisados = {}\n route = []\n route << dest\n @previous['a'] = -1\n\n @nodes.each do |n|\n analisados[n] = false\n end\n analisados[position] = true\n\n while analisados(analisados)\n adyacentes(position, analisados).each do |n|\n if @distance[n] == (@distance[position] - graph[n][position])\n @previous[position] = n\n position = n\n route << n\n end\n analisados[n] = true\n end\n\n end\n route << 'a'\n route\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def notifications_dsts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NotificationsApi.notifications_dsts_get ...'\n end\n # resource path\n local_var_path = '/notifications/dsts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'NotificationsResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotificationsApi#notifications_dsts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(*dests)\n texts = dests.map {|dest|\n dest = dest[0] if dest.size == 1\n if dest.is Array\n if file = dest.find {|f| File.file?(f.tr '\\\\', '/')}\n File.open(file.tr('\\\\', '/'), File::RDONLY) {|f| f.read}\n else\n warn \"couldn't read from neither #{dest[0].inspect} nor #{dest[1..-1].inspects*' nor '}; files missed (called from #{caller[2]})\"\n end\n else\n if File.file? dest.tr('\\\\', '/')\n File.open(dest.tr('\\\\', '/'), File::RDONLY) {|f| f.read}\n else\n warn \"couldn't read from #{dest.inspect}; file missed (called from #{caller[2]})\"\n end\n end\n }\n texts = texts[0] if texts.size == 1\n texts\n end", "def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def index\n @copies = Copy.all\n end", "def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end", "def destroy\n @destination = @organism.destinations.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_organism_destinations_url }\n format.json { head :ok }\n end\n end", "def list_all_shards(args = {}) \n get(\"/shards.json/\", args)\nend", "def copy(url, dest, headers = {})\n headers['Destination'] = dest\n request(:copy, url, headers)\n end", "def index\n @check_ins = CheckIn.all\n @destinations = Destination.all\n end", "def each_dest(&block)\n return enum_for(:each_dest) unless block_given?\n\n if @dest.kind_of?(Array)\n @dest.each(&block)\n elsif @dest\n yield @dest\n end\n end" ]
[ "0.6765999", "0.6590646", "0.6536768", "0.62608045", "0.6174211", "0.6096379", "0.60765", "0.6011723", "0.5873201", "0.5846921", "0.58293825", "0.5818351", "0.57498866", "0.57114655", "0.57114655", "0.5612621", "0.56081426", "0.55852884", "0.5585032", "0.5548711", "0.5530836", "0.551431", "0.55107796", "0.5489077", "0.5443975", "0.54353493", "0.5411718", "0.53993344", "0.53877103", "0.53795016", "0.5372559", "0.53465784", "0.5297898", "0.5291987", "0.5291987", "0.52870107", "0.52665156", "0.5254689", "0.52420825", "0.52234674", "0.52020836", "0.5168776", "0.5157309", "0.5151784", "0.51380324", "0.51182735", "0.5115233", "0.5112814", "0.5112414", "0.51113755", "0.5106932", "0.51057404", "0.5085546", "0.5081251", "0.5064553", "0.50579214", "0.5049596", "0.504799", "0.50347495", "0.50304234", "0.5018805", "0.50178266", "0.5012662", "0.50053656", "0.49777174", "0.49767303", "0.49735397", "0.49731597", "0.49729255", "0.49633944", "0.49633944", "0.49560395", "0.4942586", "0.49366927", "0.4932832", "0.49327648", "0.49102968", "0.4907615", "0.4900974", "0.48905566", "0.48900142", "0.48790923", "0.48785925", "0.48785925", "0.48785925", "0.48762363", "0.48754174", "0.48717484", "0.48621544", "0.48573014", "0.48564962", "0.4856438", "0.4852956", "0.4841109", "0.48409393", "0.4831748", "0.48283646", "0.48270753", "0.48191532", "0.48177132" ]
0.56140816
15
GET /dests/1 GET /dests/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\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 = ['Token']\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 => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def dest_get\n db_select 'destination'\n end", "def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def set_dest\n @dest = Dest.find(params[:id])\n end", "def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def index\n @destinations = Destination.all\n end", "def create\n @dest = Dest.new(dest_params)\n\n respond_to do |format|\n if @dest.save\n format.html { redirect_to dests_path, notice: 'Dest was successfully created.' }\n format.json { render :show, status: :created, location: @dest }\n else\n format.html { render :new }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\r\n @destinations = Destination.all\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end", "def update\n respond_to do |format|\n if @dest.update(dest_params)\n format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' }\n format.json { render :show, status: :ok, location: @dest }\n else\n format.html { render :edit }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def destroy\n @dest.destroy\n respond_to do |format|\n format.html { redirect_to dests_url, notice: 'Dest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @copy_target = CopyTarget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @copy_target }\n end\n end", "def index\n @destinations = current_user.destinations\n end", "def destination(dest)\n @destination ||= {}\n @destination[dest] ||= begin\n path = site.in_dest_dir(dest, URL.unescape_path(url))\n path = File.join(path, \"index\") if url.end_with?(\"/\")\n path << output_ext unless path.end_with? output_ext\n path\n end\n end", "def get_destination_with_http_info(project_key, environment_key, destination_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.get_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.get_destination\"\n end\n # verify the required parameter 'destination_id' is set\n if @api_client.config.client_side_validation && destination_id.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_id' when calling DataExportDestinationsApi.get_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}/{destinationId}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'destinationId' + '}', destination_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 = ['Token']\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 => 'Destination')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destination(dest); end", "def destination(dest); end", "def index\n @destination = Destination.new\n set_destinations\n end", "def index\n #@destinations = Destination.all\n\n if params[:name]\n @destinations = Destination.find_all_by_name(params[:name])\n else\n @destinations = Destination.all\n end\n\n @json = @destinations.to_gmaps4rails do |destination, marker|\n marker.infowindow render_to_string(:partial => \"/destinations/infowindow\",\n :locals => { :destination => destination})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def index\n query = params[:q].presence || \"*\"\n @destinations = Destination.search(query)\n end", "def show\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end", "def http_pull(dest_url)\n res = Net::HTTP.get_response(URI.parse(dest_url))\n self.fetched = res.body\n end", "def dest; end", "def destinations\n @destinations ||= []\n end", "def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def index\n @current_date = Date.today\n dated_params = {}\n @dests = Dest.all\n if params[:search].present?\n @dests = @dests.search(params[:search])\n end\n if params[:closed] != 'true'\n @dests = @dests.non_closed\n end\n if params[:dest_type].present?\n @dests = @dests.where(dest_type: params[:dest_type])\n end\n case params[:provisional]&.to_sym\n when :exclude\n @dests = @dests.where(provisional: false)\n when :only\n @dests = @dests.where(provisional: true)\n end\n if params[:company_id].present?\n @dests = @dests.where(company_id: params[:company_id])\n end\n if params[:prefecture].present?\n @dests = @dests.where(prefecture: params[:prefecture])\n end\n if params[:area_id].present?\n dated_params[:area_id] = params[:area_id]\n end\n # @dests = @dests.eager_load(:dest_dated_values)\n @dests = @dests.with_dated_values(@current_date, dated_params) if dated_params.present?\n @dests = @dests.page(params[:page])\n end", "def show\n @destination = Destination.find(params[:id])\n setup_show_data\n\n client = TwitterHelper.get_client\n @twitter_data = client.search(\"to: #{@destination.city}, travel\", :result_type => \"recent\").take(3)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def show\n @destinations = [@destination]\n @trips = @destination.trips.order(:arrived_on).reverse\n @venues = @destination.venues.order(:name)\n @posts = @destination.posts.order(:created_at).reverse\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dest_dir, @dest_name )\n path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def destroy\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def dest\n param(0)\n end", "def parse_dest(dest)\n case dest\n when Array\n dest.map { |address| parse_address(address) }\n else\n parse_address(dest)\n end\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dir, @name )\n# path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def show\n @destination = Destination.find(params[:id])\n @rentals = @destination.rentals\n\n @json = @destination.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "def dlist\n @dests.keys\n end", "def destination\n @destination\n end", "def destination\n @destination\n end", "def dresses\n render json: { collections: Collection.published_dresses }\n end", "def show\n\t\t@destination = Destination.find(params[:id])\n\t\t@itineraries = @destination.itineraries\n\t\tobject = {:destination => @destination, :itineraries => @itineraries}\n\t\tputs object\n\t\trespond_with @destination, object\n\tend", "def destination\r\n @destination\r\n end", "def get(destination)\n @rest_logger.info \"#{__method__.to_s.upcase} #{delay}\\t \" +\n \"#{self.class.get_href(destination)}\"\n sleep(delay)\n response = @site[get_nested_resource(destination)].get(\n Accept: ACCEPT,\n cookies: @cookies)\n @rest_logger.debug(response)\n wrap_response(response)\n end", "def active_remote_destinations; end", "def index\r\n @destinations = Destination.order(\"ancestry ASC\").page(params[:page])\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @destinations }\r\n end\r\n end", "def index\n respond_with(sources)\n end", "def index\n @travel_destinations = TravelDestination.all\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def index\n @line_destinations = LineDestination.all\n end", "def copy_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n response = {}\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.copy_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n response[:error] = \"Copy failed\" \n render json: response, status: 422\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def copy_and_move_info(request)\n # Collecting the relevant HTTP headers\n unless request.header('Destination')\n fail Exception::BadRequest, 'The destination header was not supplied'\n end\n\n destination = calculate_uri(request.header('Destination'))\n overwrite = request.header('Overwrite')\n\n overwrite = 'T' unless overwrite\n if overwrite.upcase == 'T'\n overwrite = true\n elsif overwrite.upcase == 'F'\n overwrite = false\n else\n # We need to throw a bad request exception, if the header was invalid\n fail Exception::BadRequest, 'The HTTP Overwrite header should be either T or F'\n end\n\n (destination_dir,) = Http::UrlUtil.split_path(destination)\n\n begin\n destination_parent = @tree.node_for_path(destination_dir)\n\n unless destination_parent.is_a?(ICollection)\n fail Exception::UnsupportedMediaType, 'The destination node is not a collection'\n end\n rescue Exception::NotFound => e\n # If the destination parent node is not found, we throw a 409\n raise Exception::Conflict, 'The destination node is not found'\n end\n\n begin\n destination_node = @tree.node_for_path(destination)\n\n # If this succeeded, it means the destination already exists\n # we'll need to throw precondition failed in case overwrite is false\n unless overwrite\n fail Exception::PreconditionFailed, 'The destination node already exists, and the overwrite header is set to false', 'Overwrite'\n end\n rescue Exception::NotFound => e\n # Destination didn't exist, we're all good\n destination_node = false\n end\n\n request_path = request.path\n if destination == request_path\n fail Exception::Forbidden, 'Source and destination uri are identical.'\n end\n if destination[0..request_path.length] == request_path + '/'\n fail Exception::Conflict, 'The destination may not be part of the same subtree as the source path.'\n end\n\n # These are the three relevant properties we need to return\n {\n 'destination' => destination,\n 'destinationExists' => !!destination_node,\n 'destinationNode' => destination_node\n }\n end", "def dest_path\n @dest_path ||= remote_path.sub(/^~\\//, '').sub(/\\/$/, '')\n end", "def new\n @destination = Destination.new\n @destination.build_dest_image\n\n respond_to do |format|\n format.html # _new.html.erb\n format.json { render json: @destination }\n end\n end", "def destinations\n bookmarks = @medium.manuscript.metadata['bookmarks'] || []\n bookmarks.map { |b| b['destination'] }\n end", "def copy(url, dest, headers = {})\n headers['Destination'] = dest\n request(:copy, url, headers)\n end", "def url_for dest, params={}\n\t\t\t\tcase dest\n\t\t\t\twhen :index, nil, false\n\t\t\t\t\tdest = {}\n\t\t\t\twhen String\n\t\t\t\t\tdest = {id: dest}\n\t\t\t\twhen Numeric, Symbol\n\t\t\t\t\tdest = {id: dest}\n\t\t\t\twhen Hash\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\t# convert dest.id and dest[:id] to their actual :id value.\n\t\t\t\t\tdest = {id: (dest.id rescue false) || (raise TypeError, \"Expecting a Symbol, Hash, String, Numeric or an object that answers to obj[:id] or obj.id\") }\n\t\t\t\tend\n\t\t\t\t::Plezi::Base::HTTPRouter.url_for self, dest, params\n\t\t\tend", "def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end", "def destroy\n @destination = @organism.destinations.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_organism_destinations_url }\n format.json { head :ok }\n end\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def index\n @user = current_user\n @destinations = Destination.search(params[:search])\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "def dest\n self[:ip_dest]\n end", "def new\n @copy_target = CopyTarget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @copy_target }\n end\n end", "def index\n @destination_types = DestinationType.all\n end", "def index\n @consultant_customer_destinations = ConsultantCustomerDestination.all\n end", "def destination\n @attributes[:destination]\n end", "def create\n\t\trespond_with Destination.create(destination_params)\n\tend", "def copy_and_convert_images\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n source_type = params[:source_type]\n dest_type = params[:dest_type]\n quality = params[:quality]\n size = params[:size]\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_and_convert_files_to(dest_dir, source_type, dest_type, quality, size)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n\n end", "def download_resource(src_url,dest_path,content_type)\n begin \n content = open(src_url).read\n basename = Pathname.new(src_url).basename.to_s.gsub(/\\..*/,'')\n vortex_url = dest_path + basename + \".\" + content_type\n vortex_url = vortex_url.downcase\n begin\n @vortex.put_string(vortex_url, content)\n puts \"Copying resource: \" + src_url + \" => \" + vortex_url\n @log = @log + \"Copying resource: \" + src_url + \" => \" + vortex_url + \"<br>\\n\"\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url: \" + vortex_url\n exit\n end\n return vortex_url\n rescue\n puts \"WARNING could not open file \" + src_url\n @log = @log + \"WARNING could not open file \" + src_url + \"<br>\\n\"\n return nil\n end\nend", "def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end", "def get_path(dest,path)\n if @prev[dest] != -1\n path += get_path(@prev[dest],\"\")\n end\n path += \">#{dest}\"\n end", "def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end", "def sources_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_get\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def shortest_paths(source, dest)\n\t\t\t@source = source\n\t\t\tdijkstra source\n\t\t\tprint_path dest\n\t\t\treturn @distance[dest]\n\t\tend", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename\n File.join(dest, CGI.unescape(full_url))\n end", "def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename\n path = Jekyll.sanitized_path(dest, CGI.unescape(url))\n path = File.join(path, 'index.html') if path[/\\.html$/].nil?\n path\n end", "def new\n @destination = @organism.destinations.new\n @destination.sector_id = @organism.sectors.first.id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def set_destination\n @destination = Destination.find(params[:id])\n end", "def set_destination\n @destination = Destination.find(params[:id])\n end", "def set_destination\n @destination = Destination.find(params[:id])\n end", "def new\n @empty_packs_destination_move = EmptyPacksDestinationMove.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @empty_packs_destination_move }\n end\n end", "def fullDestPath(destPath)\n\t'generated/' + destPath\nend", "def new\n @destination = Destination.new user: current_user, city: request.location.city\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def get_destination(project_key, environment_key, destination_id, opts = {})\n data, _status_code, _headers = get_destination_with_http_info(project_key, environment_key, destination_id, opts)\n data\n end", "def notifications_dsts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NotificationsApi.notifications_dsts_get ...'\n end\n # resource path\n local_var_path = '/notifications/dsts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'NotificationsResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotificationsApi#notifications_dsts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def shortest_path( dest, exclusions = [] )\n exclusions ||= []\n previous = shortest_paths( exclusions )\n s = []\n u = dest.hex\n while previous[ u ]\n s.unshift u\n u = previous[ u ]\n end\n s\n end", "def show\n @destination_type = DestinationType.find(params[:id])\n end", "def destination_path\n staged_path\n end", "def top_flight_destinations_with_http_info(apikey, period, origin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.top_flight_destinations ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.top_flight_destinations\" if apikey.nil?\n # verify the required parameter 'period' is set\n fail ArgumentError, \"Missing the required parameter 'period' when calling DefaultApi.top_flight_destinations\" if period.nil?\n # verify the required parameter 'origin' is set\n fail ArgumentError, \"Missing the required parameter 'origin' when calling DefaultApi.top_flight_destinations\" if origin.nil?\n # resource path\n local_var_path = \"/travel-intelligence/top-destinations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'period'] = period\n query_params[:'origin'] = origin\n query_params[:'number_of_results'] = opts[:'number_of_results'] if !opts[:'number_of_results'].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 = []\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 => 'TopDestinationsSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#top_flight_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def index\n @transfers = Transfer.all\n render json: @transfers\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6643287", "0.6525208", "0.6348897", "0.6179377", "0.6146276", "0.6146276", "0.6044886", "0.5998754", "0.58969504", "0.586379", "0.58577955", "0.5857759", "0.5842001", "0.58083284", "0.5764811", "0.57331073", "0.5726444", "0.5722374", "0.5722374", "0.5704181", "0.5652182", "0.5642368", "0.55136263", "0.5482877", "0.5472008", "0.5468404", "0.5434832", "0.5431216", "0.5429982", "0.54136276", "0.5388683", "0.5370548", "0.537", "0.53690255", "0.53630924", "0.53606474", "0.5355638", "0.53407854", "0.5325052", "0.5325052", "0.5324907", "0.5311609", "0.53052896", "0.5290922", "0.5244201", "0.52356404", "0.52343875", "0.52328813", "0.52186275", "0.5196675", "0.5184858", "0.5165718", "0.5165718", "0.5165718", "0.51653236", "0.51616573", "0.5158041", "0.5146592", "0.5125494", "0.5107088", "0.5085255", "0.50709707", "0.50553834", "0.5030789", "0.5030789", "0.502861", "0.50239956", "0.499386", "0.49869514", "0.49844164", "0.49784395", "0.49762842", "0.496923", "0.49674937", "0.49627092", "0.49593014", "0.49535146", "0.49534827", "0.49506587", "0.4941615", "0.49405503", "0.49379304", "0.4933181", "0.49240336", "0.49239552", "0.49239552", "0.49239552", "0.4920121", "0.4911034", "0.4907701", "0.4904086", "0.4889345", "0.4887253", "0.48837453", "0.48772687", "0.48694593", "0.48657954", "0.48606023", "0.48594725", "0.48594725", "0.48594725" ]
0.0
-1
POST /dests POST /dests.json
def create @dest = Dest.new(dest_params) respond_to do |format| if @dest.save format.html { redirect_to dests_path, notice: 'Dest was successfully created.' } format.json { render :show, status: :created, location: @dest } else format.html { render :new } format.json { render json: @dest.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @destination = Destination.new(destination_params)\n @destination.save\n set_destinations\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def create\n\t\trespond_with Destination.create(destination_params)\n\tend", "def create\n @destination = Destination.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def dest_params\n params.require(:destination).permit(:name, :date, :start_time, :end_time, :address, :date, :trip_id, :like_count)\n end", "def write_posts\n self.posts.each do |post|\n post.write(self.dest)\n end\n end", "def write_posts\n self.posts.each do |post|\n post.write(self.dest)\n end\n end", "def make_files(targets)\n file_pairs = targets.map { |t| \n filename = sanitize_filename(t[:data][:name] + '.json')\n [filename, t]\n }\n unique_pairs = uniqufy(file_pairs)\n unique_pairs.each do |name, content| \n puts \"Write #{File.absolute_path(name)}\"\n File.open(name, 'w') { |file| file.write(JSON.pretty_generate(content)) }\n end\nend", "def create\n @destination = Destination.new(params[:destination])\n @destination.user = current_user\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @destination = @organism.destinations.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to admin_organism_destinations_path(@organism),\n notice: \"L'activité #{@destination.name} a été créée.\" }\n \n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_dest\n @dest = Dest.find(params[:id])\n end", "def post_destination_with_http_info(project_key, environment_key, destination_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.post_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.post_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.post_destination\"\n end\n # verify the required parameter 'destination_body' is set\n if @api_client.config.client_side_validation && destination_body.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_body' when calling DataExportDestinationsApi.post_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(destination_body)\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destination')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#post_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\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 = ['Token']\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 => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end", "def index\n @destination = Destination.new\n set_destinations\n end", "def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def create\n @destination = Destination.new(destination_params)\n if @destination.valid?\n @destination.save\n redirect_to root_path\n else\n render :new, notice: 'Error in processing destination'\n end\n end", "def destroy\n @dest.destroy\n respond_to do |format|\n format.html { redirect_to dests_url, notice: 'Dest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @destination = Destination.new(destination_params)\n if params[:suggestion_id]\n Suggestion.destroy(params[:suggestion_id])\n end\n respond_to do |format|\n if @destination.save\n Destination.reindex\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def destination(dest); end", "def destination(dest); end", "def destination_params\n params.require(:destination).permit(:name, :zip, :description, :image_url)\n end", "def index\n @destinations = Destination.all\n end", "def create\n @destination = current_user.destinations.new(destination_params)\n if @destination.save\n redirect_to destinations_path, notice: 'Destination was successfully created.'\n else\n render :new\n end\n end", "def destination_params\n params.require(:destination).permit(:name)\n end", "def destinations\n @destinations ||= []\n end", "def parse_dest(dest)\n case dest\n when Array\n dest.map { |address| parse_address(address) }\n else\n parse_address(dest)\n end\n end", "def update\n respond_to do |format|\n if @dest.update(dest_params)\n format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' }\n format.json { render :show, status: :ok, location: @dest }\n else\n format.html { render :edit }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end", "def destination_params\n params.require(:destination).permit(:city, :country, :description, :album, :category, :user_id, :post_id)\n end", "def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end", "def republish(destinations: nil, sources: nil)\n if !destinations.nil? && !sources.nil?\n raise ArgumentError, \"Either destinations or sources but not both\"\n end\n\n # Add in optional arguments\n params = {}\n params[:destinations] = destinations unless destinations.nil?\n params[:sources] = sources unless sources.nil?\n params[:count] = 1 unless params.empty?\n\n rpc(action: :republish, param_name: :hash, params: params)[:blocks]\n end", "def republish(destinations: nil, sources: nil)\n if !destinations.nil? && !sources.nil?\n raise ArgumentError, 'You must provide either destinations or sources but not both'\n end\n\n params = {\n _access: :blocks,\n _coerce: Array\n }\n\n params[:destinations] = destinations unless destinations.nil?\n params[:sources] = sources unless sources.nil?\n params[:count] = 1 if destinations || sources\n\n rpc(:republish, :hash, params).map do |block|\n as_block(block)\n end\n end", "def update\n @destination.update(destination_params)\n set_destinations\n end", "def copy_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n response = {}\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.copy_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n response[:error] = \"Copy failed\" \n render json: response, status: 422\n end\n end", "def create\n @destination = Destination.new(destination_params)\n geo = Geocoder.coordinates(@destination.name)\n unless geo.nil?\n @destination.lat = geo.first\n @destination.lng = geo.last\n end\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to destinations_path, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy_and_convert_images\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n source_type = params[:source_type]\n dest_type = params[:dest_type]\n quality = params[:quality]\n size = params[:size]\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_and_convert_files_to(dest_dir, source_type, dest_type, quality, size)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n\n end", "def copy_and_move_info(request)\n # Collecting the relevant HTTP headers\n unless request.header('Destination')\n fail Exception::BadRequest, 'The destination header was not supplied'\n end\n\n destination = calculate_uri(request.header('Destination'))\n overwrite = request.header('Overwrite')\n\n overwrite = 'T' unless overwrite\n if overwrite.upcase == 'T'\n overwrite = true\n elsif overwrite.upcase == 'F'\n overwrite = false\n else\n # We need to throw a bad request exception, if the header was invalid\n fail Exception::BadRequest, 'The HTTP Overwrite header should be either T or F'\n end\n\n (destination_dir,) = Http::UrlUtil.split_path(destination)\n\n begin\n destination_parent = @tree.node_for_path(destination_dir)\n\n unless destination_parent.is_a?(ICollection)\n fail Exception::UnsupportedMediaType, 'The destination node is not a collection'\n end\n rescue Exception::NotFound => e\n # If the destination parent node is not found, we throw a 409\n raise Exception::Conflict, 'The destination node is not found'\n end\n\n begin\n destination_node = @tree.node_for_path(destination)\n\n # If this succeeded, it means the destination already exists\n # we'll need to throw precondition failed in case overwrite is false\n unless overwrite\n fail Exception::PreconditionFailed, 'The destination node already exists, and the overwrite header is set to false', 'Overwrite'\n end\n rescue Exception::NotFound => e\n # Destination didn't exist, we're all good\n destination_node = false\n end\n\n request_path = request.path\n if destination == request_path\n fail Exception::Forbidden, 'Source and destination uri are identical.'\n end\n if destination[0..request_path.length] == request_path + '/'\n fail Exception::Conflict, 'The destination may not be part of the same subtree as the source path.'\n end\n\n # These are the three relevant properties we need to return\n {\n 'destination' => destination,\n 'destinationExists' => !!destination_node,\n 'destinationNode' => destination_node\n }\n end", "def create\n @destination = Destination.new(params[:destination])\n @destination.update_attributes(:active => \"1\", :is_deleted => \"0\")\n\n @destination.company_id = current_user.company_id\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to destinations_path, notice: \"El destino #{@destination.name} fue creado exitosamente.\" }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def dest; end", "def index\n query = params[:q].presence || \"*\"\n @destinations = Destination.search(query)\n end", "def create\n @user = User.find(params[:user_id])\n @destination = Destination.new(destination_params)\n @destination.user_id = params[:user_id]\n if @destination.save\n redirect_to user_destination_path(@user.id, @destination.id)\n else\n redirect_to root_path\n end\n end", "def index\n @destinations = current_user.destinations\n end", "def destinations\n bookmarks = @medium.manuscript.metadata['bookmarks'] || []\n bookmarks.map { |b| b['destination'] }\n end", "def create\n @destination = Destination.new\n if current_user.has_permission?(:destinations)\n @destination.accessible = :all\n end\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to [:admin, @destination], :notice => \"Destination was successfully created.\" }\n else\n flash[:error] = \"Destination was not created.\"\n format.html { render active_admin_template(:new) }\n end\n end\n end", "def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def dresses\n render json: { collections: Collection.published_dresses }\n end", "def dropbox_upload_file(file, dest)\n url = \"https://content.dropboxapi.com/2/files/upload\"\n\n headers = {\n \"Content-Type\" => \"application/octet-stream\",\n \"Dropbox-API-Arg\" => JSON.generate(\n path: dest,\n mode: \"add\",\n autorename: false\n )\n }\n\n dropbox_post_json(url, headers: headers, payload: File.read(file)) do |json|\n json[\"path_display\"]\n end\n end", "def create\n @destination = Destination.new(params[:destination])\n @roadmap = Roadmap.find(params[:roadmap_id])\n \n if not validate_permission(@roadmap)\n return\n end\n\n @destination.start_date = Converters::to_date(params[:destination][:start_date])\n @destination.end_date = Converters::to_date(params[:destination][:end_date])\n @destination.roadmap = @roadmap\n\t\[email protected]_cost = Converters::currency_to_number(params[:destination][:planned_cost])\n\n respond_to do |format|\n if @destination.save\n flash[:notice] = 'O destino foi criado com sucesso!'\n format.html { redirect_to(:controller => \"roadmaps\", \n\t\t\t\t\t\t\t\t\t\t\t:action => \"show\", \n\t\t\t\t\t\t\t\t\t\t\t:id => @destination.roadmap.id\n\t\t\t\t\t\t\t\t\t\t ) }\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\n else\n # Recarrega os estados e cidades\n load_states_and_cities(@destination)\n @roadmap = @destination.roadmap\n @destinations [email protected]\n @vehicles = Vehicle.all\n @destinations = @roadmap.destinations\n \n format.html { render :action => \"new\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destination_params\n params.require(:destination).permit(:city, :state, :packing_list, :category, :avatar, :suggestion_id)\n end", "def save_json(dir)\n save_json_one(dir, country_data, 'country')\n save_json_one(dir, us_state_data,'us_state')\n save_json_one(dir, us_metro_data, 'us_metro')\n save_json_one(dir, us_county_data, 'us_county')\n\n bn = File.basename(dir)\n dn = File.dirname(dir)\n\n\n puts \"Uploading json data\"\n Dir[File.join(dir,'*.json')].each do |path|\n bn = File.basename(path)\n dn = File.dirname(path)\n cmd = \"curl -u '[email protected]:Pp[31415926]' --ftp-create-dirs -s -T #{dn}/#{bn} ftp://160.153.91.2/standalone/#{bn}\"\n r = `#{cmd} 2>&1`.chomp\n r = ' - ERRORS: ' + r unless r.empty?\n puts \" #{bn}#{r}\"\n end\n end", "def destination_params\n params.require(:destination).permit(\n :name,\n :phone,\n :sequence\n )\n end", "def destination_params\n params.require(:destination).permit(:location, :price, :trip_length, :weather, :agent_id)\n end", "def create\n TargetsForm.new(target_params).save\n\n respond_to do |format|\n format.html { redirect_to after_write_path, notice: 'Targets were successfully created.' }\n format.json { render :show, status: :created, location: @target }\n end\n end", "def dest_params\n params.require(:dest).permit(Dest::REGISTRABLE_ATTRIBUTES)\n 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 new\n @destination = Destination.new\n @destination.build_dest_image\n\n respond_to do |format|\n format.html # _new.html.erb\n format.json { render json: @destination }\n end\n end", "def write(files, private_gist = false, description = nil)\n response = request(create_url) do |url|\n Net::HTTP::Post.new(url.path).tap {|req|\n req.body = JSON.generate(data(files, private_gist, description))\n }\n end\n\n case response\n when Net::HTTPUnauthorized\n $stderr.puts \"Invalid credentials connecting to #{api_url}\"\n false\n when Net::HTTPCreated, Net::HTTPOK\n JSON.parse(response.body)['html_url']\n else\n raise StandardError, \"#{response.code} #{response.message}\"\n end\n end", "def copy_series\n target = TournamentDay.find(params[:target_id])\n source = TournamentDay.find(params[:source_id])\n source.series.each do |serie|\n copy = serie.dup\n copy.tournament_day_id = target.id\n copy.save\n end\n\n @tournament_day = TournamentDay.find(target.id, :include => :tournament)\n respond_to do |format|\n flash[:notice] = 'Serien erfolgreich kopiert'\n format.html { redirect_to(@tournament_day) }\n format.xml { head :ok }\n end\n end", "def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def write(dest); end", "def write(dest); end", "def write(dest); end", "def create\r\n @destination = Destination.new(params[:destination])\r\n @destination.gallery = Gallery.create(:title => @destination.name)\r\n\r\n respond_to do |format|\r\n if @destination.save\r\n @banner = Banner.create(:name => '地区页', imgname: 'destinations', destination_id: @destination.id)\r\n format.html { redirect_to(admin_destinations_url, :notice => 'Destination was successfully created.') }\r\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def destination_params\n params.require(:destination)\n .permit(:name, categories: [], references: [])\n .tap do |permitted_params|\n permitted_params[:references] = permitted_params[:references].reject(&:blank?)\n permitted_params[:categories] = permitted_params[:categories].reject(&:blank?)\n end\n end", "def batch_copy_missing_destination_files(files)\n dest_domain = DestDomain.find_by_namespace(@dest_mogile.domain)\n\n files.each do |file|\n # Quit if no results\n break if file.nil?\n\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Look up the source file's key in the destination domain\n destfile = DestFile.find_by_dkey_and_dmid(file.dkey, dest_domain.dmid)\n if destfile\n # File exists!\n # Check that the source and dest file sizes match\n if file.length != destfile.length\n # File exists but has been modified. Copy it over.\n begin\n Log.instance.debug(\"Key [ #{file.dkey} ] is out of date. Updating.\")\n stream_copy(file)\n @updated += 1\n @copied_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error updating [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n else\n Log.instance.debug(\"key [ #{file.dkey} ] is up to date.\")\n @uptodate += 1\n end\n else\n # File does not exist. Copy it over.\n begin\n Log.instance.debug(\"key [ #{file.dkey} ] does not exist... creating.\")\n stream_copy(file)\n @added += 1\n @copied_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error adding [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n end\n end\n end", "def destroy\n @destination.destroy\n set_destinations\n end", "def create_folder_with_files(folder_name, recipient, sender) \n\tputs \"Creating folder with files.\"\n\tdata = {\n\t\t\"name\" => folder_name,\n\t\t\"from\" => sender,\n\t\t\"to\" => recipient,\n\t\t\"files\" => [{\n\t\t\t\"name\" => \"Ruby_File1.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File1 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url1\"\n\t\t}, {\n\t\t\t\"name\" => \"Ruby_File2.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File2 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url2\"\n\t\t}]\n\t}.to_json()\n\tputs data\n\tresponse = request_post('/api/partner/folder', data)\n\tputs response.body\nend", "def create\n attrs = whitelist(params, :create).merge customer: current_user.becomes(Users::Customer)\n dattrs = attrs.delete(:destinations_attributes)\n\n @travel = Travels::Travel.new(attrs)\n\n dattrs.each_key do |key|\n dattr = dattrs[key]\n iattrs = dattr.delete(:items_attributes)\n\n dest = Travels::Places::Destination.new(dattr)\n\n iattrs.each_key do |key|\n @travel.items.build(iattrs[key]).destination = dest\n end if iattrs\n end\n\n # @travel.customer = current_user.becomes(Users::Customer)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to status_travel_path(@travel), notice: \"Gracefully created the travel!\" }\n format.json { render json: @travel, status: :created, location: @travel }\n else\n format.html { redirect_to new_travel_path, alert: \"Failed to create the travel! Errors: #{@travel.errors.full_messages}\" }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy_to_many(source, targets)\n expanded_source = File.expand_path(source)\n\n targets.each do |target|\n expanded_target = File.expand_path(target)\n\n # ensure the subdirectories exist\n FileUtils.mkpath(File.dirname(expanded_target))\n\n # copy file to other locations\n FileUtils.cp(expanded_source, expanded_target)\n end\n end", "def set_destination(opts)\n opts = check_params(opts,[:destinations])\n super(opts)\n end", "def write_output entries, dest, options\n if dest.match /^http/\n http = Atom::HTTP.new\n\n setup_http http, options\n\n entries_to_http entries, dest, http\n elsif dest == '-'\n entries_to_stdout entries\n else\n entries_to_dir entries, dest\n end\n end", "def publishLoc(niUri, locList, destHost, msgId)\n url=URI::parse(\"http://#{destHost}/netinfproto/publish\")\n\n res=nil\n req=nil\n\n loc1=locList[0]\n loc2=locList[1]\n \n if loc2\n req = Net::HTTP::Post::Multipart.new(url.path,\n \"URI\" => niUri.to_s,\n \"msgid\" => msgId,\n \"loc1\" => loc1,\n \"loc2\" => loc2)\n elsif loc1\n req = Net::HTTP::Post::Multipart.new(url.path,\n \"URI\" => niUri.to_s,\n \"msgid\" => msgId,\n \"loc1\" => loc1)\n end\n if req\n print \"Sending request: #{req.to_s} to #{url}\\n\"\n \n res = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end \n end\n res\n \n end", "def destination_params\n params.require(:destination).permit(:name, :weather, :description, :timezone, :cityimage, :landingtime, :boardingtime)\n end", "def copy(url, dest, headers = {})\n headers['Destination'] = dest\n request(:copy, url, headers)\n end", "def index\n @current_date = Date.today\n dated_params = {}\n @dests = Dest.all\n if params[:search].present?\n @dests = @dests.search(params[:search])\n end\n if params[:closed] != 'true'\n @dests = @dests.non_closed\n end\n if params[:dest_type].present?\n @dests = @dests.where(dest_type: params[:dest_type])\n end\n case params[:provisional]&.to_sym\n when :exclude\n @dests = @dests.where(provisional: false)\n when :only\n @dests = @dests.where(provisional: true)\n end\n if params[:company_id].present?\n @dests = @dests.where(company_id: params[:company_id])\n end\n if params[:prefecture].present?\n @dests = @dests.where(prefecture: params[:prefecture])\n end\n if params[:area_id].present?\n dated_params[:area_id] = params[:area_id]\n end\n # @dests = @dests.eager_load(:dest_dated_values)\n @dests = @dests.with_dated_values(@current_date, dated_params) if dated_params.present?\n @dests = @dests.page(params[:page])\n end", "def add=(location)\n @destinations << location\n end", "def dest_get\n db_select 'destination'\n end", "def index\n #@destinations = Destination.all\n\n if params[:name]\n @destinations = Destination.find_all_by_name(params[:name])\n else\n @destinations = Destination.all\n end\n\n @json = @destinations.to_gmaps4rails do |destination, marker|\n marker.infowindow render_to_string(:partial => \"/destinations/infowindow\",\n :locals => { :destination => destination})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end", "def bulk_rename_confirm\n @prefix = params[:prefix]\n begin\n @destinations = Destination.dst_by_prefix(@prefix)\n rescue\n flash[:notice] = _('Invalid_prefix')\n redirect_to :controller => :directions, :action =>:list and return false\n end\n if @destinations.size > 0\n @destination_count = @destinations.size\n @destination_name = params[:destination]\n else\n flash[:notice] = _('No_destinations_found')\n redirect_to :controller => :destination_groups, :action => :list\n end\n end", "def post_destination(project_key, environment_key, destination_body, opts = {})\n data, _status_code, _headers = post_destination_with_http_info(project_key, environment_key, destination_body, opts)\n data\n end", "def create_path(dest_path, *args)\n title = nil\n if(args.size > 0)then\n type = args[0][:type]\n title = args[0][:title]\n end\n if(not(type))then\n type = \"article-listing\"\n end\n\n destination_path = \"/\"\n dest_path.split(\"/\").each do |folder|\n if(folder != \"\")then\n folder = folder.downcase\n destination_path = destination_path + folder + \"/\"\n if( not(exists?(destination_path)) )then\n mkdir(destination_path)\n proppatch(destination_path,'<v:collection-type xmlns:v=\"vrtx\">' + type + '</v:collection-type>')\n if(title)then\n proppatch(destination_path,'<v:userTitle xmlns:v=\"vrtx\">' + title.to_s + '</v:userTitle>')\n end\n end\n end\n end\n return destination_path\n end", "def destination_params\n params.require(:destination).permit(:name, :arrived_on, :left_on, :lng, :lat, :visited)\n end", "def destination(dest)\n @destination ||= {}\n @destination[dest] ||= begin\n path = site.in_dest_dir(dest, URL.unescape_path(url))\n path = File.join(path, \"index\") if url.end_with?(\"/\")\n path << output_ext unless path.end_with? output_ext\n path\n end\n end", "def destination(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/destination\"\n req.body = params\n end\n handle_response(resp)\n end", "def create_folder(folder_name, recipient, sender)\n\tputs \"Creating folder: \" + folder_name\n\tfolder = {:name => folder_name, :to => recipient, :from => sender}\n\tdata = JSON.generate(folder)\n\tresponse = request_post('/api/partner/folder', data)\n\tputs response.body\nend", "def dlist\n @dests.keys\n end", "def write(dest)\n path = destination(dest)\n FileUtils.mkdir_p(File.dirname(path))\n File.open(path, 'w') do |f|\n src = File.join(@base, @name)\n f.write File.read( src )\n end\n end", "def gather\n if File.exist?(@location_dir) && File.directory?(@location_dir)\n if Dir.glob(File.join(@location_dir, '*')).size > 0 # avoid creating the dest directory if the source dir is empty\n unless File.exists? @destination_dir\n FileUtils.mkpath @destination_dir\n end\n @files.each do |f|\n Dir.glob(File.join(@location_dir, f)).each do |file|\n FileUtils.cp_r file, @destination_dir\n end\n end\n end\n else\n puts \"Error: #{@location_dir}, doesn't exist or not a directory\"\n end\n end", "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end", "def create_file\n dest_file = Item.new(Path.new(params[:dest_file]))\n content = params[:content]\n response = {}\n response[:dest_file] = dest_file\n permission = params[:force_permission]\n if dest_file.create(content, permission)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end", "def bulk_rename\n Destination.rename_by_prefix(params[:destination], params[:prefix])\n flash[:status] = _('Destinations_were_renamed')\n redirect_to :controller => :destination_groups, :action => :list\n end", "def sinterstore(destination, *keys); end", "def sinterstore(destination, *keys); end", "def bulk_create\n if Town.bulk_create(town_params)\n redirect_to towns_path, notice: 'Towns were succesfully created'\n else \n render :bulk_new\n end\n end", "def bulk_push\n ReadLater.bulk_push(read_laters_params[:url])\n\n redirect_to read_laters_path\n end", "def create\n @copy_target = CopyTarget.new(params[:copy_target])\n @copy_target.save\n redirect_to \"/conf\"\n\n # respond_to do |format|\n # if @copy_target.save\n # format.html { redirect_to @copy_target, notice: 'Copy target was successfully created.' }\n # format.json { render json: @copy_target, status: :created, location: @copy_target }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @copy_target.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def post(path, **args); end" ]
[ "0.6195165", "0.6031813", "0.595281", "0.576659", "0.5741007", "0.56920004", "0.56241846", "0.56241846", "0.55799353", "0.5574252", "0.55714935", "0.5569744", "0.55631393", "0.5545139", "0.5515064", "0.5505855", "0.54479957", "0.54451716", "0.54272777", "0.541588", "0.5393549", "0.53831375", "0.53831375", "0.5382265", "0.5336909", "0.531782", "0.53162575", "0.52959776", "0.52714974", "0.5245375", "0.52422", "0.5204649", "0.5156881", "0.5154339", "0.51233715", "0.51068056", "0.5092252", "0.5091971", "0.50766337", "0.5074407", "0.50563955", "0.5041717", "0.50379664", "0.50201267", "0.5012944", "0.49936405", "0.49875465", "0.49817452", "0.49776447", "0.4976324", "0.49703428", "0.49690485", "0.4963494", "0.49576566", "0.49550667", "0.49497578", "0.49404776", "0.49398786", "0.49372822", "0.49351943", "0.49336323", "0.4927425", "0.4927425", "0.4927425", "0.4923158", "0.49219918", "0.49099636", "0.4892649", "0.4890251", "0.48828706", "0.48677555", "0.48510253", "0.4850215", "0.48488507", "0.4848792", "0.4824122", "0.48211816", "0.48194277", "0.4816397", "0.48159948", "0.4802725", "0.47974962", "0.4797083", "0.47923005", "0.47880298", "0.4783226", "0.47805706", "0.47791153", "0.47763386", "0.47563562", "0.4750433", "0.47426248", "0.47425616", "0.47410855", "0.47200426", "0.47200426", "0.4718391", "0.47087753", "0.47084633", "0.46925768" ]
0.6768958
0
PATCH/PUT /dests/1 PATCH/PUT /dests/1.json
def update respond_to do |format| if @dest.update(dest_params) format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' } format.json { render :show, status: :ok, location: @dest } else format.html { render :edit } format.json { render json: @dest.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @api = args[:api] if args.key?(:api)\n @destination = args[:destination] if args.key?(:destination)\n @extensions = args[:extensions] if args.key?(:extensions)\n @origin = args[:origin] if args.key?(:origin)\n @request = args[:request] if args.key?(:request)\n @resource = args[:resource] if args.key?(:resource)\n @response = args[:response] if args.key?(:response)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @destinations = args[:destinations] if args.key?(:destinations)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch_destination_with_http_info(project_key, environment_key, destination_id, patch_only, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.patch_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.patch_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.patch_destination\"\n end\n # verify the required parameter 'destination_id' is set\n if @api_client.config.client_side_validation && destination_id.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_id' when calling DataExportDestinationsApi.patch_destination\"\n end\n # verify the required parameter 'patch_only' is set\n if @api_client.config.client_side_validation && patch_only.nil?\n fail ArgumentError, \"Missing the required parameter 'patch_only' when calling DataExportDestinationsApi.patch_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}/{destinationId}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'destinationId' + '}', destination_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(patch_only)\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destination')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#patch_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to destinations_path, notice: \"El destino #{@destination.name} fue editado exitosamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @destination_name = args[:destination_name] if args.key?(:destination_name)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @destination_name = args[:destination_name] if args.key?(:destination_name)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update!(**args)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update\n @destination.update(destination_params)\n set_destinations\n end", "def update!(**args)\n @destination = args[:destination] if args.key?(:destination)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @target.update(target_params)\n format.html { redirect_to after_write_path }\n format.json { render :show, status: :ok, location: @target }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\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!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end", "def update!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end", "def update\n id = shift_argument\n validate_arguments!\n dataclip_reference = options[:dataclip]\n uri = URI(\"#{base_url}/#{id}\")\n req = Net::HTTP::Patch.new(uri.path)\n body = prepare_body(dataclip_reference)\n execute_and_print(uri, req, body)\n end", "def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @destination = args[:destination] unless args[:destination].nil?\n @errors = args[:errors] unless args[:errors].nil?\n end", "def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_copy.update(task_copy_params)\n format.html { redirect_to @task_copy, notice: 'Task copy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_copy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(destination_params)\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end", "def update\n @copy_target = CopyTarget.find(params[:id])\n\n respond_to do |format|\n if @copy_target.update_attributes(params[:copy_target])\n format.html { redirect_to @copy_target, notice: 'Copy target was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @copy_target.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_id = args[:source_id] if args.key?(:source_id)\n @sync1 = args[:sync1] if args.key?(:sync1)\n @sync2 = args[:sync2] if args.key?(:sync2)\n @sync3 = args[:sync3] if args.key?(:sync3)\n @sync4 = args[:sync4] if args.key?(:sync4)\n end", "def update!(**args)\n @resource = args[:resource] if args.key?(:resource)\n @service = args[:service] if args.key?(:service)\n @source_entry = args[:source_entry] if args.key?(:source_entry)\n @storage_properties = args[:storage_properties] if args.key?(:storage_properties)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path] if args.key?(:path)\n end", "def sources_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_put\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n respond_to do |format|\n if @copy.update(copy_params)\n format.html { redirect_to @copy, notice: \"Copy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @copy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @copy.errors, status: :unprocessable_entity }\n end\n end\n end", "def rput( *args )\n opts = @default_options\n opts = opts.merge( args.pop ) if args.last.is_a?( Hash )\n opts = opts.merge( coalesce: false )\n\n flush\n\n srcs, target = expand_implied_target( args )\n\n srcs = resolve_sources( srcs, Array( opts[ :sync_paths ] ) )\n\n changes = []\n\n if opts[:erb_process] != false\n sdirs, sfiles = srcs.partition { |src| File.directory?( src ) }\n serbs, sfiles = sfiles.partition { |src| src =~ /\\.erb$/ }\n plains = sdirs + sfiles #might not have/is not templates\n maybes = sdirs + serbs #might have/is templates\n\n if maybes.empty?\n changes = rsync( plains, target, opts ) unless plains.empty?\n else\n if ssh_host_name == 'localhost' && opts[ :user ]\n # tmpdir needs to be visable to alt. opts[ :user ]\n opts[ :tmpdir_mode ] = 0755\n end\n process_templates( maybes, opts ) do |processed|\n unless processed.empty? || plains.empty?\n opts = opts.dup\n opts[ :excludes ] = Array( opts[ :excludes ] ) + [ '*.erb' ]\n end\n new_srcs = plains + processed\n changes = rsync( new_srcs, target, opts ) unless new_srcs.empty?\n end\n end\n else\n changes = rsync( srcs, target, opts ) unless srcs.empty?\n end\n\n changes\n end", "def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @remote_path = args[:remote_path] if args.key?(:remote_path)\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_store = args[:destination_store] if args.key?(:destination_store)\n @resource_filter = args[:resource_filter] if args.key?(:resource_filter)\n end", "def update!(**args)\n @copy = args[:copy] if args.key?(:copy)\n @new = args[:new] if args.key?(:new)\n @upload = args[:upload] if args.key?(:upload)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @dest_note.update(dest_note_params)\n format.html { redirect_to @dest_note, notice: \"Dest note was successfully updated.\" }\n format.json { render :show, status: :ok, location: @dest_note }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @dest_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @detail = args[:detail] if args.key?(:detail)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @destination.update(destination_params)\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { render :show, status: :ok, location: @destination }\n else\n format.html { render :edit }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update!(**args)\n @bigquery_destination = args[:bigquery_destination] if args.key?(:bigquery_destination)\n @csv_destination = args[:csv_destination] if args.key?(:csv_destination)\n @tfrecord_destination = args[:tfrecord_destination] if args.key?(:tfrecord_destination)\n end", "def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to(@destination, :notice => 'Destination was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @group_id = args[:group_id] if args.key?(:group_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n end", "def update!(**args)\n @expected_origins = args[:expected_origins] if args.key?(:expected_origins)\n @name = args[:name] if args.key?(:name)\n @rp_id = args[:rp_id] if args.key?(:rp_id)\n end", "def update\n if params[:resource][:document].present?\n @resource.document.purge\n @resource.document.attach(params[:resource][:document])\n end\n if params[:resource][:sample].present?\n @resource.sample.purge\n @resource.sample.attach(params[:resource][:sample])\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @fetch_source_info = args[:fetch_source_info] if args.key?(:fetch_source_info)\n @final_content_url = args[:final_content_url] if args.key?(:final_content_url)\n @metadata = args[:metadata] if args.key?(:metadata)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @post_data = args[:post_data] if args.key?(:post_data)\n @request_header = args[:request_header] if args.key?(:request_header)\n @url = args[:url] if args.key?(:url)\n end", "def update!(**args)\n @destination = args[:destination] if args.key?(:destination)\n @logs_path = args[:logs_path] if args.key?(:logs_path)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @type = args[:type] if args.key?(:type)\n end", "def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @migrate_resource_responses = args[:migrate_resource_responses] if args.key?(:migrate_resource_responses)\n end", "def update!(**args)\n @error = args[:error] if args.key?(:error)\n @resource = args[:resource] if args.key?(:resource)\n end", "def update!(**args)\n @destination_ip = args[:destination_ip] if args.key?(:destination_ip)\n @destination_network_uri = args[:destination_network_uri] if args.key?(:destination_network_uri)\n @destination_port = args[:destination_port] if args.key?(:destination_port)\n @protocol = args[:protocol] if args.key?(:protocol)\n @source_agent_uri = args[:source_agent_uri] if args.key?(:source_agent_uri)\n @source_ip = args[:source_ip] if args.key?(:source_ip)\n @source_network_uri = args[:source_network_uri] if args.key?(:source_network_uri)\n @source_port = args[:source_port] if args.key?(:source_port)\n end", "def update!(**args)\n @destination_id = args[:destination_id] if args.key?(:destination_id)\n end", "def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @remote_path = args[:remote_path] if args.key?(:remote_path)\n @server = args[:server] if args.key?(:server)\n end", "def update!(**args)\n @canceled = args[:canceled] if args.key?(:canceled)\n @content_type = args[:content_type] if args.key?(:content_type)\n @dom_tree_node_index = args[:dom_tree_node_index] if args.key?(:dom_tree_node_index)\n @failed_http_access_control_check = args[:failed_http_access_control_check] if args.key?(:failed_http_access_control_check)\n @fetch_source_info = args[:fetch_source_info] if args.key?(:fetch_source_info)\n @fetch_status = args[:fetch_status] if args.key?(:fetch_status)\n @http_header = args[:http_header] if args.key?(:http_header)\n @http_response_code = args[:http_response_code] if args.key?(:http_response_code)\n @metadata = args[:metadata] if args.key?(:metadata)\n @post_data = args[:post_data] if args.key?(:post_data)\n @redirect_target = args[:redirect_target] if args.key?(:redirect_target)\n @referenced_resource_content_index = args[:referenced_resource_content_index] if args.key?(:referenced_resource_content_index)\n @request_header = args[:request_header] if args.key?(:request_header)\n @request_method = args[:request_method] if args.key?(:request_method)\n @style_index = args[:style_index] if args.key?(:style_index)\n @synchronously_fetched = args[:synchronously_fetched] if args.key?(:synchronously_fetched)\n @timing = args[:timing] if args.key?(:timing)\n @url = args[:url] if args.key?(:url)\n @webkit_metadata = args[:webkit_metadata] if args.key?(:webkit_metadata)\n end", "def update!(**args)\n @artifact_destination = args[:artifact_destination] if args.key?(:artifact_destination)\n @export_format_id = args[:export_format_id] if args.key?(:export_format_id)\n @image_destination = args[:image_destination] if args.key?(:image_destination)\n end", "def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @uri = args[:uri] if args.key?(:uri)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update!(**args)\n @copy = args[:copy] if args.key?(:copy)\n @source_type = args[:source_type] if args.key?(:source_type)\n end", "def update!(**args)\n @copy = args[:copy] if args.key?(:copy)\n @source_type = args[:source_type] if args.key?(:source_type)\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update!(**args)\n @action = args[:action] if args.key?(:action)\n @paths = args[:paths] if args.key?(:paths)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @errors = args[:errors] if args.key?(:errors)\n @is_pending = args[:is_pending] if args.key?(:is_pending)\n @is_sitemaps_index = args[:is_sitemaps_index] if args.key?(:is_sitemaps_index)\n @last_downloaded = args[:last_downloaded] if args.key?(:last_downloaded)\n @last_submitted = args[:last_submitted] if args.key?(:last_submitted)\n @path = args[:path] if args.key?(:path)\n @type = args[:type] if args.key?(:type)\n @warnings = args[:warnings] if args.key?(:warnings)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @resource_key = args[:resource_key] if args.key?(:resource_key)\n end", "def update!(**args)\n @new_value = args[:new_value] if args.key?(:new_value)\n @original_value_pattern = args[:original_value_pattern] if args.key?(:original_value_pattern)\n @target_group_kinds = args[:target_group_kinds] if args.key?(:target_group_kinds)\n @target_json_path = args[:target_json_path] if args.key?(:target_json_path)\n @target_namespaces = args[:target_namespaces] if args.key?(:target_namespaces)\n end", "def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resource_info = args[:resource_info] if args.key?(:resource_info)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_dataset = args[:destination_dataset] if args.key?(:destination_dataset)\n end", "def update\n @resource = Resource.find(params[:id])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n aresource = Resource.find(params[:id])\n if @resource.update_attributes(params[:resource])\n\n #borra archivo anterir\n if aresource.file != @resource.file\n File.unlink(aresource.file) if File.exists? aresource.file\n end\n\n format.html { redirect_to @resource, :notice => 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def 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_destination_data_object(existing_data,new_data)\n existing_data.update(new_data)\n return existing_data\n end", "def update\n respond_to do |format|\n if @source_ref.update(source_ref_params)\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_ref }\n else\n format.html { render :edit }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6093074", "0.5898304", "0.5767967", "0.5717068", "0.56472415", "0.5610437", "0.56104255", "0.5605689", "0.5605689", "0.55785733", "0.5573259", "0.55660874", "0.5552558", "0.5551255", "0.5551255", "0.5536443", "0.5478745", "0.547578", "0.547578", "0.5465432", "0.5432136", "0.5427685", "0.5425636", "0.5425636", "0.54235697", "0.54222316", "0.5420868", "0.5417163", "0.5407782", "0.5407042", "0.53980607", "0.5391478", "0.53883564", "0.53768677", "0.537573", "0.5374911", "0.5373546", "0.53282475", "0.532465", "0.5324307", "0.53226143", "0.53177947", "0.5314575", "0.53131425", "0.5304728", "0.5302938", "0.5300468", "0.5296059", "0.5290726", "0.52891225", "0.52840143", "0.5283155", "0.52816373", "0.5277706", "0.5270218", "0.5263259", "0.52627605", "0.52589184", "0.52549887", "0.52511364", "0.5251053", "0.52501464", "0.5249926", "0.52457166", "0.52457166", "0.52457166", "0.52457166", "0.52457166", "0.52457166", "0.52451843", "0.5237546", "0.5237546", "0.5232857", "0.52290946", "0.52290946", "0.5228352", "0.5222787", "0.52111566", "0.52079666", "0.5207383", "0.5200697", "0.5199844", "0.51915616", "0.5190072", "0.5190035", "0.51889926", "0.51826584", "0.51817286", "0.51785266", "0.51778543", "0.5177093", "0.5176867", "0.5176344", "0.5170247", "0.51672554", "0.5164107", "0.5162457", "0.5159475", "0.51586396", "0.515805" ]
0.67242706
0
DELETE /dests/1 DELETE /dests/1.json
def destroy @dest.destroy respond_to do |format| format.html { redirect_to dests_url, notice: 'Dest was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @copy_target = CopyTarget.find(params[:id])\n @copy_target.destroy\n\n redirect_to \"/conf\"\n # respond_to do |format|\n # format.html { redirect_to copy_targets_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to after_write_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_copy.destroy\n respond_to do |format|\n format.html { redirect_to task_copies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url, notice: 'Destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:destination_id])\n @empty_packs_destination_move = EmptyPacksDestinationMove.find(params[:id])\n @empty_packs_destination_move.destroy\n\n respond_to do |format|\n format.html { redirect_to destination_empty_packs_destination_moves_path(@destination) }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to(destinations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @copy.destroy\n respond_to do |format|\n format.html { redirect_to copies_url, notice: \"Copy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @dtest = Dtest.find(params[:id])\n @dtest.destroy\n\n respond_to do |format|\n format.html { redirect_to dtests_url, notice: t(:dest_test) }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @destination = Destination.find(params[:id])\r\n @destination.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(admin_destinations_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @copy = Copy.find(params[:id])\n @copy.destroy\n\n respond_to do |format|\n format.html { redirect_to(copies_url) }\n format.xml { head :ok }\n end\n end", "def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do |format|\n format.html { redirect_to @source }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n set_destinations\n end", "def destroy\n @destination = @organism.destinations.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_organism_destinations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "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 @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to targets_url, notice: 'Targetsssssssssssssssssssssssssss was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultant_customer_destination.destroy\n respond_to do |format|\n format.html { redirect_to consultant_customer_destinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\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 batch_delete(uuids)\n body = uuids.to_json\n request_delete(uri: '/files/storage/', content: body)\n end", "def destroy\n @dest_note.destroy\n respond_to do |format|\n format.html { redirect_to dest_notes_url, notice: \"Dest note was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(*uris); end", "def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @script = Script.find(params[:id])\n @script.destroy\n# delete script file\n script_name = \"script_#{@script.id}.sh\"\n File.delete(\"script/#{script_name}\")\n\n# Delete error/success logs\nerror_log = \"error_#{@script.id}.txt\"\nsuccess_log = \"success_#{@script.id}.txt\"\nlog_dir = \"#{Rails.root}/script-logs/\"\n File.delete(log_dir + error_log) unless !File.exist?(log_dir + error_log)\n File.delete(log_dir + success_log) unless !File.exist?(log_dir + success_log)\n respond_to do |format|\n format.html { redirect_to scripts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @src_gst = SrcGst.find(params[:id])\n @src_gst.destroy\n\n respond_to do |format|\n format.html { redirect_to src_gsts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end", "def delete_destination_with_http_info(project_key, environment_key, destination_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.delete_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.delete_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.delete_destination\"\n end\n # verify the required parameter 'destination_id' is set\n if @api_client.config.client_side_validation && destination_id.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_id' when calling DataExportDestinationsApi.delete_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}/{destinationId}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'destinationId' + '}', destination_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 = ['Token']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#delete_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete(action, **args); end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to targets_url, notice: 'Target was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to targets_url, notice: 'Target was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @table1_copy1.destroy\n respond_to do |format|\n format.html { redirect_to table1_copy1s_url, notice: 'Table1 copy1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end", "def delete!(*rest) end", "def destroy\n @clip.destroy\n respond_to do |format|\n format.html { redirect_to trip_path(@clip.trip.parent), change: 'list' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_destination.destroy\n respond_to do |format|\n format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @out.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def destroy\n @baz1.destroy\n respond_to do |format|\n format.html { redirect_to baz1s_url, notice: \"Baz1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def rm\n path = params[:path] || '/'\n\n if params.has_key?(:files) and params[:files].kind_of?(Array)\n files = params[:files]\n dests = []\n files.each do |file|\n dest = trash_file(File.join(path, file))\n break if dest == false\n dests << dest\n end\n render nothing: true, status: 500 and return if dests.empty?\n\n parent = File.dirname(dests[0])\n dests.map! do |dest|\n File.basename(dest)\n end\n render json: { undo: {\n name: \"Move of #{dests.length} files\",\n action: \"#{move_files_path(parent)}\",\n parameters: { _method: 'put', to: path, files: dests }\n }}\n else # if to move one file to trash\n dest = trash_file(path)\n\n render nothing: true, status: 500 and return if dest == false\n\n render json: { undo: {\n name: \"Move of #{File.basename(path)}\",\n action: \"#{move_files_path(dest)}\",\n parameters: { _method: 'put', to: path }\n }}\n end\n end", "def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to bazar_path }\n format.json { head :ok }\n end\n end", "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination.destroy\n redirect_to destinations_url, notice: 'Destination was successfully destroyed.'\n end", "def destroy\n FileUtils.rm_r(@target_path) if File.exist?(@target_path)\n\n @author_site_storage.destroy\n respond_to do |format|\n format.html { redirect_to author_site_storages_url, notice: t('success_delete') }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @backup.destroy\n respond_to do |format|\n format.html { redirect_to backups_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end", "def destroy\n @cfile.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @bench_test_s3 = BenchTest::S3.find(params[:id])\n @bench_test_s3.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_s3s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @dosha_action.destroy\n respond_to do |format|\n format.html { redirect_to dosha_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end", "def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iti_cust_dest_poa_detail.destroy\n respond_to do |format|\n format.html { redirect_to iti_cust_dest_poa_details_url }\n format.json { head :no_content }\n end\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination_linkset.destroy\n respond_to do |format|\n format.html { redirect_to linkset_url(id: @destination_linkset.linkset_id,\n campaign_id: @destination_linkset.linkset.campaign_id),\n notice: 'Destination was successfully removed from the linkset' }\n format.json { head :no_content }\n\n end\n end", "def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @same.destroy\n respond_to do |format|\n format.html { redirect_to sames_url, notice: 'Same was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def destroy_file(deployment_id, id, destination, params={})\n if destination.empty? || destination == \"/\" || destination == \".\" || destination.include?(\"../\")\n raise \"#{self.class}.upload_file() passed a bad destination: '#{destination}'\"\n end\n # url = \"#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files\"\n url = \"#{base_path}/#{deployment_id}/versions/#{id}/files\"\n if !destination.to_s.empty?\n url += \"/#{destination}\"\n end\n # use URI to escape path\n uri = URI.parse(url)\n url = uri.path\n execute(method: :delete, url: url, params: params)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to @task }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n request(:delete, *args)\n end", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.64783543", "0.6445285", "0.6445285", "0.6445285", "0.6373907", "0.6275123", "0.6247192", "0.61848915", "0.61848915", "0.61848915", "0.6163547", "0.6156051", "0.61313045", "0.61017483", "0.61013377", "0.60666144", "0.605708", "0.60276604", "0.601256", "0.59772736", "0.597505", "0.59448904", "0.59448904", "0.5914505", "0.5913809", "0.5913809", "0.59086955", "0.59048903", "0.5890373", "0.5890286", "0.58638835", "0.58628875", "0.585769", "0.58567595", "0.58553857", "0.5848904", "0.5827876", "0.5825439", "0.5817345", "0.5814844", "0.5810772", "0.5810772", "0.5809379", "0.58072954", "0.5796906", "0.57833165", "0.57826906", "0.5777362", "0.5777362", "0.57719535", "0.57630795", "0.5759118", "0.57583946", "0.5751429", "0.575109", "0.5742163", "0.5740992", "0.5737688", "0.5725754", "0.5721691", "0.5721669", "0.57157516", "0.57017094", "0.569942", "0.5698324", "0.5692242", "0.56903243", "0.56899333", "0.5684837", "0.5682256", "0.5679569", "0.56755227", "0.5666226", "0.5663878", "0.566287", "0.56601816", "0.56589276", "0.56538635", "0.56533825", "0.565296", "0.5652584", "0.5648454", "0.5647264", "0.5647252", "0.56459165", "0.5644024", "0.564143", "0.5636001", "0.563577", "0.56334925", "0.5632658", "0.5631188", "0.5629864", "0.56264484", "0.56257564", "0.56247115", "0.56209517", "0.5620034", "0.5619546", "0.5618837" ]
0.71047074
0
Use callbacks to share common setup or constraints between actions.
def set_dest @dest = Dest.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def dest_params params.require(:dest).permit(Dest::REGISTRABLE_ATTRIBUTES) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Set the margins of this object.
def margins=(value) raise TypeError, ':margins option must be a Margins instance or respond to #to_hash or #to_h' unless value.respond_to?(:to_hash) || value.respond_to?(:to_h) @margins = if value.is_a?(Margins) value else value = value.to_hash rescue value.to_h Margins.new(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_margins(margin)\n set_margin_left(margin)\n set_margin_right(margin)\n set_margin_top(margin)\n set_margin_bottom(margin)\n end", "def setMargins(top, right, bottom, left)\n setMarginTop(top)\n setMarginRight(right)\n setMarginBottom(bottom)\n setMarginLeft(left)\n self\n end", "def margins=(margin)\n @top_margin = @left_margin = @right_margin = @bottom_margin = margin\n end", "def set_layout_margins(margin_pixels)\n @layout.marginTop = margin_pixels\n @layout.marginRight = margin_pixels\n @layout.marginBottom = margin_pixels\n @layout.marginLeft = margin_pixels\n end", "def setPageMargins(top, right, bottom, left)\n setMarginTop(top)\n setMarginRight(right)\n setMarginBottom(bottom)\n setMarginLeft(left)\n self\n end", "def setPageMargins(top, right, bottom, left)\n setMarginTop(top)\n setMarginRight(right)\n setMarginBottom(bottom)\n setMarginLeft(left)\n self\n end", "def set_margin(layout)\n if margin_pixels = self.margin\n layout.marginTop = margin_pixels\n layout.marginRight = margin_pixels\n layout.marginBottom = margin_pixels\n layout.marginLeft = margin_pixels\n end\n end", "def set_margins_TB(margin)\n set_margin_top(margin)\n set_margin_bottom(margin)\n end", "def margin=(margins)\n return margins = [margins] unless margins.is_a? Array\n\n case margins.length\n when 1\n @top_margin = @bottom_margin = @left_margin = @right_margin = margins[0]\n when 2\n @top_margin = margins[0]\n @bottom_margin = margins[0]\n @left_margin = margins[1]\n @right_margin = margins[1]\n when 3\n @top_margin = margins[0]\n @bottom_margin = margins[2]\n @left_margin = margins[1]\n @right_margin = margins[1]\n when 4\n @top_margin = margins[0]\n @right_margin = margins[1]\n @bottom_margin = margins[2]\n @left_margin = margins[3]\n else\n raise \"Too many arguments (#{margins.length}) sent to MarginView#margin\"\n end\n\n margins\n end", "def margin=(margins)\n return margins = [margins] unless margins.is_a? Array\n\n case margins.length\n when 1\n @top_margin = @bottom_margin = @left_margin = @right_margin = margins[0]\n when 2\n @top_margin = margins[0]\n @bottom_margin = margins[0]\n @left_margin = margins[1]\n @right_margin = margins[1]\n when 3\n @top_margin = margins[0]\n @bottom_margin = margins[2]\n @left_margin = margins[1]\n @right_margin = margins[1]\n when 4\n @top_margin = margins[0]\n @right_margin = margins[1]\n @bottom_margin = margins[2]\n @left_margin = margins[3]\n else\n raise \"Too many arguments (#{margins.length}) sent to MarginView#margin\"\n end\n\n margins\n end", "def margins(*margins)\n cur_page.margins(*margins)\n end", "def SetMargins(left, top, right=-1)\n\t\t#Set left, top and right margins\n\t\t@l_margin = left\n\t\t@t_margin = top\n\t\tif (right == -1)\n\t\t\tright = left\n\t\tend\n\t\t@r_margin = right\n\tend", "def margin(value)\n @tileset.margin = value\n end", "def margin\n @margin || 0\n end", "def margin\n @margin || 10\n end", "def margin\n @margin || 10\n end", "def margin\n @margin || 10\n end", "def set_margins_LR(margin)\n set_margin_left(margin)\n set_margin_right(margin)\n end", "def SetTopMargin(margin)\n\t\t#Set top margin\n\t\t@t_margin = margin\n\tend", "def marginLeft=(value)\n\t\t\t@marginLeft = value\n\t\tend", "def set_margin_top(margin = 1.00)\n @margin_top = margin\n end", "def pdf_margin\n [ margin_top, margin_right, margin_bottom, margin_left ]\n end", "def marginTop=(value)\n\t\t\t@marginTop = value\n\t\tend", "def margins_pt(top, left = top, bottom = top, right = left)\n # Set the margins to new values\n @top_margin = top\n @bottom_margin = bottom\n @left_margin = left\n @right_margin = right\n # Check to see if this means that the current writing position is\n # outside the writable area\n if @y > (@page_height - top)\n # Move y down\n @y = @page_height - top\n end\n\n start_new_page if @y < bottom # Make a new page\n end", "def set_margin_bottom(margin = 1.00)\n @margin_bottom = margin\n end", "def set_margin_left(margin = 0.75)\n @margin_left = margin\n end", "def set_left_margin(value)\r\n @left_margin = value\r\n end", "def margin \n margins = {} \n CssStyle.directions.each do |dir| \n value = css_style.send :\"margin_#{dir}\"\n margins[dir] = value if value\n end \n return nil if margins == {} \n margins\n end", "def SetHeaderMargin(hm=10)\n\t\t@header_margin = hm;\n\tend", "def left_margins=(value)\n @left_margins = value\n end", "def top_margins=(value)\n @top_margins = value\n end", "def bottom_margins=(value)\n @bottom_margins = value\n end", "def SetLeftMargin(margin)\n\t\t#Set left margin\n\t\t@l_margin = margin\n\t\tif ((@page>0) and (@x < margin))\n\t\t\t@x = margin\n\t\tend\n\tend", "def setNoMargins(value)\n @fields['no_margins'] = value\n self\n end", "def initialize\n @paper = Paper::A4\n @left_margin = DEFAULT_LEFT_MARGIN\n @right_margin = DEFAULT_RIGHT_MARGIN\n @top_margin = DEFAULT_TOP_MARGIN\n @bottom_margin = DEFAULT_BOTTOM_MARGIN\n @gutter = nil\n @orientation = PORTRAIT\n end", "def SetFooterMargin(fm=10)\n\t\t@footer_margin = fm;\n\tend", "def right_margins=(value)\n @right_margins = value\n end", "def set_margin_right(margin = 0.75)\n @margin_right = margin\n end", "def set(args)\n return unless args\n args.each do |k,v|\n if [:margin, :padding, :border].include?(k)\n set_param(k, *v)\n else\n self[k] = v\n end\n end\n self\n end", "def margins_cm(top, left = top, bottom = top, right = left)\n margins_pt(cm2pts(top), cm2pts(left), cm2pts(bottom), cm2pts(right))\n end", "def marginBottom=(value)\n\t\t\t@marginBottom = value\n\t\tend", "def margins_mm(top, left = top, bottom = top, right = left)\n margins_pt(mm2pts(top), mm2pts(left), mm2pts(bottom), mm2pts(right))\n end", "def initialize(value = nil)\n options = {\n # default 1 inch margins\n \"left\" => 1440,\n \"right\" => 1440,\n \"top\" => 1440,\n \"bottom\" => 1440\n }\n\n case value\n when String\n options = options.merge(self.class.parse_string(value))\n when Hash\n options = options.merge(value)\n when nil\n else\n RRTF::RTFError.fire(\"Cannot create margin from '#{value}'.\")\n end # case\n\n @left = options.delete(\"left\")\n @right = options.delete(\"right\")\n @top = options.delete(\"top\")\n @bottom = options.delete(\"bottom\")\n end", "def SetRightMargin(margin)\n\t\t#Set right margin\n\t\t@r_margin = margin\n\tend", "def marginRight=(value)\n\t\t\t@marginRight = value\n\t\tend", "def setMarginTop(top)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)\n raise Error.new(Pdfcrowd.create_invalid_value_message(top, \"setMarginTop\", \"html-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_top\"), 470);\n end\n \n @fields['margin_top'] = top\n self\n end", "def setMarginTop(top)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)\n raise Error.new(Pdfcrowd.create_invalid_value_message(top, \"setMarginTop\", \"image-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_top\"), 470);\n end\n \n @fields['margin_top'] = top\n self\n end", "def set_right_margin(value)\r\n @left_margin = value - scroll_width + 1\r\n end", "def margins_in(top, left = top, bottom = top, right = left)\n margins_pt(in2pts(top), in2pts(left), in2pts(bottom), in2pts(right))\n end", "def setMarginBottom(size)\n @textBox.set_margin_bottom(size)\n self\n end", "def margin(currency = 'XBt')\n get 'margin', currency: currency\n end", "def setMarginBottom(bottom)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)\n raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, \"setMarginBottom\", \"html-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_bottom\"), 470);\n end\n \n @fields['margin_bottom'] = bottom\n self\n end", "def spacing=(spacing)\n @spacing = [spacing].flatten\n end", "def setMarginTop(top)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)\n raise Error.new(Pdfcrowd.create_invalid_value_message(top, \"setMarginTop\", \"image-to-image\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_top\"), 470);\n end\n \n @fields['margin_top'] = top\n self\n end", "def margin_left\n cur_page.margin_left\n end", "def setMarginLeft(left)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)\n raise Error.new(Pdfcrowd.create_invalid_value_message(left, \"setMarginLeft\", \"html-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_left\"), 470);\n end\n \n @fields['margin_left'] = left\n self\n end", "def change_margin(delta)\n # binding.pry\n calc = delta.to_f/100.0\n new_sellprice = @costprice.to_f / (1.0-calc)\n self.sellprice = new_sellprice.to_i\n self.update()\n end", "def add_margins(input, output)\n `pdfcrop --margins 18 #{input.shellescape} #{output.shellescape}`\n end", "def setMarginLeft(left)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)\n raise Error.new(Pdfcrowd.create_invalid_value_message(left, \"setMarginLeft\", \"image-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_left\"), 470);\n end\n \n @fields['margin_left'] = left\n self\n end", "def setMarginBottom(bottom)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)\n raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, \"setMarginBottom\", \"image-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_bottom\"), 470);\n end\n \n @fields['margin_bottom'] = bottom\n self\n end", "def setborderwidth(*)\n super\n end", "def left_margin(value=nil)\n make_constraint(:left_margin, :equal, value)\n end", "def spacing\n @spacing ||= 1\n end", "def set_defaults\n self.width ||= 0.20\n self.height ||= 0.20\n end", "def setPageDimensions(width, height)\n setPageWidth(width)\n setPageHeight(height)\n self\n end", "def setPageDimensions(width, height)\n setPageWidth(width)\n setPageHeight(height)\n self\n end", "def default_horizontal_margin\n return 0\n end", "def setMarginLeft(left)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)\n raise Error.new(Pdfcrowd.create_invalid_value_message(left, \"setMarginLeft\", \"image-to-image\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_left\"), 470);\n end\n \n @fields['margin_left'] = left\n self\n end", "def default_horizontal_margin\n return current_layout.border_spacing\n end", "def default_horizontal_margin\n return current_layout.border_spacing\n end", "def setMarginBottom(bottom)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)\n raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, \"setMarginBottom\", \"image-to-image\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_bottom\"), 470);\n end\n \n @fields['margin_bottom'] = bottom\n self\n end", "def margin()\n @margin = @sell_price - @buy_price\n return @margin\n end", "def margin_left\n 1\n end", "def border_width=(width)\n self.each {|cell| cell.border_width = width}\n end", "def setDimensions\n @intTargetX = @canvasRefrance.getCanvasWidth\n @intTargetY = @canvasRefrance.getCanvasHeight\n end", "def calculate_top_margin\n @border_top = 5\n @border_top += title_font_size if show_graph_title\n @border_top += 5\n @border_top += subtitle_font_size if show_graph_subtitle\n end", "def test_change_margin_check_margin()\n @item1.change_margin(40)\n assert_equal(40, @item1.margin)\n end", "def setNoHeaderFooterHorizontalMargins(value)\n @fields['no_header_footer_horizontal_margins'] = value\n self\n end", "def set(cols, rows, lays, cell_w, cell_h, cell_d)\n @columns = cols.to_i\n @rows = rows.to_i\n @layers = lays.to_i\n @cell_width = cell_w.to_i\n @cell_height = cell_h.to_i\n @cell_depth = cell_d.to_i\n self\n end", "def setwidth(width)\n @width = width\n end", "def borders=(value)\n @borders = value\n end", "def default_vertical_margin\n return 0\n end", "def margin\n return 0 if self.is_close?\n self.instrument.trading_symbol.margin.calculate(self)\n end", "def alignments_reset\n @valign = GroupLayout::CENTER\n @halign = GroupLayout::CENTER\n end", "def set_paper(paper_size = 0)\n @paper_size = paper_size\n end", "def store_margin_top #:nodoc:\n record = 0x0028 # Record identifier\n length = 0x0008 # Bytes to follow\n\n margin = @margin_top # Margin in inches\n\n header = [record, length].pack('vv')\n data = [margin].pack('d')\n\n data = data.reverse if @byte_order != 0 && @byte_order != ''\n\n prepend(header, data)\n end", "def margin_top\n cur_page.margin_top\n end", "def store_margin_left #:nodoc:\n record = 0x0026 # Record identifier\n length = 0x0008 # Bytes to follow\n\n margin = @margin_left # Margin in inches\n\n header = [record, length].pack('vv')\n data = [margin].pack('d')\n\n data = data.reverse if @byte_order != 0 && @byte_order != ''\n\n prepend(header, data)\n end", "def setviewport(*)\n super\n end", "def width= w\n\t\t\t@width = w\n\t\t\t@column_width = nil\n\t\t\t@margin_width = nil\n\t\tend", "def setCenterOfMass _obj, _args\n \"_obj setCenterOfMass _args;\" \n end", "def setCanvasSize\n if @intTargetX.to_s.to_i > 20 and @intTargetY.to_s.to_i > 20\n puts('setting new dimetions')\n @canvasRefrance.resizeCanvas(@intTargetY.to_s.to_i,@intTargetX.to_s.to_i)\n else \n puts('setting defult dimentions')\n @canvasRefrance.resizeCanvas(@minDimensions,@minDimensions)\n end\n end", "def widths_reset\n @width = GroupLayout::DEFAULT_SIZE\n @max = GroupLayout::DEFAULT_SIZE\n end", "def setlinewidth(*)\n super\n end", "def setMarginRight(right)\n unless /(?i)^0$|^[0-9]*\\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)\n raise Error.new(Pdfcrowd.create_invalid_value_message(right, \"setMarginRight\", \"html-to-pdf\", \"The value must be specified in inches \\\"in\\\", millimeters \\\"mm\\\", centimeters \\\"cm\\\", pixels \\\"px\\\", or points \\\"pt\\\".\", \"set_margin_right\"), 470);\n end\n \n @fields['margin_right'] = right\n self\n end", "def setCanvasDimensions(width, height)\n setCanvasWidth(width)\n setCanvasHeight(height)\n self\n end", "def SetAutoPageBreak(auto, margin=0)\n\t\t#Set auto page break mode and triggering margin\n\t\t@auto_page_break = auto\n\t\t@b_margin = margin\n\t\t@page_break_trigger = @h - margin\n\tend", "def set_dimensions(*dims)\n if dims[0].is_a?(Rect)\n rect = dims[0]\n elsif dims[0].is_a?(Integer) && dims[1].is_a?(Integer) && dims[2].is_a?(Integer) && dims[3].is_a?(Integer)\n rect = Rect.new(dims[0],dims[1],dims[2],dims[3])\n else\n raise ArgumentError, 'invalid dimension(s) for ApplicationWindow: ' + dims.inspect\n end\n self.x = rect.x\n self.y = rect.y\n self.width = rect.width\n self.height = rect.height\n end", "def marginal_costs=(value)\n dataset_set(:marginal_costs, value)\n end", "def default_vertical_margin\n return current_layout.border_spacing\n end" ]
[ "0.8128346", "0.7953358", "0.78715336", "0.7405558", "0.7360262", "0.73598665", "0.7358993", "0.7176381", "0.7155382", "0.7155382", "0.71191967", "0.7077468", "0.694905", "0.66403484", "0.660119", "0.660119", "0.660119", "0.642252", "0.63279414", "0.6320947", "0.6300903", "0.63006884", "0.63003075", "0.6203783", "0.61741793", "0.6104549", "0.6094803", "0.5932636", "0.5931549", "0.5837707", "0.5809269", "0.57947433", "0.5774337", "0.5724761", "0.57039344", "0.56934786", "0.5690329", "0.56605107", "0.5659524", "0.5623832", "0.5595377", "0.55775875", "0.5491636", "0.54648346", "0.54332894", "0.5394553", "0.5342761", "0.5272942", "0.5272584", "0.5229394", "0.5225721", "0.5191964", "0.51864845", "0.5162052", "0.5153925", "0.51539034", "0.5143795", "0.50777346", "0.50768155", "0.5060457", "0.5017071", "0.4996932", "0.49963036", "0.4967291", "0.4942815", "0.49413928", "0.49197507", "0.49147737", "0.49136266", "0.49136266", "0.4887641", "0.48247558", "0.4801339", "0.4764751", "0.4755291", "0.4749361", "0.47376385", "0.4710539", "0.47078356", "0.47033826", "0.47005624", "0.4698661", "0.46452892", "0.4643565", "0.46398377", "0.4632413", "0.46195725", "0.45987332", "0.4598318", "0.45969266", "0.45920074", "0.45864415", "0.4577522", "0.4575349", "0.45623547", "0.45614356", "0.45585188", "0.45537716", "0.4541728", "0.45397907" ]
0.7130398
10
GET /matches GET /matches.json
def find_matches @match_distances = Match.find_match(current_user, "Any", nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end", "def index\n @matches = Match.page(params[:page]).per(1)\n end", "def index\n @matches = Match.where(\"player2_id IS NOT NULL\").order(\"#{:id} desc\")\n\n respond_to do |format|\n format.html { @matches }\n format.json { render json: @matches}\n end\n end", "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = current_user.matches\n end", "def index\n if @tournament = Tournament.where(:id => params[:tournament_id]).first\n @matches = @tournament.matches\n else\n @matches = Match.all\n end\n\n @matches_in_dates = Match.matches_in_dates(@matches)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def show\n @matches = Match.all\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @match }\n end\n end", "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def show\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @matchs_du_jour = Match.find_all_by_date_match(DateTime.now.to_date)\n\n @matchs_termines = Match.where(\"date_match < ? \",DateTime.now.to_date)\n\n @matchs_a_venir = Match.where(\"date_match > ? \",DateTime.now.to_date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n # user = User.find_by_token(params[:token])\n # # @user = User.find(params[:id])\n matches = current_user.matches\n matches.each do |match|\n match['players'] = Array.new(match.users)\n end\n\n render json: {user: current_user, decks: current_user.decks, matches: matches}\n end", "def show\n authorize! :show, Match\n\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @matches = Match.order(:name).page(params[:page])\n end", "def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end", "def index\n @team_matches = TeamMatch.all\n end", "def show\n @match = @contest.matches.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def index\n #Visa endast de kommande matcherna\n @matches = Match.where(\"datum >= ?\",Date.today).order(:datum)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @match_assignments }\n end\n end", "def show\n @lost = Lost.find(params[:id])\n @matches = Found.tagged_with(@lost.tag_list, :any => true)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost }\n end\n end", "def index\n # Vudo - Need to remove soft-deleted matchups\n @matchups = Matchup.includes(:home_team, :away_team).all\n render :json => @matchups, :include => [:home_team, :away_team]\n end", "def get_match ( match_key )\n get_api_resource \"#{@@api_base_url}match/#{match_key}\"\n end", "def index\n type = @current_user.user_type\n if type == 'Rapper'\n matches = @current_user.producer_matches\n render json: matches\n else\n matches = @current_user.rapper_matches\n render json: matches\n end\n end", "def index\n #return JSON of a user's matches profile information\n # render :text => \"Match index\"\n\n #THIS SHOULD PROBABLY BE MOVED TO MODEL\n # user = User.find(1)\n # match_ids = []\n # user.first_user_matches.each do |match|\n # match_ids << match.second_user_id\n # end\n # user.second_user_matches.each do |match|\n # match_ids << match.first_user_id\n # end\n # @matches = []\n # match_ids.each do |id|\n # @matches << User.find(id)\n # end\n # render 'index'\n\n if current_user\n @matches = current_user.matches\n render 'index'\n else\n end\n # user = User.find(2) #need to pull user_id from Devise\n # respond_with user.matches\n end", "def index\n @matches = search_all(Match)\n @advert = Advert.random('matches_list')\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :partial => @matches }\n end\n end", "def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end", "def matches()\n sql = \"SELECT matches.* FROM matches WHERE away_team_id = #{@id} OR home_team_id = #{@id};\"\n matches = SqlRunner.run( sql )\n result = matches.map { |match| Match.new(match) }\n return result\n end", "def get_event_matches ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/matches\"\n end", "def get_team_event_matches ( team_key, event_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/event/#{event_key}/matches\"\n end", "def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bet_scores }\n end\n end", "def getMatchCount\n\t\trender json: Match.count(:user1 => params[:twitter_id])\n\tend", "def show\n @match_stat = MatchStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_stat }\n end\n end", "def show\n render json: @clan_match\n end", "def index\n @matches = Photos.all\n end", "def all_matches\n\t\t@@logger.info { \"Retrieving all matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).all\n\tend", "def index\n @matches = current_user.matches.distinct\n end", "def get_matches\n @data ||= begin\n str = APIS[ @league.downcase.to_sym ]\n str = str.gsub( '$year$', @year.to_s )\n\n get( str ) ## use \"memoized\" / cached result\n end\n end", "def matches\n @user = User.find_by_email(params[:email])\n if @user\n @place = Place.get(params[:id])\n if @place\n @matches = @place.matches(@user)\n render 'matches'\n else \n render 'failure', :locals => {:message => 'Place not found', :details => \"Place ID: #{params[:id]}\"}\n end\n else\n render 'failure', :locals => {:message => 'User not found', :details => \"User: #{params[:email]}\"}\n end\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def index\n @matches = Match.page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n\n\n end", "def index\n championship_id=params[:championship_id]\n @matches = Match.where(championship_id: championship_id)\n @matches = Match.all if @matches.blank? && !params[:championship_id].present?\n page = params[:page]\n page = 1 if page.blank? && !params[:page].present?\n @matches = @matches.paginate(:page => page, :per_page => 20)\n end", "def get_match_data(match_id)\n # Given a matchId, make an API request for the match data.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matches/#{match_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n sleep(1)\n match_data = JSON.parse(response_string)\nend", "def index\n @match_details = MatchDetail.all\n end", "def index\n @matches = Match.where({active: true})\n end", "def index\n @stat_of_player_of_team_of_matches = StatOfPlayerOfTeamOfMatch.all\n end", "def index\n @match_sets = MatchSet.all\n end", "def show\n @leaguemembers = League.find(params[:id]).users\n @matches = Match.where(:league_id => params[:id])\n \n end", "def uri\n 'matches'\n end", "def matches\n @matches ||= []\n end", "def search\n\n \t@matches = []\n\n\t\tpattern = params[:search].downcase\n \tfind = Regexp.new(Regexp.quote(pattern))\n\t\t\n \tPlayer.all.each do |p|\t\t\t\n\t\t\tplayer_matches = false\n \tif p.name.downcase =~ find\n \t\tplayer_matches = true\n \t\t@matches << [p.name]\n \t\tbreak\n \tend\n end\n \n \trender :text => @matches.to_json()\n \tend", "def user_matches \n\t\t@matches = Match.personal_matches(current_user)\n\tend", "def index\n @matchs = Match.all.order(\"created_at DESC\")\n @results = @p.result\n end", "def match(match_id)\n get_request(shard_endpoint_uri(\"matches/#{match_id}\"))\n end", "def index\n @matchparticipants = Matchparticipant.all\n end", "def get_match_ids(account_id)\n # Given a summoner's accountId, make an API request for their match history.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n match_history = JSON.parse(response_string)\n match_ids = match_history[\"matches\"].map {|match| match['gameId']}.uniq\nend", "def show\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_image }\n end\n end", "def show\n @club = Club.find(params[:club_id])\n @event = Event.find(params[:event_id])\n @serie = Serie.find(params[:id])\n @matches = Match.where(serie: @serie)\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def matches\n\t\t\tcompetition.matches\n\t\tend", "def show\n @matchsindiv = Matchsindiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matchsindiv }\n end\n end", "def show\n #@bet_score = @match.bet_scores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet_score }\n end\n end", "def index\n @match_requirements = MatchRequirement.all\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @stats = Stat.where(:match_id => params[:match_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stats }\n end\n end", "def index\n session.clear\n session['matches_session'] = Hash.new\n @matches = Match.all\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def get_event_matches_with_http_info(event_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MatchApi.get_event_matches ...'\n end\n # verify the required parameter 'event_key' is set\n if @api_client.config.client_side_validation && event_key.nil?\n fail ArgumentError, \"Missing the required parameter 'event_key' when calling MatchApi.get_event_matches\"\n end\n # resource path\n local_var_path = '/event/{event_key}/matches'.sub('{' + 'event_key' + '}', CGI.escape(event_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Match>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MatchApi#get_event_matches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_match\n @match = Match.find(params[:match_id])\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @match }\n end\n end", "def index\n @match_teams = MatchTeam.all\n end", "def show\n @interpro_match = InterproMatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interpro_match }\n end\n end", "def index\n #should be the following line when our matching feature is implemented\n @user = current_user\n #@matches = Match.All\n end", "def index\n respond_with MatchDayTeam.search(team_search_params)\n end", "def index\n @group = Group.find(params[:group_id])\n @matches = @group.matches.find(:all, :order => 'date DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n format.mobile\n format.atom \n end\n end", "def show\n @match = Match.find(params[:id])\n @result = Result.where(:match_id => params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def to_json\n (@matches.map {|m| m.to_json}).to_json\n end", "def get_match(match_key, opts = {})\n data, _status_code, _headers = get_match_with_http_info(match_key, opts)\n data\n end", "def show\n @match = Match.includes(invoices: [{registrations: [:shooter]}]).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n render json: @match.invoices, root: false\n end\n end\n end", "def get_up_link_matches\n begin\n user_id = current_user.id\n\n if Match.exists?(user_id: user_id, completion_status: 'pending')\n match = Match.find_by(user_id: user_id, completion_status: 'pending')\n up_link_user = User.find_by(id: match.matched_user_id)\n up_link_user_bank = Bank.find_by(user_id: up_link_user.id)\n bank_name = up_link_user_bank.name\n account_number = up_link_user_bank.account_number\n\n render json: { status: 'SUCCESS', data: {\n first_name: up_link_user.first_name,\n last_name: up_link_user.last_name,\n phone_number: up_link_user.phone_number,\n user_id: up_link_user.id,\n match_id: match.id,\n account_number: account_number,\n bank_name: bank_name\n }}, status: :ok\n else\n render json: { status: 'SUCCESS', data: '' }, status: :ok\n end\n\n rescue Exception => e\n puts e.message\n\n render json: { status: 'ERROR', data: {\n message: 'An unexpected error occurred. Please try againlater'\n }}, status: :internal_server_error\n end\n end", "def matches\n parse\n end", "def round_matches(round)\n\t\t@@logger.info { \"Retrieving matches for a given round.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:round => round).all\n\tend", "def index\n @matches = cur_user.matches\n\n respond_to do |format|\n format.html\n format.csv { send_data @matches.to_csv }\n end\n end", "def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def get_team_event_matches_with_http_info(team_key, event_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MatchApi.get_team_event_matches ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling MatchApi.get_team_event_matches\"\n end\n # verify the required parameter 'event_key' is set\n if @api_client.config.client_side_validation && event_key.nil?\n fail ArgumentError, \"Missing the required parameter 'event_key' when calling MatchApi.get_team_event_matches\"\n end\n # resource path\n local_var_path = '/team/{team_key}/event/{event_key}/matches'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s)).sub('{' + 'event_key' + '}', CGI.escape(event_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Match>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MatchApi#get_team_event_matches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def matches(filter_params = {})\n get_request(shard_endpoint_uri('matches', filter_params))\n end", "def index\n @pmmatches = Pmmatch.all\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end" ]
[ "0.752813", "0.7394124", "0.730342", "0.7210067", "0.72072196", "0.7200118", "0.7068271", "0.7068271", "0.7068271", "0.7068271", "0.7068271", "0.70285064", "0.69965607", "0.69690144", "0.69647396", "0.6962711", "0.6949953", "0.69074726", "0.6834273", "0.6762692", "0.6753257", "0.6703258", "0.6678987", "0.66473657", "0.6602389", "0.654179", "0.6512546", "0.6472176", "0.64533615", "0.64291525", "0.6429004", "0.64184165", "0.64136076", "0.6410081", "0.6398445", "0.63950014", "0.6390643", "0.63626796", "0.6360459", "0.635506", "0.63284296", "0.6327606", "0.63266", "0.62836754", "0.62574285", "0.62524086", "0.6234057", "0.6226566", "0.61981875", "0.61852473", "0.61808133", "0.6162907", "0.61582094", "0.6145447", "0.6141464", "0.613558", "0.613231", "0.6122456", "0.6119345", "0.6117252", "0.60945034", "0.60920596", "0.60637736", "0.6050682", "0.60203123", "0.6017487", "0.6012935", "0.6012935", "0.59985346", "0.5993258", "0.5987145", "0.5980661", "0.5962105", "0.5962105", "0.5962105", "0.5962105", "0.5960202", "0.59594727", "0.59569496", "0.59412056", "0.59255564", "0.5923713", "0.5917457", "0.5914777", "0.59114677", "0.5904952", "0.5904781", "0.59026927", "0.58950794", "0.5867438", "0.585588", "0.58456415", "0.58414567", "0.58214253", "0.58016855", "0.5775159", "0.5767559", "0.5753332", "0.57528794", "0.57476467" ]
0.6246667
46
the controller for partial view of carousel which is appended on find_matches.html.erb via ajax
def carousel @match_distances = Match.find_match(current_user, params[:match_type], params[:after].to_date) render :partial => 'carousel', :content_type => 'text/html', :locals => {:match_distances => @match_distances} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matches = search_all(Match)\n @advert = Advert.random('matches_list')\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :partial => @matches }\n end\n end", "def list_view\n\t\t# render the partial page with js to show the list view\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def ajax_show\n recording = Recording.find(params[:id])\n @avalon_item = recording.avalon_item\n render partial: 'recordings/ajax_show', locals: {recording: recording}\n end", "def search_matter\n cid = @company.id\n @search_result =[]\n @search_result = matter_search # Common search\n respond_to do |format|\n format.js { render :partial=> 'matter_auto_complete', :object => @search_result }\n format.html { render :partial=> 'matter_auto_complete', :object => @search_result }\n end \n end", "def search\n find_nota\n respond_to do |format|\n format.html{render :partial=> \"row_index\"}\n format.json { render json: @dependencias }\n format.js { }\n end\n end", "def search\n find_dependencias\n respond_to do |format|\n format.html{render :partial=> \"row_index\"}\n format.json { render json: @dependencias }\n format.js { }\n end\n end", "def load_add_image_page\n\n @parent = get_parent(params[:parent_id])\n @items_to_select = @parent.images\n\n @all_components = Component.all\n @all_images = Image.all\n\n respond_to do |format|\n format.js\n end\n end", "def load_new_image_page\n\n @parent = get_parent(params[:parent_id])\n @items_to_select = [@parent]\n\n @all_properties = Property.all\n @all_products = Product.all\n @all_components = Component.all\n\n respond_to do |format|\n format.js\n end\n end", "def index\r\n @uploaded_roster = UploadedRoster.new\r\n\r\n #respond_to do |format|\r\n # format.js\r\n #end\r\n end", "def ajax_search\n @providers = Provider.search(params[:search])\n\n respond_to do |format|\n format.js {render :layout => false }\n end\n end", "def live_search\n# @banco_pages, @bancos = paginate :bancos, :per_page => 10\n @negocios = Negocio.find(:all, :order => 'nombre')\n @negocios = Negocio.find(:all, :conditions => [\"nombre like ?\", \"%#{params[:searchtext]}%\"])\n return render(:partial => 'filtronegocio', :layout => false) if request.xhr?\n end", "def results\n get_results(true)\n render :partial => (params[:result_partial] || 'results')\n end", "def render_ajax\n {:partial => 'shared/flexigrid/ajax', :locals => {:grid => self}}\n end", "def camiones\n logger.info 'en camiones' \n self.load_toggle({'q' => params[:q]}.to_s) #enviamos los parametros que vamos a aplilar\n @search = Truck.where(active: 1).includes(:state).search(params[:q])\n @banners = get_banners(params[:q])\n @trucks = @search.result.order(:nombre).page(params[:page]).per(Environment::LIMIT_SEARCH)\n @tiposCaminiones = TypeTruck.all.includes(:sub_trucks)\n @states = State.all.order(:name)\n @states_group = Truck.state_group(params[:q])\n @modelos_group = Truck.modelo_group(params[:q])\n @brand_group = Truck.marcas_group(params[:q])\n #@km_group = Truck.km_group\n @toggle_search = self.nested_search(params[:q])\n respond_to do |format|\n format.html { render :camiones }\n format.js { render :camiones }\n end\n end", "def search\n find_organismos\n respond_to do |format|\n format.html{render :partial=> \"row_index\"}\n format.json { render json: @dependencias }\n format.js { }\n end\n end", "def search\n markup = render_to_string :partial => \"search_lightbox\", :layout => false\n render :json => { :code => 200, :klass => 'success', :markup => markup }.to_json and return\n end", "def load_new_vf_page\n @parent = get_parent(params[:parent_id])\n @items_to_select = [@parent]\n\n @all_properties = Property.all\n @all_products = Product.all\n @all_components = Component.all\n\n respond_to do |format|\n format.js\n end\n end", "def index\n @q = Socio.search(params[:q])\n @socios = @q.result.paginate page: params[:page], per_page: 5\n respond_to do |format|\n format.html\n format.js# {render partial: \"socios/socio_rows\", locals: {socios: @socios}}\n end\n end", "def search\n session[:per_page]=params[:per_page]\n session[:ooc_group_type] = params[:ooc_group_type]\n session[:ooc_group_id] = params[:ooc_group_id]\n session[:ooc_asset_search] = asset_params(params)\n @assets = OocAssetSearch.search(session[:ooc_asset_search]).paginate :page=>params[:page],\n :per_page=>session[:ooc_asset_search][:per_page]\n respond_to do |format|\n format.js {\n render :update do |page|\n page.replace_html 'result', :partial => 'result'\n end\n }\n end\n end", "def load_component_tab\n @item_id = params[:item]\n respond_to do |format|\n format.html\n format.js\n end\n end", "def process_filter \n respond_to do |format|\n\t\t\tformat.js # Calls process_filter.js.erb in follows view folder AJAX Code.\n\t\tend # Respond to block\n end", "def index\n @equipment_groups = EquipmentGroup.all\n respond_to do |format|\n format.js { render :partial => 'equipment/index_remote' }\n end\n end", "def index\n @wines = Wine.all\n @items = @wines\n @items_name=\"Weine\"\n @item_name=\"Wein\"\n @item_partial=\"/wines/wine\"\n @modal=false\n @controller_name=\"wines\"\n render '/shared/crudajax'\n end", "def findplace\n respond_to do |format|\n format.js if request.xhr?\n end\n \n end", "def handle_next\n\n init_next\n\n respond_to do |format|\n\n format.js { render :file => 'shared/handle_next_prev.js.erb' }\n\n end\n\n end", "def search_results_ref_num \n query = params[:query].strip if params[:query]\n if query and request.xhr?\n @questions = Admin::Questionbank.find(:all,:order=>'created_at DESC', :conditions => [\"internal_ref_number LIKE ?\", \"%#{query}%\"]) \n render :partial => \"search_results_all\", :layout => false, :locals => {:searchresults => @questions} \n end\n end", "def playaudio\n respond_to do |format|\n format.js { render partial: 'podcastapp/audioplayer/audioplayer' }\n end\n\n end", "def live_search\n @bancos = Banco.find(:all, :order => 'nombre')\n @bancos = Banco.find(:all, :conditions => [\"nombre like ?\", \"%#{params[:searchtext]}%\"])\n return render(:partial => 'filtronombre', :layout => false) if request.xhr?\n end", "def search\n find_clients\n render_clients\n end", "def show_regexpressions\n @task = Task.find(params[:id])\n @regexpressions = @task.regexpressions\n\n respond_to do |format|\n format.js { render 'demo/show_regexpressions' }\n end\n end", "def index\n get_own_media_elements\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_media_elements\n end\n render_js_or_html_index\n end", "def start \n render :partial=>\"start.js.erb\"\n end", "def load_new_component_page\n @parent = get_parent(params[:parent_id])\n @items_to_select = [@parent]\n @all_properties = Property.all\n @all_products = Product.all\n @all_groups = Group.all\n respond_to do |format|\n format.js\n end\n end", "def index\n #p = logged_in? ? logged_in_person : nil\n per_page = 12\n conditions = []\n condition_vars = {}\n if params[:title] and params[:title] != ''\n conditions.push(\"lower(title) like :title\")\n condition_vars[:title] =\"%#{params[:title].downcase}%\"\n end\n find_conditions = [conditions.join(\" and \"), condition_vars]\n permitted_questionnaires = Questionnaire.all(:conditions => find_conditions, :order => 'id DESC')\n pager = ::Paginator.new(permitted_questionnaires.size, per_page) do |offset, pp|\n permitted_questionnaires[offset, pp]\n end\n @questionnaires = returning WillPaginate::Collection.new(params[:page] || 1, per_page, permitted_questionnaires.size) do |paginator|\n paginator.replace pager.page(params[:page]).items\n end\n \n\n respond_to do |format|\n format.html { }\n format.js do\n render :update do |page|\n page.replace_html 'questionnaire_list', :partial => 'paged_results'\n end\n end\n end\n end", "def selector\n search_params = Observation.get_search_params(params,\n current_user: current_user)\n search_params = Observation.apply_pagination_options(search_params)\n @observations = Observation.latest.query(search_params).paginate(\n page: search_params[:page], per_page: search_params[:per_page])\n Observation.preload_for_component(@observations, logged_in: !!current_user)\n respond_to do |format|\n format.html { render :layout => false, :partial => 'selector'}\n # format.js\n end\n end", "def load_add_df_page\n\n @parent = get_parent(params[:parent_id])\n @items_to_select = @parent.data_files\n\n @all_datafiles = DataFile.all\n respond_to do |format|\n format.js\n end\n end", "def index\n @webinars = Webinar.paginate :order => 'date desc', :page => params[:page], :per_page => 25\n if request.xhr?\n render(:update) do |page|\n page.replace_html 'results', :partial => \"results\"\n end\n end\n end", "def display_inline_scrap_topic\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end", "def live_search\n# @banco_pages, @bancos = paginate :bancos, :per_page => 10\n @ejidos = Ejido.find(:all, :order => 'ejido')\n @ejidos = Ejido.find(:all, :conditions => [\"ejido like ?\", \"%#{params[:searchtext]}%\"])\n return render(:partial => 'filtroejido', :layout => false) if request.xhr?\n end", "def play\n @selected_slide_key = @interface.current_slide.short_name\n respond_to do |format|\n format.html { render :play, layout: 'etm' }\n format.js\n end\n end", "def browse_partial\n render :layout => false, :html => (params.to_json * 20)\n end", "def live_search\n @phrase = params[:searchtext]\n @searchphrase = \"%\" + @phrase + \"%\"\n @players = Player.find(:all,\n :conditions => [ \"picks.id IS NULL AND players.player LIKE ?\", @searchphrase],\n :include => [:pick],\n :joins => 'LEFT JOIN picks ON players.id=picks.player_id')\n render :partial => \"search\"\n end", "def find_cartons\n \n render :inline => %{\n\t\t<% @content_header_caption = \"'find cartons'\"%> \n\n\t\t<%= build_carton_search_form()%>\n\n\t\t}, :layout => 'content'\n \n end", "def searchPubmed \n @params = params.pretty_inspect\n @resultsPerPage = params[:resultsPerPage] \n @resultsPerPage = @resultsPerPage.to_i == 0 ? 20 : @resultsPerPage\n @currentPage = params[:page]\n if (request.xhr?)\n initiateSearch\n end\n respond_to do |result| \n result.html do\n @theTerm = params[:term]\n @triggerAjax = true\n render(:template => \"pubmed/index\")\n end\n result.js do \n result.js \n end\n result.json do\n initiateSearch\n results = @pubLib.map {|result| json_for_results(result) }\n render :json => { :content => results }\n end\n #result.js\n end\n end", "def show\n @matchsindiv = Matchsindiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matchsindiv }\n end\n end", "def index \n @client_ip = remote_ip()\n @cars = Car.search(params[:search]) \n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.js # remote: true is sent a js format and sends you to search.js.erb\n end\n end", "def load_new_df_page\n @parent = get_parent(params[:parent_id])\n @items_to_select = [@parent]\n\n @all_datafiles = DataFile.all\n @all_properties = Property.all\n @all_products = Product.all\n\n respond_to do |format|\n format.js\n end\n end", "def test_ajax_next\n photo_set = photo_sets('big_photo_set')\n photo = photo_set.photos[3]\n xhr :get, :carousel, {:dir => 'next.js', :photo_set => photo_set, :current => photo, :photo => '105'}\n assert_select_rjs :insert_html, :after, 'thumb_103', /thumb_102/\n assert_select_rjs :remove, 'thumb_105'\n assert_select_rjs :replace_html, 'thumbnav', /prev\\.js/\n assert_select_rjs :replace_html, 'thumbnav', /next\\.js/\n end", "def index\n #@company = Company.find(1)\n @effects = Effect.page(params[:page]).per(1)\n respond_to do |format|\n format.html\n format.js \n\n end\n end", "def schedule_view\n\t\t# render the partial page with js to show the schedule view\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def index\n\n @per_page = 2\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n\n\n\n if ( params[:search] )\n @ciudades = Ciudade.search( params[:search] ).limit( @per_page ).skip( @skip )\n elsif ( params[:column] )\n @ciudades = Ciudade.sort( params[:column], params[:sort] ).limit( @per_page ).skip( @skip )\n else\n @ciudades = Ciudade.all.limit( @per_page ).skip( @skip )\n end\n \n\n@num_of_pages = ( @per_page.to_i > 0 ) ? ( @ciudades.size / @per_page.to_f ).ceil : 1\n\n \n respond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'ciudades/list', :locals => { :ciudades => @ciudades}, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @ciudades }\n end\n end", "def list_again(options = {})\n catch :flash_now do find_collection(@background_params) end\n div_id = options[:div_id] || \"collection\"\n template = options.delete(:collection_template) || @response_template || \"shared/collection\"\n render :update do |page|\n page.replace div_id , :partial => template, :locals => options\n end \n end", "def index_ajax\n @assets = Asset.find(:all)\n render :back => '/app'\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @projectionscripts = Projectionscript.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @projectionscripts }\n end\n end", "def askPage\n @contribucions = getAllContribucioAsk\n render :partial => 'index', :locals => { :contribucions => @contribucions } \n end", "def search\n list_results = Search.execute(PikiziLib.clean_string(params[:search_text]))\n render :update do |page| \n page.replace_html(\"current_wish_list\",render(:partial => \"/wishlists/search_results\", \n :locals => {:list_results => list_results}))\n end\n end", "def show\n @lecture = Lecture.find(params[:id])\n\t\t@page = params[:page].to_i\n @bullets = @lecture.board.bullets.paginate :page => @page, :order => 'created_at DESC', :per_page => 10\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n page.replace_html 'bullets', :partial => \"boards/show\"\n end\n end\n end\n\tend", "def index\n @activities = Activity.paginate :per_page => ENV['PER_PAGE_ACTIVITIES'], :page => params[:page], :order => 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n format.js {\n render :update do |page|\n page.replace_html 'results', :partial => 'activities_list'\n end\n }\n end \n end", "def ajax_search\n @group = Group.find(params[:group])\n @patients = @group.patients.search(params[:search])\n \n respond_to do |format| \n format.js {render :layout => false }\n end \n end", "def show_ajax\n @element = Element.find_by(tag: params[:tag])\n @previous_color = @element.previous_color || \"\" if @element\n respond_to do |format|\n format.js\n end\n end", "def interview\n\t\t@interview = InterviewReview.where(:company_id => params[:id])\n\t\t@company_id = params[:id]\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def show \n catch :flash_now do find_detail end\n div_id = params[:div_id]\n render :update do |page|\n page[div_id].replace_html :partial => \"detail\"\n end\n end", "def show\n @scan = find_scan( params.require( :id ) )\n\n html_block = if render_partial?\n proc { render @scan }\n end\n\n respond_to do |format|\n format.html( &html_block )\n format.js { render '_scan.js' }\n format.json { render json: @scan }\n end\n end", "def show\n @scan = find_scan( params.require( :id ) )\n\n html_block = if render_partial?\n proc { render @scan }\n end\n\n respond_to do |format|\n format.html( &html_block )\n format.js { render '_scan.js' }\n format.json { render json: @scan }\n end\n end", "def render\n @result_html = ''\n @result_html += \"<div class=\\\"rs-container #{self.class.name}\\\" id=\\\"#{@id}\\\">\"\n @result_html += render_controls.gsub(\"<option value=\\\"rs-#{@effect}\\\">\",\n \"<option value=\\\"rs-#{@effect}\\\" selected=\\\"selected\\\">\")\n @result_html += \"<div class=\\\"rs-wrapper\\\">\"\n @result_html += \"<div class=\\\"rs-shadow\\\"></div>\"\n @result_html += '<div class=\"rs-images\">'\n @images_urls.each do |url|\n @result_html += \"<img src=\\\"#{url}\\\"/>\"\n end\n @result_html += '</div>'\n @result_html += '<div class=\"rs-cover\">'\n @result_html += '<a class=\"rs-animation-command rs-pause\" href=\"javascript:void(0)\">Play/Pause</a>'\n @result_html += \"<img src=\\\"#{@images_urls.first}\\\"/>\"\n @result_html += '</div>'\n @result_html += '<div class=\"rs-transition\">'\n @result_html += render_flips\n @result_html += render_multi_flips\n @result_html += render_cubes\n @result_html += render_unfolds\n @result_html += '</div>'\n @result_html += '</div>'\n @result_html += render_bullets\n @result_html += '</div>'\n\n @result_html.html_safe\n end", "def index\r\n @newly_added_songs = MasterSong.newly.page(params[:page]).per(12)\r\n respond_to do |format|\r\n format.html \r\n format.js \r\n end\r\n end", "def index\n @partial_file = \"index\"\n respond_to do |format|\n format.html\n format.js {\n render :update do |page|\n page['left_col'].replace_html render_template_sub_menu(\"admin/page_templates\")\n page['middle_col'].replace_html :partial => \"index\"\n end\n }\n format.json {\n @templates = actionize PageTemplate.grid_data\n render :json => { :root => @templates }\n }\n end\n end", "def nextCustomers\n\n @searchCustomers = Customer.nextCustomers params[:start], params[:page], 9\n\n # technique below eliminates the extra .js file used in the ajax response. it trades off the disk access for the \\n replacement below\n # remember, its not quite a standard rails approach\n # searchTemplate = render_to_string partial: 'common/search/customer_search_modal_template', locals: { searchCustomers: @searchCustomers }, :layout => false\n\n # when using the technique above, the newlines (\\n) have to be removed\n # render js: \"$('#customer_search_modal_partial').html(\\'\" + searchTemplate.gsub(\"\\n\",\"\") + '\\');'\n\n render template: 'common/search/js/nextSearchCustomers.js'\n\n end", "def search\n @matcher = request.raw_post.delete(\"=\").strip || request.query_string.delete(\"=\").strip\n @icd_codes = IcdCode.find_by_sql(\"SELECT * FROM icd_codes WHERE \" +\n \"(short_description LIKE '%#{@matcher.upcase}%' OR code LIKE '%#{@matcher.upcase}%') AND \" +\n \"id IN (SELECT icd_code_id FROM practice_icd_lists WHERE practice_id = #{session[:practice_id]})\") \n\n\n if @icd_codes.size > 0 \n render :partial=> 'selected_list'\n else \n render :text=> \"<b>No match Found</b>\"\n end \n end", "def show\n @record = user_scoped.find(params[:id])\n #add_topic_path\n respond_to do |format|\n format.html {\n prepare_list\n @search = page_info.record\n render :action=>'index'\n }\n format.js\n end\n end", "def index\n\n \n @per_page = 5\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n \n\nif ( params[:search] )\n \n @paises = Paise.search( params[:search] ).limit(@per_page).skip(@skip)\n elsif ( params[:column] )\n @paises = Paise.sort( params[:column], params[:sort] ).limit(@per_page).skip(@skip)\n else\n @paises = Paise.all.limit(@per_page).skip(@skip)\n end \n \n @num_of_pages = ( @per_page.to_i > 0 ) ? ( @paises.size / @per_page.to_f ).ceil : 1\n\n\nrespond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'paises/list', :locals => { :paises => @paises }, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @paises }\n end\n end", "def showshop\n render :update do |page|\n page.replace_html 'shoplistdiv', :partial => 'shoplist'\n end \nend", "def search\n @matcher = request.raw_post.delete(\"=\").strip || request.query_string.delete(\"=\").strip\n @cpt_codes = CptCode.find_by_sql(\"SELECT * FROM cpt_codes WHERE \" +\n \"(short_description LIKE '%#{@matcher.upcase}%' OR code LIKE '%#{@matcher.upcase}%') AND \" +\n \"id IN (SELECT cpt_code_id FROM cpt_charges WHERE practice_id = #{session[:practice_id]})\") \n if @cpt_codes.size > 0 \n render :partial=> 'selected_list'\n else \n render :text=> \"<b>No match Found</b>\"\n end \n end", "def results\n respond_to do |format|\n if params[:search].present?\n @search = CompatibilitySearchForm.new(search_params)\n @search.user = current_user\n if @search.save\n @compatibility_search = @search.compatibility_search\n format.html\n format.js\n else\n format.html\n format.js\n end\n else\n format.html { redirect_to find_index_path }\n end\n end\n end", "def call_reins_controller\n \"#{ update_reins_controller }r.call_js_controller();\".html_safe\n end", "def show\n respond_to do |format|\n # format.html { render( partial: 'show') if request.xhr? }\n format.js\n end\n end", "def display_selected_matter\n params[:search] ||= {} #to set params[:search] if params is nil Bug 9871\n @matters =[]\n @mode_type = params[:mode_type] #passed from the application.js to set the mode type in view\n data = params\n @matters = matter_search # Common search\n @perpage = params[:per_page].present? ? params[:per_page] : 25 # added for changing pagination limit - do not remove -- Supriya\n @matters = @matters.paginate :page => data[:page], :per_page => @perpage\n respond_to do |format|\n format.js {render :partial=> 'matter'}\n end\n end", "def show\n @carousel_slides = @carousel.carousel_slides\n end", "def show\n render_attrs = @gallery_item.ajax_attrs(@role)\n gallery_item_ids = @gallery_item.gallery.gallery_item_ids\n gallery_item_ids.unshift(nil)\n gallery_item_ids.push(nil)\n (0..gallery_item_ids.size).each do |index|\n if(gallery_item_ids[index+1] == @gallery_item.id)\n render_attrs[:next_id] = gallery_item_ids[index+2]\n render_attrs[:prev_id] = gallery_item_ids[index]\n end\n end\n respond_to do |format|\n format.html { render }\n format.json { render :json => render_attrs }\n end\n end", "def handle_prev\n\n init_prev\n\n respond_to do |format|\n\n format.js { render :file => 'shared/handle_next_prev.js.erb' }\n\n end\n\n end", "def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end", "def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n \n # Section 11.6 Figure 11.12(b) - modified for new partial file name\n # http://pastebin.com/ajk95r8D\n #render :partial => 'movie_ajax', :object => @movie and return if request.xhr?\n # actually, the return statement is superfluous!\n render :partial => 'movie_ajax', :object => @movie if request.xhr?\n \n # will render app/views/movies/show.html.haml by default \n end", "def load_page\n respond_to do |format|\n format.html do\n load_albums_page\n render '_album_rows' , layout: false\n end\n end\n end", "def index\n @filterrific = initialize_filterrific(\n CircPolicyMatrix,\n params[:filterrific],\n persistence_id: 'shared_key',\n select_options: {\n with_cpg_id: CircPolicyGroup.options_for_select,\n with_pg_id: PatronGroup.options_for_select,\n with_it_id: ItemType.options_for_select\n },\n ) or return\n #@circ_policy_matrices = CircPolicyMatrix.order(:circ_group_id).page params[:page]\n @circ_policy_matrices = @filterrific.find.page(params[:page])\n\n\n respond_to do |format|\n format.html\n format.js\n end \n\n end", "def newPage\n @contribucions = getAllContribucio\n render :partial => 'index', :locals => { :contribucions => @contribucions } \n end", "def show\n @show_modal = 'show'\n respond_to do |format|\n # If not an ajax request, redirect to index\n format.html\n end \n end", "def index\n @content_partials = ContentPartial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_partials }\n end\n end", "def select\n @inventory_type = InventoryType.shod(params[:inventory_transfer_inventory_type_id])\n @inventories = @inventory_type.inventories\n @inventory_types = InventoryType.all\n respond_to do |format|\n format.js {render layout: false if request.xhr?}\n # format.js {render :partial => 'search_all' ,:layout => false}\n end\n end", "def list\n index\n render :partial => 'list'\n end", "def images\n @assets = filtered_assets.where(type: \"Image\").order(\"created_at DESC\").paginate(params)\n @assets = @assets.search(params[:q], fuzzy: true) if params[:q].present?\n respond_to do |format|\n format.html do\n render template: \"/dash/chooser/images\"\n end\n format.js do\n render template: \"/dash/chooser/images_search\"\n end\n end\n end", "def advance_search \n if params[:entity_type]==\"static-fragment\"\n @page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}\n else\n @page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}\n end \n @search=true \n @search_data=SearchData.new(params[:search_data]) if params[:search_data] \n @article_path=\"static_page\" \n @[email protected]_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=\"\"\n session[:per_page]=params[:per_page] if params[:per_page]!=nil\n sort_init \"updated_at\"\n sort_update\n respond_to do |format|\n format.html do \n render :action=>\"index\" ,:entity_type => params[:entity_type]\n end\n format.js do\n render :update do |page| \n page.replace_html 'article_list',component_table_list(@site.find_component_by_name(\"static_article_search\"))\n end\n end\n end \n end", "def list\n @paperclip_clients = if ( params[:search].blank? )\n PaperclipClient.all\n else\n conditions = [ {:first_name => /#{params[:search]}/}, {:last_name => /#{params[:search]}/} ]\n PaperclipClient.any_of(conditions)\n end\n \n @clients = @paperclip_clients\n\n respond_to do |format|\n format.html { render 'clients/list' }# index.html.erb\n format.js { render 'clients/list' }\n format.xml { render :xml => @paperclip_clients }\n end\n end", "def index\n @providers = Provider.all\n @response = { :item => @providers }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @providers }\n format.js { render :json => @response.to_json(), :callback => params[:callback]}\n end\n end", "def adding_responder\n article = find_entity\n @thread = article.a_thread\n receive_and_set_background_params\n @display_mode = @background_params[:display_mode]\n @responder = article.responder(@thread, params[:responding_to])\n \n base_div_id = params[:base_div_id] # id of div to add\n uuid = random_id # generate random id\n preparation_for_altering\n render :update do |page| \n page.replace_html base_div_id, \n :partial => \"article_threads/responder\", \n :locals => {:uuid => uuid},\n :object => @responder\n end\n end", "def load_add_component_page\n #Checks if parent_id is a Product or Component based on a string value\n if(params[:parent_id][0] == 'P')\n @parent = Product.find(params[:parent_id][1..params[:parent_id].length])\n @items_to_select = @parent.components\n else\n @parent = Component.find(params[:parent_id][1..params[:parent_id].length])\n @items_to_select = @parent.components\n end\n @all_components = Component.all\n respond_to do |format|\n format.js\n end\n end", "def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end", "def category_filter \n respond_to do |format|\n\t\t\tformat.js # Calls category_filter.js.erb in follows view folder AJAX Code.\n\t\tend # Respond to block\n end", "def view\n @filterrific = initialize_filterrific(\n Question,\n params[:filterrific],\n select_options: {\n sort_active: Question.options_for_sort_active,\n sort_by_level: Indicator.options_for_sort_by_level\n }\n ) or return\n\n @competency = Competency.find(get_competency_id(params[:competency_id]))\n @indicators = Indicator.by_competency(@competency.name)\n @indicator_question = IndicatorQuestion.new\n @questions = Question.filterrific_find(@filterrific).by_competency(@competency.id).paginate(page: params[:page], per_page: 5)\n\n respond_to do |format|\n format.html\n format.js\n end\n \n end", "def refresh_index_table\n\t\t@competitions = Competition.all\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n end", "def showshop\n render :update do |page|\n page.replace_html 'shoplistdiv', :partial => 'shoplist'\n end \n end" ]
[ "0.67551714", "0.6187608", "0.6107076", "0.60643417", "0.60030216", "0.5984738", "0.5920643", "0.58966625", "0.5892846", "0.58756423", "0.58517945", "0.5830084", "0.5823043", "0.57839847", "0.5769814", "0.5743563", "0.5731979", "0.57098424", "0.5690597", "0.56584513", "0.5658269", "0.56497717", "0.5644065", "0.56091714", "0.55926615", "0.55910194", "0.55866104", "0.55861974", "0.55856323", "0.55847526", "0.55825096", "0.55593735", "0.55579084", "0.554171", "0.5541547", "0.55359286", "0.55335027", "0.55207443", "0.55120605", "0.5508683", "0.5506857", "0.5501859", "0.54979", "0.5490753", "0.5476234", "0.5475263", "0.5473664", "0.5473556", "0.54726493", "0.5459617", "0.5458863", "0.5452862", "0.5452851", "0.5440015", "0.54389066", "0.5436743", "0.54349244", "0.5430487", "0.5423454", "0.541978", "0.5418797", "0.5418071", "0.541671", "0.541671", "0.54160094", "0.5415057", "0.54090077", "0.5408661", "0.540709", "0.54063994", "0.54038876", "0.54009324", "0.5387482", "0.53873533", "0.538633", "0.5379313", "0.53787196", "0.5368887", "0.5368362", "0.53673947", "0.5360711", "0.53575057", "0.53551275", "0.53531325", "0.53509766", "0.53496283", "0.5349002", "0.5348835", "0.534729", "0.5333425", "0.53279084", "0.5323384", "0.5323139", "0.5322333", "0.5322113", "0.5318778", "0.53183377", "0.5316569", "0.53157246", "0.53155327" ]
0.7224609
0
GET /matches/1 GET /matches/1.json
def show @conversation = Conversation.find_by_id(@match.conversation_id) @messages = @conversation.messages @message = Message.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def index\n @matches = Match.where(\"player2_id IS NOT NULL\").order(\"#{:id} desc\")\n\n respond_to do |format|\n format.html { @matches }\n format.json { render json: @matches}\n end\n end", "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @match }\n end\n end", "def index\n @matches = Match.page(params[:page]).per(1)\n end", "def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end", "def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def show\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n if @tournament = Tournament.where(:id => params[:tournament_id]).first\n @matches = @tournament.matches\n else\n @matches = Match.all\n end\n\n @matches_in_dates = Match.matches_in_dates(@matches)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n @matches = Match.all\n end", "def index\n @matches = current_user.matches\n end", "def show\n @match = @contest.matches.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def show\n authorize! :show, Match\n\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end", "def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end", "def show\n @match_stat = MatchStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_stat }\n end\n end", "def get_match ( match_key )\n get_api_resource \"#{@@api_base_url}match/#{match_key}\"\n end", "def index\n @matches = Match.order(:name).page(params[:page])\n end", "def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end", "def getMatchCount\n\t\trender json: Match.count(:user1 => params[:twitter_id])\n\tend", "def index\n @matchs_du_jour = Match.find_all_by_date_match(DateTime.now.to_date)\n\n @matchs_termines = Match.where(\"date_match < ? \",DateTime.now.to_date)\n\n @matchs_a_venir = Match.where(\"date_match > ? \",DateTime.now.to_date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n # user = User.find_by_token(params[:token])\n # # @user = User.find(params[:id])\n matches = current_user.matches\n matches.each do |match|\n match['players'] = Array.new(match.users)\n end\n\n render json: {user: current_user, decks: current_user.decks, matches: matches}\n end", "def index\n @team_matches = TeamMatch.all\n end", "def show\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_image }\n end\n end", "def index\n #return JSON of a user's matches profile information\n # render :text => \"Match index\"\n\n #THIS SHOULD PROBABLY BE MOVED TO MODEL\n # user = User.find(1)\n # match_ids = []\n # user.first_user_matches.each do |match|\n # match_ids << match.second_user_id\n # end\n # user.second_user_matches.each do |match|\n # match_ids << match.first_user_id\n # end\n # @matches = []\n # match_ids.each do |id|\n # @matches << User.find(id)\n # end\n # render 'index'\n\n if current_user\n @matches = current_user.matches\n render 'index'\n else\n end\n # user = User.find(2) #need to pull user_id from Devise\n # respond_with user.matches\n end", "def get_match\n @match = Match.find(params[:match_id])\n end", "def index\n @matches = Photos.all\n end", "def get_match_data(match_id)\n # Given a matchId, make an API request for the match data.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matches/#{match_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n sleep(1)\n match_data = JSON.parse(response_string)\nend", "def match(match_id)\n get_request(shard_endpoint_uri(\"matches/#{match_id}\"))\n end", "def uri\n 'matches'\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def index\n #Visa endast de kommande matcherna\n @matches = Match.where(\"datum >= ?\",Date.today).order(:datum)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @match_assignments }\n end\n end", "def show\n render json: @clan_match\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def show\n @interpro_match = InterproMatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interpro_match }\n end\n end", "def index\n championship_id=params[:championship_id]\n @matches = Match.where(championship_id: championship_id)\n @matches = Match.all if @matches.blank? && !params[:championship_id].present?\n page = params[:page]\n page = 1 if page.blank? && !params[:page].present?\n @matches = @matches.paginate(:page => page, :per_page => 20)\n end", "def show\n @lost = Lost.find(params[:id])\n @matches = Found.tagged_with(@lost.tag_list, :any => true)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @match }\n end\n end", "def index\n @matches = search_all(Match)\n @advert = Advert.random('matches_list')\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :partial => @matches }\n end\n end", "def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bet_scores }\n end\n end", "def index\n @matches = Match.page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n\n\n end", "def index\n # Vudo - Need to remove soft-deleted matchups\n @matchups = Matchup.includes(:home_team, :away_team).all\n render :json => @matchups, :include => [:home_team, :away_team]\n end", "def show\n @match = Match.find(params[:id])\n @result = Result.where(:match_id => params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def index\n type = @current_user.user_type\n if type == 'Rapper'\n matches = @current_user.producer_matches\n render json: matches\n else\n matches = @current_user.rapper_matches\n render json: matches\n end\n end", "def show\n @matchsindiv = Matchsindiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matchsindiv }\n end\n end", "def show\n #@bet_score = @match.bet_scores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet_score }\n end\n end", "def show\n @leaguemembers = League.find(params[:id]).users\n @matches = Match.where(:league_id => params[:id])\n \n end", "def index\n @match_details = MatchDetail.all\n end", "def get_match\n @match = Match.find( params[:match_id] )\n raise ActiveRecord::RecordNotFound unless @match\n end", "def index\n @matches = current_user.matches.distinct\n end", "def get_match_ids(account_id)\n # Given a summoner's accountId, make an API request for their match history.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n match_history = JSON.parse(response_string)\n match_ids = match_history[\"matches\"].map {|match| match['gameId']}.uniq\nend", "def index\n @stats = Stat.where(:match_id => params[:match_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stats }\n end\n end", "def matches()\n sql = \"SELECT matches.* FROM matches WHERE away_team_id = #{@id} OR home_team_id = #{@id};\"\n matches = SqlRunner.run( sql )\n result = matches.map { |match| Match.new(match) }\n return result\n end", "def index\n @match_sets = MatchSet.all\n end", "def index\n @matchs = Match.all.order(\"created_at DESC\")\n @results = @p.result\n end", "def show\n @club = Club.find(params[:club_id])\n @event = Event.find(params[:event_id])\n @serie = Serie.find(params[:id])\n @matches = Match.where(serie: @serie)\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def matches\n @user = User.find_by_email(params[:email])\n if @user\n @place = Place.get(params[:id])\n if @place\n @matches = @place.matches(@user)\n render 'matches'\n else \n render 'failure', :locals => {:message => 'Place not found', :details => \"Place ID: #{params[:id]}\"}\n end\n else\n render 'failure', :locals => {:message => 'User not found', :details => \"User: #{params[:email]}\"}\n end\n end", "def index\n @matches = Match.where({active: true})\n end", "def get_matches\n @data ||= begin\n str = APIS[ @league.downcase.to_sym ]\n str = str.gsub( '$year$', @year.to_s )\n\n get( str ) ## use \"memoized\" / cached result\n end\n end", "def index\n @stat_of_player_of_team_of_matches = StatOfPlayerOfTeamOfMatch.all\n end", "def get_team_event_matches ( team_key, event_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/event/#{event_key}/matches\"\n end", "def get_event_matches ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/matches\"\n end", "def create\n @match = Match.new(player1: current_user, player2: User.find(params[:player2]))\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_path, notice: 'Match was successfully created.' }\n format.json { render :index, status: :created, location: @match }\n else\n set_matches\n format.html { redirect_to matches_path, alert: @match.errors.full_messages.join(\"<br/>\") }\n format.json { render index: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_matches\n\t\t@@logger.info { \"Retrieving all matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).all\n\tend", "def index\n @group = Group.find(params[:group_id])\n @matches = @group.matches.find(:all, :order => 'date DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n format.mobile\n format.atom \n end\n end", "def get_match(match_key, opts = {})\n data, _status_code, _headers = get_match_with_http_info(match_key, opts)\n data\n end", "def index\n @matchparticipants = Matchparticipant.all\n end", "def get_match_simple(match_key, opts = {})\n data, _status_code, _headers = get_match_simple_with_http_info(match_key, opts)\n data\n end", "def get_match(id, matches, p1, p2)\n outputmatch = nil\n matches.each do |match|\n outputmatch = match['match'] if ((match['match']['player1_id'].to_s.eql?(p1) && match['match']['player2_id'].to_s.eql?(p2))||(match['match']['player1_id'].to_s.eql?(p2) && match['match']['player2_id'].to_s.eql?(p1)))\n end\n return outputmatch\nend", "def index\n session.clear\n session['matches_session'] = Hash.new\n @matches = Match.all\n end", "def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end", "def index\n #should be the following line when our matching feature is implemented\n @user = current_user\n #@matches = Match.All\n end", "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, :notice => 'Match was successfully created.' }\n format.json { render :json => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @match = @contest.matches.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end", "def show\n @profile_match = ProfileMatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @profile_match.to_xml }\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_url, notice: 'Match créé avec succès' }\n format.json { render :index, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.mobile\n format.xml { render :xml => @match }\n end\n end", "def find_matches\n @match_distances = Match.find_match(current_user, \"Any\", nil)\n end", "def to_json\n (@matches.map {|m| m.to_json}).to_json\n end", "def get_event_matches_with_http_info(event_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MatchApi.get_event_matches ...'\n end\n # verify the required parameter 'event_key' is set\n if @api_client.config.client_side_validation && event_key.nil?\n fail ArgumentError, \"Missing the required parameter 'event_key' when calling MatchApi.get_event_matches\"\n end\n # resource path\n local_var_path = '/event/{event_key}/matches'.sub('{' + 'event_key' + '}', CGI.escape(event_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Match>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MatchApi#get_event_matches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def user_matches \n\t\t@matches = Match.personal_matches(current_user)\n\tend", "def get_up_link_matches\n begin\n user_id = current_user.id\n\n if Match.exists?(user_id: user_id, completion_status: 'pending')\n match = Match.find_by(user_id: user_id, completion_status: 'pending')\n up_link_user = User.find_by(id: match.matched_user_id)\n up_link_user_bank = Bank.find_by(user_id: up_link_user.id)\n bank_name = up_link_user_bank.name\n account_number = up_link_user_bank.account_number\n\n render json: { status: 'SUCCESS', data: {\n first_name: up_link_user.first_name,\n last_name: up_link_user.last_name,\n phone_number: up_link_user.phone_number,\n user_id: up_link_user.id,\n match_id: match.id,\n account_number: account_number,\n bank_name: bank_name\n }}, status: :ok\n else\n render json: { status: 'SUCCESS', data: '' }, status: :ok\n end\n\n rescue Exception => e\n puts e.message\n\n render json: { status: 'ERROR', data: {\n message: 'An unexpected error occurred. Please try againlater'\n }}, status: :internal_server_error\n end\n end", "def show\n @match = Match.includes(invoices: [{registrations: [:shooter]}]).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n render json: @match.invoices, root: false\n end\n end\n end", "def matches\n @matches ||= []\n end", "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def record\n puts \"****************** in record match, params: #{params}\"\n match_id = params[:match_id]\n match = nil\n begin\n puts \"match find : #{params[:match_id]}\"\n match = Match.find_by(id: match_id)\n rescue Exception => exc\n puts \"match not found: #{params['id']}, #{params['tourney_id']}, #{params['round']}\"\n end\n\n\n if match.present?\n match.player1_score = params[:player1_wins]\n match.player2_score = params[:player2_wins]\n match.ties = params[:ties]\n match.round = params[:round]\n puts \"***************** updating existing match: #{match.inspect}\"\n match.save\n else\n puts \"match not present\"\n end\n respond_to do |format|\n match_hash = match.as_json\n puts \"*********** Getting to end of record service, about to render JSON, #{match_hash}\"\n format.json { render :json => match_hash.to_json }\n # format.json { render :json => {:what => 'ever'} }\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.76179665", "0.747113", "0.7408183", "0.72241014", "0.7158438", "0.71064603", "0.7097788", "0.6979289", "0.69566995", "0.6949862", "0.69414395", "0.69414395", "0.69414395", "0.69414395", "0.69414395", "0.6835067", "0.68285567", "0.6806905", "0.6789736", "0.6748504", "0.67244583", "0.6706248", "0.6705297", "0.6603169", "0.6579226", "0.6490669", "0.6425884", "0.64130896", "0.6407871", "0.63999665", "0.6378139", "0.63513774", "0.63486207", "0.633107", "0.63283855", "0.63139904", "0.6297597", "0.62882566", "0.6279381", "0.6279381", "0.6273878", "0.6256493", "0.62534225", "0.62534225", "0.62534225", "0.62534225", "0.62473136", "0.624322", "0.623965", "0.62209797", "0.62192565", "0.6185266", "0.61626", "0.61463755", "0.6141867", "0.61232483", "0.61198264", "0.61162406", "0.6109226", "0.6105083", "0.6083973", "0.6083124", "0.6079463", "0.6038746", "0.60369104", "0.6028591", "0.60188216", "0.6005107", "0.5999562", "0.597399", "0.5973327", "0.5965504", "0.5965091", "0.5962955", "0.5957532", "0.5942086", "0.59270686", "0.59131294", "0.58980817", "0.5892667", "0.5891677", "0.5863462", "0.5859846", "0.5836179", "0.58347493", "0.58301085", "0.58239955", "0.5812515", "0.58075345", "0.58041805", "0.5772016", "0.5769496", "0.576477", "0.57453865", "0.57291216", "0.5724441", "0.57204455", "0.57078695", "0.57078695", "0.5703947", "0.57005733" ]
0.0
-1
POST /matches POST /matches.json
def create @match = Match.new(match_params) @match.player1_id = current_user.id @match.end = @match.end_date # Create a conversation for match. conv = Conversation.new conv.match_id = @match.id conv.save! @match.conversation_id = conv.id respond_to do |format| if @match.save format.html { redirect_to @match, notice: ['Match was successfully created.', "alert alert-dismissible alert-success"] } else format.html { render action: 'new' } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, :notice => 'Match was successfully created.' }\n format.json { render :json => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_url, notice: 'Match créé avec succès' }\n format.json { render :index, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Read the Matches from the JSON Object\n data = params[:matches]\n matches = data.to_a\n\n MatchCreatorJob.perform_later(matches: matches)\n\n render json: {}, status: :ok\n\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: \"Match was successfully created.\" }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to $redirect, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n @match.user_id = @current_user.id\n if @match.save\n options = {include: [:user]}\n render json: serializer.new(@match, options), include: ['user']\n else\n render json: @match.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = current_user\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Match\n\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(player1: current_user, player2: User.find(params[:player2]))\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_path, notice: 'Match was successfully created.' }\n format.json { render :index, status: :created, location: @match }\n else\n set_matches\n format.html { redirect_to matches_path, alert: @match.errors.full_messages.join(\"<br/>\") }\n format.json { render index: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: '比赛创建成功' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @match = Match.new(match_params)\n @fes = Fes.where(:id => params[:fes_id]).first\n @match = @fes.matches.build(match_params)\n\n respond_to do |format|\n if @match.save\n # format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.html { redirect_to [@fes, @match], notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(match_params)\n @match.users << current_user\n @match.users << Match.criaBOT(@match.difficulty)\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_path, notice: 'Partida criada com sucesso' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team_match = TeamMatch.new(team_match_params)\n\n respond_to do |format|\n if @team_match.save\n format.html { redirect_to @team_match, notice: 'Team match was successfully created.' }\n format.json { render :show, status: :created, location: @team_match }\n else\n format.html { render :new }\n format.json { render json: @team_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@match = Match.new(match_params)\n\tend", "def create\n @match = Match.new(match_params)\n @match.owner = current_user\n @match.test = params[:match][:test] || false;\n\n params[:match][:tanks].each do |tank_id|\n unless tank_id.empty? # get around strange rails thing with multi selects\n tank = Tank.find tank_id\n if tank.public || user_can_view(current_user, tank) || current_user.admin?\n @match.tanks << tank\n end\n end\n end\n\n respond_to do |format|\n if @match.save\n\n # check if the user has a currently running match\n current_match_id = $user_matches.get(current_user.id)\n\n unless current_match_id.nil?\n # if yes kill it\n Resque::Plugins::Status::Hash.kill(current_match_id)\n puts 'killed match uuid: ' + current_match_id\n end\n\n job_id = GameService.create(match_id:@match.id)\n status = Resque::Plugins::Status::Hash.get(job_id)\n\n $user_matches.set(current_user.id, status['uuid'])\n\n puts 'saved match uuid: ' + status['uuid'] + ' to user ' + current_user.id.to_s\n\n format.html { redirect_to @match, notice: 'Match was successfully created and queued.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match_set = MatchSet.new(match_set_params)\n\n respond_to do |format|\n if @match_set.save\n format.html { redirect_to @match_set, notice: 'Match set was successfully created.' }\n format.json { render :show, status: :created, location: @match_set }\n else\n format.html { render :new }\n format.json { render json: @match_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match_form = MatchForm.new(match_form_params)\n\n respond_to do |format|\n if @match_form.save\n format.html { redirect_to @match_form, notice: 'Match form was successfully created.' }\n format.json { render :show, status: :created, location: @match_form }\n else\n format.html { render :new }\n format.json { render json: @match_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match_detail = MatchDetail.new(match_detail_params)\n\n respond_to do |format|\n if @match_detail.save\n format.html { redirect_to @match_detail, notice: 'Match detail was successfully created.' }\n format.json { render :show, status: :created, location: @match_detail }\n else\n format.html { render :new }\n format.json { render json: @match_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clan_match = ClanMatch.new(clan_match_params)\n\n if @clan_match.save\n render json: @clan_match, status: :created, location: @clan_match\n else\n render json: @clan_match.errors, status: :unprocessable_entity\n end\n end", "def create\n @match = Match.new(params[:match])\n @match.user_id = current_user.id\n\n respond_to do |format|\n if @match.save\n flash[:notice] = 'Match was successfully created.'\n format.html { redirect_to(@match) }\n format.xml { render :xml => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @matchparticipant = Matchparticipant.new(matchparticipant_params)\n\n respond_to do |format|\n if @matchparticipant.save\n format.html { redirect_to @matchparticipant, notice: 'Matchparticipant was successfully created.' }\n format.json { render :show, status: :created, location: @matchparticipant }\n else\n format.html { render :new }\n format.json { render json: @matchparticipant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n session[:match_id] = @match.id\n \n format.html { redirect_to new_match_game_path(@match) }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def create\n @match_team = MatchTeam.new(match_team_params)\n\n respond_to do |format|\n if @match_team.save\n format.html { redirect_to @match_team, notice: 'Match team was successfully created.' }\n format.json { render :show, status: :created, location: @match_team }\n else\n format.html { render :new }\n format.json { render json: @match_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:title, :team1, :team2, :match_start, :vod_start, :clip, :winner, :vod_url)\n end", "def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @match }\n end\n end", "def record\n puts \"****************** in record match, params: #{params}\"\n match_id = params[:match_id]\n match = nil\n begin\n puts \"match find : #{params[:match_id]}\"\n match = Match.find_by(id: match_id)\n rescue Exception => exc\n puts \"match not found: #{params['id']}, #{params['tourney_id']}, #{params['round']}\"\n end\n\n\n if match.present?\n match.player1_score = params[:player1_wins]\n match.player2_score = params[:player2_wins]\n match.ties = params[:ties]\n match.round = params[:round]\n puts \"***************** updating existing match: #{match.inspect}\"\n match.save\n else\n puts \"match not present\"\n end\n respond_to do |format|\n match_hash = match.as_json\n puts \"*********** Getting to end of record service, about to render JSON, #{match_hash}\"\n format.json { render :json => match_hash.to_json }\n # format.json { render :json => {:what => 'ever'} }\n end\n end", "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def match_params\n params.require(:match).permit(:fes_id, :MyUserID, :MyTeamName, :MyTwitterID, :MyNNID, :EnemyUserID, :EnemyTeamName, :EnemyTwitterID, :EnemyNNID, :NumberOfWins, :NumberOfLosses)\n end", "def match_params\n params.require(:match).permit(:member1, :member2, :result)\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def match_params\n params.require(:match).permit!\n end", "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "def creatematch(deck)\n if current_user\n puts \"NOT MATCHES HUZZAHHHHHHHHHHHHHHHHHHHHHHHHHHh\"\n playerarray = {}\n\n playerarray[0] = {}\n playerarray[0][\"id\"] = current_user.id\n playerarray[0][\"player\"] = current_user.email\n playerarray[0][\"score\"] = 5050\n playerarray[0][\"hand\"] = []\n druck = \"[#{getDeckFromNames(deck)}]\"\n Match.new({\n active:true,\n players: playerarray.to_json,\n max_players: 2,\n turn: 0,\n decks: druck\n }).save\n end\n end", "def new\n @match = @contest.matches.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end", "def create\n @master_ea_match = MasterEaMatch.new(master_ea_match_params)\n\n respond_to do |format|\n if @master_ea_match.save\n format.html { redirect_to @master_ea_match, notice: 'Master ea match was successfully created.' }\n format.json { render :show, status: :created, location: @master_ea_match }\n else\n format.html { render :new }\n format.json { render json: @master_ea_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:code, :time, :date, :player1_id, :player2_id, :score1, :score2, :venue_id, :tournament_id)\n end", "def create_matches(matches)\n matches.each do |home_team, away_team|\n create_match(home_team, away_team)\n end\n end", "def match_params\n params.require(:match).permit(:match_id, :player1_id, :player2_id, :tourney_id, :round, :player1_score, :player2_score, :ties)\n end", "def match_params\n # params[:match]\n params.require(:match).permit(:name,\n :introduce,\n :start_time,\n :end_time)\n end", "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def create\n @match = Match.new(match_params)\n # creates a player on match but does not save it yet\n @match.players.build(user_id: current_user.id)\n\n respond_to do |format|\n if @match.save && @match.errors.empty?\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render action: 'show', status: :created, location: @match }\n elsif @match.errors.empty? == false\n @errors = []\n @match.errors.messages.each do |x, y| \n @errors << y\n end\n format.html { redirect_to new_match_path, alert: \"Errors: #{@errors.join(', ').titleize}.\" }\n else\n format.html { render action: 'new', :alert => \"Unable to update user. #{@match.errors}\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:winner)\n end", "def match_params\n params.require(:match).permit(:hteam, :ateam, :htscore, :atscore, :mdate)\n end", "def create\n @match_stat = MatchStat.new(params[:match_stat])\n\n respond_to do |format|\n if @match_stat.save\n format.html { redirect_to @match_stat, notice: 'Match stat was successfully created.' }\n format.json { render json: @match_stat, status: :created, location: @match_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empire_master_match = EmpireMasterMatch.new(empire_master_match_params)\n\n respond_to do |format|\n if @empire_master_match.save\n format.html { redirect_to @empire_master_match, notice: 'Empire master match was successfully created.' }\n format.json { render :show, status: :created, location: @empire_master_match }\n else\n format.html { render :new }\n format.json { render json: @empire_master_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @match = Match.new(params[:match])\n if cannot? :create, @match\n\tredirect_to \"/hax.html\"\n end\n @match.round = 1\n @match.first_bot_round1_score = 0\n @match.first_bot_round2_score = 0\n @match.first_bot_round3_score = 0\n @match.second_bot_round1_score = 0\n @match.second_bot_round2_score = 0\n @match.second_bot_round3_score = 0\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to(@match, :notice => 'Match was successfully created.') }\n format.xml { render :xml => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:id, :player1_id, :player2_id, :player1_score, :player2_score, :guild1_id, :guild2_id, :addons_id, :is_end, :is_inprogress, :is_player1_online, :is_player2_online, :rating, :is_ranked, :created_at, :updated_at, :war, :current_user, :player1, :player2, :guild1, :guild2, :addons)\n end", "def match_params\n params.require(:match).permit(:home, :bet, :away, team_ids: [])\n end", "def match_params\n params.require(:match_participant).permit(:participant, :team, :result)\n end", "def index\n @matches = Match.where(\"player2_id IS NOT NULL\").order(\"#{:id} desc\")\n\n respond_to do |format|\n format.html { @matches }\n format.json { render json: @matches}\n end\n end", "def match_params\n params.require(:match).permit(:match_id, :match_seq_num, :start_time, :lobby_type, :radiant_team_id, :dire_team_id)\n end", "def index\n @matches = Match.page(params[:page]).per(1)\n end", "def new\n @player = Player.new\n @player.matches.build\n @player.save\n end", "def create\n @match_image = MatchImage.new(params[:match_image])\n\n respond_to do |format|\n if @match_image.save\n format.html { redirect_to @match_image, notice: 'Match image was successfully created.' }\n format.json { render json: @match_image, status: :created, location: @match_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interpro_match = InterproMatch.new(params[:interpro_match])\n\n respond_to do |format|\n if @interpro_match.save\n format.html { redirect_to @interpro_match, notice: 'Interpro match was successfully created.' }\n format.json { render json: @interpro_match, status: :created, location: @interpro_match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interpro_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n # create matches for input\n if !params[:names].blank?\n # split input by line break\n names = params[:names].rstrip.split(/\\r?\\n/).map{|line| line.chomp}\n # insert dummy players\n if names.length % 4 == 3\n names.insert(names.length,\"★ダミーP\")\n elsif names.length % 4 == 2\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n elsif names.length % 4 == 1\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n end\n # sort if required\n if params[:sort] == \"1\"\n names = names.sort_by{rand}\n end\n courts = params[:courts].to_i\n court_select = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"]\n # for each 4 names create match\n (names.length / 4).times do |x|\n match = Match.new\n match.round_id = @round.id\n match.court = court_select[x % courts]\n match.player1_name = names[x * 4]\n match.player2_name = names[x * 4 + 1]\n match.player3_name = names[x * 4 + 2]\n match.player4_name = names[x * 4 + 3]\n match.save\n end\n end\n \n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:mentor_id, :mentee_id, :created_at, :updated_at)\n end", "def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def create\n @match = @contest.matches.build(params[:match])\n #@match.user_id = @user.id unless @user.nil?\n @match.user_id = current_user.id unless current_user.nil?\n @match.contest_id = @contest.id\n @match.category_id = params[:category] if params[:category]\n @match.unique_id = Match.generate_unique_id\n \n respond_to do |format|\n if @match.save\n flash[:notice] = 'Match was successfully created.'\n @match.create_all_entries_for_the_match(@contest)\n #create_result_table(@match)\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:matched_with_user_id)\n end", "def match_params\n params.require(:match).permit(:competition_id, :channel_id, :winner, :competitor1_score, :competitor2_score, :winner_match_pos, :match_finished)\n end", "def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end", "def create\n @group = Group.find(params[:group_id])\n @match = Match.new(params[:match])\n @match.group = @group\n\n respond_to do |format|\n if @match.save\n flash[:notice] = 'Match was successfully created.'\n format.html { redirect_to(@match) }\n format.xml { render :xml => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile_match = ProfileMatch.new(params[:profile_match])\n\n respond_to do |format|\n if @profile_match.save\n flash[:notice] = 'ProfileMatch was successfully created.'\n format.html { redirect_to profile_profile_match_url(@profile_match) }\n format.xml { head :created, :location => profile_profile_match_url(@profile_match) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile_match.errors.to_xml }\n end\n end\n end", "def create\n @matchup = Matchup.new(params[:matchup])\n\n respond_to do |format|\n if @matchup.save\n format.html { redirect_to(@matchup, :notice => 'Matchup was successfully created.') }\n format.xml { render :xml => @matchup, :status => :created, :location => @matchup }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @matchup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:name, :language, :game_id,:owner_id,:star_time,:mastered,:maximum_players)\n end", "def index\n if @tournament = Tournament.where(:id => params[:tournament_id]).first\n @matches = @tournament.matches\n else\n @matches = Match.all\n end\n\n @matches_in_dates = Match.matches_in_dates(@matches)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def match_params\n params.require(:match).permit(:home_team_score, :away_team_score, :home_team_id, :away_team_id, :tournament_id)\n end", "def match_params\n params.require(:match).permit(:tournament_id,:local,:visitor,:date)\n end", "def match_params\n params.require(:match).permit(:date, :salle, :ville, :orga, :metro, :comment)\n end", "def create\n match_day_team = MatchDayTeam.new(match_day_team_params)\n if match_day_team.save\n render json: match_day_team, status: 201, location: [:api, match_day_team]\n else\n failed_to_create(match_day_team, \"match_day_team\")\n end\n end", "def match_params\n params.require(:match).permit(:player1_score, :player2_score)\n end", "def create\n @round = Round.new(round_params['round'])\n\n respond_to do |format|\n if @round.save\n @round.create_matches\n update_parents(@round)\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n params.require(:match).permit(:start, :duration_hours, :duration_days, :court, :desc, :match_type, :pid, :country, :postcode, :after)\n end", "def create\n reset_match_maker if (params['reset_match_maker'] == 'true')\n match_maker.start_timeout_seconds = params['match_maker_timeout'].to_f if (params['match_maker_timeout'])\n @number_of_players = params['number_of_opponents'].to_i + 1\n @user = current_user\n if match = match_maker.match(current_user, @number_of_players)\n match.users.each { |user| Pusher.trigger(\"wait_channel_#{user.id}\", 'match_start_event', { match_id: match.id }) }\n #match.users.each { |user| Pusher.trigger(\"wait_channel_#{user.id}\", 'match_start_event', { message: \"/matches/#{match.id}/users/#{user.id}\" }) }\n respond_to do |format|\n format.json { render :json => { message: \"refresh\" } }\n format.html { redirect_to \"/matches/#{match.id}/users/#{current_user.id}\", status: :found }\n #format.html { render json: { match_id: match.id } }\n end\n else\n respond_to do |format|\n format.json { render :json => { message: \"Waiting for #{@number_of_players} players\" } }\n format.html { render 'start/wait' }\n end\n end\n end", "def match_params\n params.require(:match).permit(:meatcut_id, :technique_id, :good_idea, :notes)\n end", "def match_params\n params.require(:match).permit(:home, :away, :time)\n end", "def index\n @matches = current_user.matches\n end", "def match_params\n params.require(:match).permit(:local_id, :visitant_id, :match_date, :date_number, :championship_id, :date_start,:goals_local_team,:goals_visitant_team,:page,:match_id)\n end", "def match_params\n params.require(:match).permit(:id, :match_name, :game_type_id, :home_team_id, :away_team_id, :home_player_one_id, :home_player_two_id, :away_player_one_id, :away_player_two_id, :winner_team_id, :loser_team_id, games_attributes:[:id, :game_name, :home_point, :away_point, :winner_team_id, :loser_team_id, :created_at, :updated_at])\n end" ]
[ "0.70272964", "0.70107347", "0.6944617", "0.6944617", "0.6933998", "0.6931489", "0.6931489", "0.6931489", "0.6931489", "0.6931489", "0.6931489", "0.6931427", "0.6931427", "0.6931427", "0.6930626", "0.68569237", "0.68431115", "0.6746942", "0.6663972", "0.66263044", "0.6600143", "0.65982145", "0.655417", "0.6509566", "0.6419841", "0.6342651", "0.6208227", "0.61679345", "0.6162808", "0.6157807", "0.61426824", "0.6131503", "0.6107395", "0.60748553", "0.60748553", "0.60748553", "0.60748553", "0.60687023", "0.6043438", "0.60335445", "0.6019271", "0.59947014", "0.5989108", "0.59805685", "0.59794307", "0.59758955", "0.59758955", "0.59758955", "0.59758955", "0.59758955", "0.5966313", "0.5962687", "0.59552795", "0.594317", "0.5923632", "0.5923088", "0.59066737", "0.58917904", "0.5886345", "0.5862224", "0.58582854", "0.5848231", "0.5821333", "0.58111376", "0.57949436", "0.5788016", "0.5777669", "0.5773442", "0.57692593", "0.5759283", "0.5738337", "0.57350814", "0.5713008", "0.57128733", "0.5697631", "0.56950116", "0.5694722", "0.5689616", "0.5687672", "0.5687392", "0.567472", "0.5671564", "0.5665935", "0.5660245", "0.5643551", "0.56356823", "0.56242466", "0.56179404", "0.5617287", "0.56129974", "0.56118196", "0.55947727", "0.5587134", "0.5577945", "0.5576452", "0.55576533", "0.5551926", "0.55425483", "0.55317366", "0.5529903" ]
0.5683172
80
PATCH/PUT /matches/1 PATCH/PUT /matches/1.json
def update @match.assign_attributes(match_params) @match.end = @match.end_date respond_to do |format| if @match.save format.html { redirect_to @match, notice: ['Match was successfully updated.', "alert alert-dismissible alert-success"] } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @match.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end", "def update\n @match = match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, :notice => 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug \"GOT TO matches -> update\"\n match = Match.find(params[:match_id].to_i)\n requestor = match.user_for_id(params[:requestor_id].to_i)\n recipient = match.user_for_id(params[:requested_id].to_i)\n match.ask_for_cards(requestor: requestor, recipient: recipient, card_rank: params['rank'].upcase)\n match.save!\n render json: nil, status: :ok\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_url, notice: 'Match modifié avec succès' }\n format.json { render :index, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_path, notice: 'Match was successfully updated.' }\n format.json { render :index, status: :ok, location: @match }\n else\n set_matches\n format.html { redirect_to matches_path, alert: @match.errors.full_messages.join(\"<br/>\") }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: \"Match was successfully updated.\" }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = @contest.matches.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(contest_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n UpdateMatch.run(params)\n redirect_to tournament_path(tournament_id), status: 303\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n # format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.html { redirect_to [@fes, @match], notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clan_match = ClanMatch.find(params[:id])\n\n if @clan_match.update(clan_match_params)\n head :no_content\n else\n render json: @clan_match.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @match_set.update(match_set_params)\n format.html { redirect_to @match_set, notice: 'Match set was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_set }\n else\n format.html { render :edit }\n format.json { render json: @match_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(@match) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n end", "def update\n authorize! :update, Match\n\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(match_params)\n UserMailer.match_played(@match.player1, @match.player2, @match).deliver\n UserMailer.match_played(@match.player2, @match.player1, @match).deliver\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team_match.update(team_match_params)\n format.html { redirect_to @team_match, notice: 'Team match was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_match }\n else\n format.html { render :edit }\n format.json { render json: @team_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n @result = Result.where(:match_id => params[:id])\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: '更新成功' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.js {}\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master_ea_match.update(master_ea_match_params)\n format.html { redirect_to @master_ea_match, notice: 'Master ea match was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_ea_match }\n else\n format.html { render :edit }\n format.json { render json: @master_ea_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_form.update(match_form_params)\n format.html { redirect_to @match_form, notice: 'Match form was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_form }\n else\n format.html { render :edit }\n format.json { render json: @match_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_detail.update(match_detail_params)\n format.html { redirect_to @match_detail, notice: 'Match detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_detail }\n else\n format.html { render :edit }\n format.json { render json: @match_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @table.update(table_params)\n\n # force related running match to refresh\n if @table.banner_id.blank?\n @table.matches.where(is_running: true).each do |match|\n match.touch\n end\n end\n\n format.html { redirect_to tables_path, notice: 'Table was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @table }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @matchparticipant.update(matchparticipant_params)\n format.html { redirect_to @matchparticipant, notice: 'Matchparticipant was successfully updated.' }\n format.json { render :show, status: :ok, location: @matchparticipant }\n else\n format.html { render :edit }\n format.json { render json: @matchparticipant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match_stat = MatchStat.find(params[:id])\n\n respond_to do |format|\n if @match_stat.update_attributes(params[:match_stat])\n format.html { redirect_to @match_stat, notice: 'Match stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @com1_old_score = @match.competitor1_score\n @com2_old_score = @match.competitor2_score\n respond_to do |format|\n if @match.update(match_params)\n update_tournament\n puts \"Updating\"\n update_channel_name(@match)\n update_channel_name(@match.winner_match) unless @match.winner_match.nil?\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n if @match_image.update_attributes(params[:match_image])\n format.html { redirect_to @match_image, notice: 'Match image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n @match.match_editors.create({:user_id => current_user.id})\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(@match) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interpro_match = InterproMatch.find(params[:id])\n\n respond_to do |format|\n if @interpro_match.update_attributes(params[:interpro_match])\n format.html { redirect_to @interpro_match, notice: 'Interpro match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interpro_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_team.update(match_team_params)\n format.html { redirect_to @match_team, notice: 'Match team was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_team }\n else\n format.html { render :edit }\n format.json { render json: @match_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_requirement.update(match_requirement_params)\n format.html { redirect_to @match_requirement, notice: 'Match requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_requirement }\n else\n format.html { render :edit }\n format.json { render json: @match_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n if [email protected]?\n pronostics=Pronostic.find_all_by_match_id(@match.id)\n pronostics.each do |p|\n if p.win?\n player=p.user\n if player\n player.score=player.score+3\n player.scoreday=player.scoreday+3\n player.save\n end\n elsif !p.win? && p.global_win?\n player=p.user\n if player\n player.score=player.score+1\n player.scoreday=player.scoreday+1\n player.save\n end\n end\n end\n end\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empire_master_match.update(empire_master_match_params)\n format.html { redirect_to @empire_master_match, notice: 'Empire master match was successfully updated.' }\n format.json { render :show, status: :ok, location: @empire_master_match }\n else\n format.html { render :edit }\n format.json { render json: @empire_master_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @match_info = args[:match_info] if args.key?(:match_info)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @team_for_the_match = TeamForTheMatch.find(params[:id])\n\n respond_to do |format|\n if @team_for_the_match.update_attributes(params[:team_for_the_match])\n format.html { redirect_to(@team_for_the_match, :notice => 'Team for the match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_for_the_match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # Vudo: Recalculate win or loss value based on updated score (if there is one) -- make own endpoint for score?\n update_params = matchup_params\n\n # Handle Spread History\n if @matchup.spread_history.blank?\n spread_object = {\n spread: matchup_params[:vegas_spread],\n date: DateTime.now.strftime('%Q').to_f,\n }\n spread_history = [spread_object].to_json\n update_params[:spread_history] = spread_history\n else\n spread_history = append_spread_to_matchup\n update_params[:spread_history] = spread_history\n end\n\n @matchup.update(update_params)\n @matchup.reload\n\n if !([\"home_team_score\", \"away_team_score\", \"vegas_spread\", \"system_spread\"] & matchup_params.keys).empty?\n @matchup.correct_pick = @matchup.correct_pick?.to_s\n @matchup.save!\n end\n\n render :json => @matchup\n end", "def update!(**args)\n @exact_match = args[:exact_match] if args.key?(:exact_match)\n end", "def update\n respond_to do |format|\n if @match_pick.update(match_pick_params)\n format.html { redirect_to @match_pick, notice: 'Match pick was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_pick }\n else\n format.html { render :edit }\n format.json { render json: @match_pick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @matchsindiv = Matchsindiv.find(params[:id])\n\n respond_to do |format|\n if @matchsindiv.update_attributes(params[:matchsindiv])\n format.html { redirect_to @matchsindiv, notice: 'Matchsindiv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @matchsindiv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @content_match_type = args[:content_match_type] if args.key?(:content_match_type)\n @match_duration = args[:match_duration] if args.key?(:match_duration)\n @match_percent = args[:match_percent] if args.key?(:match_percent)\n @reference_duration = args[:reference_duration] if args.key?(:reference_duration)\n @reference_percent = args[:reference_percent] if args.key?(:reference_percent)\n @required_territories = args[:required_territories] if args.key?(:required_territories)\n end", "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @master_ea_no_match.update(master_ea_no_match_params)\n format.html { redirect_to @master_ea_no_match, notice: 'Master ea no match was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_ea_no_match }\n else\n format.html { render :edit }\n format.json { render json: @master_ea_no_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@bet_score = @match.bet_scores.find(params[:id])\n\n respond_to do |format|\n if @bet_score.update_attributes(params[:bet_score])\n format.html { redirect_to match_bet_score_path(@match, @bet_score), notice: 'Bet score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bet_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @longest_match = args[:longest_match] if args.key?(:longest_match)\n @match_segments = args[:match_segments] if args.key?(:match_segments)\n @reference_id = args[:reference_id] if args.key?(:reference_id)\n @total_match = args[:total_match] if args.key?(:total_match)\n end", "def update\n @player.update(player_params)\n render json: @player, status: 200\n end", "def update\n @profile_match = ProfileMatch.find(params[:id])\n\n respond_to do |format|\n if @profile_match.update_attributes(params[:profile_match])\n flash[:notice] = 'ProfileMatch was successfully updated.'\n format.html { redirect_to profile_profile_match_url(@profile_match) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile_match.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n\n format.html { redirect_to admin_matches_path, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n #this will invoke create.js.erb (formmat.js)\n format.js \n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match_part = MatchPart.find(params[:id])\n\n respond_to do |format|\n if @match_part.update_attributes(params[:match_part])\n flash[:notice] = 'MatchPart was successfully updated.'\n format.html { redirect_to(@match_part) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match_part.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update!(**args)\n @conflicting_reference_id = args[:conflicting_reference_id] if args.key?(:conflicting_reference_id)\n @expiry_time = args[:expiry_time] if args.key?(:expiry_time)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @matches = args[:matches] if args.key?(:matches)\n @original_reference_id = args[:original_reference_id] if args.key?(:original_reference_id)\n @status = args[:status] if args.key?(:status)\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @match = args[:match] if args.key?(:match)\n @query = args[:query] if args.key?(:query)\n end", "def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end", "def update\n put :update\n end", "def update\n @replay = Replay.find(params[:id])\n @replay.level_id = params[:replay][:level_id]\n @replay.score = params[:replay][:score]\n @replay.player = params[:replay][:player]\n @replay.data = params[:replay][:data].read\n\n respond_to do |format|\n\n format.html { redirect_to replays_path, :notice => 'Replay was successfully updated.' }\n format.json { head :no_content }\n\n end\n end", "def update\n respond_to do |format|\n if @api_v1_reward.update(api_v1_reward_params)\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_reward }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_reward.errors, status: :unprocessable_entity }\n end\n end\n end", "def match_params\n authorize! :update, Match\n\n params.require(:match).permit(:player1_score, :player2_score)\n end", "def update\n respond_to do |format|\n if @innings.update(innings_params)\n format.html { redirect_to match_path(@match), notice: 'Innings was successfully updated.' }\n format.json { render :show, status: :ok, location: @innings }\n else\n format.html { render :edit }\n format.json { render json: @innings.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rev_guess.update(rev_guess_params)\n format.html { redirect_to matches_url(date: @match.kickoff.to_date), notice: 'RevGuess was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rev_guess.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @player.update!(player_params) # anticipated possible exceptions rescued in BaseController\n render json: @player, status: 200\n end", "def update\n respond_to do |format|\n if @stat_of_player_of_team_of_match.update(stat_of_player_of_team_of_match_params)\n format.html { redirect_to @stat_of_player_of_team_of_match, notice: 'Stat of player of team of match was successfully updated.' }\n format.json { render :show, status: :ok, location: @stat_of_player_of_team_of_match }\n else\n format.html { render :edit }\n format.json { render json: @stat_of_player_of_team_of_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def update!(**args)\n @exact_match_config = args[:exact_match_config] if args.key?(:exact_match_config)\n end", "def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n @minimum_wait_duration = args[:minimum_wait_duration] if args.key?(:minimum_wait_duration)\n @negative_cache_duration = args[:negative_cache_duration] if args.key?(:negative_cache_duration)\n end", "def update!(**args)\n @id_matcher = args[:id_matcher] if args.key?(:id_matcher)\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n#\tif @score.update_attributes( :image=> params[:score] )\n format.html { redirect_to @score, :notice => 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @deck_matchup.update(deck_matchup_params)\n format.html { redirect_to @deck_matchup, notice: 'Deck matchup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deck_matchup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empire_master_no_match.update(empire_master_no_match_params)\n format.html { redirect_to @empire_master_no_match, notice: 'Empire master no match was successfully updated.' }\n format.json { render :show, status: :ok, location: @empire_master_no_match }\n else\n format.html { render :edit }\n format.json { render json: @empire_master_no_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @face_match = args[:face_match] if args.key?(:face_match)\n @personal_results = args[:personal_results] if args.key?(:personal_results)\n @voice_match = args[:voice_match] if args.key?(:voice_match)\n end", "def update!(**args)\n @match_score = args[:match_score] if args.key?(:match_score)\n end", "def update\n respond_to do |format|\n if @cagematch.update(cagematch_params)\n format.html { redirect_to @cagematch, notice: 'Cagematch was successfully updated.' }\n format.json { render :show, status: :ok, location: @cagematch }\n else\n format.html { render :edit }\n format.json { render json: @cagematch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_matches\n\tif (DBTools.new.getPlayerId(session['sessionid']) == false)\n\t\thalt(401, 'user not logged in')\n\telse\n\t\tplayerid = DBTools.new.getPlayerId(session['sessionid']);\n\tend\n\tconn = DBTools.new.connectToDB()\n\tquery = \"SELECT battleid, invite FROM users_notify WHERE userid=#{playerid};\"\n\tresult = conn.exec(query)\n\tresponse = Array.new\n\tresult.each do |row|\n\t\tresponse << {'battleid' => row['battleid'], 'invite' => row['invite']}\n\tend\n\tquery = \"DELETE FROM users_notify WHERE userid=#{playerid};\"\n\tconn.exec(query)\n\tconn.finish()\n\treturn response.to_json\nend", "def update!(**args)\n @match_type = args[:match_type] if args.key?(:match_type)\n @text = args[:text] if args.key?(:text)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @player_promise = PlayerPromise.find(params[:id])\n\n respond_to do |format|\n if @player_promise.update_attributes(params[:player_promise])\n format.html { redirect_to @player_promise, notice: 'Player promise was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_promise.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7097369", "0.67878073", "0.6784116", "0.6765547", "0.6757647", "0.6743928", "0.67202103", "0.6686816", "0.66761553", "0.66006404", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.6593729", "0.65932953", "0.6522772", "0.6477488", "0.64578426", "0.64578426", "0.64453274", "0.644269", "0.64019644", "0.63428503", "0.63398755", "0.63398755", "0.63327026", "0.6317775", "0.63167703", "0.6316064", "0.6308873", "0.61982596", "0.61959845", "0.6195261", "0.6143482", "0.61256236", "0.6118957", "0.60867316", "0.6045062", "0.6039027", "0.6026803", "0.60168993", "0.5996968", "0.59781075", "0.59672517", "0.59491897", "0.5941545", "0.59210956", "0.5920823", "0.5900584", "0.5882987", "0.58707786", "0.5855766", "0.58540714", "0.5829192", "0.58170736", "0.57981455", "0.57800984", "0.5777032", "0.57479393", "0.574037", "0.5735853", "0.57130504", "0.5700164", "0.5683453", "0.5669845", "0.56623846", "0.566172", "0.56540823", "0.5652765", "0.5652533", "0.56327224", "0.5621045", "0.56141585", "0.56005985", "0.55880773", "0.5587543", "0.5583", "0.5555461", "0.55417776", "0.55397373", "0.5530043", "0.552705", "0.55253667", "0.55228287", "0.55227256", "0.55158776", "0.5511565", "0.5502654", "0.5502146", "0.54915184", "0.5490205", "0.5476105", "0.54759586", "0.5466642" ]
0.5607702
79
join or leave match
def join pids = get_player_list(@match).map{|p| p.try(:id)} # list of player ids status = false if can_join(pids) #if possible, join status = join_now(@match, current_user.id) done = ["joined", "success"] elsif pids.include?(current_user.id) #if already joined, then leave status = leave_now(@match, current_user.id, @host) done = ["left", "warning"] if !get_player_list(@match).any? #if there is no more players in match, then destroy destroy return end end respond_to do |format| if status and @match.save format.html { redirect_to @match, notice: ['You have succesfully ' + done[0] + ' the match.', "alert alert-dismissible alert-" + done[1]] } else format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', "alert alert-dismissible alert-danger"] } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(*) end", "def full_join(other, *exps)\n join(other, *exps, join_type: :full)\n end", "def join; end", "def unjoin(&block)\n @objs.find(&block)\n end", "def join!(other_entry)\n raise \"Cannot be joined\" unless joinable?(other_entry)\n\n o_accts, o_nonaccts = other_entry.splits.partition{|s| s.ledger === Account}\n accts, nonaccts = splits.partition{|s| s.ledger === Account}\n\n Entry.transaction do\n o_accts.zip(nonaccts).each do |acct, nonacct|\n nonacct.ledger = acct.ledger\n nonacct.save!\n end\n\n accts.zip(o_nonaccts).each do |acct, nonacct|\n nonacct.ledger = acct.ledger\n nonacct.save!\n end\n\n self.memo = [memo, other_entry.memo].join(\" / \")\n other_entry.destroy\n save!\n end\n end", "def join\n end", "def unjoin(p1, p2, whence = nil)\n p1.remove(p2)\n p2.remove(p1)\n end", "def test_join\n assert_equal('1 2 Assign 4 Buzz Assign 7 8 Assign Buzz 11 Assign 13 14 AssignBuzz', @ab.join)\n end", "def merge_join(key_index, file1, file2)\n # Sorting part.\n merge_sorter!(key_index, file1, file2)\n # Merging part.\n r = file1[i = 0]\n q = file2[j = 0]\n while i != file1.length && j != file2.length\n if greater_than?(r[key_index], q[key_index])\n q = file2[j += 1]\n elsif less_than?(r[key_index], q[key_index])\n r = file1[i += 1]\n else\n # The records match on the join key.\n puts \"#{r[key_index]} #{r.reject { |e| e == r[key_index] }.to_csv.chomp} #{q.reject \\\n { |e| e == r[key_index] }.to_csv.chomp}\" unless r[key_index].nil? || q[key_index].nil?\n t = file2[k = j + 1]\n # Check for further records that match with r on the join key.\n while k != file2.length && r[key_index] == t[key_index]\n puts \"#{r[key_index]} #{r.reject { |e| e == r[key_index] }.to_csv.chomp} #{t.reject \\\n { |e| e == r[key_index] }.to_csv.chomp}\" unless r[key_index].nil? || t[key_index].nil?\n t = file2[k += 1]\n end\n s = file1[l = i + 1]\n # Check for further records that match with q on the join key.\n while l != file1.length && q[key_index] == s[key_index]\n puts \"#{q[key_index]} #{q.reject { |e| e == q[key_index] }.to_csv.chomp} #{s.reject \\\n { |e| e == q[key_index] }.to_csv.chomp}\" unless q[key_index].nil? || s[key_index].nil?\n s = file1[l += 1]\n end\n r = file1[i += 1]\n q = file2[j += 1]\n end\n end\nend", "def join()\n raise \"Missing implementation 'join'\"\n end", "def join(other, *exps, join_type: :inner)\n unless other.is_a?(Table)\n raise UserError, 'need other table as first argument to join'\n end\n unless JOIN_TYPES.include?(join_type)\n raise UserError, \"join_type may only be: #{JOIN_TYPES.join(', ')}\"\n end\n\n # These may be needed for outer joins.\n self_row_nils = headers.map { |h| [h, nil] }.to_h\n other_row_nils = other.headers.map { |h| [h, nil] }.to_h\n join_exp, other_common_heads =\n build_join_expression(exps, other, join_type)\n ev = Evaluator.new\n result = empty_dup\n other_rows = other.rows\n other_row_matches = Array.new(other_rows.size, false)\n rows.each do |self_row|\n self_row_matched = false\n other_rows.each_with_index do |other_row, k|\n # Same as other_row, but with keys that are common with self and equal\n # in value, removed, so the output table need not repeat them.\n locals = build_locals_hash(row_a: self_row, row_b: other_row)\n matches = ev.evaluate(join_exp, locals: locals)\n next unless matches\n\n self_row_matched = other_row_matches[k] = true\n out_row = build_out_row(row_a: self_row, row_b: other_row,\n common_heads: other_common_heads,\n type: join_type)\n result << out_row\n end\n next unless [:left, :full].include?(join_type)\n next if self_row_matched\n\n result << build_out_row(row_a: self_row,\n row_b: other_row_nils,\n type: join_type)\n end\n if [:right, :full].include?(join_type)\n other_rows.each_with_index do |other_row, k|\n next if other_row_matches[k]\n\n result << build_out_row(row_a: self_row_nils,\n row_b: other_row,\n type: join_type)\n end\n end\n result.normalize_boundaries\n result\n end", "def join(outs) ; nil ; end", "def cross_join(other)\n join(other, join_type: :cross)\n end", "def join( limit = nil )\n loop do\n t = @group.list.first\n break if t.nil?\n return nil unless t.join(limit)\n end\n self\n end", "def rejoin(target = nil, join_options = nil)\n target ||= join_target\n join_options ||= @join_options\n logger.info \"Rejoining to #{target}\"\n ignoring_ended_calls do\n unless target == @call\n @join_target = target\n @call.join target, join_options\n end\n end\n @calls.each do |call|\n ignoring_ended_calls { call.join target, join_options }\n end\n end", "def test_join\n assert_equal('1 2 Bar 4 Baz Bar 7 8 Bar Baz 11 Bar 13 14 BarBaz', @kbb.join)\n end", "def join(secDataset,pair)\n #print \"\\n#{pair}\\n\"\n pair[0].downcase! unless @columns.include?(pair[0])\n pair[1].downcase! unless secDataset.columns.include?(pair[1])\n @data.each do |row|\n secDataset.each do |row2|\n #print \"\\nPorovnavam #{row[pair[0]]} s #{row2[pair[1]]}\\n\"\n if (row[pair[0]] == row2[pair[1]])\n row.merge!(row2)\n break\n end\n end\n #secDataset.find(pair[0])\n #TODO zoptimalizovat -> zlepsit slozitost z m*n!\n end\n sloupce = secDataset.columns\n sloupce.each do |sl|\n set_column(sl,nil)\n end\n\n end", "def merge!(with); end", "def joined_results\n if conflict?\n if @conflict_handler\n @conflict_handler[results]\n else\n results\n end\n else\n first, rest = results.first, results[1..-1]\n rest.reduce(first) { |rs, r| rs.combine(r) }.apply(@join_function).result\n end\n end", "def join(force = false)\n post 'join'\n end", "def visit_Arel_Nodes_JoinSource o, collector\n if o.right.any?\n # We need to visit the right to get remove bind values, but we don't\n # add it to the collector\n collector.join_source << inject_join(o.right, collector, ' ')\n end\n collector\n end", "def join(other)\n new(entries.merge(other.entries) { |_name, old, new| old + new })\n end", "def right_join(other, *exps)\n join(other, *exps, join_type: :right)\n end", "def join(*rest) end", "def test_join1\n\t\tr = prep(\"program foo;\\nfoo(A,B) :- bar(A,B);\\n\")\n\t\t\n\t\t# set up schema table's predicate\n\t\t## require 'ruby-debug'; debugger\n\t\tterm_schema = @terms.schema_of\n\t\tterm_pred = Predicate.new(false,@terms.name,@terms,term_schema.variables)\n\t\tterm_pred.set(r, \"global\", \"r3\", 1)\n\t\t\n\t\tsj = ScanJoin.new(r, term_pred, @preds.schema_of)\t\n\t\tts = TupleSet.new(\"pred\", *@preds.tuples)\n\t\tres = sj.evaluate(ts)\n\n\t\tassert_equal(2, res.tups.length)\n\tend", "def unordered_match (target_word, matrix, ans_arr_el, index, track, trace)\t\n\tif index == 0 \n\t\t$seed[ans_arr_el[0][0]][:num_groups][ans_arr_el[0][1]].each do |word|\n\t\t\ttemp_word = track + word \n\t\t\tif(target_word == temp_word.chars.sort.join)\t\t\t\t\n\t\t\t\ttemp_answer = trace.dup\n\t\t\t\ttemp_answer.push(word)\n\t\t\t\t$answer[:words].push(temp_answer)\t\t\t\t\n\t\t\tend\n\t\tend\n\telsif index > 0\n\t\t$seed[ans_arr_el[index][0]][:num_groups][ans_arr_el[index][1]].each do |word|\n\t\t\tc = trace.dup\n\t\t\tc.push(word)\n\t\t\tunordered_match(target_word, matrix, ans_arr_el, index - 1, track + word, c)\t\t\t\t\t\t\n\t\tend\t\t\n\tend\t\nend", "def map_join_nowrap(list, *args, &block)\n options = args.extract_options!\n map_join(list, *args, options.merge(:nowrap => true), &block)\n end", "def join(p1, p2, set_first)\n p1.add(p2, set_first)\n p2.add(p1)\n end", "def pull_join\n raise NotImplementedError\n end", "def compound_match(fragments, target)\r\n a = fragments.uniq.combination(2).find { |a, b| a + b == target || b + a == target }\r\n return unless a\r\n b = [fragments.index(a[0]), fragments.index(a[1])]\r\n [a[0], a[1], target.start_with?(a[0]) ? b : b.reverse]\r\n end", "def left_join(other, *exps)\n join(other, *exps, join_type: :left)\n end", "def join(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.add(self)\n\t\tend", "def relation_method\n :join\n end", "def onomatopoeic_join(phonemes)\n phonemes.join unless phonemes.empty?\n end", "def join_with_and list, seperator=\", \"\n return list.first if list.count==1\n result = \"\"\n list.each do |item|\n result << item\n unless item==list.last\n if item==list[-2]\n result << \" and \"\n else\n result << seperator\n end\n end\n end\n result\n end", "def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end", "def left_join_null(left_table:, right_table:, right_col:, left_col:)\n full_left_col = left_table.to_s + \".\" + left_col.to_s\n result = @client[left_table].left_outer_join(right_table, right_col => left_col).where(full_left_col => nil)\n \n @log.debug \"aaaaaaaaaaaaaaa\"\n @log.debug result\n result.each do |i|\n @log.debug i\n end\n @log.debug \"bbbbbbbbbbbbbb\"\n \n return result\n end", "def inner_join(other, *exps)\n join(other, *exps)\n end", "def merge!(oth)\n t = merge(oth)\n if self == t\n nil\n else\n replace!(t)\n self\n end\n end", "def unjoin(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.remove(self)\n\t\tend", "def capture_map_join_nowrap(list, *args, &block)\n options = args.extract_options!\n capture_map_join(list, *args, options.merge(:nowrap => true), &block)\n end", "def operation_as_join\n @operation == :all && ' && ' || ' || '\n end", "def append_join(join)\n @clause[:join] << join.string \n @clause[:join] << join.implicit_joins\n end", "def prepend_join(join)\n @clause[:join] = join.string << @clause[:join]\n @clause[:join] << join.implicit_joins\n end", "def merge_joins_with_searchlogic(*args)\n joins = merge_joins_without_searchlogic(*args)\n joins.collect { |j| j.is_a?(String) ? j.split(\" \") : j }.flatten.uniq\n end", "def unjoin(other)\t\t\n\t\t# Ensure the other CSV has the keys present\n\t\tif not has_keys?(other)\n\t\t\traise \"ERROR: Could not find all key columns #{@keys.to_s} in other CSV\"\n\t\tend\n\t\t\n\t\t# Because .length will change as we delete, we must save ahead of time\n\t\t# and also track the number of rows we've removed\n\t\tlength = @matrix.length\n\t\tremoved_count = 0\n\t\t\n\t\t# Iterate our matrix removing rows present in the other CSV\n\t\t0.upto length do |index|\n\t\t\t# nil row check\n\t\t\tif not @matrix[index-removed_count]\n\t\t\t\tnext\n\t\t\tend\n\t\t\t\n\t\t\t# If this row IS also present in other, delete it here\n\t\t\tif also_present?(@matrix[index-removed_count], other)\n\t\t\t\[email protected](index-removed_count)\n\t\t\t\tremoved_count += 1\n\t\t\tend\n\t\tend\t\t\n\tend", "def compound_match(fragments, target)\n match_set = fragments.map.with_index{|word, idx| [target.split(word), idx]}.select{|item| item[0].include?(\"\")}\n match_set = match_set.select{ |item| fragments.index(item.first&.last) != nil}\n index1 = match_set.first&.last\n index2 = fragments.index(match_set&.first&.first&.last) || nil\n return nil if index2.nil?\n\n if fragments[index1] + fragments[index2] == target\n if index1 < index2\n return [fragments[index1], fragments[index2], [index1, index2]]\n else\n return [fragments[index2], fragments[index1], [index1, index2]]\n end\n else\n if index1 < index2\n return [fragments[index1], fragments[index2], [index2, index1]]\n else\n return [fragments[index2], fragments[index1], [index2, index1]]\n end\n end\nend", "def want_to_join!(team)\n self.teams << team unless is_member_of?(team)\n end", "def join(other)\n\t\t\n\t\t# Ensure the other CSV has the keys present\n\t\tif not has_keys?(other)\n\t\t\traise \"ERROR: Could not find all key columns #{@keys.to_s} in other CSV\"\n\t\tend\n\t\t\n\t\t# Because .length will change as we delete, we must save ahead of time\n\t\t# and also track the number of rows we've removed\n\t\tlength = @matrix.length\n\t\tremoved_count = 0\n\t\t\n\t\t# Iterate our matrix removing rows not present in the other CSV\n\t\t0.upto length do |index|\n\t\t\t# nil row check\n\t\t\tif not @matrix[index-removed_count]\n\t\t\t\tnext\n\t\t\tend\n\t\t\t\n\t\t\t# If this row is NOT also present in other, delete it here\n\t\t\tif not also_present?(@matrix[index-removed_count], other)\n\t\t\t\[email protected](index-removed_count)\n\t\t\t\tremoved_count += 1\n\t\t\tend\n\t\tend\n\tend", "def random_join\n union_disjoint_sets_carve_wall(skip_probability: [true, false] )\n end", "def my_join(arr, separator = \"\")\n output_str = arr[0].to_s\n arr.each do |el|\n if el != arr[0]\n output_str += (separator.to_s + el.to_s)\n end\n end\n\n output_str\nend", "def join(input, glue = T.unsafe(nil)); end", "def stop_if_match; true; end", "def merge(with); end", "def join(*relations)\n relations.all?{|r| is_relation!(r)}\n relations.inject(nil){|memo,r| memo.nil? ? r : memo.join(r)}\n end", "def receive_match(pos_one, pos_two)\n @matches.push(pos_one, pos_two)\n @known_cards.delete_if { |k,v| v.include?(pos_one) || v.include?(pos_two) } #it is deleting that k/v from known_c!!!\n end", "def join(owned_chunks)\n \n end", "def merge_using(source, join_condition)\n clone(:merge_using => [source, join_condition].freeze)\n end", "def merge!(other); end", "def natjoin2(tbl2, missing_value=nil, retain_left=false, retain_right=false)\n Tb::Enumerator.new {|y|\n tbl1 = self\n header1 = header2 = nil\n sorted_tbl2 = nil\n common_header = nil\n total_header = nil\n sorted_tbl1 = tbl1.with_header {|h1|\n header1 = h1\n sorted_tbl2 = tbl2.with_header {|h2|\n header2 = h2\n common_header = header1 & header2\n total_header = header1 | header2\n y.set_header total_header\n }.lazy_map {|pairs|\n [common_header.map {|f| pairs[f] }, pairs]\n }.extsort_by {|cv, pairs| cv }.to_fileenumerator\n }.lazy_map {|pairs|\n [common_header.map {|f| pairs[f] }, pairs]\n }.extsort_by {|cv, pairs| cv }.to_fileenumerator\n sorted_tbl1.open_reader {|t1|\n sorted_tbl2.open_reader {|t2|\n missing_hash = {}\n total_header.each {|f|\n missing_hash[f] = missing_value\n }\n Tb::ExEnumerator.merge_sorted(t1, t2) {|cv, t1_or_nil, t2_or_nil|\n if !t2_or_nil\n t1.subeach_by {|_cv1, _| _cv1 }.each {|_, _pairs1|\n if retain_left\n y.yield missing_hash.merge(_pairs1.to_hash)\n end\n }\n elsif !t1_or_nil\n t2.subeach_by {|_cv2, _| _cv2 }.each {|_, _pairs2|\n if retain_right\n y.yield missing_hash.merge(_pairs2.to_hash)\n end\n }\n else # t1_or_nil && t1_or_nil\n t2_pos = t2.pos\n t1.subeach_by {|_cv1, _| _cv1 }.each {|_, _pairs1|\n t2.pos = t2_pos\n t2.subeach_by {|_cv2, _| _cv2 }.each {|_, _pairs2|\n y.yield(_pairs2.to_hash.merge(_pairs1.to_hash))\n }\n }\n end\n }\n }\n }\n }\n end", "def joins\n []\n end", "def natjoin2_outer(tbl2, missing_value=nil, retain_left=true, retain_right=true)\n natjoin2(tbl2, missing_value, retain_left, retain_right)\n end", "def join(value)\n if value.is_a? self.class then value.fetch\n else value end\n end", "def build_join_expression(exps, other, type)\n return ['true', []] if type == :cross\n\n a_heads = headers\n b_heads = other.headers\n common_heads = a_heads & b_heads\n b_common_heads = []\n if exps.empty?\n if common_heads.empty?\n msg = \"#{type}-join with no common column names needs join expression\"\n raise UserError, msg\n else\n # A Natural join on all common heads\n common_heads.each do |h|\n ensure_common_types!(self_h: h, other_h: h, other: other)\n end\n nat_exp = common_heads.map { |h| \"(#{h}_a == #{h}_b)\" }.join(' && ')\n [nat_exp, common_heads]\n end\n else\n # We have join expressions to evaluate\n and_conds = []\n partial_result = nil\n last_sym = nil\n exps.each do |exp|\n case exp\n when Symbol\n case exp.to_s.clean\n when /\\A(?<sy>.*)_a\\z/\n a_head = Regexp.last_match[:sy].to_sym\n unless a_heads.include?(a_head)\n raise UserError, \"no column '#{a_head}' in table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: a_head,\n other_h: last_sym,\n other: other)\n partial_result << \"#{a_head}_a)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{a_head}_a == \"\n end\n last_sym = a_head\n when /\\A(?<sy>.*)_b\\z/\n b_head = Regexp.last_match[:sy].to_sym\n unless b_heads.include?(b_head)\n raise UserError, \"no column '#{b_head}' in second table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: last_sym,\n other_h: b_head,\n other: other)\n partial_result << \"#{b_head}_b)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{b_head}_b == \"\n end\n b_common_heads << b_head\n last_sym = b_head\n else\n # No modifier, so must be one of the common columns\n unless partial_result.nil?\n # We were expecting the second of a modified pair, but got an\n # unmodified symbol instead.\n msg =\n \"follow '#{last_sym}' by qualified exp from the other table\"\n raise UserError, msg\n end\n # We have an unqualified symbol that must appear in both tables\n unless common_heads.include?(exp)\n msg = \"unqualified column '#{exp}' must occur in both tables\"\n raise UserError, msg\n end\n ensure_common_types!(self_h: exp, other_h: exp, other: other)\n and_conds << \"(#{exp}_a == #{exp}_b)\"\n b_common_heads << exp\n end\n when String\n # We have a string expression in which all column references must be\n # qualified.\n and_conds << \"(#{exp})\"\n else\n msg = \"invalid join expression '#{exp}' of class #{exp.class}\"\n raise UserError, msg\n end\n end\n [and_conds.join(' && '), b_common_heads]\n end\n end", "def join_query(from, to, field, value)\n \"_query_:\\\"{!join from=#{from} to=#{to}}#{field}:\\\\\\\"#{value}\\\\\\\"\\\"\"\n end", "def join_with_and(list, seperator = ', ')\n return list.first if list.count == 1\n result = ''\n list.each do |item|\n result << item\n next if item == list.last\n result << if item == list[-2]\n ' and '\n else\n seperator\n end\n end\n result\n end", "def join_with_and(list, seperator = ', ')\n return list.first if list.count == 1\n result = ''\n list.each do |item|\n result << item\n next if item == list.last\n result << if item == list[-2]\n ' and '\n else\n seperator\n end\n end\n result\n end", "def lru_join(x, y)\n x.lru_next = y\n y.lru_prev = x\n return y\n end", "def join_forward(buffer, count = buffer.prefix_count)\n count = count > 1 ? (count - 1) : count\n buffer.undo_record do |record|\n count.times do\n buffer.insert = buffer.at_insert.lineend\n record.replace('insert', 'insert + 1 chars', ' ')\n end\n end\n end", "def test_split_join_record_line\n check = proc do |start, record, final|\n # Check parsing first\n result = @parser.parse_line(start)\n [:one, :two].each do |param|\n\n assert_equal(\n record[param], result[param],\n\n \"Did not correctly parse #{start.inspect}\")\n end\n\n # And generating\n assert_equal(final, @parser.to_line(result), \"Did not correctly generate #{final.inspect} from #{record.inspect}\")\n end\n\n # First try it with symmetric characters\n @parser.record_line :symmetric, :fields => %w{one two},\n :separator => \" \"\n\n check.call \"a b\", {:one => \"a\", :two => \"b\"}, \"a b\"\n @parser.clear_records\n\n # Now assymetric but both strings\n @parser.record_line :asymmetric, :fields => %w{one two},\n :separator => \"\\t\", :joiner => \" \"\n\n check.call \"a\\tb\", {:one => \"a\", :two => \"b\"}, \"a b\"\n @parser.clear_records\n\n # And assymmetric with a regex\n @parser.record_line :asymmetric2, :fields => %w{one two},\n :separator => /\\s+/, :joiner => \" \"\n\n check.call \"a\\tb\", {:one => \"a\", :two => \"b\"}, \"a b\"\n check.call \"a b\", {:one => \"a\", :two => \"b\"}, \"a b\"\n end", "def set_match\n\t\t@matched = true\n\tend", "def join(other)\n new(relation.join(other.relation))\n end", "def join_table(type, table, expr=nil, options=OPTS, &block)\n if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all?\n options = options.merge(:join_using=>true)\n end\n super\n end", "def delete_matched(matcher, options = T.unsafe(nil)); end", "def or other_result\n result = dup\n result.matched = hash_union(matched, other_result.matched)\n result.not_matched = hash_union(not_matched, other_result.not_matched)\n result\n end", "def match(i, j, protein)\n twin = [protein.sequence[i-1], @genome.sequence[j-1]].sort\n st = twin.join\n @@blosum62[st]\n end", "def group_join!(group)\n affiliations.create!( :group_id => group.id )\n end", "def join(other)\n return nil unless self.frequency == other.frequency\n\n expanded_datetimes = self.datetimes.map { |datetimes_within_an_interval|\n back_one = datetimes_within_an_interval.first - frequency.duration\n forward_one = datetimes_within_an_interval.last + frequency.duration\n\n [back_one] + datetimes_within_an_interval + [forward_one]\n }\n\n joint_ranges = []\n\n # Look for overlaps, where an overlap may be 'off by 1' -- hence the 'expanded_datetimes'\n # ...but start with other and join to each of it's intervals.\n #\n # Remember that 'pattern.datetimes' returns a list of datetimes per interval\n other.datetimes.each do |other_datetimes_within_an_interval|\n\n joinable_datetimes = expanded_datetimes.find { |expanded_datetimes_within_an_interval|\n other_datetimes_within_an_interval.any? { |d|\n expanded_datetimes_within_an_interval.include?(d)\n }\n }\n break unless joinable_datetimes\n\n # Joint ranges should be those that overlap\n #\n # This is buggy, because joinable_datetimes is a list of datetimes per interval that overlap\n # Excluding the first doesn't make sense\n #\n # Instead, we should exclude the first AND last for each element within joinable_datetimes \n joint_datetimes = (other_datetimes_within_an_interval + joinable_datetimes[1...-1]).sort\n joint_ranges << (joint_datetimes.first..joint_datetimes.last)\n end\n\n # This seems to be trying to say \"Only join when we got one for each interval of self\"\n # ...it also seems too restrictive...\n #\n # What if other includes multiple intervals of self?\n # Then we don't need same number of intervals\n #\n # Also might be wrong in other ways, it's tricky to tell\n if joint_ranges.size == self.intervals.size\n Pattern.new(joint_ranges, frequency.duration)\n end\n end", "def merge!\n other_tag = Tag.find_by_name(self.name)\n if other_tag.nil? or other_tag.id == self.id\n return self\n else\n taggings.map(&:clone).each { |t| (t.tag = other_tag) && t.save! }\n self.destroy\n return other_tag\n end\n end", "def merge!; end", "def join\n\t\tm = SubMachine.empty('join')\n\t\tm.merge self\n\t\tm.states[m.first].transitions = [Transition.new(Hash.new, Array.new, @first)]\n\n\t\t@states[@lastTrue].transitions = [Transition.new(Hash.new, Array.new, m.last ) ]\n\t\t@states[@lastFalse].transitions = [Transition.new(Hash.new, Array.new, m.last ) ]\n\n\t\treturn m\n\tend", "def method_missing ( method, *args )\n # Handle all [*_]join calls:\n return _addJoin( method, *args ) if method =~ /^[a-z_]*join$/\n super\n end", "def optimize\n left.ne(right.first)\n end", "def add_join(join)\n @clause[:final_join] = join.implicit_joins\n end", "def deintersect\n [self]\n end", "def union!(other)\n redis.sunionstore key, key, other.key\n ensure\n notify_changed\n end", "def apply_join(query, join)\n validate_query(query)\n query.joins(join)\n end", "def join_pid_seq_no_overlap(seq_pair_hash, diff = 0.0, model = 1)\n begin\n if model == 1\n overlap = determine_overlap_pid_pair(seq_pair_hash, diff)\n return join_pid_seq_overlap(seq_pair_hash, diff, overlap)\n elsif model == 2\n joined_seq_hash = {}\n seq_pair_hash.each do |seq_name, seq_pair|\n overlap_list = []\n overlap_matrix(seq_pair[0], seq_pair[1]).each do |overlap1, diff_nt|\n cut_off_base = overlap1 * diff\n overlap_list << overlap1 if diff_nt <= cut_off_base\n end\n if overlap_list.empty?\n joined_seq_hash[seq_name] = seq_pair[0] + seq_pair[1]\n else\n overlap = overlap_list.max\n joined_seq_hash[seq_name] = seq_pair[0] + seq_pair[1][overlap..-1]\n end\n end\n return joined_seq_hash\n else\n raise ArgumentError.new(\"Error::Wrong Overlap Model Argument. Given \\'#{model}\\', expected '1' or '2'.\")\n end\n rescue ArgumentError => e\n puts e\n end\nend", "def join_for_works_from_files\n \"{!join from=#{ActiveFedora.id_field} to=file_set_ids_ssim}#{edismax_query}\"\n end", "def joinable?\n left.eql?(right.rename(left.name))\n end", "def ntest_left_outer_join\n program = CombosBud.new('localhost', 12345)\n assert_nothing_raised( RuntimeError) { program.tick }\n loj_outs = program.loj_out.map{|t| t}\n assert_equal(3, loj_outs.length)\n assert_equal(loj_outs.inspect, '[[\"z\", nil, 1, nil], [\"v\", nil, 1, nil], [\"a\", \"a\", 1, 1]]')\n end", "def joins\n []\n end", "def join\n [email protected]\n # Taking a copy here is really important!\n self.decrement @thread_count\n # Stop the threads or else suffer a deadlock.\n threads.each do |t|\n debug \"joining thread #{t}\" if @debug\n t.join\n end\n end", "def local_join(body)\n room = body.dup\n room[0,1] = '' until room[0,1] != '@'\n return nil unless room.length >= 1\n unless @var[:special_rooms].include?(room)\n room_hash = MD5::digest(room)[0,8]\n room_hash = EMPTY_ROOM if room == 'chat'\n @connection.room_names[room_hash] = room\n @connection.room_ids[room] = room_hash\n _remote_control(@var[:our_name], :invite, body, true)\n _server_control('join', room_hash)\n end\n local_switch(room.dup)\nend", "def join_thread\n @thread&.join\n end", "def clean_join_table\n # these 2 lines run pretty much the same sql, self.parses adds a where in clause\n self.parsers = []\n # OR\n # ActiveRecord::Base.connection.execute(\"DELETE FROM parsers_transformations WHERE transformation_id = #{id}\")\n end", "def joined\n meta(joined: true)\n end", "def queue_matches\n\n end", "def join_for_works_from_files\n \"{!join from=#{Hyrax.config.id_field} to=file_set_ids_ssim}#{dismax_query}\"\n end", "def merge(r, equalities_resolved = false)\n if ::ActiveRecord::Relation === r && !equalities_resolved\n if self.table_name != r.table_name\n super(r.visited)\n else\n merge_resolving_duplicate_squeel_equalities(r)\n end\n else\n super(r)\n end\n end" ]
[ "0.6254337", "0.6191731", "0.61108476", "0.6023713", "0.58929896", "0.57704884", "0.5713556", "0.56528234", "0.5608979", "0.54569805", "0.54124427", "0.5351181", "0.53285927", "0.53168476", "0.5312828", "0.52872753", "0.5266655", "0.5259483", "0.524402", "0.5202691", "0.52011853", "0.5187004", "0.51445085", "0.51341295", "0.51322234", "0.5126902", "0.5121473", "0.51134604", "0.5113072", "0.5112186", "0.5082712", "0.50745505", "0.50663346", "0.50547653", "0.5041179", "0.5030279", "0.50275874", "0.502707", "0.50054586", "0.49877328", "0.49858043", "0.49855962", "0.49839693", "0.49785274", "0.49783054", "0.4969818", "0.4955895", "0.4948552", "0.4943586", "0.49235556", "0.49035147", "0.48997742", "0.48991486", "0.4888857", "0.48785588", "0.48755252", "0.48748457", "0.48743814", "0.48669407", "0.48632467", "0.48594418", "0.48580652", "0.4851345", "0.48501942", "0.48328644", "0.48317802", "0.48317802", "0.48299918", "0.4813172", "0.47892293", "0.477491", "0.4771425", "0.47589812", "0.47471738", "0.47449163", "0.47428975", "0.47370946", "0.47238427", "0.47230756", "0.47221416", "0.47209483", "0.47185022", "0.4707078", "0.47064865", "0.4695241", "0.4661132", "0.46577308", "0.46505585", "0.4646594", "0.46371597", "0.4626229", "0.46227458", "0.46206996", "0.4620396", "0.46104422", "0.46042654", "0.4601438", "0.4586202", "0.4574599", "0.45723745" ]
0.4955277
47
host can kick people out of match
def kick status = false pid = params[:match][:pid].to_i # find and kick player out by setting foreign key to nil if (@match.player2_id == pid) then @match.player2_id = nil; status = true elsif (@match.player3_id == pid) then @match.player3_id = nil; status = true elsif (@match.player4_id == pid) then @match.player4_id = nil; status = true end respond_to do |format| if status and @match.save format.html { redirect_to @match, notice: ['Player have been successfully kicked out.', "alert alert-dismissible alert-success" ] } else format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', "alert alert-dismissible alert-danger"] } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_everybody! why\n\t\t\tModel::Instance.live_on_host(host).each { |i| kill i, why }\n\t\tend", "def leave_lobby\n if lobby\n game = lobby\n if game.player_count == 1\n game.destroy!\n elsif game.host == self\n game.player(self).destroy\n Player.where(game: game).first.update! host: true\n else\n game.player(self).destroy\n end\n true\n else\n false\n end\n end", "def exit\n @server.check_out(@host) unless @server.nil?\n end", "def kill\n @lives -= 1\n @alive = false\n return if @lives <= 0\n warp\n end", "def kill() end", "def kick?\n false\n end", "def test_reach_out_unset\n handle_basic_subscription user: users(:newish)\n\n assert_equal 1, users(:newish).characters.size\n assert_equal TitleSubgameConnection, subscription.current_subgame_connection.class\n perform :receive, gameaction: \"reach_out_one\", args: \"blob\"\n assert_equal EntwinedSubgameConnection, subscription.current_subgame_connection.class\n\n # No new character should be created\n assert_equal 1, Character.where(:user_id => users(:newish).id).count\n end", "def kill\n @alive = false\n end", "def kick_out\n @passengers.shift\n end", "def kill!() end", "def check_out\n @current_guests = nil\n end", "def kill_player(player)\n\t\[email protected]_if { |enemy| enemy.singleton_class != player.singleton_class }\n\tend", "def host_down(host)\n end", "def kill(victim)\n victim.die\n end", "def kick_out\n while self.over_capacity?\n self.patrons.pop\n end\n end", "def alive_players\n @players.reject{|p| p.dead? }\n end", "def remove_from_gamespace\n # remove it from the room it's in.\n self.from_room \n self.recycle \n # Possibly in the future return all switches. I.e. an admin taking over an NPC body.\n end", "def kill_user *args\r\n puts \"not implemented yet\"\r\n end", "def kill_player(input_user)\n @enemies_in_sight.delete(input_user)\n end", "def kick\n passive_mutex.synchronize do\n passive_cond.signal\n end\n end", "def destroy_current_puzzle_if_any\n\n return true if $redis.keys(\"#{remote_ip}.hidden.ids\").empty?\n \n $redis.keys(\"#{remote_ip}.hidden.*\").each do |key|\n $redis.del(key)\n end\n\n $redis.del(\"#{remote_ip}.#{session}.image_reference\")\n end", "def prune_peer(device_name, reload = 1)\n if self.active == 1\n\n server = Rami::Server.new({'host' => self.server_ip, 'username' => self.ami_username, 'secret' => self.ami_secret})\n server.console =1\n server.event_cache = 100\n server.run\n\n client = Rami::Client.new(server)\n client.timeout = 3\n\n # changed from device.username, hope it works\n device_username = device_name\n\n t = client.command(\"sip prune realtime peer \" + device_username)\n \n if (defined?(AST_18) and AST_18.to_i == 1)\n #AST18 does not use this command, user ir pruned with 'sip prune realtime peer NAME'\n else\n t = client.command(\"sip prune realtime user \" + device_username)\n end\n \n if (defined?(AST_18) and AST_18.to_i == 1)\n # AST18 do not care about user/peer to prune it\n t = client.command(\"iax2 prune realtime \" + device_username)\n else\n t = client.command(\"iax2 prune realtime user \" + device_username)\n t = client.command(\"iax2 prune realtime peer \" + device_username) \n end\n\n\n if reload == 1\n t = client.command(\"sip show peer \" + device_username + \" load\")\n t = client.command(\"iax2 show peer \" + device_username + \" load\")\n t = client.command(\"sip show user \" + device_username + \" load\")\n \n if (defined?(AST_18) and AST_18.to_i == 1)\n #AST18 does not use this command, user is loaded with 'iax2 show peer NAME load'\n else\n t = client.command(\"iax2 show user \" + device_username + \" load\") \n end\n\n end \n\n client.respond_to?(:stop) ? client.stop : false\n\n end\n\n end", "def test_leave\n session=enter_the_room(\"zark\")[\"session\"]\n leave(session)\n end", "def someone_did_kick(stem, kicker, channel, victim, msg)\n end", "def wakeup!(client); end", "def end_state?\n not player_alive?(Player1) or not player_alive?(Player2)\n end", "def tor_exit_node?; end", "def tor_exit_node?; end", "def stop_if_match; true; end", "def resign(game = ongoing_game)\n game.player(self).update(role: \"dead_player\")\n end", "def destroy m\n\t\t@users[m.user.nick].destroy\n m.reply \"boom!\"\n end", "def server_leave(client, body)\n return nil unless @rooms[body]\n return nil unless @rooms[body].include?(client.name)\n select_send(MSG_SERVER, EMPTY_ROOM, @keyring.default.iv,\n server_encrypt(\"presence leave #{client.name}#{body}\")\n ) { |x| @rooms[body].include?(x.name) }\n @rooms[body].delete client.name\n if @rooms[body].empty?\n @rooms.delete body\n @motd.delete body\n end\nend", "def kill_player\r\n @enemies.each do |player|\r\n if (player.life_points <= 0)\r\n @enemies.delete(player)\r\n puts \"#{player.name} vient d'être éliminé !\"\r\n end\r\n end \r\n end", "def join(server, already); end", "def server_lost(srv)\n @servers.delete(srv) if @servers.include?(srv)\n end", "def org_killed_me(org)\n org_bad_things(org,@killing_mod) \n end", "def end_turn\n @players_1_turn = !@players_1_turn\n end", "def test_check_group_out_of_room()\n @room.check_in(@group2)\n @room.check_out()\n assert_equal(0, @room.karaoke_room_occupied())\n end", "def stop_game?\n finished? || user_turn?\n end", "def finish_game\n\t\tif @check_mate_on == true\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) is in CHECKMATE !!!\\n#{@opponent_player.name} (#{@opponent_player.color})WON the game !!!\"\n\t\t\texit\n\t\tend\n\tend", "def check_out\n @server[\"/worker\"].put({\n :name => @name,\n :terminated => true\n })\n log 'exiting'\n end", "def disconnect!; true; end", "def allow_kick_bomb\n @kick_bomb = true\n end", "def chef_to_be_removed(chef_server_list)\n servers_up = cloud_server_list\n chef_server_list.delete_if do |name,server|\n puts \"Do not delete #{name}, it's up\" if servers_up[name]\n !! servers_up[name]\n end\nend", "def resurrect!\n alive! if resurrectable?\n end", "def off_org_users\n \n end", "def remove_server( host, port )\n server = get_server( host, port )\n Penctl.update_server( @pen, server[:slot], :address => '0.0.0.0', :port => 0 )\n !server_in_pool? host, port\n end", "def goaway!\n goaway block: true\n end", "def cpu_prevent\n current_turn = @state[:turn]\n @state[:turn] = current_turn == PLAYER_1_TURN ? PLAYER_2_TURN : PLAYER_1_TURN # pretend to be other player\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET\n board_remove_token(c) # remove the winning move\n @state[:turn] = current_turn # change back\n board_place_token(c) # place token to block\n return true\n elsif token_placed # make sure token was placed before force delete\n board_remove_token(c)\n end\n end\n @state[:turn] = current_turn # remember to switch back\n false\n end", "def end_game()\n get_winners()\n end", "def losing_players\n if player_1.hit_points <= 0\n player_1\n elsif player_2.hit_points <= 0\n player_2\n end\n end", "def other_users_online()\n userlist = `ps haeo user | sort -u`.split(\"\\n\")\n userlist -= userlist.grep(/s0840449|root/)\n not userlist.empty?\nend", "def free_booth\n @booth = User.where(:id => params[:user_id]).first\n @invoice = @booth.cs_invoices.first\n if @invoice\n begin\n # terminated calls if any\n server_id, channel = params.values_at(:server, :channel)\n\n unless server_id.blank? or channel.blank?\n server = Server.where(:id => server_id.to_i).first\n\n if server\n server.ami_cmd(\"soft hangup #{channel}\")\n end\n\n MorLog.my_debug \"Hangup channel: #{channel} on server: #{server_id}\"\n end\n rescue Exception => e\n @status = _('Unable_to_terminate_calls_check_connectivity')\n end\n end\n render :layout=>false\n end", "def destroyed_ship(enemy_sunk)\n if enemy_sunk\n @neighbor_strategy = false\n @unsunk_hit_ship = false\n @hit_guesses = []\n return true\n else\n return false\n end\n end", "def check_out_guest(guest)\n @guest.delete(guest)\n end", "def unpause\n data = JSON.generate(:unpause => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def check_host\n unless @game.host == current_user\n render( :status => :unauthorized,\n :text => \"Cannot %s a game you didn't create.\" % params[:action])\n return false\n end\n return true\n end", "def check_out_guest(guest)\n @guests.delete(guest)\n end", "def unprotect\n @target\n end", "def someone_did_lose_privilege(stem, channel, nick, privilege, bestower)\n end", "def host_is_okay\n return false unless @report_data[:host]\n return false unless valid_ip(@report_data[:host])\n return false unless @report_data[:state] == Msf::HostState::Alive\n if @args[:blacklist]\n return false if @args[:blacklist].include?(@report_data[:host])\n end\n return true\n end", "def all_dead?(check_only = false)\n return false if !check_only && !$game_system.allow_gameover?\n re = super() && ($game_party.in_battle || members.size > 0)\n @dead_confirm_timer = 0 if @dead_confirm_timer.nil?\n @dead_confirm_timer = re ? @dead_confirm_timer + 1 : 0\n BattleManager.send_flag(in_battle: true) if re\n return re && @dead_confirm_timer > 180\n end", "def leave; end", "def leave(person)\n members.delete(person);\n end", "def local_switch(body, prevent = false)\n room = body\n room = 'chat' if room.length < 1\n unless @connection.room_ids[room] or room == 'chat' or room[0,1] == '@' or\n @var[:special_rooms].include?(room)\n _notice \"You are not in room '#{room}'\", :error\n return false\n end\n @var[:room] = room\n unless prevent\n if room[0,1] == '@'\n _notice \"You are now private messaging with #{room[1..-1]}.\", room\n else\n _notice \"You are now chatting in '#{room}'\", room\n end\n end\n true\nend", "def enemy_eliminated?\n items = listen\n\n if items.empty? \n true\n elsif items.all?(&:ticking?)\n true\n elsif @possible_enemy_count==0\n true\n else\n false\n end\n end", "def abort()\n if @ssh_session && !@ssh_session.closed? then\n #try to close connection gracefully\n @ssh_session.close\n # and if it won't, send out the hunter to bring in Snowwhite's heart after some time\n Thread.new do\n sleep 5\n @ssh_session.shutdown! unless @ssh_session.nil? || @ssh_session.closed?\n end\n end\n end", "def ygg_attacker() ; return nil ; end", "def disconn(user_id)\r\n @waiting.delete(user_id)\r\n end", "def loser\n losing_players\n end", "def check_captive_behind_enemy \n return true if @captives > 0 and check_for_a_bomb and \n warrior.feel(:left).empty? and !warrior.feel(:left).wall? and\n warrior.look(:forward)[1].to_s.to_sym == :Captive and\n warrior.look(:forward)[0].to_s.to_sym == :Sludge\n return false\n end", "def ban\n self.enabled = false\n save\n\n hosts.each do |host|\n if host.client.present?\n host.disable_jobs_and_lock\n else\n host.block\n end\n end\n end", "def shutdown\n @server_active = false\n end", "def unmanage_host(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.headers['Accept'] = 'application/json,version=2'\n curl.headers['Content-Type'] = 'application/json'\n host_settings = {}\n host_settings[:host] = {}\n host_settings[:managed] = false\n host_settings_json = host_settings.to_json\n curl.http_post(host_settings_json)\n result = JSON.parse(curl.body_str)\n raise result['message'] if result['message'] =~ /^ERF51/\n result\n end", "def stay_alive?(live_neighbors)\n live_neighbors == 2 || live_neighbors == 3\nend", "def member_in_action(active)\n for battler in active.combination_battlers\n if battler != active and battler.current_phase != ''\n battler.current_phase = ''\n return true\n end\n end\n return false\n end", "def dead?\n !alive?\n end", "def someone_did_leave_channel(stem, person, channel)\n end", "def life_lost\n # if we are attacking ourselves, don't give our life back (otherwise it will never end)\n unless current_user == current_user.previous.player\n # Render the status message and push it to all clients\n message = render_to_string :partial => 'messages/gained_a_life', \n :locals => {:user_1 => current_user.previous.player, :user_2 => current_user}\n send_status_message(message) \n \n # Attacker gains the life that their victim lost\n attacker = current_user.previous.player\n life_gained(attacker)\n end\n ensure\n render :nothing => true\n end", "def destroy\n\t\t# TODO: disallow leaving the game if you're dead.\n\t\t# Possibly also introduce a 'retired' state for players who left the game after it started,\n\t\t# rather than just deleting them outright?\n\t\t@player = Player.find(params[:id])\n\t\t@game = @player.game\n\t\tunless playing? and (@player == me or me.is_operator?)\n\t\t\traise \"You can't kick a player because you're not an operator!\"\n\t\tend\n\t\tobserving_game_events(@game) do\n\t\t\[email protected]_player(@player)\n\t\tend\n\t\tif @player == me\n\t\t\tannounce_event(\"%s has left the game\", @player.name)\n\t\telse\n\t\t\tannounce_event(\"%s was kicked by %s\", @player.name, me.name)\n\t\tend\n\n\t\trender :nothing => true and return if request.xhr?\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @game }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def cancel(m)\n player = @game.players.find { |p| p.irc_authname == m.user.authname}\n @game.players.delete(player)\n\n @initiator = @game.players[0]\n m.reply I18n.mixer.cancel(m.user.nick)\n\n unless @initiator\n @timer.stop\n @game = nil\n m.reply I18n.mixer.last_left\n else\n m.reply I18n.mixer.new_initiator(@initiator.irc_nick)\n m.reply show_players\n end\n end", "def remove_dead_actors\n for battler in tactics_all\n if (battler.actor? && battler.death_state? &&\n $game_party.all_members.include?(battler) &&\n !GTBS::Prevent_Actor_Leave_List.include?(battler.id))\n $game_party.remove_actor(battler.id) \n end\n end\n end", "def do_delete\n moved = []\n # evacuate the room.\n\n if [email protected]? \n moved = @stuff.dup\n moved.each do |person|\n if person.is_a?(Player)\n # send them to a safe vnum...we're going to use vnum 1\n person.go_anywhere\n end\n end\n end\n \n\n 4.times do |i|\n ex = self.exit_list[i]\n next if ex == nil\n\n log :debug, \"ex #{ex.direction} deleted\"\n\n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev] \n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].towards_room.gri == self # if it's the same room as being deleted we delete \n ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].do_delete\n end\n end\n ex.do_delete\n end\n\n moved.each do |p|\n p.execute_command(\"look\")\n end\n Tag.clear_tag(self)\n @vtag = nil\n a = @vnum / 1000\n Vnum.rooms[@vnum % 1000] = nil # unlinked from main list.\n end", "def player_stop\n game_owner_only!\n @game.stop(current_user.id)\n redirect_to @game\n end", "def kill!\n @die = true\n end", "def end_game\n sleep 1\n self.stop = true\n winer = if ((21 - user.hand.total_score) < (21 - dealer.hand.total_score)) && (user.hand.total_score <= 21)\n user.name\n elsif (dealer.hand.total_score <= 21) && (user.hand.total_score <= 21) && (user.hand.total_score == dealer.hand.total_score)\n 'Ничья!'\n elsif dealer.hand.total_score <= 21\n dealer.name\n elsif user.hand.total_score <= 21\n user.name\n else\n 'Все проиграли!'\n end\n interface.show_winner(winer)\n interface.show_user_cards(user)\n interface.show_open_dealer_cards(dealer)\n update_bank(winer)\n end", "def kill(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n @kill_sig_received = true\n \n if is_hybrid_cloud? \n Thread.new {\n Kernel.sleep(5)\n HelperFunctions.terminate_hybrid_vms(creds)\n }\n elsif is_cloud?\n Thread.new {\n Kernel.sleep(5)\n infrastructure = creds[\"infrastructure\"]\n keyname = creds[\"keyname\"]\n HelperFunctions.terminate_all_vms(infrastructure, keyname)\n }\n else\n # in xen/kvm deployments we actually want to keep the boxes\n # turned on since that was the state they started in\n\n if my_node.is_login?\n stop_ejabberd \n end\n\n if my_node.is_shadow? or my_node.is_appengine?\n ApiChecker.stop \n end\n\n maybe_stop_taskqueue_worker(\"apichecker\")\n maybe_stop_taskqueue_worker(AppDashboard::APP_NAME)\n\n jobs_to_run = my_node.jobs\n commands = {\n \"load_balancer\" => \"stop_app_dashboard\",\n \"appengine\" => \"stop_appengine\",\n \"db_master\" => \"stop_db_master\",\n \"db_slave\" => \"stop_db_slave\",\n \"zookeeper\" => \"stop_zookeeper\"\n }\n\n my_node.jobs.each { |job|\n if commands.include?(job)\n Djinn.log_info(\"About to run [#{commands[job]}]\")\n send(commands[job].to_sym)\n else\n Djinn.log_info(\"Unable to find command for job #{job}. Skipping it.\")\n end\n }\n\n if has_soap_server?(my_node)\n stop_soap_server\n stop_datastore_server\n end\n\n TaskQueue.stop if my_node.is_taskqueue_master?\n TaskQueue.stop if my_node.is_taskqueue_slave?\n TaskQueue.stop_flower if my_node.is_login?\n\n stop_app_manager_server\n stop_infrastructure_manager\n end\n\n MonitInterface.shutdown\n FileUtils.rm_rf(STATE_FILE)\n\n if @creds['alter_etc_resolv'].downcase == \"true\"\n HelperFunctions.restore_etc_resolv()\n end\n\n return \"OK\" \n end", "def shutdown(how = 2)\n begin\n super\n ensure\n @tunnel.remove if closed?\n end\n return 0\n end", "def stop()\n data = JSON.generate(:suspend => nil)\n puts data\n pp \"About to post ACTION\"\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def empty hand\n put \"empty #{hand}\"\n case({ :wait => [/\\.\\.\\.wait|you may only type ahead 1 command|stunned/],\n :empty => [\"You drop\"]})\n when :wait\n pause Rt::value\n empty hand\n end\nend", "def play_night_phase\n increment_phase\n villager_to_kill = @players.reject {|player| player.is_werewolf? }.random\n\n # healer picks someone at random, is ignorant of seer's cleared list\n if @players.any? { |player| player.is_healer? } && villager_to_kill == @players.random\n log \"NIGHT: Wolves kill nobody; the #{villager_to_kill.class} was healed\"\n else\n log \"NIGHT: Wolves kill a #{villager_to_kill.class}\"\n @players.delete villager_to_kill\n end\n end", "def kill!\n @kill = true\n end", "def unban(nick_or_host)\n @session.chanserv.unban(self.name, nick_or_host)\n end", "def msg_KICK(source, args)\n c = Channel.find_by_name(args[0])\n target = User.find(args[1])\n\n # Charybdis checks server-side and rejects kicks on +S clients, no need for\n # rejoin code here.\n\n # TS 0 very unlikely, simply accept it, esp. since our uplink checked\n c.del_user(target)\n target.part(c)\n return nil\n end", "def dealer_stop\n game_owner_only!\n if @game.dealer_stop?\n @game.stop(nil)\n redirect_to @game\n else\n redirect_to @game, alert: 'Dealer cannot stop before 17'\n end\n\n end", "def isOpped(m) \n return true if m.user.nick == 'godzirra'\n\n if m.channel\n @bot.debug \"Channel #{m.channel} and opped #{m.channel.opped? m.user}\"\n return m.channel.opped? m.user\n else\n @bot.channels.each do |chan| \n if chan.opped? m.user\n return true\n end\n end\n end\n return false\n end", "def play_out\n begin\n make_move(choose_move) until @minefield.clear?\n DISPLAY.call 'Victory!'\n rescue TrippedMineError\n DISPLAY.call 'Boom!'\n return false\n end\n true\n end", "def client_exited(user_id, room)\n dump_round_vars \"Entering client_exited(#{room})\"\n if (@@curr_round[room] != nil)\n result = Result.where(\"user_id = ?\", user_id).where(\"round_id = ?\", @@curr_round[room]).first\n result.update(round_complete: false) if !result.nil?\n end\n @@clientList[room] -= [user_id]\n\n if @@clientList[room].empty? # room is empty, so...\n cleanup_empty_room(room)\n end\n dump_round_vars '', 'Exiting client_exited()'\n end", "def dead?; end", "def can_attack?( target )\n not @finished and targets.include?( target )\n end" ]
[ "0.6057796", "0.5888233", "0.58694094", "0.5862972", "0.58392763", "0.5825796", "0.58088505", "0.57993275", "0.57777536", "0.57258165", "0.5702344", "0.5681475", "0.56562567", "0.5639832", "0.55717254", "0.553291", "0.5532185", "0.5525365", "0.5517782", "0.548014", "0.54772764", "0.5450708", "0.5447162", "0.54402304", "0.54206604", "0.54190207", "0.5418471", "0.5418471", "0.5412854", "0.54063624", "0.5391065", "0.53857625", "0.5374017", "0.53668857", "0.53640217", "0.534192", "0.5332222", "0.5330026", "0.5321026", "0.53006446", "0.5295877", "0.52944994", "0.52938265", "0.52920634", "0.528971", "0.5287774", "0.5284164", "0.5275783", "0.5271849", "0.52714634", "0.52688754", "0.5263359", "0.5257418", "0.5256347", "0.5254526", "0.5252834", "0.5251731", "0.52428776", "0.5239095", "0.5237758", "0.52366495", "0.52351207", "0.5232223", "0.52276057", "0.5222322", "0.5220345", "0.52120256", "0.5207587", "0.5205248", "0.52050805", "0.520386", "0.5202973", "0.520255", "0.52021784", "0.5190405", "0.5185165", "0.5184874", "0.518255", "0.5178772", "0.51753926", "0.5173307", "0.5172981", "0.5172369", "0.51723593", "0.51704466", "0.5170077", "0.51672155", "0.51625645", "0.51623785", "0.5161676", "0.5161429", "0.515194", "0.5151805", "0.5151125", "0.5150571", "0.51466244", "0.51460075", "0.5143235", "0.51389575", "0.51389265" ]
0.5206732
68
DELETE /matches/1 DELETE /matches/1.json
def destroy @match.destroy respond_to do |format| format.html { redirect_to @match, notice: ['You have succesfully left the match.', "alert alert-dismissible alert-warning"]} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matchs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = @contest.matches.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n respond_to do |format|\n if @match\n if @match.destroy\n format.json { head :no_content, status: :ok}\n end\n else\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match.destroy\n render json: {success: true}\n end", "def destroy\n @match = Match.find(params[:id])\n \n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match supprimé' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_to) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n # format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.html { redirect_to fes_matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_stat = MatchStat.find(params[:id])\n @match_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to match_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_path, notice: 'Partida deletada com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_path(tournament: match_params[:tournament_id]), notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clan_match.destroy\n\n head :no_content\n end", "def destroy\n @master_ea_match.destroy\n respond_to do |format|\n format.html { redirect_to master_ea_matches_url, notice: 'Master ea match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to current_player, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n if cannot? :update, @match\n\tredirect_to \"/hax.html\"\n else\n \[email protected]\n end\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match_detail.destroy\n respond_to do |format|\n format.html { redirect_to match_details_url, notice: 'Match detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @group = @match.group\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_matches_url(@group)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @master_ea_no_match.destroy\n respond_to do |format|\n format.html { redirect_to master_ea_no_matches_url, notice: 'Master ea no match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_image = MatchImage.find(params[:id])\n @match_image.destroy\n\n respond_to do |format|\n format.html { redirect_to match_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interpro_match = InterproMatch.find(params[:id])\n @interpro_match.destroy\n\n respond_to do |format|\n format.html { redirect_to interpro_matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_set.destroy\n respond_to do |format|\n format.html { redirect_to match_sets_url, notice: 'Match set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_match.destroy\n respond_to do |format|\n format.html { redirect_to team_matches_url, notice: 'Team match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile_match = ProfileMatch.find(params[:id])\n @profile_match.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_profile_matches_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @matchsindiv = Matchsindiv.find(params[:id])\n @matchsindiv.destroy\n\n respond_to do |format|\n format.html { redirect_to matchsindivs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @empire_master_match.destroy\n respond_to do |format|\n format.html { redirect_to empire_master_matches_url, notice: 'Empire master match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cagematch.destroy\n respond_to do |format|\n format.html { redirect_to cagematches_url, notice: 'Cagematch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @matchup = Matchup.find(params[:id])\n @matchup.destroy\n\n respond_to do |format|\n format.html { redirect_to(matchups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #Called automatically when a match is destroyed\n @innings.destroy\n respond_to do |format|\n format.html { redirect_to match_path(@match), notice: 'Innings was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @matchparticipant.destroy\n respond_to do |format|\n format.html { redirect_to matchparticipants_url, notice: 'Matchparticipant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mot_m.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_for_the_match = TeamForTheMatch.find(params[:id])\n @team_for_the_match.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_for_the_matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match_pick.destroy\n respond_to do |format|\n format.html { redirect_to match_picks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_part = MatchPart.find(params[:id])\n @match_part.destroy\n\n respond_to do |format|\n format.html { redirect_to(match_parts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @empire_master_no_match.destroy\n respond_to do |format|\n format.html { redirect_to empire_master_no_matches_url, notice: 'Empire master no match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_team.destroy\n respond_to do |format|\n format.html { redirect_to match_teams_url, notice: 'Match team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat_of_player_of_team_of_match.destroy\n respond_to do |format|\n format.html { redirect_to stat_of_player_of_team_of_matches_url, notice: 'Stat of player of team of match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_form.destroy\n respond_to do |format|\n format.html { redirect_to match_forms_url, notice: 'Match form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_requirement.destroy\n respond_to do |format|\n format.html { redirect_to match_requirements_url, notice: 'Match requirement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = @match.comments.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to match_url(@match) }\n format.json { head :no_content }\n end\n end", "def destroy\n match_day_team = MatchDayTeam.find(params[:id])\n match_day_team.destroy\n head 204\n end", "def destroy\n @deck_matchup.destroy\n respond_to do |format|\n format.html { redirect_to deck_matchups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to replays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capture = Capture.find(params[:id])\n @capture.destroy\n\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n Matching.all.where(user_id: current_user.id).each do |match|\n match.destroy\n end\n\n @user.destroy\n #delete their schedule and matches eventually\n \n respond_to do |format|\n format.html { redirect_to logout_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n #this will invoke create.js.erb (formmat.js)\n format.js \n format.html { redirect_to admin_matches_path, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @matchday.destroy\n respond_to do |format|\n format.html { redirect_to matchdays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end", "def 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 @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to(shots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_form_lineitem.destroy\n respond_to do |format|\n format.html { redirect_to match_form_lineitems_url, notice: 'Match form lineitem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "def destroy\n @capture.destroy\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n if current_user == @tournament.creator\n Match.all.find_all{|match| match.tournament==@tournament}.each do |match|\n match.destroy\n end\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url, notice: 'Tournament was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n flash.now[:error] = \"Desole, vous n'etes pas le createur du tournoi.\"\n end\n end", "def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to(replays_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\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!\n Recliner.delete(uri)\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end" ]
[ "0.7725601", "0.7725601", "0.7725601", "0.7714915", "0.7679225", "0.7675409", "0.75533676", "0.7499803", "0.7478338", "0.7476574", "0.7439347", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407539", "0.7407233", "0.7366712", "0.7347717", "0.72107416", "0.71879715", "0.7177457", "0.7166176", "0.7136457", "0.7119972", "0.70739496", "0.7053145", "0.70197374", "0.6985932", "0.6974145", "0.6955754", "0.69424564", "0.6934331", "0.69203115", "0.6853384", "0.68319494", "0.6813655", "0.6763845", "0.67611146", "0.67479074", "0.6720055", "0.67199147", "0.6692241", "0.6676418", "0.6627222", "0.6567149", "0.65665436", "0.65599954", "0.65453404", "0.6543301", "0.6515191", "0.651071", "0.64690465", "0.646381", "0.6459918", "0.64578396", "0.6367017", "0.63667655", "0.635142", "0.63501865", "0.6314185", "0.6312678", "0.6302455", "0.6299355", "0.62796164", "0.626543", "0.62646943", "0.6253581", "0.62395", "0.62395", "0.62395", "0.62395", "0.62385607", "0.62260854", "0.621389", "0.621245", "0.621245", "0.621245", "0.621245", "0.6207269", "0.62008446", "0.61917955", "0.61791736", "0.6173532", "0.6168584", "0.61646545", "0.6164537", "0.61640465", "0.6158723", "0.6146632", "0.6144621", "0.61386913", "0.61358047", "0.6134079" ]
0.64375997
62
Use callbacks to share common setup or constraints between actions.
def set_match @match = Match.find(params[:id]) @host = false if current_user and current_user.id == @match.player1_id @host = true end 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 match_params params.require(:match).permit(:start, :duration_hours, :duration_days, :court, :desc, :match_type, :pid, :country, :postcode, :after) 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
Adds connection to registry.
def add(channel_name, stream_name, connection) @mutex.synchronize do subscribers[channel_name][stream_name].push(connection) connection end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(name, connection)\n @connections.store(name, connection)\n end", "def add_connection(connection)\n self.connections[connection.id] = connection\n end", "def connection(name, params = {})\n Celluloid::Logger.info \"Registering connection '#{name}'...\"\n self.connection_types << {:name => name}.merge(params)\n end", "def add_connection(resource, connection)\n @data['powerConnections'] << {\n 'connectionUri' => resource['uri'],\n 'deviceConnection' => connection,\n 'sourceConnection' => connection\n }\n end", "def put_connection(conn)\n conn.close if !active?\n @connections.offer(conn)\n end", "def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result.error}\"\n connection.terminate\n false\n end\n end", "def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result ? e.result.error : '<No Response!>'}\"\n connection.terminate\n false\n end\n end", "def add_replication conn\n if @schedule.has_key? conn.name\n return\n else\n @schedule[conn.name] = conn\n\n if !@active\n @active = true\n EM::add_timer(@interval) { run_replications }\n end\n end\n end", "def connect\n @connection.create\n end", "def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end", "def register_tunnel_connection(connection)\n @tunnel_connections[connection.connection_id] = connection\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection] ||= Set.new\n @tunnel_connections_by_control[control_connection] << connection\n end", "def checkin_connection(conn)\n @available_connections << conn\n conn\n end", "def add(connection, config)\n config[:name] ||= \"#{@role}/#{@connections.length + 1}\"\n\n wrapper = Makara::ConnectionWrapper.new(connection, @proxy, config)\n wrapper._makara_weight.times{ @connections << wrapper }\n\n if should_shuffle?\n @connections.shuffle!\n @current_idx = rand(@connections.length)\n end\n\n wrapper\n end", "def register(connection = nil)\n client_id = SecureRandom.uuid\n @clients[\"#{client_id}\"] = connection\n client_id.to_s\n end", "def create_connection(name, connection)\n repo.add(name, connection)\n write \"Loaded a new round called #{name}.\"\n save!\n end", "def add_to_pool\n return if closed? || outdated?\n conn_id = [@address, @port, @use_ssl,\n proxy_address, proxy_port, proxy_user]\n\n POOL_MUTEX[conn_id].synchronize do\n CONN_POOL[conn_id] << self\n end\n end", "def add_connection(uri) #:nodoc:\n publisher = SlaveProxy.new(@caller_id, uri)\n begin\n protocol, host, port = publisher.request_topic(@topic_name, [[\"TCPROS\"]])\n if protocol == \"TCPROS\"\n connection = TCPROS::Client.new(host, port, @caller_id, @topic_name, @topic_type, uri, @tcp_no_delay)\n connection.start\n else\n puts \"not support protocol: #{protocol}\"\n raise \"not support protocol: #{protocol}\"\n end\n connection.id = \"#{@topic_name}_in_#{@connection_id_number}\"\n @connection_id_number += 1\n @connections.push(connection)\n return connection\n rescue\n#\tputs \"request to #{uri} fail\"\n return false\n end\n end", "def push_connection(conn_key, spec, th = nil)\n conns = tconf(th).connections\n n_conn = new_conn(conn_key, spec)\n conns.push(n_conn)\n tconf(th).stack_size += 1\n conns.last\n end", "def add_connection(pin, wire)\n @jcell.add_wire_conn(pin, wire.name)\n end", "def open_connection\n # DataObjects::Connection.new(uri) will give you back the right\n # driver based on the DataObjects::URI#scheme\n connection = connection_stack.last || DataObjects::Connection.new(normalized_uri)\n connection_stack << connection\n connection\n end", "def on_connect(client_id, ip_address)\n @client_manager.add(client_id, ip_address)\n end", "def connect\n @connection_manager.connect\n end", "def add_switch(hostname, descr, community)\n db_cached_connect\n\n retvalue = nil\n\n begin\n modify_switch(nil, hostname, descr, community)\n rescue DBI::ProgrammingError => e\n if e.message[/Key .* already exists/]\n STDERR.puts \"This switch (#{hostname}) already exists, not adding.\"\n else\n raise e\n end\n end\n\n return retvalue\n end", "def <<(connection)\n @config ||= connection.config\n @streams[connection.class.to_s] << connection\n end", "def add(user, connection)\n found = find(user.id)\n\n if found.nil?\n @users.push({ :user => user, :connections => [connection] })\n else\n @users[found[:index]][:connections].push connection\n end\n\n @chat.root_room.shout Chat::Message.system(\"#{user.name} connected to #{connection.room.identifier}\", user).to_json\n end", "def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @ownedMember << s # ownedElement?!?!\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end", "def add_connector(connector)\n @connectors[connector.name] = connector\n self\n end", "def push(conn)\n # No need to cache if the connection has already been closed.\n return if closed?(conn)\n\n connections.synchronize do\n connections.push([Time.now + idle_timeout, conn])\n end\n end", "def new_connection; end", "def accept_new_connection\n new_socket = @host.accept\n @connections << new_socket\n new_socket.write(\"Write QUIT to disconnect\\n\")\n end", "def connect\n @connection_pool.get_connection\n end", "def register\n @is_registered = true\n self\n end", "def add_connection(location)\n raise 'Error: input arguement to method add_connection' unless location.is_a? Location\n @neighbors << location\n end", "def add_host(hostname, port=nil)\n hostname, port = normalize_address(hostname, port)\n promise = nil\n @lock.synchronize do\n _, _, promise = @hosts.find { |h, p, _| h == hostname && p == port }\n if promise\n return promise.future\n else\n promise = Promise.new\n @hosts << [hostname, port, promise]\n end\n end\n if @io_reactor.running?\n promise.observe(connect(hostname, port))\n end\n promise.future.map(self)\n end", "def connect_using conn\n @connection = conn\n end", "def connect\n # Implement in subclass\n end", "def connect\n return if connected?\n self.adapters.each{|adapter| adapter.connect }\n self.connected = true\n end", "def use_connection(conn_key, spec, th = nil)\n # remove connection first\n de_conn(th)\n\n conns = tconf(th).connections\n n_conn = new_conn(conn_key, spec)\n conns.unshift(n_conn)\n n_conn\n end", "def connect\n raise NotImplementedError, \"#connect should be overridden by adapters\"\n end", "def connect\n raise NotImplementedError, \"#connect should be overriden by adapters\"\n end", "def action_connect\n if current_resource.exists? && current_resource.connected?\n Chef::Log.debug(\"#{new_resource} already connected - skipping\")\n else\n converge_by(\"Connect #{new_resource}\") do\n executor.execute!('connect-node', escape(new_resource.slave_name))\n end\n end\n end", "def connect\n @connection.open\n end", "def register_connection_router(router_name, router_class)\n connection_routers[router_name] = router_class\n end", "def add(host, key); end", "def connect!\n payload = {}\n user.options.active.each do |option|\n hook = option.hook(@user)\n payload[option.code] = hook ? hook.connect : {}\n end\n user.connects.create!(server_id: server.id, option_attributes: payload)\n end", "def connect!\n sessions\n self\n end", "def register(*args)\n registry.register(*args)\n end", "def checkin_connection(conn)\n @queue.push(conn)\n conn\n end", "def add client_id, socket\n @clients[client_id] = socket\n end", "def on_registration(connection)\n end", "def new_connection(handler)\n return unless Config.metrics\n unless handler.application.nil?\n # Get peer's IP and port\n peer = handler.peer_ip_port()\n # Update record\n work_data.update(\n {app_id: handler.application.app_id},\n {'$addToSet' => {connections: {slanger_id: Cluster.node_id, peer: peer}}, '$set' => {timestamp: Time.now.to_i}},\n {upsert: true}\n )\n end\n end", "def connect(*) end", "def connect\n @redis ||= create\n end", "def save_ssh_connection(conn)\n conn.exec! 'cd ~'\n @lock.synchronize do\n @connection_pool << conn\n end\n rescue\n output \"Discarding nonfunctional SSH connection\"\n end", "def checkin(conn)\n synchronize do\n release conn\n @available.add conn\n end\n end", "def connect\n @client = Redis.new(host: @host, port: @port)\n @logger.info(\"Connecting to database #{@host}:#{@port}\")\n end", "def on_connect(&block)\n raise IrcError.new('wrong arity') if block.arity != 4\n self[:connect] << block\n end", "def connect!; end", "def connect!; end", "def register\n ring_server.write [:name, @service, DRbObject.new(@object), @identifier],\n @renewer\n return nil\n end", "def connect\n super\n end", "def connect\n super\n end", "def connect\n @connector.connect\n @p.set_connection @connector\n end", "def register(client); end", "def establish_connection\n end", "def connect_socket\n @irc = Net::YAIL.new(\n :address => @servers[@nextserver],\n :port => @port,\n :username => @nick,\n :realname => @realname,\n :nicknames => @nicks,\n :silent => false,\n :loud => false\n )\n\n # Simple hook for welcome to allow auto-joining of the channel\n EVENTS.each do |event|\n @irc.prepend_handler(event.to_sym,\n self.method((\"handle_\" + event).to_sym))\n end\n end", "def connect!\n end", "def enotify_connect\n begin\n print \"=== Connecting to emacs... \".cyan\n @sock = TCPSocket.new(@enotify_host, @enotify_port)\n enotify_register\n puts \"Success!\".green\n rescue SocketError, Errno::ECONNREFUSED => e\n puts \"Failed!\".red\n rescue_sock_error\n end\n end", "def direct_connect\n debug \"Connection will be established via direct connection #{host}:#{port}\"\n connection = build_connection(host, port, queue)\n if(register(connection))\n info \"Registered new connection #{connection}\"\n distribution.redistribute!\n else\n abort Error::ConnectionFailure.new(\"Failed to establish subscription at provided end point (#{host}:#{port}\")\n end\n connection\n end", "def register(data)\n unless @registered\n @user = Hashie::Mash.new(data)\n @user.event_machine_connection_id = @connection.id\n @user.event_machine_connection = self\n puts \"uuid: #{@user.uuid}\"\n puts \"first_name: #{@user.first_name}\"\n puts \"last_name: #{@user.last_name}\"\n puts \"software_key: #{@user.auth_key}\"\n puts \"type: #{@user.type}\"\n puts \"identifier (em): #{@user.event_machine_connection_id.to_s}\"\n \n # store user in global hash - (this could also be in mongodb,mysql,redis,etc)\n $connections.store(@user.uuid,@user)\n puts $connections.inspect\n \n unless !$connections.has_key? @user.uuid\n puts \"user is registered and in $connections hash\"\n @registered = true\n $ws_notifier.call(\"#{@user.uuid} just registered on the server\",\"connection\")\n else\n puts \"epic fail. shutting down now\"\n end\n else\n puts \"user is already registered. ignoring re-registration\"\n end\n \n end", "def connect; end", "def connect\n end", "def add_host(name, port = nil)\n raise \"Host '#{name}' already configured\" if hosts[name]\n hosts[name] = { port: port, databases: {} }\n @saved = false\n end", "def connect(name, args = nil, &block)\n raise \"Connection '#{name.inspect}' is already registered\" if @clients[name]\n\n if !args.nil? && !args[:type].nil?\n Qswarm.logger.info \"[#{@name.inspect}] Registering #{args[:type].inspect} connection #{name.inspect}\"\n require \"qswarm/connections/#{args[:type].downcase}\"\n @clients[name] = eval(\"Qswarm::Connections::#{args[:type].capitalize}\").new(self, name, args, &block)\n else\n Qswarm.logger.info \"[#{@name.inspect}] Registering default connection #{name.inspect}\"\n @clients[name] = Qswarm::Connection.new(self, name, args, &block)\n end\n end", "def connect\n start_listener!\n end", "def connection\n @connection.connect\n end", "def connect\n Connection.new\n end", "def add_channel( channel )\n\t\tserver = @servers[channel.server_name]\n\t\t@channels[channel.name] = channel\n\t\tserver.add_channel( channel )\n\t\tshift_server_pos( server.number, 1 )\n\t\t@length += 1\n\tend", "def connection=(val)\n @@connection = val\n end", "def register_client(game_id, player, hostname, port)\n game = @game_list[game_id]\n game.proxy = RClient.new(hostname, port, 'hosteventproxy')\n\n game.game_state.on_change.listen {\n Thread.new {\n game.proxy.on_change_fire\n }\n }\n\n game.connect_game.on_win.listen { |winner|\n if (winner == player)\n game.proxy.on_win_fire\n end\n }\n ''\n end", "def connect\n connection.tap do |c|\n c.start\n end\n end", "def register\n raw \"PASS #{@config[:password]}\" if @config.key? :password\n raw \"CAP LS\" if defined? MODULE_LOADED_CLIENT_CAPABILITIES\n\n raw \"NICK #{@nick}\"\n raw \"USER #{@user} 0 0 :#{@realname}\"\n end", "def register\n end", "def add(name)\n self.class.add(name, @jira_key)\n end", "def checkout_new_connection\n c = new_connection\n @connections << c\n checkout_and_verify(c)\n end", "def add(adapter)\n adapters << adapter\n end", "def add_server( host, port )\n raise ArgumentError.new(\"Server is in the pool already\") if server_in_pool?( host, port)\n free_slot = get_server( '0.0.0.0', 0 )\n Penctl.update_server( @pen, free_slot[:slot], :address => host, :port => port)\n server_in_pool? host, port\n end", "def process_create_connection(connection_id)\n if @connections[connection_id]\n E \"asked to create already open connection #{connection_id}\"\n return\n end\n \n D \"Tunnel #{connection_id} to #{@tunnel_to_host} port #{@tunnel_to_port}\"\n connection = EventMachine.connect(@tunnel_to_host, @tunnel_to_port,\n Client::TunnelConnection, connection_id, @client)\n @connections[connection_id] = connection\n end", "def connect\n connection.connect\n nil\n end", "def add_node(node = {})\n @nodes.push Bark::Client.new node\n end", "def after_connect\n redis_connect\n set_adapters\n set_callbacks\n end", "def register(...)\n container.register(...)\n end", "def connect(name)\n conf = lookup_config(name)\n synchronize do\n clients[name] ||= []\n if clients[name].first.nil?\n clients[name] << new_redis_client(conf)\n end\n end\n clients[name].first\n end", "def add_socket(sock)\n self.sockets << sock\n end", "def join(c)\n connections << c\n end", "def connection\n @connection = create_connection! unless connected?\n @connection\n end", "def register(name, type)\n registry[name] = type\n end", "def configure_connection\n end", "def add_client(client) # add client object\n @clients[client.name] = client\n end", "def register_for(id); end" ]
[ "0.73868203", "0.7200651", "0.641041", "0.64012283", "0.62663186", "0.618856", "0.6158942", "0.6058691", "0.60495335", "0.60487205", "0.60311264", "0.5960618", "0.5952973", "0.5943147", "0.5921314", "0.57941055", "0.5726427", "0.56905174", "0.5681155", "0.5628591", "0.5610981", "0.5593566", "0.5588838", "0.5582", "0.5569826", "0.55673987", "0.55598545", "0.55504125", "0.5541376", "0.548453", "0.54762334", "0.54599506", "0.5455592", "0.5448646", "0.5425917", "0.5400144", "0.5397604", "0.53937185", "0.5383393", "0.538187", "0.53754896", "0.53621787", "0.5355573", "0.5347144", "0.5343611", "0.5335182", "0.53175527", "0.5309439", "0.5304526", "0.52961165", "0.5276554", "0.52654356", "0.5259573", "0.5253577", "0.52489805", "0.524386", "0.52389455", "0.5231661", "0.5231661", "0.5222311", "0.5220796", "0.5220796", "0.5206388", "0.5202764", "0.5193367", "0.5188588", "0.5169798", "0.5168085", "0.5163314", "0.5160036", "0.515152", "0.51512164", "0.5144989", "0.5140008", "0.5135915", "0.5134433", "0.5133726", "0.5131955", "0.51269794", "0.51265204", "0.5080437", "0.50727016", "0.50598526", "0.5058958", "0.5054561", "0.5050162", "0.50493", "0.50485", "0.5046845", "0.5042485", "0.5041137", "0.5037047", "0.50369525", "0.50367254", "0.50303954", "0.5021231", "0.50148827", "0.5013568", "0.50135595", "0.50120044" ]
0.6054567
8
Removes connection from registry.
def remove(channel_name, stream_name, connection) @mutex.synchronize do subscribers[channel_name][stream_name].delete(connection) subscribers[channel_name].delete(stream_name) if subscribers[channel_name][stream_name].empty? connection end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_and_close(connection)\n @connections.delete(connection)\n close_connection(connection)\n end", "def remove_connection(connection)\n self.connections.delete(connection.id)\n end", "def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registered\n self.unregister(@user.uuid)\n $ws_notifier.call(\"#{@user.uuid} just left the server\",\"disconnection\")\n else\n puts \"Never registered. So don't try to kill connection data\"\n end\n rescue\n puts \"Error (unbind). Couldn't delete from hash\"\n end\n puts \"Person is no longer connected\"\n end", "def remove(conn)\n @connections.delete conn\n @available.delete conn\n\n release conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end", "def remove(connection)\n @mutex.synchronize do\n @connections.delete(connection)\n @checked_out.delete(connection)\n @condition.signal\n end\n close_connection(connection)\n @logger.debug {\"#{@name}: Removed connection #{connection}(#{connection.object_id}) self=#{self}\"}\n end", "def unbind\n puts \"Connection terminated #{@my_connection_index}) #{@my_address} - #{@signature}\"\n\n pp self.inspect if error?\n\n # TODO: Remove connection from $connection_list\n end", "def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end", "def remove(conn)\n synchronize do\n @connections.delete conn\n @available.delete conn\n\n release conn, conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end\n end", "def with_connection_auto_remove\n with_connection do |connection|\n begin\n yield connection\n rescue Exception\n remove(connection)\n raise\n end\n end\n end", "def delete(name)\n @connections.delete(name)\n end", "def del\n connection.del(key_label)\n end", "def disconnect!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections = []\n @available.clear\n end", "def disconnect\n @connection.close if connected?\n @connection = nil\n end", "def remove_connection(resource, connection)\n @data['powerConnections'].reject! do |conn|\n conn['connectionUri'] == resource['uri'] && conn['deviceConnection'] == connection\n end\n end", "def shutdown\n @registry.clear\n end", "def unregister(uuid)\n if $connections.has_key? (@user.uuid)\n $connections.delete(@user.uuid)\n end\n end", "def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end", "def disconnect!() @connections.each_value(&:disconnect) end", "def clear\n @registry.keys.each { |id| close(id) }\n end", "def remove! identifier\n connect do |connection|\n connection.remove( identifier )\n end\n end", "def delete_active_connection\n super\n end", "def pop\n connections.synchronize do\n evict\n _, connection = connections.pop\n connection\n end\n end", "def disconnect\r\n @connection.close_connection\r\n @connection = nil\r\n end", "def unsubscribe\n redis.unsubscribe\n end", "def deregister_tunnel_connection(connection)\n @tunnel_connections.delete connection.connection_id\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection].delete connection\n end", "def disconnect; @connection.close end", "def unbind\n #@node.notifiers.unsubscribe(@notify_sid) if @notify_sid\n @node.command_connections.delete(self)\n end", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections.clear\n @available.clear\n end\n end", "def disconnect\n _logout\n @connection.close\n end", "def disconnect\n database.close if connected?\n @@connections[name][db_name] = nil\n end", "def disconnect\n @connection.logout\n end", "def reset_connection!\n @connection = nil\n end", "def disconnect!\n clear_cache!(new_connection: true)\n reset_transaction\n @raw_connection_dirty = false\n end", "def destroy\n connection.close\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def release_connection\n conn = @reserved_connections.delete(current_connection_id)\n checkin conn if conn\n end", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n $DEBUG && warn(\"Closing pg connection: #{conn.object_id}\")\n conn.close\n end\n @connections = []\n @available.clear\n end\n end", "def disconnect!\n @connection.logoff rescue nil\n end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def disconnect_connection(conn)\n sync{@size[0] -= 1}\n super\n end", "def client_quit(socket)\n @connections.delete(socket)\n socket.close\n end", "def disconnect()\r\n @callbacks.each { |block| block.call }.clear()\r\n @conn.close if @conn\r\n @conn = nil\r\n end", "def disconnect(signal=nil, endpoint=nil)\n purge_connections(connections, signal, endpoint)\n end", "def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end", "def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect(key=nil)\n logger.debug \"RedisUtil::Factory.disconnect start\"\n synchronize do\n clients.clone.each do |name, client|\n next if key && name != key\n \n connections = clients.delete(name) || []\n connections.each do |connection|\n begin\n logger.debug \"Disconnecting Redis client: #{connection}\"\n connection.quit\n rescue => e\n logger.warn(\"Exception while disconnecting: #{e}\")\n end\n end\n end\n end\n logger.debug \"RedisUtil::Factory.disconnect complete\"\n nil\n end", "def rm_port_connection(port)\n @jcell.remove_port_conn(port)\n end", "def unregister(path)\n\t\t\t\tpath = path.to_sym\n\t\t\t\tif @@registry[path]\n\t\t\t\t\t@@registry_count[path] -= 1\n\t\t\t\t\tif @@registry_count[path] <= 0\n\t\t\t\t\t\tsub = @@registry.delete(path)\n\t\t\t\t\t\tsub.unsubscribe\n\t\t\t\t\t\t@@registry_count.delete(path)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def clear\n @registry.clear\n self\n end", "def disconnect_from nick\n c = @connection_cache.delete nick\n c.try :close_connection_after_writing\n end", "def unbind\n @logger.trace 'Connection closed'\n self\n end", "def unbind\n log.info { (outgoing? && !@connection_completed) ? \"Connection failed\" : \"Disconnected\" }\n @node.push_notification(:connection, {type: :disconnected, host: @host, port: @port})\n @state = :disconnected\n @node.connections.delete(self)\n end", "def destroy_connection\r\n\tbegin\r\n\t\[email protected] if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end", "def remove_connection\n flash[:notice] = I18n.t(:remove_social_connection)\n\t Authentication.remove_conn(current_gamer.id, params[:provider])\n\t redirect_to \"/gamers/edit\"\n\tend", "def close()\n\t\[email protected]\n\t\t@connection = nil\n\tend", "def disconnect\n info 'closing connection to host'\n @connected = false\n end", "def disconnect\n disconnect_all\n end", "def destroy\n conn.delete(self_link)\n end", "def disconnect\n @thread.exit\n @client.disconnect\n @channels.clear\n end", "def unplug!\n return self unless exist?\n ole.Delete\n self\n end", "def clear_reloadable_connections!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect! if conn.requires_reloading?\n end\n @connections.delete_if do |conn|\n conn.requires_reloading?\n end\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end", "def unsubscribe\n unregister\n end", "def unregister\n @is_registered = false\n self\n end", "def clear\n @redis.del @name\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def cleanup_connection!\n Models::JanusInstance.destroys\n end", "def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end", "def clear_reloadable_connections!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n end\n\n @connections.delete_if(&:finished?)\n\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end\n end", "def disconnect!\n @connection.close rescue nil\n end", "def disconnect\n if threaded[:connection]\n threaded[:connection].disconnect\n threaded[:connection] = nil\n end\n end", "def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end", "def on_shutdown\n logger.debug \"Disconnecting user: #{@user} from channel: #{@channel}.\"\n @@connections[@channel].delete(@user)\n end", "def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end", "def remove_connection(owner)\n self.clear_cache\n # Don't return a ConnectionSpecification hash since we've disabled establish_connection anyway\n return nil\n end", "def remove_registration\n reg = Iq.new_register\n reg.to = jid.domain\n reg.query.add(REXML::Element.new('remove'))\n send_with_id(reg)\n end", "def clear\n @registry = {}\n end", "def disconnect\n connection { |conn| conn.disconnect }\n true\n end", "def disconnect!\n super\n @connection.close rescue nil\n end", "def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end", "def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end", "def reset_connection!\n @@socket = nil\n end", "def clear_reloadable_connections!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect! if conn.requires_reloading?\n end\n @connections.delete_if do |conn|\n conn.requires_reloading?\n end\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end\n end", "def close(id)\n entry = @registry.delete(id)\n return unless entry\n begin\n $rhevm_log.info(\"Closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}'.\")\n entry.connection.close\n rescue OvirtSDK4::Error => error\n $rhevm_log.warn(\n \"Error while closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}', \" \\\n \"backtrace follows.\"\n )\n $rhevm_log.warn(error.message)\n error.backtrace.each do |line|\n $rhevm_log.warn(line)\n end\n end\n end", "def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end", "def cleanup\n super\n disconnect\n end", "def clear_registry(reg_, opts_={}, &condition_)\n @tasks << RegistryMiddleware::ClearRegistry.new(reg_, opts_, &condition_)\n self\n end", "def disconnect!\n disconnect\n end", "def clear_reloadable_connections!\n if @@allow_concurrency\n # With concurrent connections @@active_connections is\n # a hash keyed by thread id.\n @@active_connections.each do |thread_id, conns|\n conns.each do |name, conn|\n if conn.requires_reloading?\n conn.disconnect!\n @@active_connections[thread_id].delete(name)\n end\n end\n end\n else\n @@active_connections.each do |name, conn|\n if conn.requires_reloading?\n conn.disconnect!\n @@active_connections.delete(name)\n end\n end\n end\n end", "def disconnect_connection(conn)\n sync{@connection_timestamps.delete(conn)}\n super\n end", "def cleanup\n begin\n File.unlink(File.join(Restore::Config.socket_dir, 'restore_backend.sock'))\n rescue => e\n BackgrounDRb::ServerLogger.log_exception('server', e)\n end\n end", "def shutdown\n @connection_manager.shutdown if @connection_manager\n @client = nil\n @connection_manager = nil\n end", "def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end", "def unconnect(args)\n raise ArgumentError, \"No object given.\" if !args[\"object\"]\n object = args[\"object\"].to_sym\n raise ArgumentError, \"Object doesnt exist: '#{object}'.\" if [email protected]?(object)\n\n if args[\"conn_id\"]\n conn_ids = [args[\"conn_id\"]]\n elsif args[\"conn_ids\"]\n conn_ids = args[\"conn_ids\"]\n else\n raise ArgumentError, \"Could not figure out connection IDs.\"\n end\n\n conn_ids.each do |conn_id|\n raise Errno::ENOENT, \"Conn ID doest exist: '#{conn_id}' (#{args}).\" if !@callbacks[object].key?(conn_id)\n @callbacks[object].delete(conn_id)\n end\n end", "def close\n redis.disconnect!\n end", "def del_reg(id)\n _registers.delete(id)\n end", "def disconnect\n @socket.close\n end", "def delete_all_connections!\n @connections.each { |cnx| cnx.parent = nil }\n @connections = []\n end" ]
[ "0.7282421", "0.68719095", "0.6791724", "0.6747273", "0.6622707", "0.6603567", "0.65898085", "0.65682554", "0.65450084", "0.653657", "0.6466049", "0.6461736", "0.64568275", "0.64500415", "0.6425565", "0.641191", "0.6401252", "0.63956743", "0.636758", "0.63664097", "0.6335865", "0.6319349", "0.62997854", "0.6220281", "0.6216108", "0.6207545", "0.62006253", "0.6195108", "0.61887395", "0.6173347", "0.6166004", "0.61544204", "0.6132789", "0.6126493", "0.6117678", "0.6114723", "0.60962445", "0.6082616", "0.6068924", "0.6034013", "0.60292405", "0.60135245", "0.6011524", "0.6002316", "0.59884727", "0.59865046", "0.59865046", "0.59865046", "0.59865046", "0.598265", "0.59389114", "0.59054464", "0.59042025", "0.5884023", "0.5883469", "0.5883408", "0.5880343", "0.5876137", "0.5874308", "0.5872104", "0.5864291", "0.58621544", "0.5859531", "0.58560264", "0.58536744", "0.58473116", "0.58359945", "0.5829952", "0.58271194", "0.5813044", "0.5806778", "0.5801126", "0.5800195", "0.57946825", "0.5791047", "0.5789902", "0.578247", "0.57693833", "0.57630444", "0.5761303", "0.5755066", "0.5743505", "0.5729984", "0.57274866", "0.5725698", "0.572472", "0.57138443", "0.57107425", "0.57071275", "0.5700842", "0.5686392", "0.5677131", "0.5673877", "0.56693375", "0.56671107", "0.5664763", "0.5663071", "0.5655026", "0.5654481", "0.56542796", "0.5647401" ]
0.0
-1
Return all connections from all channels when `channel_name` omitted. Return all connections from channel when `stream_name` omitted. Return connections from channel stream when `channel_name` and `stream_name` provided.
def find(channel_name = nil, stream_name = nil) @mutex.synchronize do return subscribers.values.map(&:values).flatten if channel_name.nil? return subscribers[channel_name].values.flatten if stream_name.nil? subscribers[channel_name][stream_name] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channels\r\n return for_context(nil, false) { |c| c.channels }\r\n end", "def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end", "def applicable_channels\n if @channel_group == :_none_\n # it's a single channel\n [@channel]\n else\n @config.channels_by_group(@channel_group)\n end\n end", "def list_all_channels(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'listAllChannles')\n return get(uri)\n end", "def channels\n []\n end", "def list_all_channels(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'listAllChannels')\n return get(uri)\n end", "def getOnlineChannels(channelData)\n\tresult = []\n\tchannelData['streams'].each do |stream|\n\t\tresult << makeChannelString(outputFormat(), stream)\n\tend\n\tresult\nend", "def channels(users)\n if users.respond_to? :each\n users.map { |user| channel(user) }.compact\n else\n [channel(users)]\n end\n end", "def search_channel\n channel = Channel.where(name: params[:name])\n channel.empty? ? Channel.all : channel\n end", "def real_channels\n results = []\n next_token = ''\n loop do\n resp = sns.list_topics((next_token.empty? ? {} : { next_token: next_token }))\n results.concat(resp.topics.map(&:topic_arn))\n next_token = (resp.next_token.empty? ? '' : resp.next_token)\n break if next_token.empty?\n end\n results\n end", "def channels_list\n get \"channels\"\n end", "def channels(params = {page:1})\n http.get('/channels', params)\n end", "def channels\n build :channels, :using => data_for(:channels)\n end", "def channels\r\n return @chanlist\r\n end", "def get_all_channels\n user_id = current_user.id\n user_channels=Chatbox.uniq.where(:user_id => user_id).pluck(:channel)\n return user_channels \n end", "def channels\n @format.channels\n end", "def channels_for(user, app_name)\n channels = []\n if user.present?\n channels += [private_channels_for(user, app_name)]\n channels << REVIEWER_CHANNEL if user.reviewer? and app_name == ADMIN_APP\n channels << SUPERVISOR_CHANNEL if user.supervisor? and app_name == ADMIN_APP\n channels << ORDER_FULFILMENT_CHANNEL if user.order_fulfilment? and app_name == STOCK_APP\n channels << STOCK_CHANNEL if app_name == STOCK_APP\n end\n channels << BROWSE_CHANNEL if app_name == BROWSE_APP\n channels.flatten.compact.uniq\n end", "def list_channels(opts={})\n response = @connection.request('channels.list', opts)\n end", "def channels(*params)\n puts \"Channels:\"\n\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? ' (muted)' : ''}\"\n end\n end", "def channels(*params)\n puts \"Channels:\"\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? \" (muted)\" : \"\"}\"\n end\n end", "def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end", "def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end", "def channels\n @channel_map.values\n end", "def all_connections\n yield @conn.first if @conn\n end", "def all_connections\n hold do |conn|\n yield conn\n\n # Use a hash to record all connections already seen. As soon as we\n # come across a connection we've already seen, we stop the loop.\n conns = {}\n conns.compare_by_identity\n while true\n conn = nil\n begin\n break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]\n conns[conn] = true\n yield conn\n ensure\n @queue.push(conn) if conn\n end\n end\n end\n end", "def get_related_channels(query='', results=10, start=0)\r\n get_related('Channels',query, results, start)\r\n end", "def channels\n self.class::CHANNELS\n end", "def init_stream_names\n streams = []\n\n has_more_streams = true\n\n while has_more_streams do\n response = @@client.list_streams({\n exclusive_start_stream_name: streams.last\n })\n\n streams.concat(response.stream_names)\n has_more_streams = response.has_more_streams\n end\n\n streams\n end", "def subscribed_channels\n @channels\n end", "def get_subscribed_channels\n @channels\n end", "def list_resources\n 'channels'\n end", "def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end", "def channels(status = false)\n if status == false\n @channels\n elsif status.nil?\n @statuses.select { |_, s| s.nil? }.map(&:first)\n else\n @statuses.select { |_, s| status.to_sym == s }.map(&:first)\n end\n end", "def subscribed\n stream_from channel_name\n end", "def subscriptions\n @channels\n end", "def find_channel(channel_name, server_name = nil, type: nil)\n results = []\n\n if /<#(?<id>\\d+)>?/ =~ channel_name\n # Check for channel mentions separately\n return [channel(id)]\n end\n\n @servers.each_value do |server|\n server.channels.each do |channel|\n results << channel if channel.name == channel_name && (server_name || server.name) == server.name && (!type || (channel.type == type))\n end\n end\n\n results\n end", "def channels_from names\n names.map{|x| Wires::Channel[x]}\n end", "def get_channels(opts = {})\n data, _status_code, _headers = get_channels_with_http_info(opts)\n data\n end", "def streams\n ::M2X::Client::Stream.list(@client, self)\n end", "def check_all(channels)\n channels.select { |channel| online?(channel) }\n end", "def get_connections(queue)\n @connections.select { |con| con.src.label == queue.label }\n end", "def filter_for_channel(messages)\n uniques = messages.uniq { |x| x[1] }\n\n uniques.count == 1 ? uniques : uniques.select { |x| x[1] }\n end", "def connections\n connections = []\n self.requests.each do |request|\n if request.status == \"accepted\"\n if request.post.author == self\n connections << request.messenger\n else\n connections << request.post.author\n end\n end\n end\n connections\n end", "def each(&block)\n return @channels.keys.each(&block)\n end", "def stream_names\n @stream_names ||= init_stream_names\n end", "def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\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 connections\n return @connectors.keys\n end", "def each\n @mutex.synchronize do\n # Don't include the ones in a reserved_placeholder state because that object is meaningless\n @connections.each { |connection| yield connection unless connection.kind_of?(Thread) }\n end\n end", "def channels; 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 listchannels(**args)\n stub.list_channels(\n Lnrpc::ListChannelsRequest.new(\n active_only: args[:active_only], inactive_only: args[:inactive_only],\n public_only: args[:public_only], private_only: args[:private_only]\n )\n )\n end", "def each_controlchannel\n Array[*shared[:controlchannel]].each {|channel| \n chan, key = channel.split(' ')\n c = Channel(chan)\n c.join(key) if [email protected]?(chan)\n yield c\n }\n end", "def all\n repo.connections.each do |name, connection|\n write \"#{name} : #{connection}\"\n end\n end", "def connections\n @mutex.synchronize do\n @connections.values.inject(0, &:+)\n end\n end", "def list_channels(workspace)\n puts \"\\nChannel List\\n\\n\"\n tp workspace.channels, \"id\", \"name\", \"topic\", \"member_count\"\nend", "def public_channel\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_public_channels\n end", "def connections\n @connections ||= []\n end", "def subscribe(*channels, &block); end", "def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end", "def connections(\n strategy: nil,\n name: nil,\n fields: nil,\n include_fields: nil,\n page: nil,\n per_page: nil,\n include_totals: nil\n )\n include_fields = true if !fields.nil? && include_fields.nil?\n request_params = {\n strategy: strategy,\n name: name,\n fields: fields.is_a?(Array) ? fields.join(',') : fields,\n include_fields: include_fields,\n page: !page.nil? ? page.to_i : nil,\n per_page: !page.nil? && !per_page.nil? ? per_page.to_i : nil,\n include_totals: include_totals\n }\n get(connections_path, request_params)\n end", "def connectors\n return @connectors\n end", "def connectors\n return @connectors\n end", "def each_channel(&block); end", "def get_channels_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChatChannelsApi.get_channels ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ChatChannelsApi.get_channels, must be smaller than or equal to 50.'\n end\n\n # resource path\n local_var_path = '/chat/users/me/channels'\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2007')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChatChannelsApi#get_channels\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def channels()\n return MicrosoftGraph::Me::JoinedTeams::Item::Channels::ChannelsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def get_connections\n @connected_to.keys\n end", "def get_channels\n\n\t\t#should return json of the first page of channels as a set of objects\n\t\ti = 1\n\t\tdone = false\n\t\tnew_channels = []\n\n\t\tuntil done do\n\t\t\t# get the first page of data, because we always need that\n\t\t\tcurrent_page = @salsify.get('channels', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:page => i,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:per_page => \"50\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\n\t\t\t#determine the total number of pages\n\t\t\ttotal_pages = @salsify.get_total_pages(current_page)\n\t\t\tputs \"we have #{total_pages} total pages to get through\"\n\n\t\t\t#store the channels on this page\n\t\t\tnew_channels += channels_to_objects(current_page)\n\t\t\tputs \"completed page #{i}\"\n\n\n\t\t\t# if we have no more pages to fetch, we're done!\n\t\t\tif(i >= total_pages)\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\ti += 1\n\t\tend\n\n\t\tnew_channels\n\n\tend", "def connections\n connections = @mutex.synchronize { connections = @connections.dup }\n connections.delete_if { |c| c.kind_of?(Thread) }\n connections.freeze\n connections\n end", "def batch_get_channel(body)\n # checks if all required parameters are set\n \n raise ArgumentError, 'Missing required parameter \"body\"' if body.nil?\n \n\n op = NovacastSDK::Client::Operation.new '/channels/batch_get', :POST\n\n # path parameters\n path_params = {}\n op.params = path_params\n\n # header parameters\n header_params = {}\n op.headers = header_params\n\n # query parameters\n query_params = {}\n op.query = query_params\n\n # http body (model)\n \n op.body = body.to_json\n \n\n \n # authentication requirement\n op.auths = [\n { name: 'accessKey', key: 'access_token', in_query: true }\n ]\n \n\n resp = call_api op\n\n \n NovacastSDK::EventV1::Models::ChannelList.from_json resp.body\n \n end", "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end", "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end", "def extract_connections!\n # Get the connections.\n cnxs = self.each_connection.to_a\n # Remove them from the scope.\n # cnxs.each { |cnx| self.delete_connection!(cnx) }\n # cnxs.delete_all_connections!\n self.delete_all_connections!\n # Return the connections.\n return cnxs\n end", "def [](channel_name)\r\n return @channels[channel_name.downcase]\r\n end", "def subscription_filter(ci, publishers)\n wildcards = ci[:component].subscribes.select { |connector| connector.type == \"ENV:*\" }\n raise \"Multiple wildcard subscriptions specified in component #{ci[:component].name}\" if wildcards.size > 1\n\n subscriptions = ci[:component].subscribes.map do |conn|\n new_conn = nil\n # Avoid copying ENV: connectors if wildcard subscription is found\n if not ( conn.name.start_with? \"ENV:\" and wildcards.any? )\n new_conn = OpenShift::Connector.new(conn.name)\n new_conn.from_descriptor(conn.to_descriptor)\n end\n new_conn\n end.compact\n\n # Add all published \"ENV:\" connections for subscriber with wildcard\n if wildcards.any?\n connector = wildcards[0]\n publishers.keys.each do |ptype|\n if ptype.start_with? \"ENV:\"\n new_conn = OpenShift::Connector.new(connector.name)\n new_conn.type = ptype\n new_conn.required = connector.required\n subscriptions << new_conn\n end\n end\n end\n subscriptions\n end", "def connections(relation_name, limit = 0)\n return Relation.get_connections(relation_name, self.node, limit)\n end", "def incoming_channels()\n return MicrosoftGraph::Me::JoinedTeams::Item::IncomingChannels::IncomingChannelsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def streams\n []\n end", "def channel?\n not query?\n end", "def each\n @uuids.each do |uuid|\n if !@connections[uuid].nil?\n yield @connections[uuid]\n end\n end\n end", "def channel_name\r\n return for_context(false) { |c| c.channel_name } \r\n end", "def channel_shops\n @_channel_shops ||= own_shop.descendant_entities.where.\n not(channel_id: nil).where.\n not(channel_id: id)\n end", "def index\n @slack_channels = SlackChannel.search_and_paginate(params)\n end", "def get_batch_connections_for_friends(connection_name, options = {})\n batch_facebook_request_on_friends do |batch_api, friend|\n batch_api.get_connections(friend['id'], connection_name, options)\n end\n end", "def grab_connections\n connections = []\n connections << @host\n end", "def index\n @admin_channels = Admin::Channel.where(\"parent_id IS NULL OR parent_id = 0\").page(params[:page])\n end", "def get_upstream_channels\r\n logger.debug \"Upstream1 Channels\"\r\n upstream_channels=UpstreamChannel.find(:all)\r\n logger.debug \"Upstream Channels2\"\r\n chlist=upstream_channels.collect {|ch| {:freq=>ch.freq, :bandwidth => ch.bandwidth, :name => ch.name}}\r\n logger.debug \"Upstream Channels3\"\r\n logger.debug upstream_channels.inspect()\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => chlist.to_x }\r\n format.amf { \r\n logger.debug \"Returning upstream_channels\"\r\n logger.debug \"Returning #{upstream_channels}\"\r\n render :amf => chlist\r\n }\r\n end\r\n end", "def list_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\r\n @channels = current_user.channels.all\r\n end", "def connections(token)\n request(\n __method__,\n :get,\n \"#{api_base}/users/@me/connections\",\n Authorization: token\n )\n end", "def external_datastreams\n datastreams.select { |name, ds| ds.external? }\n end", "def index\n @channels = Channel.where(:user_id => current_user.id).to_a\n end", "def index\n @channels = Channel.all\n end", "def index\n @channels = Channel.all\n end", "def list_user_communication_channels(user_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"user_id is required\" if user_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :user_id => user_id\n )\n\n # resource path\n path = path_replace(\"/v1/users/{user_id}/communication_channels\",\n :user_id => user_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(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|CommunicationChannel.new(response)}\n end", "def supported_connections\n ConnectionProvider.providers.select { |connection| connection.supported_by?(@handle) }\n end", "def connections_parse\n @data.each_key do |key|\n next unless @data[key].is_a?(Hash)\n next unless @data[key].include?('manageConnections')\n @data[key].each do |conn, value|\n next unless conn.include?('connections')\n network_parse(value)\n end\n end\nend", "def public_channel(ns)\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n get_client(ns).public_channel\n end", "def remove(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].delete(connection)\n subscribers[channel_name].delete(stream_name) if subscribers[channel_name][stream_name].empty?\n connection\n end\n end", "def describe_stream(stream_name)\n stream = @@client.describe_stream({\n stream_name: stream_name\n }).stream_description\n\n while stream.has_more_shards do\n stream_continued = @@client.describe_stream({\n stream_name: stream_name,\n exclusive_start_shard_id: stream.shards.last.shard_id\n }).stream_description\n\n stream.shards.concat(stream_continued.shards)\n stream.has_more_shards = stream_continued.has_more_shards\n end\n\n stream\n end" ]
[ "0.633454", "0.60956794", "0.59331185", "0.59165126", "0.58937556", "0.5835396", "0.5834562", "0.5637086", "0.560203", "0.5535989", "0.55326", "0.5522645", "0.5521402", "0.5517922", "0.5468858", "0.54467934", "0.54044443", "0.53646654", "0.53612685", "0.5339611", "0.5328954", "0.5328954", "0.53090835", "0.52964103", "0.5237317", "0.5230411", "0.52253294", "0.5221525", "0.52009887", "0.51761675", "0.5173231", "0.5171643", "0.511766", "0.51056224", "0.50858086", "0.5084545", "0.5078152", "0.5073814", "0.50691706", "0.5029804", "0.49911842", "0.49783003", "0.4973135", "0.49671838", "0.49514198", "0.49435362", "0.4896684", "0.48930776", "0.48868194", "0.48800957", "0.48761708", "0.48499712", "0.48466808", "0.48403135", "0.48252463", "0.48056927", "0.48031628", "0.47652978", "0.47354925", "0.47144985", "0.4704171", "0.47012168", "0.47012168", "0.46644807", "0.4659001", "0.464871", "0.46381173", "0.46339047", "0.462085", "0.46154165", "0.46138117", "0.46138117", "0.4604217", "0.46004775", "0.45920095", "0.45878", "0.45801574", "0.4574729", "0.45737398", "0.4565348", "0.45549208", "0.45481393", "0.45465183", "0.45400518", "0.45340976", "0.45227712", "0.45216805", "0.45195997", "0.45082822", "0.44975966", "0.44812047", "0.44746083", "0.4468821", "0.4468821", "0.4465038", "0.4459659", "0.44534996", "0.44519192", "0.4450386", "0.44425046" ]
0.5920967
3
The main command loop
def main_loop() setup() finished = false while !finished print ":) " line = gets.chomp if line == 'Q' finished = true else parse_command(line) end end exit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop\n end", "def loop\n end", "def loop\n end", "def run_loop\n end", "def run!\n while @commands.length > 0\n command = @commands.shift\n puts command\n @run_success = run command unless @dry_run\n end \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 start\n\t\twhile true\n\t\t\tputs \"\\nWhat would you like to do?\\n Available commands: 'add', 'remove', 'print', 'exit'\"\n\t\t\taction = gets.chomp.downcase\n\t\t\tcase action\n\t\t\twhen 'add'\n\t\t\t\tadd\n\t\t\twhen 'remove'\n\t\t\t\tremove\n\t\t\twhen 'print'\n\t\t\t\tprint\n\t\t\twhen 'exit'\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def command_start; end", "def command_start; end", "def command_start; end", "def run!\n puts \"Type 'help' to view commands\"\n run = true\n while run\n print \">> \"\n input = gets.split[0].to_sym\n output = handle_input input\n puts output\n run = false if output == \"Goodbye! Thanks for playing!\"\n end\n end", "def loop; end", "def cmdLoop\n miqvep = MiqVmExplorerParser.new\n trap(\"INT\") { raise \"Interrupt\" }\n begin\n while true\n if $haveReadline\n input = readline(\"MiqExplorer: \", true)\n else\n $stderr.print \"MiqExplorer: \"\n input = $stdin.gets.chomp\n end\n \n #\n # Skip empty commands and comments.\n #\n next if input.length == 0\n next if input =~ /^\\s*#/\n \n #\n # Process the command.\n #\n miqvep.parse(shellParse(input))\n \n #\n # If I/O was redirected, set it back to the console.\n #\n if $miqOut != $stdout\n $miqOut.close\n $miqOut = $stdout\n end\n end\n rescue MiqOptionParser::ParseError,OptionParser::ParseError => perr\n $stderr.puts perr.message\n $log.debug perr.backtrace.join(\"\\n\")\n retry\n rescue => err\n $stderr.puts err.backtrace.join(\"\\n\")\n $stderr.puts err.to_s\n $log.debug err.backtrace.join(\"\\n\")\n retry\n end\n end", "def loop\n cmd = Parser.get_input ConsoleDisplay.prompt\n cmd_hash = Parser.parse cmd\n @alive = false if cmd_hash[:cmd] == \"exit\"\n cmd_hash\n end", "def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end", "def cmdloop(intro = nil)\n preloop\n write intro if intro\n begin\n set_completion_proc(:complete)\n begin\n execute_command\n # Catch ^C\n rescue Interrupt\n user_interrupt\n # I don't know why ZeroDivisionError isn't caught below...\n rescue ZeroDivisionError\n handle_all_remaining_exceptions(ZeroDivisionError)\n rescue => exception\n handle_all_remaining_exceptions(exception)\n end\n end until @stop\n postloop\n end", "def start\n main_loop\n end", "def commands; end", "def main()\n\n\twhile(line = STDIN.gets())\n\t\tputs \"\\t\\t#{line.chomp} @#{$clock}\"\n\t\tline = line.strip()\n\t\tarr = line.split(' ')\n\t\tcmd = arr[0]\n\t\targs = arr[1..-1]\n\t\tcase cmd\n\t\twhen \"EDGEB\"; edgeb(args)\n\t\twhen \"EDGED\"; edged(args)\n\t\twhen \"EDGEU\"; edgeu(args)\n\t\twhen \"DUMPTABLE\"; dumptable(args)\n\t\twhen \"SHUTDOWN\"; shutdown(args)\n\t\twhen \"STATUS\"; status()\n\t\twhen \"SENDMSG\"; sendmsg(args)\n\t\twhen \"PING\"; ping(args)\n\t\twhen \"TRACEROUTE\"; traceroute(args)\n\t\twhen \"FTP\"; ftp(args);\n\t\twhen \"CIRCUIT\"; circuit(args);\n\t\telse STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\tend\n\tend\nend", "def run\n loop do\n prompt = self.class.prompt || \"#{`whoami`.chomp} $ \"\n cmd = @readline.readline prompt\n\n finish if cmd.nil? or cmd == 'exit'\n next if cmd.empty?\n @history << cmd\n execute cmd\n end\n end", "def run\n greet\n menu\n end", "def run_main\n end", "def create_command_thread\n Thread.new do\n loop do\n log_info('Type help to get a list of the commands you can use.')\n print 'Commande : '\n @__cmd_to_eval = STDIN.gets.chomp\n sleep\n rescue StandardError\n @cmd_thread = nil\n @__cmd_to_eval = nil\n break\n end\n end\n end", "def run\n send Rainbow('Running cpgui...').aqua\n @run = true\n input while @run\n end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def main\n loop do\n # current path used for readline\n cmdline = Readline.readline(\"#{shell_format} \", true)\n break if %w[exit quit q].include?(cmdline)\n\n Readline::HISTORY.pop if %W[hist #{''}].include?(cmdline)\n check_type_of_command(cmdline)\n end\nend", "def run_control\n loop {\n Thread.start(@control.accept) do |control|\n log(\"Control \", control, \" is accepted\\n\")\n control.puts(\"Controller connected. Enter 'help' for command list.\")\n ctrl_commands(control)\n end\n }.join \n end", "def main()\n\n\twhile(line = STDIN.gets())\n line = line.strip()\n arr = line.split(' ')\n cmd = arr[0]\n args = arr[1..-1]\n case cmd\n when \"EDGEB\"; edgeb(args)\n when \"EDGED\"; edged(args)\n when \"EDGEU\"; edgeu(args)\n when \"DUMPTABLE\"; dumptable(args)\n when \"SHUTDOWN\"; shutdown(args)\n when \"STATUS\"; status()\n when \"SNDMSG\"; sendmsg(args)\n when \"PING\"; ping(args)\n when \"TRACEROUTE\"; traceroute(args)\n else STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n end\n\tend\n\nend", "def run\n\t \tbegin \n\t \twrite_command_status(@cmd_queue_0)\n\t \t\n\t \[email protected] \"Processing command queue...\"\n\t \tloop do\n\t \t\tbegin\n\t \t\t\tstr = listen\n\t \t\trescue EOFError\n\t \t\t\[email protected] \"No more messages from pump\"\n\t \t\t\tbreak\n\t \t\tend\n\n\t \t\trep = parse_response(str)\n\n\t \t\t# Look at command response and wait or proceed on queue\n\n\t \t\t# Is it a status message\n\t \t\t# Yes\n\t \t\tif rep[:status]\n\t\t\t\tif process_status(rep)\n\t\t\t\t break\n\t\t\t\tend\n\t \t\t# No\n\t \t\telsif !rep[:status]\n\t \t\t\tprocess_command(rep)\n\t \t\telse\n\t \t\t\[email protected] \"Unknown message type\"\n\t \t\tend\n\t \tend\n\t \[email protected] \"...command queue complete\"\n\n\t \trescue IRB::Abort\n\t \t\[email protected] \"Abort\"\n\t\t\tsleep(0.25)\n\t\t\twrite_stop\n\t\t\t#flush comms?\n\t \trescue Interrupt\n\t \t\[email protected] \"Interupt\"\n\t \t\t#write_stop\n\t \tensure \n\t \t\[email protected] \"Closing\"\n\t\t\t#write_stop\n\t \tend\n\n\t end", "def start\n while @next_command_index < @commands_array.length\n apply_command(@commands_array[@next_command_index])\n @next_command_index += 1\n end\n end", "def begin\n puts instruction\n\n while read_command(gets.chomp)\n end\n end", "def main\n @t.each do \n |line|\n info = grab_info(line) # grabs the info from an PRIVMSG\n STDOUT.puts line, \"\\n\" # puts to the console\n ##\n # An IRC client (a bot is a client) must respond to PINGs from the IRC server.\n # If not, the bot will be kicked.\n pong(line) if line[0..3] == \"PING\"\n if info and info[4] # only called if grabbing the info was successful\n log_it info # logs in a friendly format, in chat.txt\n ##\n # Are there any commands? This bot won't even check for a command unless it starts with a dot (.)\n # and the caller is authorized\n check_for_cmd(info[4], info[0]) if info and info[4] =~ /^\\.(.+)/ and auth(info)\n self.check_for_greet(info[4], info[0]) if info[4].include?(@config[:nick]) # should i respond with a greeting?\n if @config[:mode] == \"trivia\"\n check_answer(info[4], info[0]) # did the user answer correctly?\n end\n end\n end\n end", "def run!\n @commands.run!\n end", "def run() end", "def main()\n\n\twhile(line = STDIN.gets())\n\t\tline = line.strip()\n\t\tarr = line.split(' ')\n\t\tcmd = arr[0]\n\t\targs = arr[1..-1]\n\t\tcase cmd\n\t\twhen \"EDGEB\"; edgeb(args)\n\t\twhen \"EDGED\"; edged(args)\n\t\twhen \"EDGEW\"; edgew(args)\n\t\twhen \"DUMPTABLE\"; dumptable(args)\n\t\twhen \"SHUTDOWN\"; shutdown(args)\n\t\twhen \"STATUS\"; status()\n\t\twhen \"SENDMSG\"; sendmsg(args)\n\t\twhen \"PING\"; ping(args)\n\t\twhen \"TRACEROUTE\"; traceroute(args)\n\t\twhen \"FTP\"; ftp(args)\n\t\twhen \"CIRCUIT\"; circuit(args)\n\t\telse STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\tend\n\tend\n\nend", "def run_cmd(cmd)\n\tend", "def run_program\n\twhile @repeat\n\t\tputs COMMANDS_TEXT\n\t\tprint \"Enter command: \"\n\t\tcommand = gets.chomp\n\t\tprint \"\\n\"\n\t\tcase command.downcase\n\t\twhen \"add\", \"a\"\n\t\t\tadd_property()\n\t\twhen \"search\", \"s\"\n\t\t\tsearch_properties()\n\t\twhen \"print\", \"p\"\n\t\t\tprint_properties(get_properties(), \"All\")\n\t\twhen \"exit\", \"e\"\n\t\t\tputs \"\\n\\nThank you for using this program, your changes have been saved here:\\n#{SOURCE_PATH + DATABASE_NAME}\"\n\t\t\t@repeat = false\n\t\telse\n\t\t\tputs \"\\n\\nSorry, I didn't recognise this command: #{command}\"\n\t\tend\n\tend\nend", "def cmd; end", "def main()\n\n\twhile(line = STDIN.gets())\n\t\tline = line.strip()\n\t\tarr = line.split(' ')\n\t\tcmd = arr[0]\n\t\targs = arr[1..-1]\n\t\tcase cmd\n\t\twhen \"EDGEB\"; edgeb(args)\n\t\twhen \"EDGED\"; edged(args)\n\t\twhen \"EDGEU\"; edgeu(args)\n\t\twhen \"DUMPTABLE\"; dumptable(args)\n\t\twhen \"SHUTDOWN\"; shutdown(args)\n\t\twhen \"STATUS\"; status()\n\t\twhen \"SENDMSG\"; sendmsg(args)\n\t\twhen \"PING\"; req_ping(args)\n\t\twhen \"TRACEROUTE\"; traceroute(args)\n\t\twhen \"FTP\"; ftp(args);\n\t\twhen \"CIRCUIT\"; circuit(args);\n\t\telse STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\tend\n\tend\n\nend", "def parentloop; end", "def do_work()\n\n show_help()\n ::Twiga.say_info \"\\ntwiga> \"\n\n while (cmd = gets) do\n cmd.strip!\n tokens = cmd.split(/ /)\n unless tokens.empty?\n\n item = tokens[1] || 'test'\n \n case tokens.first.downcase\n\n when 'quit','exit' then break\n\n when 'register' then do_register( item )\n when 'refresh' then do_refresh( item )\n when 'list' then do_list( item )\n when 'fetch' then do_fetch( item )\n when 'delete' then do_delete( item )\n\n when 'save' then update_gcp_seed_tokens( item )\n when 'seed' then show_seed()\n when 'ready' then do_ready_state( item )\n when 'time' then show_time( item )\n when 'devices' then show_devices()\n\n when 'connect' then do_connect( item )\n\n when 'help' then show_help() \n when 'cups' then do_cups_work() \n when 'gcp' then show_gcp( item )\n\n else\n ::Twiga.say_err \"? unknown command: #{cmd}\"\n end # case\n \n end # unless no command\n\n ::Twiga.say_info \"\\ntwiga> \"\n end\n\n end", "def start\n loop do\n run\n end\n end", "def main()\n\twhile(line = STDIN.gets())\n\t\tline = line.strip()\n\t\tarr = line.split(' ')\n\t\tcmd = arr[0]\n\t\targs = arr[1..-1]\n\t\tcase cmd\n\t\twhen \"EDGEB\"; edgeb(args)\n\t\twhen \"EDGED\"; edged(args)\n\t\twhen \"EDGEU\"; edgeu(args)\n\t\twhen \"DUMPTABLE\"; dumptable(args)\n\t\twhen \"SHUTDOWN\"; shutdown(args)\n\t\twhen \"STATUS\"; status()\n\t\twhen \"SENDMSG\"; sendmsg(args)\n\t\twhen \"PING\"; ping(args)\n\t\twhen \"TRACEROUTE\"; traceroute(args)\n\t\twhen \"FTP\"; ftp(args);\n\t\twhen \"CIRCUIT\"; circuit(args);\n\t\telse STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\tend\n\tend\n\nend", "def main_run\n\n reset = true #flag to now if you want to exit or not\n\n while reset\n\n puts 'Welcome to CS Air.'\n\n @num_to_command.each {|num,cmd| puts \"Type #{num} for #{cmd}\"}\n command = gets.chomp.to_i\n\n while not @num_to_command.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n\n case\n when command == 1\n reset = false #user wants to exit\n next\n when command == 2\n @ui_lib.print_city_list #print out list of all the cities\n next\n when command == 3\n city_specific_run #city specific details\n next\n when command == 4\n statistic_run #CS Air statistic details\n next\n when command == 5\n system('open', @ui_lib.query.get_map_url)\n next\n end\n end\n end", "def main\n\tconsume = ARGV[0] == '-c'\n\tgenerate = ARGV[0] == '-g'\n\tARGV.shift\n\tARGV.shift\n\tinteractive = ! (consume or generate)\n\tif generate\n\t\tgenerate_forever\n\telsif consume\n\t\tcheck_forever\n\telse\n\t\t# interactive mode\n\t\tinteractive_loop\n\tend\nend", "def run\n prepare_process\n reporter.welcome_message\n exit(1) if print_config_errors\n\n # Set up our console input handling and history\n console = Console.new(config, reporter)\n\n # Start the server\n while console_run_loop(console)\n # just need to run the loop\n end\n\n console.store_history\n\n cleanup_process\n end", "def start_cli\n puts hello\n quit = false\n while not quit\n line = gets.strip!\n\n quit = true if line == 'quit'\n action = take_cmd(@cli_cmds, line, @jid)\n unless quit\n output = action.call\n puts output unless output.nil?\n end\n end\n end", "def run( *args )\n\n\t\tself.setup_completion\n\t\tself.read_history\n\n\t\t# Run until something sets the quit flag\n\t\tuntil @quitting\n\t\t\tinput = Readline.readline( @prompt, true )\n\t\t\tself.log.debug \"Input is: %p\" % [ input ]\n\n\t\t\t# EOL makes the shell quit\n\t\t\tif input.nil?\n\t\t\t\tself.log.debug \"EOL: setting quit flag\"\n\t\t\t\t@quitting = true\n\n\t\t\t# Blank input -- just reprompt\n\t\t\telsif input == ''\n\t\t\t\tself.log.debug \"No command. Re-displaying the prompt.\"\n\n\t\t\t# Act on everything else\n\t\t\telse\n\t\t\t\tself.log.debug \"Dispatching input: %p\" % [ input ]\n\t\t\t\tcommand, *args = Shellwords.shellwords( input )\n\t\t\t\tself.dispatch_command( command, *args )\n\t\t\tend\n\t\tend\n\n\t\tself.save_history\n\n\tend", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def main()\n\n while(line = STDIN.gets())\n \n line = line.strip()\n arr = line.split(' ')\n cmd = arr[0]\n args = arr[1..-1]\n case cmd\n when \"EDGEB\"; edgeb_stdin(args)\n when \"EDGED\"; edged(args)\n when \"EDGEU\"; edgeu(args)\n when \"DUMPTABLE\"; dumptable(args)\n when \"SHUTDOWN\"; shutdown(args)\n when \"STATUS\"; status()\n when \"SENDMSG\"; sendmsg(arr)\n when \"PING\"; ping(args)\n when \"TRACEROUTE\"; traceroute(arr)\n when \"FTP\"; ftp(arr)\n when \"CIRCUITB\"; circuitb(args)\n when \"CIRCUITM\"; circuitm(arr)\n when \"CIRCUITD\"; circuitd(args)\n else STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n end\n\n end\n\nend", "def run\n cmd = \"default\"\n until cmd == \"end\" do\n cmd = Readline.readline(\"[issue ##{@issue.id}] \") || \"\"\n cmd.chomp!\n\n case cmd\n when /^new/ then new_entry\n when /^(ls|show)/ then show_entries\n when /^desc/ then describe_issue\n when /^delete/ then delete_entry(cmd.split.drop 1)\n when /^edit/ then EditHandler.new(@issue).edit_what(cmd.split.drop 1)\n when /^concat/ then concat_description\n when /^replace/ then replace_pattern\n when /^search/ then search_term((cmd.split.drop 1).join ' ')\n when /^lt/ then time(cmd.split.drop 1) # lt for log time\n when /^forget/ then cmd = \"end\"\n when /^finish/ then finish ? cmd = \"end\" : nil\n when /^attachout/ then output_attach\n when /^attachls/ then show_attach\n when /^attach/ then attach\n when /^help/ then print_help\n when /^end/ then next\n else puts \"Type 'help' for help\"\n end\n end\n end", "def command_queue; end", "def run!\n options = setup_options\n drivers = ARGV\n while drivers.size >= 1 \n driver = drivers.shift\n run_with_logging File.basename(driver, File.extname(driver)), options do \n begin\n $Log.info \"Begin Pipelining #{driver} | #{Etc.getlogin} on #{`hostname`}\"\n run_pipe(options, driver)\n $Log.info \"Finished Pipelining #{driver}\"\n rescue StandardError => e\n $Log.error e\n end\n end\n end\nend", "def run\n # Include all handlers now.\n Dir['./handlers/*.rb'].sort.each do |file|\n require file\n end\n\n @config.bots.each do |bot_id, bot_data|\n conn = DiscordConnection.new(bot_data)\n\n conn.connection_id = bot_id\n\n conn.message do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n\n if (prefix = check_prefix(msg.text))\n CommandDispatcher.handle prefix, msg\n else\n @handlers.each do |handler|\n break if handler.call(msg) == true\n end\n end\n end\n\n conn.mention do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n next if msg.content.match? /^(\\.|\\!)(a|d|add_|del_|delete_|remove_|count_)?q(uote|s|uotes|uote_count)?\\b/\n next unless msg.content.present?\n next if bot_data.client_type == :user\n\n msg.send_message \"#{msg.message.author.mention}, please type `.help` if you would like to learn more about my functions!\"\n end\n\n @connections.push conn\n conn.connect\n end\n\n SweetieBot.log \"Made #{@connections.length} connection#{@connections.length > 1 ? 's' : ''}.\"\n SweetieBot.log 'Ready!'\n\n # keep the main thread alive\n loop do\n if @should_stop\n stop!\n exit\n end\n\n sleep 1\n end\n end", "def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end", "def run_command(command)\n while run == true\n case command.downcase\n when 'new'\n new_contact\n run\n when 'list'\n list_contacts\n run\n when 'find'\n puts \"Enter ID: \"\n id = gets.chomp.to_i\n Contact.find(id)\n run \n when 'find by first name'\n puts \"Enter first name: \"\n name = gets.chomp\n Contact.find_all_by_firstname(name)\n run\n when 'add'\n puts \"Enter contact ID: \"\n id = gets.chomp.to_i\n puts \"Enter Label: \"\n label = gets.chomp\n puts \"Enter Phone Number: \"\n number = gets.chomp\n Contact.add_phone(id, label, number)\n run\n when 'save'\n Contact.save\n run\n when 'quit'\n Contact.save\n puts \"Goodbye\"\n else \n puts \"unknown command\"\n run\n end\n end\n end", "def run(args)\n if args.size > 0\n # show details of given commands\n show_details(args)\n else\n # print full list of commands\n list_commands\n end\n end", "def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end", "def run\n end", "def event_loop\n loop do\n Curses.doupdate\n @message.clear\n\n case key = @message.getch\n when 9 then @display.next_link\n when 'Z', 353, Curses::Key::BTAB then @display.previous_link # shift-tab\n\n when 10, Curses::Key::ENTER then display_name @display.current_link\n\n when Curses::Key::LEFT then go_to @history.back\n when Curses::Key::RIGHT then go_to @history.forward\n\n when Curses::Key::END then @display.scroll_bottom\n when Curses::Key::HOME then @display.scroll_top\n when 'j', Curses::Key::DOWN then @display.scroll_down\n when 'k', Curses::Key::UP then @display.scroll_up\n when ' ', Curses::Key::NPAGE then @display.page_down\n when Curses::Key::PPAGE then @display.page_up\n\n when 'h' then\n display @history.list, nil\n when 'i' then\n @message.show \"pos: #{@history.position} items: #{@history.pages.length}\"\n\n when 'Q', 3, 4 then\n break # ^C, ^D\n when 26, Curses::Key::SUSPEND then\n Curses.close_screen\n Process.kill 'STOP', $$\n when nil, Curses::Key::RESIZE then\n @display.update_size\n @message.update_size\n\n when 'g' then display_name @message.prompt\n\n else\n @message.error \"unknown key #{key.inspect}\"\n end\n end\n end", "def run\n end", "def post_loop; end", "def run( args=nil )\n console.error 'Running the generic command!!! WAT? https://www.destroyallsoftware.com/talks/wat'\n end", "def main\n puts \"Welcome to the Ada Slack CLI!\"\n @workspace = Slack::Workspace.new\n\n choice = get_user_input\n until (OPTIONS[-1].include? choice) #checks for quit command from user\n perform_action(choice)\n choice = get_user_input\n end\n puts \"\\n>>>>>> Thank you for using the Slack CLI! Goodbye.\"\nend", "def main\n\n # test\n\n # Console.new\n console_start\n end", "def command\n consume 1, :command\n end", "def execute(input: $stdin, output: $stdout)\n loop do\n case @command\n when :config\n require_relative 'config'\n cmd = PocShotstack::Commands::Config.new('gui', {})\n @command = cmd&.execute(input: input, output: output)\n when :demo\n require_relative 'demo'\n cmd = PocShotstack::Commands::Demo.new('gui', {})\n @command = cmd&.execute(input: input, output: output)\n when :exit\n break\n else\n @command = gui\n end\n \n end\n end", "def run\n end", "def loop_forever; end", "def running; end", "def running; end", "def kloop\n end", "def postloop\n end", "def run! \n loop { puts @context.eval(@pipe.gets) }\n end", "def run\n raise NotImplementedError, 'Generic loop has nothing to do'\n end", "def mycmd\n while true\n print \"Cmd> \"\n cmd = gets\n puts(eval(cmd))\n end\nend" ]
[ "0.7266236", "0.7255659", "0.7255659", "0.72381294", "0.7225912", "0.70664", "0.70106673", "0.6919402", "0.6919402", "0.6919402", "0.69075453", "0.6906838", "0.6906626", "0.6838003", "0.678883", "0.6764842", "0.67495894", "0.670526", "0.66695315", "0.6663981", "0.6663489", "0.6653548", "0.664215", "0.66042256", "0.6595666", "0.6595666", "0.6595666", "0.6595666", "0.6595666", "0.6595666", "0.6580189", "0.65778446", "0.6577381", "0.65654075", "0.65588295", "0.6545882", "0.65420943", "0.653562", "0.6533401", "0.65317154", "0.65267235", "0.651943", "0.6518961", "0.6513442", "0.6500847", "0.64859486", "0.6472848", "0.6468874", "0.6468064", "0.6459125", "0.64415914", "0.6431878", "0.64292717", "0.64226353", "0.64226353", "0.64226353", "0.64226353", "0.64226353", "0.64226353", "0.64226353", "0.6418234", "0.6418234", "0.64114094", "0.64018184", "0.63964236", "0.6361333", "0.6360457", "0.6334754", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.6331111", "0.63232815", "0.63052446", "0.63047254", "0.6302919", "0.6287664", "0.6267014", "0.6261207", "0.6254422", "0.62430656", "0.62312174", "0.6230561", "0.62299055", "0.6216263", "0.6215515", "0.62150246", "0.6212458", "0.6212458", "0.62058216", "0.6205283", "0.62050354", "0.620258", "0.6188955" ]
0.730992
1
:new_articles_count, :last_sync_at def new_articles_count This is a chained criteria, not method call object.shinchyaku.count end
def name object.merchant.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count; end", "def count; end", "def count; end", "def count\n # implement in subclasses\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n end", "def count\n end", "def topics_count\n object.topics.count\n end", "def user_count; end", "def last_sick_mention_count\n @range_center = Date.today\n twenty_four_hour_count = Mention.find(:all, :select => \"DATE(mentioned_at) as mentioned_at_date, mentioned_at, substring_index(mentioner, ' (', 1) as mentioner_stripped, mentioner, link, exact_location\", :group => 'mentioner_stripped, mentioned_at_date', :conditions => {:city_id => self.id, :mentioned_at => (\"#{@range_center.year}-#{@range_center.month.to_s.rjust(2, '0')}-#{@range_center.day.to_s.rjust(2, '0')} 00:00\"..\"#{@range_center.year}-#{@range_center.month.to_s.rjust(2, '0')}-#{@range_center.day.to_s.rjust(2, '0')} 23:59\")})\n twenty_four_hour_count.length\n end", "def count\n self[:count].to_i\n end", "def record_count\n\t\t# TODO\n\tend", "def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end", "def outdated_count\n outdated.count\n end", "def comic_count\r\n \tsorted_articles.length\r\n end", "def count\n @count ||= get_count\n end", "def todays_auto_tweet_count\n self.twitter_tweets.count\n end", "def count\n @history.objects.find { |o| o.name == \"count\" }.val\n end", "def sick_mention_count(date)\n @range_center = date\n twenty_four_hour_count = Mention.find(:all, :select => \"DATE(mentioned_at) as mentioned_at_date, mentioned_at, substring_index(mentioner, ' (', 1) as mentioner_stripped, mentioner, link, exact_location\", :group => 'mentioner_stripped, mentioned_at_date', :conditions => {:city_id => self.id, :mentioned_at => (\"#{@range_center.year}-#{@range_center.month.to_s.rjust(2, '0')}-#{@range_center.day.to_s.rjust(2, '0')} 00:00\"..\"#{@range_center.year}-#{@range_center.month.to_s.rjust(2, '0')}-#{@range_center.day.to_s.rjust(2, '0')} 23:59\")})\n twenty_four_hour_count.length\n end", "def default_article_sync\n feed.entries.count > 20 ? 20 : feed.entries.count\n end", "def count\n @count ||= 0\n end", "def count=(_); end", "def artist_count\n self.artists.count\n end", "def count\n @count ||= @query.count\n end", "def count\n self.all.count\n end", "def count\n @count ||= 1\n end", "def count\n @count ||= 1\n end", "def count\n 1\n end", "def count\n all.count\n end", "def calculate_count _changed_card=nil\n ids = left.related_companies\n update_topic_company_cached_count ids.size\n result = {}\n ids.each do |company_id|\n result[company_id] = true unless result.key?(company_id)\n end\n result.to_json\nend", "def count\n self.class.count(self)\n end", "def num_recent_uniques\n # ten_min_ago = DateTime.new( )\n # self.distinct_visitors.where(\"created_at = ?\", ten_min_ago)\n end", "def count\n raise NotImplementedError\n end", "def count\n each.count\n end", "def cool_view_count\n view_count\n end", "def old_count\n model.find(id)[field]\n end", "def latest_published count\n\t self.find(:all, :order => \"published_on DESC\", :conditions => \"published_on > 0 AND live = 1\", :limit => count )\n\tend", "def songs_count\n \[email protected]\n end", "def count\n @collector.count\n end", "def number_of_senator\n\ta = Legislator.where(\"title=?\",\"Sen\")\n\tputs \"Senators:\" +\"#{a.count}\"\nend", "def count\n @obj['count'].to_i\n end", "def count ; @count ||= table.count end", "def total_votes\n \tself.shout_votes.count\n end", "def track_count\n self.tracks.count\n end", "def question_count \n @by_question.count\n end", "def count!\n count(nil)\n end", "def count\n query.count\n end", "def count\n query.count\n end", "def count\n @count ||=\n begin\n # self.sql sets self.model_class.\n this_sql = sql(:count => true)\n model_class.connection.\n query(this_sql).\n first.first\n end\n end", "def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend", "def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend", "def count; info['doc_count']; end", "def song_count\n self.songs.count\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def artist_count\n @model.artists.count\n end", "def likes_count\n self.likes_count_field\n end", "def count\n if @count\n if @count.respond_to?(:call)\n @count = @count.call\n else\n @count\n end\n else\n super\n end\n end", "def count\n @count ||= 0\n @count += 1\n end", "def count\n transactions.count\n end", "def total_count\n @total_count ||= self.query.count\n end", "def count(products) #este nome pode ser o que nós quisermos porque só está dentro do método\n products.count\nend", "def total_activity_count\n return self.timeline_events.find(:all, :conditions => {:event_type => \"document_item_changed\"}).length + \n self.questions.count +\n self.questions.answered.count\n end", "def song_count\n # @artist = self\n # @artist.songs.count\n self.songs.count\n end", "def count_for(resource)\n\t\tself.find(resource).count\n\tend", "def count=(_arg0); end", "def comments_count\n self.comments.count\n end", "def subscriptions_count\n subscriptions.count\n end", "def new_messages_count\n new_messages = self.received_messages.where(:new_message => true)\n if new_messages\n return new_messages.size\n else\n return 0\n end\n end", "def first_author_publications_cnt()\n self.investigator_abstracts.find(:all,\n :conditions => [\"is_first_author = :is_first_author and end_date is null\",\n {:is_first_author => true}] ).length\n end", "def request_count; end", "def likes_count\n self.likes.size\n end", "def member_count\n attach_info\n @member_count\n end", "def test_count\n @tests.count\n end", "def count\n raw_history['num_results']\n end", "def count\n @params[:rettype] = 'count'\n self\n end", "def count\n collection.count\n end", "def get_user_count(id, topic_name)\n timenow = DateTime.now\n if topic_name != \"Main\"\n return Active.where(:channel_id => id, :topic_name => topic_name).where(\"updated > ?\", timenow-5.seconds).size\n else\n return Active.where(:channel_id => id).where(\"updated > ?\", timenow-5.seconds).size\n end\n end", "def offense_counts; end", "def offense_counts; end", "def totalcount\n @totalcount\n end", "def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end", "def post_count\n self.interests_posts.count\n end", "def counts\r\n @counts\r\n end", "def media_object_count\n @media_object_count ||= MediaObject.where(\"collection_ssim\" => name).count\n end", "def number_of_new_nodes\n \t{'New Nodes Added' => aw.node_added_count }\n \tend", "def number_of_new_nodes\n \t{'New Nodes Added' => aw.node_added_count }\n \tend", "def my_count\n count = my_followers.count\n end", "def changeset_count\n\t\tchangesets_x_all.first[:objects].count\n\tend", "def page_count; pages.count; end", "def object_count\n 0\n end", "def count(filter = {})\n select = {}\n if filter[:days]\n if filter[:revoked]\n select[:revoked] = (Date.today - filter[:days])..(Date.today)\n else\n select[:created_at] = (Date.today - filter[:days])..(Date.today)\n end\n elsif filter.has_key?(:revoked)\n select[:revoked] = filter[:revoked] ? { :$ne=>nil } : { :$eq=>nil }\n end\n select[:client_id] = filter[:client_id] if filter[:client_id]\n self.find(select)\n \n end", "def count\n @data['count']\n end", "def count_entitled\n return @count_entitled\n end", "def vote_count\n self.votes.count\n end", "def count\n call_client(:count)\n end" ]
[ "0.67849255", "0.67849255", "0.67849255", "0.67697257", "0.6685441", "0.6685441", "0.6685441", "0.6667741", "0.66437775", "0.66437775", "0.66437775", "0.6635947", "0.6635947", "0.6553508", "0.63973993", "0.63850015", "0.63789105", "0.636141", "0.6346396", "0.6343944", "0.6341716", "0.63244283", "0.6298377", "0.6285558", "0.62842536", "0.6278428", "0.6257682", "0.6250001", "0.62064403", "0.6165627", "0.61537164", "0.61467427", "0.61467427", "0.6132712", "0.6125208", "0.6115435", "0.61140716", "0.60992056", "0.60894793", "0.6087188", "0.6082442", "0.60814345", "0.6063122", "0.6058541", "0.60548514", "0.60460544", "0.6043525", "0.6041975", "0.6039477", "0.6039418", "0.6022084", "0.60216814", "0.601065", "0.601065", "0.60068727", "0.6004006", "0.6004006", "0.6003903", "0.60006547", "0.5998648", "0.5997591", "0.599749", "0.5997173", "0.59908605", "0.5983564", "0.5978962", "0.5976168", "0.59756964", "0.59739494", "0.5971618", "0.5971437", "0.5959652", "0.59502774", "0.59489506", "0.5948158", "0.5938735", "0.5932551", "0.5929287", "0.59231466", "0.5921748", "0.5916632", "0.5914876", "0.5910368", "0.5908613", "0.5908613", "0.5903257", "0.5900921", "0.5899046", "0.589888", "0.58955437", "0.5894123", "0.5894123", "0.5886555", "0.588081", "0.58654773", "0.5863213", "0.58559376", "0.5851301", "0.5849671", "0.58442056", "0.58426577" ]
0.0
-1
GET /reviews GET /reviews.json
def index if params[:search] @products = Product.search(params[:keyword]).filter(params[:filter]) @categories = Category.all @new_path = new_product_path @product_a = Product.new #for modal partial rendering else @products = Product.all.order("Created_at DESC") @categories = Category.all @new_path = new_product_path @product_a = Product.new #for modal partial rendering end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def reviews(id, review_type='top_critic', page_limit='20', page='1', country='us')\n results = self.class.get(\"/movies/#{id}/reviews.json\", :query => {:review_type => review_type, :page_limit => page_limit, :page => page, :country => country}).parsed_response\n return results\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def reviews(params = {})\n data = request(\"/review/list\", params.merge(v: \"2\"))\n reviews = data[\"reviews\"][\"review\"]\n if reviews.present?\n reviews.map { |review| Hashie::Mash.new(review) }\n else\n []\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end", "def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end", "def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end", "def reviews\n download_reviews\n @reviews.flatten!\n end", "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end", "def index\n render json: Album.find(params[:album_id]).reviews\n end", "def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def review\n fetch('restaurant.review')\n end", "def index\n\t\t@book_reviews = BookReview.find_all_by_user_id(current_user.id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @book_reviews }\n\t\tend\n\tend", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def index\n @reviews = Review.all\n \n end", "def index\n @reviews = Review.order(:place_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def index\n @reviews = current_user.reviews\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @user = User.find(params[:id])\n @reviews = @user.reviews.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n\t\t@reviews = @movie.reviews\n\tend", "def index\n render_json content: Review.all\n end", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def index\n\t\tparams[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where(\"user_id = ?\", current_user.id)\n\t\t@reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @reviews }\n\t\t\tformat.js\n\t\tend \n\tend", "def show\n @review = @post.reviews.find(params[:id])\n respond_with @post, @review\n end", "def index\n @reviews = @story.reviews\n end", "def index\n\t\t@shop = Shop.find(params[:shop_id])\n\t\t@reviews = @shop.reviews\n\tend", "def show\n render_json content: @review\n end", "def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end", "def reviews\n @reviews\n end", "def index\n @user = User.find(params[:uid])\n @reviews = @reviews.where(user_id: @user.id).where(anonymous: false)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def get_reviews(proposal_id)\n\t\treturn Review.find_all_by_proposal_id(proposal_id)\n\tend", "def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end", "def show\n\n respond_to do |format|\n format.html #show\n format.json { render json: @review }\n end\n end", "def index\n @product_reviews = ProductReview.all\n end", "def index\n @reviews = Employee.where(reviewed: nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @visitor_reviews = VisitorReview.all\n end", "def index\n @reviews = @publication.reviews.all\n end", "def index\n @reviews = Review.includes(:movie).order('created_at Desc').all\n render json: @reviews, include: [:movie]\n end", "def list\n @reviews = current_user.organization.reviews\n end", "def index\n @item_reviews = ItemReview.all\n end", "def index\n @item_reviews = ItemReview.all\n end", "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end", "def index\n @critic_reviews = CriticReview.all\n end", "def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end", "def pending\n @reviews = current_user.written_reviews.pending\n render json: @reviews\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def index\n @q = @ci_reviews.search params[:q]\n @ci_reviews = @q.result.page(params[:page])\n end", "def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend", "def show\n @wifi = Wifi.find(params[:id])\n @reviews = @wifi.reviews\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wifi }\n end\n end", "def load_reviews\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/reviews?res_id=#{self.zomato_restaurant_id}\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n if response && response.length >= 2\n response = JSON.parse(response)\n response['user_reviews'].each do |review|\n new_review = Review.new\n new_review.review_rating = review['review']['rating']\n new_review.review_text = review['review']['review_text']\n new_review.rating_color = review['review']['rating_color']\n new_review.rating_text = review['review']['rating_text']\n new_review.review_time_stamp = Time.at(review['review']['timestamp'].to_i).to_time.to_i\n new_review.likes = review['review']['likes']\n new_review.author_name = review['review']['user']['name']\n new_review.author_foodie_level = review['review']['user']['foodie_level']\n new_review.user_image = review['review']['user']['profile_image']\n new_review.comments_count = review['review']['comments_count']\n new_review.restaurant_id = self.zomato_restaurant_id\n new_review.save\n end\n end\n end\n end", "def index\n #deeply nested... so starts with gyms,goes to trainers,goes to clients.\n #since clients belongs to trainer we use trainer here..\n #but in trainers_controller the trainers belongs to gyms so gyms is used orignally.\n @product=Product.find(params[:product_id])\n @reviews=Review.where(product_id: @product.id)\n render json:@reviews, status: :ok\n end", "def index\n @shop_reviews = ShopReview.all\n end", "def index\n response.headers['X-Total-Count'] = @reviews.count.to_s\n @reviews = @reviews.page(params[:page]) if params[:page].present?\n @reviews = @reviews.per(params[:per]) if params[:per].present?\n\n _render collection: @reviews, flag: params[:flag].try(:to_sym)\n end", "def index\n @food_reviews = FoodReview.all\n end", "def index\n @reviews_and_ratings = ReviewsAndRating.all\n end", "def index\n @restaurant_reviews = RestaurantReview.all\n end", "def index\n @reviews = Review.find(:all, :limit => 10, :include => [:user, :package])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @review }\n end\n end", "def index\n @user_reviews = UserReview.find(:all)\n @user = get_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_reviews }\n end\n end", "def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def index \n reviews=Review.all.sort \n render json: reviews\n end", "def index\n @hm_reviews = HmReview.all\n end", "def index\n @evenreviews = Evenreview.all\n end", "def index\n respond_with :api, @review, @review.comments\n end", "def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end", "def userindex\n @user = User\n .left_joins(:reviews).includes(:reviews)\n .find(current_user.id)\n\n reviews = @user.reviews\n render json: reviews\n end", "def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend", "def show\n\t\t@review = Review.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend", "def show\n find_review\n find_show\n respond_to do |f|\n f.html {render :show}\n f.json {render json: @review}\n end\n end", "def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end" ]
[ "0.8128604", "0.76803666", "0.76803666", "0.76768506", "0.7594319", "0.7533078", "0.75313497", "0.75313497", "0.7528348", "0.7404546", "0.7360395", "0.7340902", "0.7319881", "0.73067623", "0.7281126", "0.72661823", "0.721507", "0.7189025", "0.7180426", "0.71802807", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.7115584", "0.71085274", "0.70829946", "0.70829946", "0.70829946", "0.70426154", "0.70365053", "0.7026979", "0.69900113", "0.6971866", "0.6971866", "0.6971866", "0.6971866", "0.6971866", "0.6953886", "0.69421935", "0.6937741", "0.6859427", "0.6835107", "0.68228954", "0.6793513", "0.67446417", "0.6743918", "0.6739694", "0.67096776", "0.67090833", "0.6696974", "0.6677338", "0.66749763", "0.66605955", "0.66577846", "0.6645358", "0.66157675", "0.6611565", "0.6595463", "0.6590827", "0.6590338", "0.6590338", "0.65844125", "0.6577233", "0.6563872", "0.65489864", "0.6543836", "0.6541467", "0.6534573", "0.65318", "0.6527391", "0.6516056", "0.65151626", "0.6510525", "0.65023685", "0.6498509", "0.64941055", "0.6489196", "0.648788", "0.64791256", "0.6475891", "0.64680594", "0.64590037", "0.6446738", "0.6437988", "0.6432153", "0.6408189", "0.63943285", "0.63920134", "0.6387681", "0.63785774", "0.63785774", "0.63785774", "0.63785774" ]
0.0
-1
GET /reviews/1 GET /reviews/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end", "def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend", "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def reviews(id, review_type='top_critic', page_limit='20', page='1', country='us')\n results = self.class.get(\"/movies/#{id}/reviews.json\", :query => {:review_type => review_type, :page_limit => page_limit, :page => page, :country => country}).parsed_response\n return results\n end", "def index\n render json: Album.find(params[:album_id]).reviews\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def review\n fetch('restaurant.review')\n end", "def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end", "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end", "def reviews(params = {})\n data = request(\"/review/list\", params.merge(v: \"2\"))\n reviews = data[\"reviews\"][\"review\"]\n if reviews.present?\n reviews.map { |review| Hashie::Mash.new(review) }\n else\n []\n end\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n \n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def index\n @reviews = Review.order(:place_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @user = User.find(params[:id])\n @reviews = @user.reviews.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @review = @post.reviews.find(params[:id])\n respond_with @post, @review\n end", "def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end", "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end", "def reviews\n download_reviews\n @reviews.flatten!\n end", "def index\n render_json content: Review.all\n end", "def index\n @reviews = current_user.reviews\n end", "def index\n\t\t@reviews = @movie.reviews\n\tend", "def index\n\t\t@book_reviews = BookReview.find_all_by_user_id(current_user.id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @book_reviews }\n\t\tend\n\tend", "def find_review\n Review.find(params[\"id\"])\n end", "def show\n\n respond_to do |format|\n format.html #show\n format.json { render json: @review }\n end\n end", "def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def index\n @reviews = @story.reviews\n end", "def show\n @review = Review.find(params[:id])\n end", "def show\n @review = Review.find(params[:id])\n end", "def show\n @review = Review.find(params[:id])\n end", "def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end", "def show\n @review = Review.find(params[:id])\n\n end", "def show\n render_json content: @review\n end", "def reviews\n @reviews\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def show\n @wifi = Wifi.find(params[:id])\n @reviews = @wifi.reviews\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wifi }\n end\n end", "def index\n @reviews = Employee.where(reviewed: nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def load_reviews\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/reviews?res_id=#{self.zomato_restaurant_id}\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n if response && response.length >= 2\n response = JSON.parse(response)\n response['user_reviews'].each do |review|\n new_review = Review.new\n new_review.review_rating = review['review']['rating']\n new_review.review_text = review['review']['review_text']\n new_review.rating_color = review['review']['rating_color']\n new_review.rating_text = review['review']['rating_text']\n new_review.review_time_stamp = Time.at(review['review']['timestamp'].to_i).to_time.to_i\n new_review.likes = review['review']['likes']\n new_review.author_name = review['review']['user']['name']\n new_review.author_foodie_level = review['review']['user']['foodie_level']\n new_review.user_image = review['review']['user']['profile_image']\n new_review.comments_count = review['review']['comments_count']\n new_review.restaurant_id = self.zomato_restaurant_id\n new_review.save\n end\n end\n end\n end", "def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end", "def index\n\t\t@shop = Shop.find(params[:shop_id])\n\t\t@reviews = @shop.reviews\n\tend", "def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def index\n @user = User.find(params[:uid])\n @reviews = @reviews.where(user_id: @user.id).where(anonymous: false)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @item_reviews = ItemReview.all\n end", "def index\n @item_reviews = ItemReview.all\n end", "def find_review\n @review = Review.find(params[:id])\n end", "def index\n @product_reviews = ProductReview.all\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def show\n\t\t@review = Review.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend", "def get_reviews(proposal_id)\n\t\treturn Review.find_all_by_proposal_id(proposal_id)\n\tend", "def index\n @reviews = @publication.reviews.all\n end", "def index\n #deeply nested... so starts with gyms,goes to trainers,goes to clients.\n #since clients belongs to trainer we use trainer here..\n #but in trainers_controller the trainers belongs to gyms so gyms is used orignally.\n @product=Product.find(params[:product_id])\n @reviews=Review.where(product_id: @product.id)\n render json:@reviews, status: :ok\n end", "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end", "def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend", "def index\n @reviews = Review.find params[:id]\n\n @user = User.find(params[user:id])\n @review = Review.new\n end", "def index\n @first_reviews = FirstReview.all\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end", "def show\n @review = Review.find(params[:id])\n @product = @review.product\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def index\n @critic_reviews = CriticReview.all\n end", "def index\n\t\tparams[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where(\"user_id = ?\", current_user.id)\n\t\t@reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @reviews }\n\t\t\tformat.js\n\t\tend \n\tend", "def index\n @visitor_reviews = VisitorReview.all\n end", "def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend", "def index\n @restaurant_reviews = RestaurantReview.all\n end", "def index\n @food_reviews = FoodReview.all\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def show\n\t\t@review = Review.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend" ]
[ "0.78798026", "0.751587", "0.751587", "0.7503942", "0.7390879", "0.7352559", "0.73425764", "0.7342495", "0.7331215", "0.7331215", "0.7281798", "0.7159771", "0.71292806", "0.71292806", "0.71292806", "0.71292806", "0.71292806", "0.7086854", "0.7068903", "0.7065639", "0.70534414", "0.7051076", "0.7031837", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.702976", "0.6967458", "0.6952553", "0.6952553", "0.6952553", "0.69041574", "0.68616897", "0.6853123", "0.68469477", "0.684433", "0.6803986", "0.67659664", "0.67470056", "0.67396665", "0.6726065", "0.67228353", "0.6676249", "0.66737473", "0.66715634", "0.66650397", "0.6663765", "0.6663765", "0.6663765", "0.66348475", "0.66309", "0.66130596", "0.6612883", "0.6609606", "0.66023946", "0.6600405", "0.6567519", "0.6566965", "0.65612656", "0.65612656", "0.65612656", "0.65612656", "0.65612656", "0.65612656", "0.65600735", "0.65485746", "0.6547667", "0.65259105", "0.6520837", "0.651067", "0.651067", "0.6507564", "0.64947945", "0.64763635", "0.64677906", "0.6467752", "0.6466392", "0.646511", "0.6454", "0.6447822", "0.6443005", "0.64335966", "0.6433539", "0.6433313", "0.641217", "0.64053214", "0.63977104", "0.63914824", "0.6390406", "0.63863045", "0.6377239", "0.6369179", "0.63686013" ]
0.0
-1