query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
fdaa9e07b688473b2b0aa76012743b17
Maintain subscription status. Must be called by the user (or subclass) of this class, most likely in the thread created by start.
[ { "docid": "fdab8cbda884824cf86f6f2437c350c5", "score": "0.0", "text": "def handle_ack ack\n raise ArgumentError unless ack.control?\n op_type, tags = ack.control_op\n @sub_tracker.update op_type, tags\n end", "title": "" } ]
[ { "docid": "7eac2fdd9d3028dca74efec2aaa0b772", "score": "0.7555355", "text": "def sync_subscribed_status\n\t\tself.subscribed = self.status == 'subscribed'\n\t\ttrue # Ensure the execution chain continues.\n\tend", "title": "" }, { "docid": "ac3d1be333fc3c3beaca1f26d7ebf77a", "score": "0.6859727", "text": "def update_subscription\n self.subscription.update_attribute(:pending, 0)\n end", "title": "" }, { "docid": "7b659ef1a8e91dcd57a095a979123cec", "score": "0.6743546", "text": "def ensure_subscription!\n raise \"Must have active subscription\" unless subscription\n end", "title": "" }, { "docid": "1ce224f3c4bae4b61d32fd1dd66b22dc", "score": "0.6717247", "text": "def subscribe\n if current_user.subscription?\n current_user.subscription = false\n else\n current_user.subscription = true\n end\n\n if current_user.save\n if current_user.subscription?\n flash[:notice] = \"You have successfully subscribed!\"\n redirect_to root_path\n else\n flash[:alert] = \"You are now unsubscribed.\"\n redirect_to root_path\n end\n else\n flash[:warning] = \"There was an error. Please try again.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "2d9ec1f6cbdd1938c2fd357d30963948", "score": "0.6683191", "text": "def subscribe\n perform_subscribe\n reload!\n end", "title": "" }, { "docid": "2d9ec1f6cbdd1938c2fd357d30963948", "score": "0.6683191", "text": "def subscribe\n perform_subscribe\n reload!\n end", "title": "" }, { "docid": "5fe8a3b5c9b08cc51713aa53e7698af4", "score": "0.66597944", "text": "def set_subscription_status\n @subscription_status = SubscriptionStatus.find(params[:id])\n end", "title": "" }, { "docid": "70f9bdfcf8f0e12b387a43c63e3a2341", "score": "0.659546", "text": "def subscribed; end", "title": "" }, { "docid": "4841f63ff0a0e8a959c91a9a1dc524c3", "score": "0.6554127", "text": "def ensure_subscription!\n fail \"Must have active subscription\" unless subscription\n end", "title": "" }, { "docid": "1b82fec0226d825601bac58167412bbe", "score": "0.65120727", "text": "def subscribe\n\t\tself.update_attributes(:subscribed => true)\n\t\t#self.save\n\tend", "title": "" }, { "docid": "5fe2eb75404f683b64028d80be7f16c5", "score": "0.64876294", "text": "def subscribe!\n return subscribed? if subscribed? || on_subscribe_block.nil?\n on_subscribe_block.call\n @subscribed = true\n end", "title": "" }, { "docid": "f146354ac1bfbd38b83106efd8fd74f9", "score": "0.6446754", "text": "def unsubscribe!\n self.update(status: 'unsubscribed')\n end", "title": "" }, { "docid": "e8f5bbb9057f3603dd426897c3cfc037", "score": "0.6439059", "text": "def acknowledge_subscription_status_change\n if subscription_status_changed? :from => 'active', :to => 'past_due'\n PaymentMailer.with(:member => self).missed.deliver\n self.due_date = @days_past_due.days.ago\n end\n end", "title": "" }, { "docid": "3f3af0698afb4be7724e1671081a98f6", "score": "0.63926125", "text": "def unsubscribed; end", "title": "" }, { "docid": "7b006e3f6c50ff7086783bf53530d2b3", "score": "0.63690203", "text": "def subscribed(subscription)\n if subscription && subscription.subscription == :subscribed\n puts \"Subscribe successful.\"\n else\n puts \"Subscribe failed!\"\n end\n end", "title": "" }, { "docid": "e582614ea3c53d750466ff1e01d42924", "score": "0.6361027", "text": "def handle_subscription(presence)\n @logger.warn 'Subscription request from %s to %s' % [presence.from, presence.to]\n @logger.debug presence.to_s\n answer = presence.answer(false)\n answer.type = :subscribed\n @component.send(answer)\n @sessions[presence.from.bare.to_s].process_status_update(presence.to.to_s.split('@').first.to_i)\n end", "title": "" }, { "docid": "ad2346d3d6d5f3d7660a8e33dd8122ac", "score": "0.6316083", "text": "def set_status\n # The \"self\"s seem to be required because of the \"def status=\" above. Not sure why...\n bob = subscriber\n if bob && bob.active\n if bob.recurring\n self.status = :paid\n else\n self.status = :cancelled\n end\n # REMOVE THIS WEN WE LAUNCH:\n else\n # While we're in beta everyone should stay on the free plan\n self.status = :free\n end\n # PUT THE FOLLOWING LINES IN WHEN WE LAUNCH:\n # elsif is_within_free_trial?\n # self.status = :free\n # else\n # self.status = :inactive\n # end\n save!\n end", "title": "" }, { "docid": "6fe702ea2830c4a3e3f37ebcbdd306ce", "score": "0.6299054", "text": "def changeSubscriptionStatus(status)\n require 'json'\n\n sub_id = @subscription.subscription_id\n service_id = @subscription.service_id\n service = Service.find(service_id)\n\n # Only change sub status\n subscriptionJSON = {\n 'status' => status\n }.to_json\n\n # Send it to context broker endpoint for Subscriptions\n # TODO: Move path in configuration elsewhere\n serviceURI = service.endpoint+\":1026/v2/subscriptions/\"+sub_id\n\n begin\n response = RestClient.patch(\n serviceURI,\n subscriptionJSON,\n 'Content-Type' => 'application/json'\n )\n # Change status of sub if successful\n @subscription.update(status: status)\n json_response({status: status})\n rescue RestClient::ExceptionWithResponse => e\n # If errored, report to client\n json_response({message: e.response}, :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "08bac26505deb9083227f309d496c267", "score": "0.6258784", "text": "def subscribed?\n subscribed == true\n end", "title": "" }, { "docid": "9e9700e200f10b276da117ce499c0342", "score": "0.6245505", "text": "def subscribe\n end", "title": "" }, { "docid": "451df67ed6337235230c5ba677561567", "score": "0.6229741", "text": "def subscription_changed(user, user_subscription, status)\n p \"posts/index #subscription_changed called\"\n case status\n when :unsubscribed\n user.usub_with_current_user = nil\n #iterates posts in order to set them so with updated subscription status\n #because each post may come with separate instances of one subscription entity\n #so if posts have the same author it should update subscribe component of each those posts\n state.posts.each do |post|\n if post.author.id == user.id\n post.author.usub_with_current_user = UserSubscription.new(to_user_id: user.id)\n end\n end\n when :subscribed\n user.usub_with_current_user = user_subscription\n state.posts.each do |post|\n if post.author.id == user.id\n post.author.usub_with_current_user = user_subscription\n end\n end\n end\n force_update\n end", "title": "" }, { "docid": "35992f53e1f412948ea2580cd4a8991d", "score": "0.6225756", "text": "def subscribe\n end", "title": "" }, { "docid": "5606e209ed41c922ed94333ca37d9223", "score": "0.62195915", "text": "def execute\n subscribable? ? subscribe : unsubscribe\n end", "title": "" }, { "docid": "7a8e0ba1824bd364e936c16405bd4d03", "score": "0.61954474", "text": "def ready?\n @subscribed\n end", "title": "" }, { "docid": "1c49185468b9f16477424c06282a2fac", "score": "0.61741835", "text": "def subscribe! # rubocop:disable Lint/UselessMethodDefinition\n super\n end", "title": "" }, { "docid": "c84d72ba5ac99d900d10716650feb762", "score": "0.6164747", "text": "def subscription_state\n return @subscription_state\n end", "title": "" }, { "docid": "78f1660ccff3a490760d95770d4bc05d", "score": "0.6147463", "text": "def subscribe\n @subscription.add_subscription self.class\n end", "title": "" }, { "docid": "705e2009ec6bf3a64562cada0a1ab020", "score": "0.6128172", "text": "def subscribed?\n not unsubscribed?\n end", "title": "" }, { "docid": "072df5767acdec12eef908bc8be25fe7", "score": "0.6114106", "text": "def initialize\n @subscriptions = Subscriptions.new\n @primary = false\n end", "title": "" }, { "docid": "9f2160eecbc61d2563ad48efbcfcb53d", "score": "0.6105861", "text": "def subscribe\n \n end", "title": "" }, { "docid": "1c57eddbdb2be92d64422588b287df04", "score": "0.60949934", "text": "def subscription_state=(value)\n @subscription_state = value\n end", "title": "" }, { "docid": "31373ba95df846944a98bc7889998ee2", "score": "0.6089552", "text": "def subscribe\n @subscribe = Subscribe.new\n end", "title": "" }, { "docid": "4d88bb75c6a40b766a3b87461b5fc6bb", "score": "0.6082819", "text": "def touch\n subscriptions.each do |exchange_name, routing_keys|\n if exchange = Myxi::Exchange::EXCHANGES[exchange_name.to_sym]\n routing_keys.each do |routing_key|\n unless exchange.can_subscribe?(routing_key, self.auth_object)\n Myxi.logger.info \"[#{id}] Session is not longer allowed to subscibe to #{exchange_name}/#{routing_key}\"\n unsubscribe(exchange_name, routing_key, true)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "0991c876f8e4c54e6a5c9973dafb97af", "score": "0.6080336", "text": "def subscription\n @current\n end", "title": "" }, { "docid": "bd1579637ac4103090c724dcc47035f0", "score": "0.6045494", "text": "def publish\n subscriptions.each(&:call) if publishable?\n modified false\n end", "title": "" }, { "docid": "e2e84c91389a9420a12205f29fecbd1f", "score": "0.602132", "text": "def set_subscriptions\n @subscriptions = Subscription.all\n end", "title": "" }, { "docid": "4746601dc3e56d118ac61b6e4c7b3cb4", "score": "0.601158", "text": "def onsubscription(&blk)\n @onsubscription = blk\n end", "title": "" }, { "docid": "4a243b094ca4612e1c183a8b2e15e861", "score": "0.59895426", "text": "def unsubscribed\n end", "title": "" }, { "docid": "7155b45634d6ee219560833a01e52ff7", "score": "0.5969196", "text": "def unsubscribed\n\n end", "title": "" }, { "docid": "0c40f1cfe9581e6edaf2e9b6f1b9c032", "score": "0.5952164", "text": "def enqueued!\n status_will_change!\n super\n end", "title": "" }, { "docid": "0c40f1cfe9581e6edaf2e9b6f1b9c032", "score": "0.5952164", "text": "def enqueued!\n status_will_change!\n super\n end", "title": "" }, { "docid": "3acb752fe2d34227c50305abc7fc8764", "score": "0.5945618", "text": "def publish\n self.status = PUBLISHED\n end", "title": "" }, { "docid": "b24a3d31082dbfac5d32162da414ee2c", "score": "0.59419173", "text": "def subscribed?\n !ended? && !unsubscribed?\n end", "title": "" }, { "docid": "e9043482320940c1da327650faac359d", "score": "0.5930953", "text": "def expire\n\t self.subscription_status=\"expired\"\n\t self.save\n\tend", "title": "" }, { "docid": "87068f3df268b4abf45c7d20782d26aa", "score": "0.59258556", "text": "def confirm!\n self.subscribed = true\n super\n end", "title": "" }, { "docid": "960017757889520c33166b2d3c01564b", "score": "0.59256315", "text": "def subscription\n raise NotImplementedError\n end", "title": "" }, { "docid": "7a9f91193f634657105d6e245ac2b66d", "score": "0.5915061", "text": "def store; context.subscription_store; end", "title": "" }, { "docid": "b91a38b181c02079c5e44dc12c399931", "score": "0.5900276", "text": "def build_subscription\n self.subscription = Subscription.create\n self.subscription.subscribe!\n end", "title": "" }, { "docid": "a06129d2d43d6169e26b9612160c1586", "score": "0.58997613", "text": "def touch_subscriptions\n if saved_change_to_title? || saved_change_to_url?\n feed_subscriptions.find_each do |s|\n s.touch_subscriptions\n end\n end\n end", "title": "" }, { "docid": "de0f61551f4a2b48ba9d1f175995628c", "score": "0.5890861", "text": "def set_subscription\n logger.debug 'set_subs called'\n @subscription = Subscription.find(params[:id])\n end", "title": "" }, { "docid": "292902edf02aad0fc377854ba86610f3", "score": "0.58799136", "text": "def active_subscribed?\n subscription.nil? ? false : true\n end", "title": "" }, { "docid": "2fb3e43bd62a8c84da838e7d3c256134", "score": "0.58722603", "text": "def synchronize_subscription!\n return false unless has_payment_account\n user.update_attribute(:plan, external_subscription)\n end", "title": "" }, { "docid": "229201a160b19e7f92a39296e62c2154", "score": "0.58610964", "text": "def create\n if params[:subscribe] == \"yes\"\n user = current_user\n user.subscription = true\n user.save!\n else\n flash[:success] = \"Your subscription preferences have been updated!\"\n end\n end", "title": "" }, { "docid": "4a397961e1d68c6de8d962f8032a3e96", "score": "0.5859245", "text": "def subscriptions=(value)\n @subscriptions = value\n end", "title": "" }, { "docid": "4a397961e1d68c6de8d962f8032a3e96", "score": "0.5859245", "text": "def subscriptions=(value)\n @subscriptions = value\n end", "title": "" }, { "docid": "1f2dfd03606eced40d941f882431e62a", "score": "0.5845037", "text": "def reactivate_subscription\n sub = fetch_subscription\n raise NoSubscription, 'User does not have a subscription' if sub.blank?\n\n unless sub.cancel_at_period_end\n raise SubscriptionNotCanceled, 'Cannot reactivate subscription ' \\\n \"because it isn't canceled\"\n end\n\n sub.cancel_at_period_end = false\n sub.save\n\n update_subscription(sub)\n end", "title": "" }, { "docid": "be2853c8c752ae7c0d62eae9286ff662", "score": "0.5830062", "text": "def unsubscribed\n super\n # TODO: abort any pending requests\n end", "title": "" }, { "docid": "834de4de4e43b7e2aa21f6fdb63cc8d9", "score": "0.58276045", "text": "def mark_started!; self.status = 0 end", "title": "" }, { "docid": "834de4de4e43b7e2aa21f6fdb63cc8d9", "score": "0.58276045", "text": "def mark_started!; self.status = 0 end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.5827323", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.5827323", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.5827323", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.5827323", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "2c10a171201ac8adafbe72957fc83ee1", "score": "0.5825773", "text": "def subscriptions\n @subscriptions ||= []\n end", "title": "" }, { "docid": "17332661226ffca0f80aff2cded4bbb5", "score": "0.5819084", "text": "def subscribed?\n subscription.nil? || active_trial? ? false : true\n end", "title": "" }, { "docid": "53ed4c98d295d7a836897b2155c2799c", "score": "0.5804625", "text": "def notify\n unless notified?\n Resque.enqueue ::SubscriptionCloseToLimit, account.administrator.email\n end\n end", "title": "" }, { "docid": "ebc4d6253e8b6984a837424031430c05", "score": "0.5784779", "text": "def active?\n active && subscription.active?\n end", "title": "" }, { "docid": "f3a7e76d2d2d0fdeef45444cdd5c435d", "score": "0.57832885", "text": "def subscribed?\n self.active_subscription.present?\n end", "title": "" }, { "docid": "330c453dbb6b08e9db4e41a2bc1682f1", "score": "0.5781021", "text": "def set_subscribed_to_all\n @subscribed_to_all = (current_user.subscriptions.count == Book.count + Website.count)\n end", "title": "" }, { "docid": "9807ddac2303b48760c95e12ce4f22f8", "score": "0.5760832", "text": "def subscribe!(subscribe_to)\n if self != subscribe_to\n self.subscriptions.create!(:subscribed_id => subscribe_to.id)\n logger.info \"User :: user id #{self.username} subscribed to user \" <<\n \"#{subscribe_to.username}\"\n end\n end", "title": "" }, { "docid": "5276cc4b6e2a015dc409a484ddaee469", "score": "0.57607806", "text": "def subscribe_all\n @sub_tracker.subscribe_all\n end", "title": "" }, { "docid": "80124367d1c29717777a7e7a0abc58da", "score": "0.5756055", "text": "def setup_subscriptions\n @logger.debug(\"subscribing to client subscriptions\")\n @settings[:client][:subscriptions].each do |subscription|\n @logger.debug(\"subscribing to a subscription\", :subscription => subscription)\n options = transport_subscribe_options(subscription)\n @transport.subscribe(*options) do |message_info, message|\n begin\n check = MultiJson.load(message)\n @logger.info(\"received check request\", :check => check)\n process_check_request(check)\n rescue MultiJson::ParseError => error\n @logger.error(\"failed to parse the check request payload\", {\n :message => message,\n :error => error.to_s\n })\n end\n end\n end\n end", "title": "" }, { "docid": "0ee055d104b2e1a49ce1888ddc669d6a", "score": "0.57499087", "text": "def subscriptions\n @subscriptions ||= []\n end", "title": "" }, { "docid": "4100c38f8be960e70c419c42d5e75f83", "score": "0.5744699", "text": "def successful_unsubscribe\n end", "title": "" }, { "docid": "c0ffeb0e61a9a2378f9aa823286d2aa3", "score": "0.57379436", "text": "def subscribe(sub)\n active_subscriptions.create(sub_id: sub.id)\n end", "title": "" }, { "docid": "7634a5768c1518868e05bf4cd50f1c5d", "score": "0.57244796", "text": "def subscribe\n @current_user.update!(\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n alerts: true,\n )\n end", "title": "" }, { "docid": "c590bb49c53a2d6ecd37a2824e56e1bd", "score": "0.5710281", "text": "def update_newsletter_subscription(user)\n if user.allow_news != user.allow_news_before_last_save\n if user.allow_news\n CreateNewsletterSubscription.call(user)\n else\n DestroyNewsletterSubscription.call(user)\n end\n elsif user.email_before_last_save && user.allow_news\n UpdateNewsletterSubscription.call(user)\n end\n end", "title": "" }, { "docid": "19c8375db507f163a1290cd3fc87ccb7", "score": "0.57086897", "text": "def set_subscriptions\n if subscriptions.empty?\n Subscription.new.defaults.each do |s|\n self.subscriptions.create(:category => s, :receive_mail => true)\n end\n elsif subscriptions.count == 1 && subscriptions.first.category == 'all'\n setting = subscriptions.first.receive_mail\n Subscription.new.defaults.each do |s|\n self.subscriptions.create(:category => s, :receive_mail => setting)\n end\n end\n end", "title": "" }, { "docid": "c55d4814071bdab06215c24596503c46", "score": "0.5706604", "text": "def subscribe\n if current_user\n @user = User.find(current_user.id)\n @user.update_attribute(:subscription_id, params[:id])\n redirect_to subscriptions_path\n else\n redirect_to new_user_session_path\n end\n end", "title": "" }, { "docid": "95606aeb19a25f3f66746b433112fbb3", "score": "0.57020134", "text": "def activate_subscription(id)\r\n# Subscription.new.activate(id)\r\n #Subscription.new.change_state(id, true)\r\n Subscription.new(id).change_state(true)\r\n end", "title": "" }, { "docid": "640d5e230f079ecbd5c6173c0af8664c", "score": "0.57017076", "text": "def unsubscribe!\n self.update_attributes(unsubscribed: true)\n end", "title": "" }, { "docid": "ad22a93acd887081bd055fdd40e524c2", "score": "0.56855124", "text": "def subscription=(new_subscription)\n raise 'Subscription already set' if @set\n\n @set = true\n should_unsubscribe = false\n old = nil\n @gate.synchronize do\n should_unsubscribe = @unsubscribed\n unless should_unsubscribe\n old = @current\n @current = new_subscription\n end\n end\n\n old.unsubscribe if old\n new_subscription.unsubscribe if should_unsubscribe && !new_subscription.nil? \n end", "title": "" }, { "docid": "fe714deb6b8d803f78fd5d8559caf8e7", "score": "0.56769425", "text": "def subscriptions\n\t\t@subscriptions_api ||= Glass::Api::Subscriptions.new(self)\n\tend", "title": "" }, { "docid": "17ed5103504f05ee38388a3a40d25b04", "score": "0.56743896", "text": "def set_subscription\n @subscription = Subscription.find_by_token(params[:id]) \n @subscription = Subscription.find(params[:id]) if @subscription.nil? and current_person # only allow if user logged in\n if @subscription.nil?\n forbidden\n else\n if @subscription.external_id && @subscription.updated_at < (Time.now - 1.hour) && [email protected]_point_put_required\n # If the subscription is linked (has external_id) \n # Use when person is returning to their subscription, after more than 1 hour.\n @subscription = nuw_end_point_reload(@subscription) \n end\n\n # blank these so they cannot be returned\n @subscription.card_number = \"\"\n @subscription.ccv = \"\"\n @subscription.account_number = \"\"\n @subscription.bsb = \"\"\n if @subscription.person\n @subscription.person.email = \"\" if temporary_email?(@subscription.person.email)\n @subscription.person.first_name = \"\" if temporary_first_name?(@subscription.person.first_name)\n @subscription.person.last_name = \"\" if temporary_last_name?(@subscription.person.last_name)\n end \n @subscription.signature_vector = \"\" unless current_person.present? || params[:pdf] == 'true' # users can't sign, but do see the signature; non-users always have to sign and don't see the sig\n end\n end", "title": "" }, { "docid": "8ac675396cfb7a0f170f5d5aa87bf19d", "score": "0.5674315", "text": "def subscriptions\n @subscriptions ||= Services::SubscriptionsService.new(@api_service)\n end", "title": "" }, { "docid": "0bd5c78fd42893d895b6b562754ad4ee", "score": "0.5660219", "text": "def mark_working!; self.status = 1 end", "title": "" }, { "docid": "0bd5c78fd42893d895b6b562754ad4ee", "score": "0.5660219", "text": "def mark_working!; self.status = 1 end", "title": "" }, { "docid": "239a55eef27c9fa3924cb127fea61b03", "score": "0.5660014", "text": "def create_subscription\n @subscription = @calendar.subscriptions.find_by_user_id(current_user.id)\n if @subscription.nil?\n @subscription = @calendar.subscriptions.build(user_id: current_user.id)\n @subscription.rw = false\n end\n @subscription.subscribed = true\n @subscription.title = unique_title\n if @subscription.save\n redirect_back_or current_user\n else\n flash[:error] = \"Error Subscribing to Calendar!\"\n redirect_back_or @current_user\n end\n end", "title": "" }, { "docid": "4787fc6aed71786826efca679c6ed4aa", "score": "0.5657898", "text": "def open\n self.state.subscribable = true\n self.state.save\n self\n end", "title": "" }, { "docid": "f659e553706e748ef6b07f9a281665b3", "score": "0.56558305", "text": "def subscribe(path, subscription)\n if folder_exists?(path)\n if (subscription != folder_is_subscribed?(path))\n if (subscription)\n @connection.subscribe(path)\n else\n @connection.unsubscribe(path)\n end\n end\n end\n end", "title": "" }, { "docid": "0238af48e1ce504aabffdb270eee38dc", "score": "0.565352", "text": "def unsubscribed(successful)\n puts \"Unsubscribe was successful.\" if successful\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.5650271", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.5650271", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.5650271", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "2c52c4094d54860da1c98f81801bd72e", "score": "0.5647881", "text": "def ensure_subscribed\n return if options.environment == :production\n\n raise Sage::BusinessLogic::Exception::AccessDeniedException, \"Not Subscribed\" if current_user.unsubscribed?\n raise Sage::BusinessLogic::Exception::ExpiredSubscriptionException, \"Subscription Expired\" if current_user.expired?\n end", "title": "" }, { "docid": "f3b3b571506629aadb945f57a5e5893f", "score": "0.5642602", "text": "def set_subscription\n *, @subscription = @service.get_subscription(params[:id])\n end", "title": "" }, { "docid": "2d8555e33c5a0f1f470edcd29c2a4478", "score": "0.56341875", "text": "def update_status\n # If a thesis has been set to 'Pending publication' or 'Published', this\n # method cannot change it; other methods will set/revert that status.\n return if ['Pending publication', 'Published', 'Publication error'].include? publication_status\n\n # Still here? Then we proceed...\n # By default, a thesis is set to 'Not ready for production'\n self.publication_status = 'Not ready for publication'\n # If all qualifying conditions are met, then we set status to\n # 'publication review'. This will leave unchanged a thesis that was\n # already set to 'Pending publication' via another method.\n self.publication_status = 'Publication review' if evaluate_status\n # Please note that the 'pending publiation' and 'published' statuses can\n # not be set via this method - they get assigned elsewhere.\n end", "title": "" }, { "docid": "0976892e2961a1e66f0c419b7a2d8385", "score": "0.5632975", "text": "def subscribe(subscription)\n if subscription.confirmed?\n if subscription.unsubscribed?\n raise \"Subscription #{subscription.id} is unsubscribed.\"\n else\n update_subscription(subscription)\n end\n else\n raise \"Subscription #{subscription.id} is not confirmed.\"\n end\n end", "title": "" }, { "docid": "0fc539bc6acbc1796c87cc226125e567", "score": "0.56320125", "text": "def update_account_state(chargify_subscription)\n if chargify_subscription.state == 'canceled' || chargify_subscription.state == 'expired' || chargify_subscription.state == 'suspended'\n self.account_suspended = true\n self.account_deleted_at = Time.now.utc\n self.save!\n else\n self.account_suspended = false\n self.account_deleted_at = nil\n self.save!\n end\n end", "title": "" }, { "docid": "753d3b61ce263a1562cfcb08300d1b7f", "score": "0.56308097", "text": "def active_subscription\n self.subscriptions.active.first\n end", "title": "" }, { "docid": "c014132cc6040e699126c38566b4c7cd", "score": "0.56275856", "text": "def perform id\n @subscription = Subscription.find id\n\n if @subscription.due?\n Services::Benchmark.measure benchmarkable: @subscription.subscribable do\n case @subscription.subscribable.class\n when Services::Facebook::Page then synchronize_facebook_page @subscription.subscribable\n when Services::Twitter::Timeline then synchronize_twitter_timeline @subscription.subscribable\n when Services::Twitter::Search then synchronize_twitter_search @subscription.subscribable\n end\n end\n\n # If the subscription's subscribable no longer exists or can no longer be accessed,\n # the subscription will have been destroyed.\n return if @subscription.destroyed?\n\n @subscription.notify\n end\n\n @subscription.deschedule\n # If another subscription for the same subject was processed after the subscription was enqueued\n # and the subject was destroyed, both subscriptions would be deleted from the database and the worker\n # would raise an error upon attempting to process it.\n #\n # One might argue that it would be more appropriate to simply deschedule other subscriptions,\n # but Mike Perham of Sidekiq disagrees and has not facilitated for doing so:\n #\n # https://github.com/mperham/sidekiq/pull/257\n rescue Mongoid::Errors::DocumentNotFound\n end", "title": "" } ]
f03025671123a6268471e0587f1ac12d
Returns the value of attribute environment. source://sprockets//lib/sprockets/manifest.rb22
[ { "docid": "49f00bfaa492bf1bf2e814fe53c3b20c", "score": "0.5946017", "text": "def environment; end", "title": "" } ]
[ { "docid": "5382fa64c9f2a4b64e7b54c6cc3f2c65", "score": "0.7117829", "text": "def environment\n global_params[:environment]\n end", "title": "" }, { "docid": "fd8efbaf695c304aa7bb8c3c14ce531e", "score": "0.6895187", "text": "def env_tag\n env = provision_object.get_tags[:environment]\n return env[0, 3] unless env.blank?\n end", "title": "" }, { "docid": "fd8efbaf695c304aa7bb8c3c14ce531e", "score": "0.6895187", "text": "def env_tag\n env = provision_object.get_tags[:environment]\n return env[0, 3] unless env.blank?\n end", "title": "" }, { "docid": "fd8efbaf695c304aa7bb8c3c14ce531e", "score": "0.6895187", "text": "def env_tag\n env = provision_object.get_tags[:environment]\n return env[0, 3] unless env.blank?\n end", "title": "" }, { "docid": "3014a86d274d8593a52846062cf3e9bf", "score": "0.6738209", "text": "def env\n @config[\"env\"][environment]\n end", "title": "" }, { "docid": "80b869536a88bf5ec35eb7032ed646b3", "score": "0.66763085", "text": "def environment\n Rails.env\n #\"production\" # uncomment for quick testing.\n end", "title": "" }, { "docid": "2ea5a350aa32fe9c93c9e5e5624cb17f", "score": "0.6611041", "text": "def assets_environment\n Helpers.environment || environment\n end", "title": "" }, { "docid": "396e0507d5b7f91c922573d2a2811d60", "score": "0.65895617", "text": "def environment\n settings[:environment]\n end", "title": "" }, { "docid": "368663230ab496c84dc23b46da57f02c", "score": "0.6555795", "text": "def sprockets_environment\n options[:sprockets][:environment]\n end", "title": "" }, { "docid": "368663230ab496c84dc23b46da57f02c", "score": "0.6555795", "text": "def sprockets_environment\n options[:sprockets][:environment]\n end", "title": "" }, { "docid": "7c4a436ed157b9cd796371319f7b06ac", "score": "0.6550707", "text": "def environment \n if exists?(:stage)\n stage.to_s\n elsif exists?(:rails_env)\n rails_env.to_s\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV'].to_s\n else\n \"production\" \n end\nend", "title": "" }, { "docid": "03dcdba79530b254f84d842ad2132ed0", "score": "0.6523597", "text": "def environment\n config[:environment]\n end", "title": "" }, { "docid": "2c7b548e3dc040ae137b1b638991a7d6", "score": "0.64604306", "text": "def environment\n if exists?(:stage)\n stage\n elsif exists(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend", "title": "" }, { "docid": "a9c744e06ba6c2045f639215c1c1e0e0", "score": "0.64457685", "text": "def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend", "title": "" }, { "docid": "a9c744e06ba6c2045f639215c1c1e0e0", "score": "0.64457685", "text": "def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend", "title": "" }, { "docid": "588467eb2851b25df3e21a778f619c09", "score": "0.6417367", "text": "def environment\n @options[:environment]\n end", "title": "" }, { "docid": "588467eb2851b25df3e21a778f619c09", "score": "0.6417367", "text": "def environment\n @options[:environment]\n end", "title": "" }, { "docid": "5cc23227195af973d332e177b730c8e8", "score": "0.6403461", "text": "def environment \n #if exists?(:stage)\n # stage\n #elsif exists?(:rails_env)\n if exists?(:rails_env)\n rails_env \n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\" \n end\nend", "title": "" }, { "docid": "4f79972107482c02241799647fa3ae60", "score": "0.6402322", "text": "def environment\n Rails.env\n end", "title": "" }, { "docid": "cf2b8a01d262c9c96630225616146ddb", "score": "0.639208", "text": "def environment\n @env\n end", "title": "" }, { "docid": "f7c7b23669c0fd62e6e896d9993853e1", "score": "0.6377556", "text": "def environment\n opts[:environment]\n end", "title": "" }, { "docid": "82828c6729a1b9a4d582119a852b7bf6", "score": "0.63478327", "text": "def environment\n ::RAILS_ENV\n end", "title": "" }, { "docid": "6ec063ca055467ca50bf22d66e1dc06e", "score": "0.6338891", "text": "def environment\n @environment ||= \"development\" \n @environment ||= ::Rails.env if defined? ::Rails\n @environment\n end", "title": "" }, { "docid": "a776b1a3a36e2fcc5b4d5f174974fe1d", "score": "0.63381404", "text": "def environment_name\n environment['name']\n end", "title": "" }, { "docid": "ce11182056d9a75004be84d7b8d9c8a4", "score": "0.63291144", "text": "def value\n ENV[key]\n end", "title": "" }, { "docid": "545bf33c7c7e6c2473d461a64e4d0360", "score": "0.6324845", "text": "def env\n @environment\n end", "title": "" }, { "docid": "a6ff174dd65ec2b1a3b17540e224c9f9", "score": "0.6317091", "text": "def assets_env\n return :development unless ENV['RACK_ENV'] == 'production'\n ENV['LOCAL_ASSETS'] ? :local_assets : :production\n end", "title": "" }, { "docid": "c87bbd30d11d787e9a1674d7c76e61e8", "score": "0.630657", "text": "def environment_name\n dna['environment']['name']\n end", "title": "" }, { "docid": "f4455e5d50df8f3575e1489b72f938a7", "score": "0.6305098", "text": "def env\n ENV\n end", "title": "" }, { "docid": "0f15d28ad2c3264b6e5df448dbe3dcd3", "score": "0.63028514", "text": "def environment\n @environment\n end", "title": "" }, { "docid": "ab3a162c61e519d2ca97834afe9f43a6", "score": "0.6296663", "text": "def getEnv; end", "title": "" }, { "docid": "894cea4933bc51f5f2f8f16f7fc02e33", "score": "0.6285", "text": "def read_environment\n\n end", "title": "" }, { "docid": "bfa99344fb8b4eadde01c356ba73e2e4", "score": "0.6280192", "text": "def environment_version; end", "title": "" }, { "docid": "da4fbfa7dce7879a6ff2f4a04b34ef41", "score": "0.6278909", "text": "def env\n ENV\n end", "title": "" }, { "docid": "da4fbfa7dce7879a6ff2f4a04b34ef41", "score": "0.6278909", "text": "def env\n ENV\n end", "title": "" }, { "docid": "da4fbfa7dce7879a6ff2f4a04b34ef41", "score": "0.6278909", "text": "def env\n ENV\n end", "title": "" }, { "docid": "da4fbfa7dce7879a6ff2f4a04b34ef41", "score": "0.6278909", "text": "def env\n ENV\n end", "title": "" }, { "docid": "da4fbfa7dce7879a6ff2f4a04b34ef41", "score": "0.6278909", "text": "def env\n ENV\n end", "title": "" }, { "docid": "e3d5cdff1f994286f06db87fee14eef6", "score": "0.6272627", "text": "def environment\n if env[\"STATSD_ENV\"]\n env[\"STATSD_ENV\"]\n elsif defined?(Rails) && Rails.respond_to?(:env)\n Rails.env.to_s\n else\n env[\"RAILS_ENV\"] || env[\"RACK_ENV\"] || env[\"ENV\"] || \"development\"\n end\n end", "title": "" }, { "docid": "5bf1b261924b2cdc6ac7f6d78918e8c8", "score": "0.62699604", "text": "def environment\n @environment ||= read_environment :instance, \"RAILS_ENV\", \"RACK_ENV\", :default\n end", "title": "" }, { "docid": "9cbc13ec684ee0afac7b137c22c321ad", "score": "0.62586254", "text": "def environment\r\n if @@capistrano_instance.exists?(:rails_env)\r\n @@capistrano_instance.fetch(:rails_env)\r\n elsif @@capistrano_instance.exists?(:rack_env)\r\n @@capistrano_instance.fetch(:rack_env)\r\n elsif @@capistrano_instance.exists?(:stage)\r\n @@capistrano_instance.fetch(:stage)\r\n elsif(ENV['RAILS_ENV'])\r\n ENV['RAILS_ENV']\r\n else\r\n puts \"------------------------------------------------------------------\"\r\n puts \"- Stage, rack or rails environment isn't set in -\"\r\n puts \"- :stage or :rails_env or :rack_env, defaulting to 'production' -\"\r\n puts \"------------------------------------------------------------------\"\r\n \"production\"\r\n end\r\n end", "title": "" }, { "docid": "6a3bd7b0a6d10491407676541aeb259b", "score": "0.62480015", "text": "def environment\n @environment ||= ENV.map do |key, value|\n \"#{key}=#{value}\"\n end\n end", "title": "" }, { "docid": "1c29d824eef9c725ccd70c3031c65d2e", "score": "0.62172127", "text": "def aps_environment\n @dict['aps-environment']\n end", "title": "" }, { "docid": "6ecb646c3104d3d25219d63a13887a6b", "score": "0.6215969", "text": "def rails_env(_attachment, _style_name)\n Rails.env\n end", "title": "" }, { "docid": "d5841df4e0c4e57324d259977d20ec07", "score": "0.62130123", "text": "def env\n @env\n end", "title": "" }, { "docid": "d5841df4e0c4e57324d259977d20ec07", "score": "0.62130123", "text": "def env\n @env\n end", "title": "" }, { "docid": "d5841df4e0c4e57324d259977d20ec07", "score": "0.62130123", "text": "def env\n @env\n end", "title": "" }, { "docid": "a128e7190ac50aad5020cfd2f7acb934", "score": "0.6198399", "text": "def asset_env_index\n ASSET_ENVIRONMENT.index\n end", "title": "" }, { "docid": "219bacc1c586b18aad990790cf40213c", "score": "0.61899066", "text": "def environment_variables\n @environment_variables\n end", "title": "" }, { "docid": "b7a096bc282c3f847fd83bf5c2a7e80f", "score": "0.6181667", "text": "def environment=(value)\n @environment = value\n end", "title": "" }, { "docid": "b7a096bc282c3f847fd83bf5c2a7e80f", "score": "0.6181667", "text": "def environment=(value)\n @environment = value\n end", "title": "" }, { "docid": "3e978c0b0a4af6579dfb27f8c5abcda2", "score": "0.61762303", "text": "def environment_name\n environment.name\n end", "title": "" }, { "docid": "a55a31462e6253c770813c197cdc82da", "score": "0.6156073", "text": "def environment=(e)\n @environment = e.to_s\n end", "title": "" }, { "docid": "8fa6499f0551593cda12aa7c32fccbfc", "score": "0.61480397", "text": "def environment_vars\n self.resolved_data['environment_vars'].to_h\n end", "title": "" }, { "docid": "e3c99085880e23145d78d530626e15b5", "score": "0.6145681", "text": "def envvar\n CircleCi.request(\"#{base_path}/envvar\").get\n end", "title": "" }, { "docid": "0baea80e75dd975f635a84887b8e28e2", "score": "0.6124005", "text": "def env\n if @production\n :production\n else\n :test\n end\n end", "title": "" }, { "docid": "6037f55d4bc346092dfee55f2724567e", "score": "0.6118824", "text": "def env\n Rails.env\n end", "title": "" }, { "docid": "8abe7941bc2cc2431df63fbc2f849405", "score": "0.6118153", "text": "def project_environment\n $environment\nend", "title": "" }, { "docid": "e5b153f9cec6c203987d3c5662f2adca", "score": "0.6117626", "text": "def environment\n @environment ||= :development\n end", "title": "" }, { "docid": "4d3ed275b3df9676a5039e3374353d56", "score": "0.6115534", "text": "def environment\n self.options[:environment] || self.options[:e] || self.options[:env] || 'development'\n end", "title": "" }, { "docid": "4d3ed275b3df9676a5039e3374353d56", "score": "0.6115534", "text": "def environment\n self.options[:environment] || self.options[:e] || self.options[:env] || 'development'\n end", "title": "" }, { "docid": "06b556d52a2b191831819a61fb527856", "score": "0.6115138", "text": "def env\n @env\n end", "title": "" }, { "docid": "06b556d52a2b191831819a61fb527856", "score": "0.6115138", "text": "def env\n @env\n end", "title": "" }, { "docid": "c1020ca0758d7250c563f9a48d24dc31", "score": "0.61120903", "text": "def env\n @env\n end", "title": "" }, { "docid": "b5d8430b68e34bb1ce825b967b66e423", "score": "0.61087215", "text": "def environment\n environment_variables.map{ |v| ENV[v] }.join(':')\n end", "title": "" }, { "docid": "b0f7f5242bba74e099058540c4323174", "score": "0.6101058", "text": "def env\n if @production\n :production\n else\n :test\n end\n end", "title": "" }, { "docid": "756b573118501b24c3cb13947fe8ec16", "score": "0.6094701", "text": "def manifest\n m = current_environment.manifest\n if m == Puppet::Node::Environment::NO_MANIFEST\n nil\n else\n m\n end\n end", "title": "" }, { "docid": "7e82d447bec0727f0f089270c6e978bb", "score": "0.60907394", "text": "def environment\n @environment ||= Cabar::Environment.new(@env_var)\n end", "title": "" }, { "docid": "845fbdd47fe9312a253eca34178e7837", "score": "0.6079461", "text": "def environment_descriptor\n if Rails.env.development?\n 'Local'\n elsif Socket.gethostname =~ /(local|dev|stage)\\./\n Regexp.last_match.captures\n .first\n .gsub('dev', 'development')\n .humanize\n end\n end", "title": "" }, { "docid": "37ea91bbe3e67be7a9a8249cffaa836a", "score": "0.60769105", "text": "def env_key; end", "title": "" }, { "docid": "37ea91bbe3e67be7a9a8249cffaa836a", "score": "0.60769105", "text": "def env_key; end", "title": "" }, { "docid": "00698f46216b59c91449f700825159b1", "score": "0.6076543", "text": "def environment\n environment = 'development'\n\n if ARGV.last.match(/(development|production)/)\n environment = ARGV.last\n end\n \n return environment\nend", "title": "" }, { "docid": "00698f46216b59c91449f700825159b1", "score": "0.6076543", "text": "def environment\n environment = 'development'\n\n if ARGV.last.match(/(development|production)/)\n environment = ARGV.last\n end\n \n return environment\nend", "title": "" }, { "docid": "821e61531922c733d4c821d1a97593ad", "score": "0.60749507", "text": "def get_env cle\n ENV[cle]\n end", "title": "" }, { "docid": "0a81d4612b0705eda33ed4529b76a0ee", "score": "0.60749", "text": "def name\n @environment['name']\n end", "title": "" }, { "docid": "db47066076de5f12ad4c62d7c8a4aa2e", "score": "0.60678256", "text": "def env\n Rails.env\n end", "title": "" }, { "docid": "a32035b480a5ecf996b009b45872d935", "score": "0.6067507", "text": "def environment_info()\n \"#{@env_id}<info\"\n end", "title": "" }, { "docid": "f29af5002f83ddf9c8511cd39385563e", "score": "0.60631716", "text": "def environment\n RACK_ENV\n end", "title": "" }, { "docid": "816116eb31f6250112d59904bf79304a", "score": "0.60629463", "text": "def environment\n @environment ||= self.detect_environment\n end", "title": "" }, { "docid": "c7127237a86792643ca8cab8a0d32061", "score": "0.60439336", "text": "def env\n @@env ||= (ENV['ENV'].to_sym || :production)\n end", "title": "" }, { "docid": "f6accc65fb5fe291c9abc09e287975a4", "score": "0.6035052", "text": "def environment\n sandbox? ? :sandbox : :production\n end", "title": "" }, { "docid": "edb610cceb632aab8e4f20453c5b71a7", "score": "0.6027784", "text": "def environment\n if defined?(RAILS_ENV)\n RAILS_ENV # Rails 2\n elsif defined?(Rails) && defined?(Rails.env)\n Rails.env.to_s # Rails 3\n elsif ENV.key?('RACK_ENV')\n ENV['RACK_ENV']\n else\n 'development'\n end\n end", "title": "" }, { "docid": "3678c4359ac9e821ea1d2d64a7f4c0a4", "score": "0.6023055", "text": "def get\n load_yaml unless @loaded\n @loaded = true\n self[assets_env]\n end", "title": "" }, { "docid": "dfc8ac82231917a4f1fc16f4b64c1725", "score": "0.601321", "text": "def enviroment_name \n\t(ENV['ENVIROMENT']||= 'qa').downcase.to_sym \nend", "title": "" }, { "docid": "f588d484e0d5188ee94cffa4cf059816", "score": "0.6011236", "text": "def environment(environment = nil)\n @environment = environment if environment\n (@environment || ENV['TBK_COMMERCE_ENVIRONMENT'] || :production).to_sym\n end", "title": "" }, { "docid": "2242d007a29e33dd05fd6a85728be4b0", "score": "0.6007572", "text": "def environment=(value)\n super value.to_s\n end", "title": "" }, { "docid": "08031ace69f4f3406235177205d030d0", "score": "0.6003618", "text": "def current_environment; end", "title": "" }, { "docid": "239eeb5e376c4798550a8f9e456af7a0", "score": "0.5994151", "text": "def rails_env(attachment, style_name)\n 'test'\n end", "title": "" }, { "docid": "6348e558a2bb8b40b76954366ca5a634", "score": "0.59844565", "text": "def env\n @_env\n end", "title": "" }, { "docid": "1c38cc830935cbe49355bbdacd5849dc", "score": "0.59597445", "text": "def [](*attributes)\n x=config\n if normalized(attributes.first) == 'environment'\n x = config[normalize(:environment)]\n else \n attributes.each { |att| \n break if x.nil?\n x = env_dependent_value(x[normalize(att)])\n }\n end\n x\n end", "title": "" }, { "docid": "6455b9b680dbd5a9018696e44897f319", "score": "0.59529644", "text": "def assets_version\n ENV[\"RAILS_ASSET_ID\"] || ''\n end", "title": "" } ]
76c9a0afcd10e67de15a5ef6984e2001
Delete queue in all usable brokers or all selected brokers that are usable === Parameters name(String):: Queue name options(Hash):: Queue declare options plus :brokers(Array):: Identity of brokers in which queue is to be deleted === Return identities(Array):: Identity of brokers where queue was deleted
[ { "docid": "98a5e3220bb4e9ef27ec9b258b14027e", "score": "0.8040815", "text": "def delete(name, options = {})\n identities = []\n u = usable\n brokers = options.delete(:brokers)\n ((brokers || u) & u).each { |i| identities << i if (b = @brokers_hash[i]) && b.delete(name, options) }\n identities\n end", "title": "" } ]
[ { "docid": "0276b293004dce2f8c847811bc3071bf", "score": "0.800236", "text": "def delete_amqp_resources(name, options = {})\n identities = []\n u = usable\n ((options[:brokers] || u) & u).each { |i| identities << i if (b = @brokers_hash[i]) && b.delete_amqp_resources(:queue, name) }\n identities\n end", "title": "" }, { "docid": "887e2c1c68ebe00a87c61d5fe13d59a9", "score": "0.64091444", "text": "def delete(brokers)\n remove(brokers.first)\n VCAP::CloudController::Jobs::DeleteActionJob::NO_ERRORS\n rescue\n brokers.first.update(state: VCAP::CloudController::ServiceBrokerStateEnum::DELETE_FAILED)\n raise\n end", "title": "" }, { "docid": "91093b54e14ff5364e3643e62e2a91aa", "score": "0.6346231", "text": "def delete(name)\n if queues[name]\n queues.delete(name)\n else\n raise 'NonExistentQueue'\n end\n end", "title": "" }, { "docid": "5194746263f1650653496f42f215d291", "score": "0.62312686", "text": "def destroy\n @service.queues.delete(@name)\n end", "title": "" }, { "docid": "869b8451863d8e4fe6ed20ac0abbdc20", "score": "0.61838055", "text": "def delete\n @redis.del @queue_name\n @redis.keys(\"#{@queue_name}:*\").each do |key|\n @redis.del key\n end\n @redis.srem \"timberline_queue_names\", @queue_name\n end", "title": "" }, { "docid": "3815c20cdb45838b6504ebb6150815f6", "score": "0.6102289", "text": "def delete opts = {}\n @mq.callback{\n @mq.send Protocol::Queue::Delete.new({ :queue => name,\n :nowait => true }.merge(opts))\n }\n @mq.queues.delete @name\n nil\n end", "title": "" }, { "docid": "b6dfe7316db2dd48153a45ff222e268d", "score": "0.6077394", "text": "def queues\n @queues.map { |name| name.gsub(/^remq\\:/, '') }\n end", "title": "" }, { "docid": "d21c158940a94e4e17eb8d84458530fc", "score": "0.60588664", "text": "def remove_from_queue_list\n puts \"Removing #{@consumer_name} from Queue List\"\n @redis_conn.hdel('decoupled.consumers', @consumer_name)\n end", "title": "" }, { "docid": "5a7aed340ebd25f022d1214ef9ca17d9", "score": "0.591976", "text": "def del_q(name)\n # Should I shut it down first? Is there a way to tell a queue to stop accepting input,\n # wait until it's empty then go away? Future enhancement\n @log.info(\"Controller: Deleting Queue: #{name}\")\n @queues.delete(name)\n end", "title": "" }, { "docid": "9b2c08a5fab182ab31527b19c864b409", "score": "0.5903437", "text": "def dequeue_all\n queued_jobs.map(&:delete)\n end", "title": "" }, { "docid": "815d62fa9d03a547ff620f678a44c35a", "score": "0.5816658", "text": "def delete_queue(queue_name)\n channel.queue_delete(queue_name)\n end", "title": "" }, { "docid": "548f61beaf30c565d62e9b14d3c43360", "score": "0.57252264", "text": "def remove_from_queue_list\n puts \"Removing #{@consumer_name} from Queue List\"\n @redis_conn.hdel('decoupled.schedulers', @consumer_name)\n end", "title": "" }, { "docid": "61af05143c94c030207e883eb1418613", "score": "0.5716024", "text": "def delete_queue(queue)\n entries = show_queue(queue)\n return 0 if entries.blank?\n\n entries.map do |entry|\n idelete(get_qnid(queue, entry))\n end.length\n end", "title": "" }, { "docid": "a8161d4f6eab2da96c000b518c3230d8", "score": "0.5674403", "text": "def queue_delete(name, opts = {})\n raise_if_no_longer_open!\n\n @connection.send_frame(AMQ::Protocol::Queue::Delete.encode(@id,\n name,\n opts[:if_unused],\n opts[:if_empty],\n false))\n with_continuation_timeout do\n @last_queue_delete_ok = wait_on_continuations\n end\n raise_if_continuation_resulted_in_a_channel_error!\n\n @last_queue_delete_ok\n end", "title": "" }, { "docid": "d0ee50a92ca91c068f613d65e37d4d7e", "score": "0.56742287", "text": "def delete_queue(queue_name)\n raise NonEmptyQueue unless find_queue(queue_name).empty?\n queues.delete(queue_name)\n end", "title": "" }, { "docid": "f5427bc97a443968aa7c1e40a1406c6e", "score": "0.55934376", "text": "def delete_multi(names, options = T.unsafe(nil)); end", "title": "" }, { "docid": "4a08c54d8d090cae522b0f093b029515", "score": "0.5592754", "text": "def delete_all(mailbox = T.unsafe(nil)); end", "title": "" }, { "docid": "3839cf39333d65409046b6661cc4153c", "score": "0.5567658", "text": "def delete_all(name, options = {})\n versions(name).collect { |version| future(:delete, name, version, options) }.map(&:value)\n end", "title": "" }, { "docid": "0c9131fd35bc4e09133af91d87c3d1d8", "score": "0.5521458", "text": "def delete_many(shard_id, table_name, ids)\n if table_name == TABLE_NAMES[:node]\n # Cascade deletions\n delete_wires_for_nodes(shard_id, ids)\n delete_messages_for_nodes(shard_id, ids)\n end\n table = get_table(shard_id, table_name)\n table.delete(ids)\n end", "title": "" }, { "docid": "1d592c8dbe4bfd4d94688d26af3a1300", "score": "0.54691494", "text": "def remove_queue(name)\n @queues.delete(ReMQ.normalize_queue_name(name))\n end", "title": "" }, { "docid": "7978edd10a6dd8beb946f7d39f54e31d", "score": "0.5468444", "text": "def clear_all\n @queues&.values&.each { |e| e.clear }\n end", "title": "" }, { "docid": "5420e483e4fffed605ce0516e6a72128", "score": "0.546015", "text": "def destroy_all_jobs_for(name)\n pattern = \"*#{name}_*\"\n storage.del(*storage.keys(pattern)) unless storage.keys(pattern).empty?\n end", "title": "" }, { "docid": "35db363b121604002b3604e4d36b2704", "score": "0.5450282", "text": "def purge_queue!\n queue.map(&:delete)\n end", "title": "" }, { "docid": "28835a302ab2aa6544a0283e68669267", "score": "0.54386437", "text": "def delete(force=false)\n @sqs.interface.delete_queue(@url, force)\n end", "title": "" }, { "docid": "6c6d1410065c9314b0f72e2e443a4f89", "score": "0.5425849", "text": "def delete(force=false)\n @sqs.interface.delete_queue(@url)\n end", "title": "" }, { "docid": "f521ba426a1ebfd58f2f1e12c4d6d275", "score": "0.5425175", "text": "def queues\n hive.map {|b| b.private? ? nil : b.queue_name }.compact\n end", "title": "" }, { "docid": "4b0b9e0485d2c2cb7f6dd1f4f095ce67", "score": "0.54203427", "text": "def delete\n # Get the list of clients and delete us first\n clients = nil\n redis.multi do\n clients = redis.smembers(redis_key(\"user(clients):#@name\"))\n nonatomic_delete\n end\n\n unless clients.value.empty?\n # Grab client information\n clients = clients.value.zip(redis.hmget(redis_key(\"clients\"), clients.value)).map { |(client_name, client_json)|\n client_json ? Client.new(client_name, client_json) : nil\n }.reject(&:nil?)\n\n # Delete them all\n redis.multi do\n clients.each &:nonatomic_delete\n end\n end\n end", "title": "" }, { "docid": "4d7d14700a9cd253618cf9cafae9054a", "score": "0.54107267", "text": "def delete_queue(userid)\n task_opts = {\n :action => \"deleting Cloud Volume Backup for user #{userid}\",\n :userid => userid\n }\n\n queue_opts = {\n :class_name => self.class.name,\n :method_name => 'delete',\n :instance_id => id,\n :role => 'ems_operations',\n :queue_name => ext_management_system.queue_name_for_ems_operations,\n :zone => ext_management_system.my_zone,\n :args => []\n }\n\n MiqTask.generic_action_with_callback(task_opts, queue_opts)\n end", "title": "" }, { "docid": "ba74f8e06be38d14814df19493004e60", "score": "0.5401158", "text": "def delete_pools pool_names\n pool_names.map {|pool_name| delete_pool pool_name}.flatten 1\n end", "title": "" }, { "docid": "3783b3dfaf2cf875989a64e6ce1dcade", "score": "0.5369339", "text": "def queue_delete(name, if_empty = false, if_unused = false)\n converting_rjc_exceptions_to_ruby do\n @delegate.queue_delete(name, if_empty, if_unused)\n end\n end", "title": "" }, { "docid": "e91a638dc9154995467de4e4ad6999ad", "score": "0.5363287", "text": "def delete(host, queue)\n redis_del_hash(\"#{key_prefix}:#{host}\", queue)\n end", "title": "" }, { "docid": "e85b86228448ca902ec8ac9997d357bf", "score": "0.5362237", "text": "def delete(*names)\n names.each { |name| commands.delete name }\n end", "title": "" }, { "docid": "459dfb2944794f653e07d840ac2bffa2", "score": "0.5360735", "text": "def delete_all\n each { |msg| delete(msg) }\n clear\n end", "title": "" }, { "docid": "595d1af301335d12786bb43ed91efac6", "score": "0.5351179", "text": "def dequeue_all\n @queue.dequeue_all\n end", "title": "" }, { "docid": "595d1af301335d12786bb43ed91efac6", "score": "0.5351179", "text": "def dequeue_all\n @queue.dequeue_all\n end", "title": "" }, { "docid": "076d76a999f8ee489b65595ad06215e3", "score": "0.53443485", "text": "def queue_names; [@queue_name]; end", "title": "" }, { "docid": "51f8b04b23d70fa5087be416a0542762", "score": "0.53418124", "text": "def queues(conn, &block)\n conn.sscan(\"queues\").each(&block)\n end", "title": "" }, { "docid": "139e4ed3ca78fae9075101a00ae7d12b", "score": "0.53330845", "text": "def deletehosts\n assert_privileges(\"host_delete\")\n delete_elements(Host, :process_hosts)\n end", "title": "" }, { "docid": "139e4ed3ca78fae9075101a00ae7d12b", "score": "0.53330845", "text": "def deletehosts\n assert_privileges(\"host_delete\")\n delete_elements(Host, :process_hosts)\n end", "title": "" }, { "docid": "7c7396b5bec84d85319a697f93af0d3e", "score": "0.5324843", "text": "def destroy_star_network(name, size)\n for i in 0..(size - 1)\n bridge = name + i.to_s() + \"br\"\n `ruby xlxc-destroy.rb -n #{name + i.to_s()}`\n `ruby xlxc-bridge.rb -b #{bridge} --del`\n end\nend", "title": "" }, { "docid": "728e2576a45f0ad93ee6b899bdf91dd5", "score": "0.5324491", "text": "def delete(*tasks)\n @queue.delete(*tasks)\n end", "title": "" }, { "docid": "e51d1555de135205e476372b77fac7ba", "score": "0.5323636", "text": "def queue_purge(name)\n converting_rjc_exceptions_to_ruby do\n @delegate.queue_purge(name)\n end\n end", "title": "" }, { "docid": "42765dca1e9ffdad90c908bc2e623b49", "score": "0.5301661", "text": "def delete_all(*args, &block); end", "title": "" }, { "docid": "b2d2c5bc0ff339d0dbcc917994d8a807", "score": "0.52971375", "text": "def delete_command\n if Sparrow::Queue.delete(!args[1])\n logger.info \"Deleting queue - #{args[1]}\"\n publish DELETED\n else\n publish NOT_FOUND\n end\n end", "title": "" }, { "docid": "256d14ca8aa68b1d8c5e0e492597db8a", "score": "0.52970016", "text": "def remove_all(*classes)\n # Delete by query not supported by queue, so send to server\n queue.session.remove_all(*classes)\n end", "title": "" }, { "docid": "b95b1133d87d3cc60cef0d2a1edbf156", "score": "0.5291426", "text": "def purge\n @queues = {}\n end", "title": "" }, { "docid": "ba948c94a69cbdc5ea1a642361cf6060", "score": "0.52871066", "text": "def queues\n Array(redis.smembers(:queues))\n end", "title": "" }, { "docid": "ba948c94a69cbdc5ea1a642361cf6060", "score": "0.52871066", "text": "def queues\n Array(redis.smembers(:queues))\n end", "title": "" }, { "docid": "2287199034c1217fedf70038c299d75b", "score": "0.5285696", "text": "def delete_queueing_method(opts)\n opts = check_params(opts,[:queues])\n super(opts)\n end", "title": "" }, { "docid": "2db1b55916634aaad58cfde33d74a0a7", "score": "0.5285299", "text": "def delete_all(client, name, options = {})\n versions(client, name).each do |version|\n delete(client, name, version, options)\n end\n end", "title": "" }, { "docid": "574f0428c696f433c054b681e988ce6a", "score": "0.52570456", "text": "def delete_all(*ids)\n ids_to_keys(ids).each{ |key| connection.delete(key) }\n end", "title": "" }, { "docid": "4af65dbbd5d004de0af97926820ebcc0", "score": "0.52458245", "text": "def clear_all\n Queues.clear_all\n end", "title": "" }, { "docid": "7296a3d7cc15124651d0eded6cbdbea4", "score": "0.52452207", "text": "def drop_cnames\n return # done\n [\n ].each do |cn|\n @infoblox.delete_cname(cname: cn)\n end\nend", "title": "" }, { "docid": "f528bccd495fee44a023c763d6a27366", "score": "0.5225832", "text": "def delete(sgs_to_delete)\n\tec2 = AWS::EC2.new\n\tsgs_to_delete.each do |id|\n\t\[email protected](\"deleting #{id}\")\n\t\tbegin\n\t\t\tec2.security_groups[id].delete\n\t\trescue AWS::EC2::Errors::DependencyViolation => e\n\t\t\[email protected](\"unable to delete security group #{id} because of dependancy\") \n\t\trescue AWS::EC2::Errors::CannotDelete => e\n\t\t\[email protected](\"cannot delete the default sg\")\n\t\tend\n\tend\nend", "title": "" }, { "docid": "af76e845b869e03668d4d6681880f0b1", "score": "0.522108", "text": "def delete(selections)\n title_message(\"Deleting Branches\")\n selections.each do |s|\n s.delete\n puts \"- #{s}\"\n end\n confirmation_message\n end", "title": "" }, { "docid": "247de010ad50d4748abff10cca36d2dc", "score": "0.52167", "text": "def delete_list(nonce_list)\n _resetCount()\n runRedisTransaction(hpk_tag, @hpk, 'delete list') do\n nonce_list.each do |nonce|\n _delete_item nonce\n logger.info \"#{INFO} #{RED}deleting #{GREEN}#{dumpHex nonce.from_b64}#{ENDCLR} in mbx #{MAGENTA}#{dumpHex @hpk.from_b64}#{ENDCLR}\"\n end\n end\n end", "title": "" }, { "docid": "0d0bc5171dcfef7d6e809b07a4bd1b23", "score": "0.5215303", "text": "def delete_mailbox!(name)\n @connection.delete(name)\n true\n end", "title": "" }, { "docid": "f47962bb5730762c747ce0f6e31ec433", "score": "0.5204441", "text": "def brokers(timeout=0)\n unless @curator.started?\n @curator.start\n end\n\n brokers = []\n @curator.children.for_path(BROKERS_PATH).each do |id|\n path = \"#{BROKERS_PATH}/#{id}\"\n brokers << @curator.data.for_path(path).to_s\n end\n return brokers\n end", "title": "" }, { "docid": "a27495318071dd91a782d07ac4e65416", "score": "0.5202898", "text": "def destroy_connected_network(name, size)\n bridge = name + \"br\"\n for i in 0..(size - 1)\n `ruby xlxc-destroy.rb -n #{name + i.to_s()}`\n end\n `ruby xlxc-bridge.rb -b #{bridge} --del`\nend", "title": "" }, { "docid": "34d5acdfdae4e0748fc4b08803bd2069", "score": "0.5201711", "text": "def idelete(qnid)\n queue = qnid.split(':').first\n redis.multi do\n redis.del(rk_args(qnid))\n redis.zrem(rk_deferred, qnid)\n redis.lrem(rk_queue(queue), 0, qnid)\n end\n end", "title": "" }, { "docid": "2616d60d82591765ffe627831f033bd2", "score": "0.5195355", "text": "def delete(opts = {})\n @channel.deregister_exchange(self)\n @channel.exchange_delete(@name, opts) unless predeclared?\n end", "title": "" }, { "docid": "2616d60d82591765ffe627831f033bd2", "score": "0.5195355", "text": "def delete(opts = {})\n @channel.deregister_exchange(self)\n @channel.exchange_delete(@name, opts) unless predeclared?\n end", "title": "" }, { "docid": "ecb4453a6580638e702d7cbc6746dab3", "score": "0.5190917", "text": "def destroy_all\n params[:jobs_queue_ids].each do |jobs_queue_id|\n jobs_queue = JobsQueue.find(jobs_queue_id)\n jobs_queue.destroy if current_user.groups.default.first.jobs_queues.include?(jobs_queue) and jobs_queue.jobs.size.zero?\n end unless params[:jobs_queue_ids].blank?\n \n respond_to do |format|\n format.html { redirect_to(jobs_queues_url(:show => params[:show], :sort => params[:sort], :search => params[:search])) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "30f32b4c388a78d15fe5bf47392a4267", "score": "0.51829416", "text": "def remove_all!(*classes)\n # Delete by query not supported by queue, so send to server\n queue.session.remove_all!(*classes)\n end", "title": "" }, { "docid": "ec383369fa9beb40d74e1b0a12f549b2", "score": "0.51806515", "text": "def nuke_q(q_name)\n generic_nuke(:queue, q_name) \n end", "title": "" }, { "docid": "d64501cd9dc15be88af4a01bd622517d", "score": "0.5179425", "text": "def delete\n @queue << \"delete\"\n end", "title": "" }, { "docid": "c8d7fa93a13ac0c16387cbe34fd12b4e", "score": "0.51719016", "text": "def delete(name, _options = {})\n exec(\"delete\", c: name, p: port)\n end", "title": "" }, { "docid": "1b1a0e500e89dbe2193736b5c54787a2", "score": "0.5169989", "text": "def delete(ids)\n checkauth\n checkversion(1,1)\n\n if ids.class==Fixnum\n hostids=[{'hostid'=>ids}]\n elsif ids.class==Array\n hostids=ids.collect {|id| {'hostid'=>id} }\n else\n raise ZbxAPI_ParameterError, \"host.delete parameter must be number or array\"\n end\n\n obj=do_request(json_obj('host.delete',hostids))\n obj['result']\n end", "title": "" }, { "docid": "1e494df41f0985ce81eb55e2d7c5d456", "score": "0.5165436", "text": "def delete_leaderboard_named(leaderboard_name)\n @redis_connection.multi do |transaction|\n transaction.del(leaderboard_name)\n transaction.del(member_data_key(leaderboard_name))\n transaction.del(ties_leaderboard_key(leaderboard_name))\n end\n end", "title": "" }, { "docid": "a56b961a2c34814873832475a5eed1f2", "score": "0.5155468", "text": "def remove_deleted_items queue, items\n items.each do |item|\n queue.delete_if { |x| x.include? item }\n end\n queue\n end", "title": "" }, { "docid": "26b598fa947d85dac600398177e4f1fe", "score": "0.51470524", "text": "def delete( params=nil )\n s = self\n Jormungandr.redis.del s._key\n s.class.instance_eval { all.delete s }\n s\n end", "title": "" }, { "docid": "04232939c65aded8f108943f1f42dbef", "score": "0.51414233", "text": "def destroy_all(prefix = {})\n map(&:destroy)\n end", "title": "" }, { "docid": "ecc45462fe5ed884662261673687cbad", "score": "0.51350796", "text": "def wmq_empty_queues(*q_names)\n WMQ::QueueManager.connect(wmq_config) do |qmgr|\n q_names.each do |q_name|\n qmgr.open_queue(:q_name=>q_name, :mode=>:input) do |queue|\n queue.each { |message| }\n end\n end\n end\n end", "title": "" }, { "docid": "275d091a3ee0ab0cf776074cabb8ea88", "score": "0.51326907", "text": "def queues\n @connection.queues\n end", "title": "" }, { "docid": "3d8c3135f55d01ec223b90e0a5dccbf8", "score": "0.51313704", "text": "def destroy_all\n queue = params[:queue] || 'failed'\n Resque::Failure.clear(queue)\n redirect_to failures_path(redirect_params)\n end", "title": "" }, { "docid": "4ddbc472f76859ae6b918fbd93bd8a1b", "score": "0.5130474", "text": "def delete(name)\n host = find_by_name(name)\n return unless host\n\n # remove any associated IP addresses\n Netdot.logger.debug(\"Removing IP records for #{name}\")\n host['Ipblock'].keys.each do |id|\n begin\n @connection.delete(\"host?ipid=#{id}\")\n rescue => e\n # Not Found is ok, otherwise re-raise\n raise unless e.message =~ /404/\n end\n end\n end", "title": "" }, { "docid": "0414b164a813f489ca0a03297091ad4d", "score": "0.5129422", "text": "def exchange_delete(name, opts = {})\n raise_if_no_longer_open!\n\n @connection.send_frame(AMQ::Protocol::Exchange::Delete.encode(@id,\n name,\n opts[:if_unused],\n false))\n with_continuation_timeout do\n @last_exchange_delete_ok = wait_on_continuations\n end\n\n raise_if_continuation_resulted_in_a_channel_error!\n @last_exchange_delete_ok\n end", "title": "" }, { "docid": "49e306534c64cecb405e9653ad2e4f33", "score": "0.5128989", "text": "def queues_for_stock(stock_id, official_spread)\n buy_queue = @store.delete_orders stock_id, true, official_spread.first\n sell_queue = @store.delete_orders stock_id, false, official_spread.last\n return buy_queue, sell_queue\n end", "title": "" }, { "docid": "e2dee53b0da3b0f2f312129a9505384a", "score": "0.51284707", "text": "def delete(name, seq = nil)\n cmd = \"no ip prefix-list #{name}\"\n cmd << \" seq #{seq}\" if seq\n configure(cmd)\n end", "title": "" }, { "docid": "84b75d7ed46bc94c59376a473eba7519", "score": "0.51187956", "text": "def remove(*objects, &block)\n if block\n # Delete by query not supported by queue, so send to server\n queue.session.remove(*objects, &block)\n else\n objects.flatten.each do |object|\n queue.remove(object)\n end\n end\n end", "title": "" }, { "docid": "afaec64d1adcbbfa66106359f3369248", "score": "0.5111193", "text": "def delete_peers_with_same_name\n Peer.find_all_by_contact_point( self.contact_point ).each do |peer| peer.delete end\n end", "title": "" }, { "docid": "42981cdddf03990c4db18890e1cecfa4", "score": "0.51109093", "text": "def queues\n queue_response = fraggle.get('/queues')\n\n if queue_response.value.empty?\n []\n else\n decode(queue_response.value)\n end\n end", "title": "" }, { "docid": "8ae759ccea436d1f9f7aed9ba7c672a6", "score": "0.51099384", "text": "def delete(name)\n host = find_by_name(name)\n return unless host\n\n # remove any associated IP addresses\n Netdot.logger.debug(\"Removing IP records for #{name}\")\n host['Ipblock'].keys.each do |id|\n begin\n @connection.delete(\"host?ipid=#{id}\")\n rescue Exception => e\n # Not Found is ok, otherwise re-raise\n raise unless (e.message =~ /404/)\n end\n end\n end", "title": "" }, { "docid": "981cc5282069a2a0454d2b8608a02795", "score": "0.5105968", "text": "def batch_delete_item(options)\n options.each_pair do |table_name, ids|\n table = describe_table(table_name)\n ids.each do |id|\n client.delete_item(table_name: table_name, key: key_stanza(table, *id))\n end\n end\n nil\n end", "title": "" }, { "docid": "fbc3cd96445f0fd7bba8f639b8ce3be0", "score": "0.5103013", "text": "def autogenerated_queues\n []\n end", "title": "" }, { "docid": "bd960dfd08aedd6b386a8cdc41d3b425", "score": "0.50946605", "text": "def rmems(cids)\n raise \"No EMS given\" if cids.length == 0\n cids.each do |cid|\n $emsConnections.deleteConnection(cid)\n end\n end", "title": "" }, { "docid": "cb3fc52d09c142eb9a9063bec6512bff", "score": "0.5085233", "text": "def delete_queue (queue)\n\n queue = resolve_queue(queue)\n \n params = {} \n params[\"Action\"] = \"DeleteQueue\"\n\n doc = do_action :get, @queue_host, \"/#{queue.name}\", params\n\n end", "title": "" }, { "docid": "7312211cd1c1d58e76992cd0b0b48909", "score": "0.50807583", "text": "def get_names\n @redis.keys(\"*:queue:*\").reject {|q| q =~ /hudson/}\n end", "title": "" }, { "docid": "70a7a6af7221a93104b15495779a6f0b", "score": "0.50771904", "text": "def queues\n []\n end", "title": "" }, { "docid": "14aebd12ce7a41367473a85832e4d2bf", "score": "0.50749016", "text": "def remove_all\r\n executors = Array.new\r\n\r\n @@executors.each_key do |id|\r\n executors << @@executors.delete(id)\r\n end\r\n\r\n return executors\r\n end", "title": "" }, { "docid": "58509ab75a235fee618be222b503a50f", "score": "0.50696725", "text": "def unique_queues\n @unique_queues\n end", "title": "" }, { "docid": "c0a332547b4bcb0e0b4dc146a2ca7a9c", "score": "0.5067841", "text": "def delete!\n @server.delete_mailbox!(@name)\n end", "title": "" }, { "docid": "b95b6c8a54f3fe4268e93a280519b992", "score": "0.5052495", "text": "def del_consumer(name)\n @log.info(\"Controller: Deleting Consumer #{name}\")\n @consumers.delete(name)\n end", "title": "" }, { "docid": "7aaa5cecf03e21dae1d1dd57a6efec09", "score": "0.5047424", "text": "def ebs_delete\n @candidates.each do |i|\n @client.delete_volume({dry_run: false, volume_id: i,})\n @log.info \"Account #{@profile} - deleting #{i}\"\n end\nend", "title": "" }, { "docid": "b79249601aef96b2564bacf206731d16", "score": "0.5042674", "text": "def delete_client_or_node(name)\n client = load_actor(name, \"clients\")\n keys.delete(client)\n end", "title": "" }, { "docid": "49a8a3569b4aee99cadc432d87e7ec89", "score": "0.5040489", "text": "def remove_confirmables(confirmer)\n self.where(:confirmer_type => confirmer.class.name.classify).\n where(:confirmer_id => confirmer.id).destroy_all\n end", "title": "" }, { "docid": "4034760314d8afa03e758cee2d3d4858", "score": "0.5039451", "text": "def remote_dequeue_from(queue, namespace, klass, *args)\n\t\t\t\toriginal_namespace \t\t = Resque.redis.namespace\n\t\t\t\tResque.redis.namespace = namespace\n\n\t\t\t\tResque::Job.destroy(queue.to_sym, klass, *args)\n\t\t\tensure\n\t\t\t\tResque.redis.namespace = original_namespace\n\t\t\tend", "title": "" }, { "docid": "2602140adaa8d0bd743352f2825a578b", "score": "0.50384706", "text": "def remove_completed(*queues)\n\n rm_queues = queues.flatten\n rm_queues = list_queues if rm_queues.empty?\n\n rm_queues.each do |queue|\n list_dags(queue).each do |dag_id|\n dag = Dag.find(dag_id)\n remove_dag(queue, dag) if dag.complete?\n end\n end\n end", "title": "" }, { "docid": "53ccea34429e0096dc795c1bb1e7937c", "score": "0.5037489", "text": "def de_queue()\n \n end", "title": "" }, { "docid": "c134ffbc84e247cac010bf54c50457b7", "score": "0.5034601", "text": "def kill_consumers\n @log.info(\"Controller: Killing Consumers\")\n @consumers.each do |key, consumer|\n consumer.kill\n end\n end", "title": "" } ]
13fba01abcab444244edee948bbf614a
SN103 Id: 355 Name: Unit or Basis for Measurement Code Type: ID Min/Max: 2/2 Description: Code specifying the units in which a value is being expressed, or manner in which a measurement has been taken
[ { "docid": "91358dff8a1841b3e54bb27e14029b94", "score": "0.0", "text": "def SN103=(arg)", "title": "" } ]
[ { "docid": "f025e42d8905b2e798cd4be8fe3d7cd1", "score": "0.6321565", "text": "def unit\n data.unit\n end", "title": "" }, { "docid": "17015df1e0aeb1bfec57471d95888f52", "score": "0.6219748", "text": "def unit_str; end", "title": "" }, { "docid": "17015df1e0aeb1bfec57471d95888f52", "score": "0.6219748", "text": "def unit_str; end", "title": "" }, { "docid": "93fa7dea09ce58b730d8254a0be1c4a5", "score": "0.6160496", "text": "def change_field_value_units(value)\n return if value.nil? || value.type != 'IVL_PQ'\n # Update units from simple_xml version, mm[Hg], to new mmHg version\n if value.low && value.low.unit == 'mm[Hg]'\n value.low.instance_variable_set(:@unit, 'mmHg')\n end\n if value.high && value.high.unit == 'mm[Hg]'\n value.high.instance_variable_set(:@unit, 'mmHg')\n end\n end", "title": "" }, { "docid": "e02dacbe031de7273e964a29573b465b", "score": "0.61073273", "text": "def measurement_source\n { 'http://eol.org/schema/terms/NumberOfSequencesInGenBank' =>\n 'GenBank sequences',\n 'http://eol.org/schema/terms/NumberRichSpeciesPagesInEOL' =>\n 'EOL',\n 'http://eol.org/schema/terms/NumberSpecimensInGGBN' =>\n 'GGBN',\n 'http://eol.org/schema/terms/NumberRecordsInGBIF' =>\n 'GBIF',\n 'http://eol.org/schema/terms/NumberPublicRecordsInBOLD' =>\n 'BOLD',\n 'http://eol.org/schema/terms/NumberReferencesInBHL' =>\n 'BHL' }\n end", "title": "" }, { "docid": "d9a1071edf42509b3071a3eb921f99fa", "score": "0.60579133", "text": "def unit\n attr_val('./cda:value/@unit')\n end", "title": "" }, { "docid": "d9a1071edf42509b3071a3eb921f99fa", "score": "0.60579133", "text": "def unit\n attr_val('./cda:value/@unit')\n end", "title": "" }, { "docid": "d9a1071edf42509b3071a3eb921f99fa", "score": "0.60579133", "text": "def unit\n attr_val('./cda:value/@unit')\n end", "title": "" }, { "docid": "f9d15761a1773721397722ac3809341e", "score": "0.60480195", "text": "def nem12_uom\r\n return [\r\n\r\n# Unit of power\r\n 'wh',\r\n 'kwh',\r\n 'mwh',\r\n\r\n 'varh',\r\n 'kvarh',\r\n 'mvarh',\r\n\r\n 'vah',\r\n 'kvah',\r\n 'mvah',\r\n\r\n# Unit of something else\r\n 'w',\r\n 'kw',\r\n 'mw',\r\n\r\n 'var',\r\n 'mvar',\r\n 'kvar',\r\n\r\n 'va',\r\n 'kva',\r\n 'mva',\r\n\r\n 'v',\r\n 'kv',\r\n\r\n 'a',\r\n 'ka',\r\n\r\n 'pf'\r\n ]\r\n end", "title": "" }, { "docid": "9e33ddf1721a75f962fe567a739358d6", "score": "0.60447824", "text": "def minor_units; end", "title": "" }, { "docid": "9e33ddf1721a75f962fe567a739358d6", "score": "0.60447824", "text": "def minor_units; end", "title": "" }, { "docid": "9e33ddf1721a75f962fe567a739358d6", "score": "0.60447824", "text": "def minor_units; end", "title": "" }, { "docid": "9e33ddf1721a75f962fe567a739358d6", "score": "0.60447824", "text": "def minor_units; end", "title": "" }, { "docid": "9e1dc15f11aafb0ff4b22ff21f07f811", "score": "0.6024661", "text": "def unit_type\n { 1 => \"US Customary\", 2 => \"SI\" }[ unit_type_id ]\n end", "title": "" }, { "docid": "91d1659798603750b567f92f1f465cec", "score": "0.59924716", "text": "def set_MeasurementUnitID(value)\n set_input(\"MeasurementUnitID\", value)\n end", "title": "" }, { "docid": "39f26c0b53b446f122098994f294020a", "score": "0.58628935", "text": "def unit=(value)\n @unit = value\n end", "title": "" }, { "docid": "17ffb16f4cf0bafdaef59d39bf59f72f", "score": "0.5855816", "text": "def measurement_set(type, value, unit)\n measure = measurement(type)\n\n # create a new isbn record if we need to\n if measure.nil?\n measure = ONIX::Measure.new\n measure.measure_type_code = type\n product.measurements << measure\n end\n\n # store the new value\n measure.measurement = value\n measure.measure_unit_code = unit.to_s\n end", "title": "" }, { "docid": "6f755b9696e2fe7c8e7a92aea90f94ce", "score": "0.57756543", "text": "def subunit_to_unit; end", "title": "" }, { "docid": "6f755b9696e2fe7c8e7a92aea90f94ce", "score": "0.57756543", "text": "def subunit_to_unit; end", "title": "" }, { "docid": "6f755b9696e2fe7c8e7a92aea90f94ce", "score": "0.57756543", "text": "def subunit_to_unit; end", "title": "" }, { "docid": "6f755b9696e2fe7c8e7a92aea90f94ce", "score": "0.57756543", "text": "def subunit_to_unit; end", "title": "" }, { "docid": "b64327e095266eff5adfa55d2bb6a0f4", "score": "0.5715232", "text": "def unit_processing(code)\n a = code.split(':') # Unit : Army : HP : Fuel : Ammo\n return if a.size < 2\n type = a[0]\n army = $game_map.set_unit_army(a[1].to_i)\n # Stores the unit data into the map data table\n eval(\"$game_map.map_data[self.x, self.y].unit = #{type}.new(self.x, self.y, army)\")\n $game_map.get_unit(self.x,self.y).health = a[2].to_i if a.size >= 3\n $game_map.get_unit(self.x,self.y).fuel = a[3].to_i if a.size >= 4\n $game_map.get_unit(self.x,self.y).ammo = a[4].to_i if a.size >= 5\n army.add_unit($game_map.get_unit(self.x,self.y))\n end", "title": "" }, { "docid": "8a7b8e18975d086093993d6ec2bc8655", "score": "0.5699652", "text": "def unit\n case @unit\n when 'mi' then 'Miles'\n when 'km' then 'Kilometers'\n end\n end", "title": "" }, { "docid": "a9787695ae7e60db770a8686742ab2d9", "score": "0.5658901", "text": "def modeler_description\n return 'The measure just passes in the string and does not validate that it is a proper meter name. It is up to the user to know this or to look at the .mdd file from a previous simulation run.'\n end", "title": "" }, { "docid": "8d0f5e1ab9bdee4431d05ca206c48f20", "score": "0.56477064", "text": "def presentation_unit_type_measure\n packing_material.presentation_unit_type_measure\n end", "title": "" }, { "docid": "a293e88c1e3cd730ffc5ff37f0b94452", "score": "0.56439185", "text": "def unit\n @units\n end", "title": "" }, { "docid": "cf51ea6f5ecefe85e1c347539ca28e8c", "score": "0.56423664", "text": "def name_unit\n \"#{unit_type_title} #{unit_number}\"\n end", "title": "" }, { "docid": "70e4fe248c4bc2ac9934b9f0d00377d8", "score": "0.56397486", "text": "def unit\n letters(parts[3])\n end", "title": "" }, { "docid": "43430c6b75abea22a9c8b6194de6a2df", "score": "0.5636121", "text": "def housing_unit_id_value\n housing_unit_id\n end", "title": "" }, { "docid": "b0445d951edae21f8ffca265861d1fac", "score": "0.5609327", "text": "def measurement_unit_gas\n 'm3'\n end", "title": "" }, { "docid": "d8552f2845adf6e058bbc25c2e48b0c8", "score": "0.5607123", "text": "def manipulation_units\n raise \"Not implemented yet!\"\n end", "title": "" }, { "docid": "f411b55c31ae3f52f1de6bf90bddc4f5", "score": "0.5604415", "text": "def modeler_description\n return \"This measure inserts EMS code for each airloop found to contain an AirLoopHVAC:UnitarySystem object. It is meant to be paired specifically with the Create Variable Speed RTU OpenStudio measure.\n\nUsers can select the fan mass flow fractions for up to nine stages (ventilation, two or four cooling, and two or four heating). The default control logic is as follows:\nWhen the unit is ventilating (heating and cooling coil energy is zero), the fan flow rate is set to 40% of nominal.\nWhen the unit is in heating (gas heating coil), the fan flow rate is set to 100% of nominal (not changeable).\nWhen the unit is in staged heating/cooling, as indicated by the current heating/cooling coil energy rate divided by the nominal heating/cooling coil size, the fan flow rate is set to either 50/100% (two-stage compressor), or 40/50/75/100% (four-stage compressor).\n\nWhen applied to staged coils, the measure assumes that all stages are of equal capacity. That is, for two-speed coils, that the compressors are split 50/50, and that in four-stage units, that each of the four compressors represents 25% of the total capacity.\n\nThe measure is set up so that a separate block of EMS code is inserted for each applicable airloop (i.e., the EMS text is not hard-coded).\"\n end", "title": "" }, { "docid": "27c255d230628be7597e6cec7d0b03e7", "score": "0.5588877", "text": "def getUnits( key )\n meta = @metaData[ key ];\n if( meta != nil )then\n return meta.units;\n end;\n return ''; \n end", "title": "" }, { "docid": "0dc3765ecc593c8089e332ef7db7f1f4", "score": "0.5576564", "text": "def modeler_description\n return \"This measure creates a Meter:Custom idf object based on a user-defined .csv file and optionally adds an Output:Meter for the cutom meter to save the values to the .eio and .mtr files. Common errors: (1) Using space names instead of thermal zone names as key variables, (2) not specificying the Zone variable, e.g. Lights Electric Energy vs. Zone Lights Electric Energy, (3) Requesting a variable or meter that is not there. E.g., if a zone has no electric equipment, you cannot request a Zone Electric Equipment Electric Energy variable.\"\n end", "title": "" }, { "docid": "9155205f992c632424c0384edb5e2aec", "score": "0.5572418", "text": "def units_min\n @data['unitsMin'].try(:to_f)\n end", "title": "" }, { "docid": "1451ad1fa265d3cd9bd3a42a810032da", "score": "0.5568803", "text": "def calc_us_1_5\n return VAL_1_5\n end", "title": "" }, { "docid": "52c01a752d125dea643926e6b9360509", "score": "0.55606014", "text": "def primitiveUnits= value\r\n value = value.to_s\r\n @attributes['primitiveUnits'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "cf06fde1650ad7e80f63cbdbc88c772a", "score": "0.55521727", "text": "def value_with_unit\n start_value.nil? ? \"\" : start_value.to_s + \" \" + (end_value.nil? ? \"\" : \"- \" + end_value.to_s + \" \") + unit.symbol\n end", "title": "" }, { "docid": "332e627222513ed329add1400b910cf6", "score": "0.55477524", "text": "def presentation_unit_type_measurement\n packing_material.presentation_unit_type_measurement\n end", "title": "" }, { "docid": "0e99a11a5ddc723eaeb2755a81a3a6b0", "score": "0.55380297", "text": "def generate_material_code\n\t\tself.material_code = \"#{name}(#{custom_thk_dia}-#{custom_dimension_h}-#{custom_dimension_w}-#{custom_wt_ibs_ft})\"\n\tend", "title": "" }, { "docid": "60933aa3beda88999006d3276dee8c61", "score": "0.553556", "text": "def set_Unit(value)\n set_input(\"Unit\", value)\n end", "title": "" }, { "docid": "769918e1a39ecfe19fe4ea5964968207", "score": "0.55340385", "text": "def patternUnits= value\r\n value = value.to_s\r\n @attributes['patternUnits'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "98dcbe0f83255615dfff1248b5085abb", "score": "0.553391", "text": "def measure\n unit.unit_name\n end", "title": "" }, { "docid": "99837c89d79de120580d8c11ec1a227a", "score": "0.55164176", "text": "def m214; 14; end", "title": "" }, { "docid": "ce1ff5cd05e1675d641bfa0ae1d7795f", "score": "0.5514789", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "f829c16a2281ae95b681ef1fb9277f9c", "score": "0.5511307", "text": "def value_si\n @unit.to_si(@value)\n end", "title": "" }, { "docid": "8cd98ef1cd66d2f2f934e02395792f92", "score": "0.5502487", "text": "def units_record() @records.get(GRT_UNITS); end", "title": "" }, { "docid": "58227060755a2dea4c36c3d63087c8e5", "score": "0.549811", "text": "def units\n return \"\" if @numerator == UNITY_ARRAY && @denominator == UNITY_ARRAY\n return @unit_name unless @unit_name.nil?\n output_n = []\n output_d =[] \n num = @numerator.clone.compact\n den = @denominator.clone.compact\n if @numerator == UNITY_ARRAY\n output_n << \"1\"\n else\n num.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_n << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[num[index+1]]}\"\n num[index+1]=nil\n else\n output_n << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n if @denominator == UNITY_ARRAY\n output_d = ['1']\n else\n den.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_d << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[den[index+1]]}\"\n den[index+1]=nil\n else\n output_d << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n on = output_n.reject {|x| x.empty?}.map {|x| [x, output_n.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n od = output_d.reject {|x| x.empty?}.map {|x| [x, output_d.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n out = \"#{on.join('*')}#{od == ['1'] ? '': '/'+od.join('*')}\".strip \n @unit_name = out unless self.kind == :temperature\n return out\n end", "title": "" }, { "docid": "59a78c0b88cc515b2958d6e92874613e", "score": "0.549767", "text": "def name_short\n \"#{unit_type_short} #{unit_type_title} #{unit_number}\"\n end", "title": "" }, { "docid": "403280e7ec0054c4aaca57b12afab1af", "score": "0.5494488", "text": "def test_ut_t4_smt_mdm_009\n smt_list = MetricDescription.get_smt_list([\"STTPP\",\"STCDN \"],\"File\",[\"QAC\",\"QAC++\"], \"name\", \"DESC\")\n assert smt_list.size,4\n assert smt_list[0].name >= smt_list[2].name\n end", "title": "" }, { "docid": "ab3e0f4cbd154f39d3592925a34c9636", "score": "0.54850537", "text": "def units(); @records.get_data(GRT_UNITS); end", "title": "" }, { "docid": "c0878b611a032cf3005410f6e493f907", "score": "0.5484436", "text": "def get_csi_distance_code\n csi_code = '0'\n if length_in_meters == 25\n csi_code = '1'\n elsif length_in_meters == 50\n csi_code = '2'\n elsif length_in_meters == 100\n csi_code = '3'\n elsif length_in_meters == 200\n csi_code = '4'\n elsif length_in_meters == 400\n csi_code = '5'\n elsif length_in_meters == 800\n csi_code = '6'\n elsif length_in_meters == 1500\n csi_code = '7'\n end\n csi_code\n end", "title": "" }, { "docid": "4dfe40bb645a9714d71f0219dc5fa5c5", "score": "0.54794514", "text": "def standard_description\n mask = 0b0\n mask += standard_quantity_min.present? ? 1 : 0\n mask += standard_quantity_max.present? ? 2 : 0\n case mask\n when 0b00\n nil\n when 0b01\n t('.more_than', min: standard_quantity_min, unit: unit)\n when 0b10\n t('.less_than', max: standard_quantity_max, unit: unit)\n when 0b11\n t('.interval', min: standard_quantity_min, max: standard_quantity_max,\n unit: unit)\n end\n end", "title": "" }, { "docid": "43fcc29b8c60ec88df9f4129a411e60a", "score": "0.5475158", "text": "def format_uflex_ac_spec(data, options = {})\n case data\n when NilClass\n data_new = 0\n when Fixnum, Float\n case\n when data == 0\n data_new = data.to_s\n when data.abs < 1e-9\n data_new = (data * 1_000_000_000_000).round(4).to_s + '*ps'\n when data.abs < 1e-6\n data_new = (data * 1_000_000_000).round(4).to_s + '*ns'\n when data.abs < 1e-3\n data_new = (data * 1_000_000).round(4).to_s + '*us'\n when data.abs < 1\n data_new = (data * 1_000).round(4).to_s + '*ms'\n else\n data_new = data.to_s\n end\n data_new = data_new.gsub(/^/, '=')\n when String\n data_new = data.gsub(/^/, '=').gsub(/(\\W)([a-zA-Z])/, '\\1_\\2')\n # Remove underscores from unit designations\n data_new.gsub!(/(\\W)_(nS|uS|mS|S)(\\W)/i, '\\1\\2\\3')\n data_new.gsub!(/(\\W)_(nS|uS|mS|S)$/i, '\\1\\2')\n else\n Origen.log.error \"Unknown class type (#{data.class}) for spec value: #{data}\"\n fail\n end\n data_new\n end", "title": "" }, { "docid": "99218a54de4d46626bc76b3d318dfd58", "score": "0.54745764", "text": "def fm_create_description_icd10_maj\n return \"TEST ICD10MAJ'S\" + \"#{AdmissionHelper.range_rand(1, 1000).to_s}\"\n end", "title": "" }, { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.5464798", "text": "def numerator_units; end", "title": "" }, { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.5464798", "text": "def numerator_units; end", "title": "" }, { "docid": "746d7337fa7bc238fb293e5aeb2feb3b", "score": "0.54616064", "text": "def decode\n if self[:optlen].to_i == 4\n \"MSS:#{self[:value].to_i}\"\n else\n \"MSS-bad:#{self[:value]}\"\n end\n end", "title": "" }, { "docid": "8667bfd8e76a3d427ebfc73da23775c7", "score": "0.54593605", "text": "def duty_type_components\n if duty_type == '30' && tty_code.to_s.in?(['570', '551'])\n [\n MeasureComponent.new do |mc|\n mc.duty_amount = 0.0\n mc.duty_expression_id = '01'\n mc.monetary_unit_code = 'GBP'\n mc.measurement_unit_code = 'LTR'\n end\n ]\n else\n []\n end\n end", "title": "" }, { "docid": "07e8c4ce18a1327b7fe6c4c61c24ca07", "score": "0.54382986", "text": "def unit; end", "title": "" }, { "docid": "3ce0cd57eb910e9043bfbff320156153", "score": "0.54362106", "text": "def markerUnits= value\r\n value = value.to_s\r\n @attributes['markerUnits'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "7314c718c7a2f6067d8206e4c6734551", "score": "0.54332864", "text": "def value_per_100g; nutr_val; end", "title": "" }, { "docid": "a79bc642fbb3699e3df6ee5ff9d8d2d3", "score": "0.54250306", "text": "def set_MeasurementType(value)\n set_input(\"MeasurementType\", value)\n end", "title": "" }, { "docid": "f54e83b0cc51bf525ec6a621c6a48326", "score": "0.5422606", "text": "def unit\n @unit\n end", "title": "" }, { "docid": "d3fa3089affe4bb9c246cbdf302d5676", "score": "0.5419746", "text": "def set_UnitValue(value)\n set_input(\"UnitValue\", value)\n end", "title": "" }, { "docid": "d3fa3089affe4bb9c246cbdf302d5676", "score": "0.5419746", "text": "def set_UnitValue(value)\n set_input(\"UnitValue\", value)\n end", "title": "" }, { "docid": "d3fa3089affe4bb9c246cbdf302d5676", "score": "0.5419746", "text": "def set_UnitValue(value)\n set_input(\"UnitValue\", value)\n end", "title": "" }, { "docid": "d3fa3089affe4bb9c246cbdf302d5676", "score": "0.5419746", "text": "def set_UnitValue(value)\n set_input(\"UnitValue\", value)\n end", "title": "" }, { "docid": "53f57c8fe8c52ac42f483e51b2340e64", "score": "0.54177046", "text": "def major_unit=(value)\n @major_unit = value\n end", "title": "" }, { "docid": "e2b371981552333116f609a9e7101d43", "score": "0.5415962", "text": "def get_units_short\n return self.get_probe.results_units_short\n end", "title": "" }, { "docid": "6060543881ca307fb014bf0cddf83a97", "score": "0.54092914", "text": "def band_a\n 1000\n end", "title": "" }, { "docid": "129aab252d8818fa544dc5f5c8418084", "score": "0.54037815", "text": "def get_test_type_desc()\r\n case @test_type\r\n when '2000'\r\n '2000 meters continuously swimming'\r\n when '200-100'\r\n '200 meters vs 100 meters bests diff' \r\n when '400-200'\r\n '400 meters vs 200 meters bests diff'\r\n else\r\n 'generic test'\r\n end \r\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.539438", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.539438", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.539438", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.5394341", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.5394341", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.5394341", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.5394341", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "c91b776a2371455d98572d9c0d7ec180", "score": "0.5394341", "text": "def set_Units(value)\n set_input(\"Units\", value)\n end", "title": "" }, { "docid": "8e3cccf12f0fa09dc28343c48dadb22f", "score": "0.53898406", "text": "def unit_helper(number,from_unit_string,to_unit_string)\r\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\r\n end", "title": "" }, { "docid": "8e3cccf12f0fa09dc28343c48dadb22f", "score": "0.53898406", "text": "def unit_helper(number,from_unit_string,to_unit_string)\r\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\r\n end", "title": "" }, { "docid": "8e3cccf12f0fa09dc28343c48dadb22f", "score": "0.53898406", "text": "def unit_helper(number,from_unit_string,to_unit_string)\r\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\r\n end", "title": "" }, { "docid": "3163aa28c5cb2671d08074bfafbdc5d2", "score": "0.5388795", "text": "def unit_name_and_label\n \"#{ code } (#{ label })\"\n end", "title": "" }, { "docid": "94a029db354be73258c66b3f42911bf4", "score": "0.5376859", "text": "def inspect\n \"#{@value.inspect} [#{@unit.symbol}] #{@unit.dimension.inspect}\"\n end", "title": "" }, { "docid": "e0f8daaf4ed30ddef971be34567aac87", "score": "0.5362347", "text": "def modeler_description\n return 'This measure goes each water heater, if it finds a small (<50gal, as defined on the MICS database), electric non-heatpump water heater, it calculates the COP corresponding to a EF=3.5\n\n The equations for calculating EF and UA are listed here:\n http://www.energycodes.gov/sites/default/files/documents/PrototypeModelEnhancements_2014_0.pdf (Appendix A: Service Water Heating).\n https://github.com/NREL/openstudio-standards/blob/master/lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb#L90-L102\n First a UA corresponding to a high EF for a standard electric SWH is calculated.\n With that UA value and a EF=3.5 (as listed in common commercially available HP water heaters), the water heater thermal efficiency (corresponding to the COP in this case) is calculated,\n through eq. on line 102 in the github page.\n This number is used for the COP in the partial-load curve assigned to the new HP water heater.\n https://www.energystar.gov/productfinder/product/certified-water-heaters/?formId=0d5ff0a5-d583-4bb4-a6d5-76436de5b169&scrollTo=9&search_text=&fuel_filter=&type_filter=Heat+Pump&brand_name_isopen=&input_rate_thousand_btu_per_hour_isopen=&markets_filter=United+States&zip_code_filter=&product_types=Select+a+Product+Category&sort_by=uniform_energy_factor_uef&sort_direction=DESC&currentZipCode=80401&page_number=0&lastpage=0'\n end", "title": "" }, { "docid": "75ed0cd00af70f3acb5dfa1c29aecd8a", "score": "0.535748", "text": "def raw_sub_type; end", "title": "" }, { "docid": "448663b21d4e5760a844228d4131fd55", "score": "0.5354192", "text": "def test_ut_t4_smt_mdm_008\n smt_list = MetricDescription.get_smt_list([\"STTPP\",\"STCDN \"],\"File\",[\"QAC\",\"QAC++\"], \"name\", \"ASC\")\n assert smt_list.size,4\n assert smt_list[0].name <= smt_list[2].name\n end", "title": "" }, { "docid": "a67192821eff3dd2c98477e3a1b685e0", "score": "0.5353963", "text": "def check_meter_code\n ret = '$err'\n if !meter_code.blank? && meter_code.length == 12\n b = meter_code[0]\n yy = meter_code[1..2]\n m = meter_code[3]\n c = meter_code[4]\n ssssss = meter_code[5..10]\n k = meter_code[11]\n manufacturer_letter = meter_model.meter_brand.letter_id rescue nil\n model_letter = meter_model.letter_id rescue nil\n caliber_letter = caliber.letter_id rescue nil\n st2 = (11 * (meter_code[0].ord - \"A\".ord)) + (8 * (meter_code[3].ord - \"A\".ord)) + (7 * (meter_code[4].ord - \"A\".ord))\n st1 = (10 * meter_code[1].to_i) + (9 * meter_code[2].to_i) + (6 * meter_code[5].to_i) + (5 * meter_code[6].to_i) +\n (4 * meter_code[7].to_i) + (3 * meter_code[8].to_i) + (2 * meter_code[9].to_i) + meter_code[10].to_i\n control_digit = (\"A\".ord + ((st1 + st2) % 26)).chr\n # Check manufacturer\n if !manufacturer_letter.blank? && manufacturer_letter == b\n # Check year\n if is_numeric?(yy)\n # Check model\n if !model_letter.blank? && model_letter == m\n # Check caliber\n if !caliber_letter.blank? && caliber_letter == c\n # Check serial no.\n if is_numeric?(ssssss)\n # Check control digit\n if !control_digit.blank? && control_digit == k\n ret = '$ok'\n else\n ret = '$control$' + control_digit\n end\n else\n ret = '$serial'\n end\n else\n ret = '$caliber'\n end\n else\n ret = '$model'\n end\n else\n ret = '$year'\n end\n else\n ret = '$manufacturer'\n end\n end\n ret\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "5c478f105e947e4163c142f24b524927", "score": "0.53501683", "text": "def unit_helper(number,from_unit_string,to_unit_string)\n converted_number = OpenStudio::convert(OpenStudio::Quantity.new(number, OpenStudio::createUnit(from_unit_string).get), OpenStudio::createUnit(to_unit_string).get).get.value\n end", "title": "" }, { "docid": "df5f6036443c04e369bca13f98688de9", "score": "0.5349728", "text": "def unit_conversion(value, unit, type)\n if ['pct', 'deg_c', 'v', 'a', 'hz', 'bitmap'].include?(unit)\n value = self.method(\"convert_\" + unit).call(value, type)\n end\n value\n end", "title": "" }, { "docid": "04a97b1d0cb2b5046327ef05da25a5bc", "score": "0.5347845", "text": "def format_uflex_global_spec(data, options = {})\n options = {\n spec: nil\n }.update(options)\n\n case options[:spec]\n when /fgb_/i\n spec_type = 'freq'\n when /vgb_/i\n spec_type = 'volt'\n else\n spec_type = nil\n end\n\n case data\n when NilClass\n data_new = 0\n when Fixnum, Float\n case\n when data == 0\n data_new = data.to_s\n when data.abs < 1e-6\n data_new = (data * 1_000_000_000).round(4).to_s + '*nV' if spec_type == 'volt'\n data_new = data.to_s if spec_type.nil?\n when data.abs < 1e-3\n data_new = (data * 1_000_000).round(4).to_s + '*uV' if spec_type == 'volt'\n data_new = data.to_s if spec_type.nil?\n when data.abs < 1\n data_new = (data * 1_000).round(4).to_s + '*mV' if spec_type == 'volt'\n data_new = data.to_s if spec_type.nil?\n else\n data_new = data.to_s + '*V' if spec_type == 'volt'\n data_new = data.to_s if spec_type.nil?\n end\n data_new = data_new.gsub(/^/, '=')\n when String\n data_new = data.gsub(/^/, '=').gsub(/(\\W)([a-zA-Z])/, '\\1_\\2')\n # Remove underscores from unit designations\n data_new.gsub!(/(\\W)_(nV|uV|mV|V|nA|uA|mA|A)(\\W)/i, '\\1\\2\\3')\n data_new.gsub!(/(\\W)_(nV|uV|mV|V|nA|uA|mA|A)$/i, '\\1\\2')\n else\n Origen.log.error \"Unknown class type (#{data.class}) for spec value: #{data}\"\n fail\n end\n data_new\n end", "title": "" }, { "docid": "4c97da8aa243d274f2ea0075ff8a05e9", "score": "0.5340804", "text": "def unit\n @unit\n end", "title": "" }, { "docid": "0691b09ed424aae13e52dc7f099ccc4f", "score": "0.53405213", "text": "def unit_for(code)\n lab_test_by_code = LabTest.find_by(code: code)\n unit_for_lab_test = accession.results.find_by(lab_test_id: lab_test_by_code).unit.name\n unit_for_lab_test.presence\n end", "title": "" }, { "docid": "feb906fb6ee60797e010a989f3958ea0", "score": "0.53344333", "text": "def major_unit\n return @major_unit\n end", "title": "" }, { "docid": "4a79077b5a33ce018b047496ed861a05", "score": "0.5333464", "text": "def minor_unit=(value)\n @minor_unit = value\n end", "title": "" } ]
00a96a6b74f7c734fb2231a02b54f85a
Es una estadi de registro
[ { "docid": "89b1f5d11e7b13c2e619ee9fae82bc73", "score": "0.0", "text": "def is_register?\n\t\ttag_name.eql?(REGISTER)\n\tend", "title": "" } ]
[ { "docid": "7e30f13f1ce28810a96fb3cba92456ef", "score": "0.7055714", "text": "def horas_no_lec\n @asignaturas = Asignatura.where('lectiva=false').order('orden')\n @lectiva = false\n @id_asig = params[:id_asig]\n @id_profe = params[:id_profe]\n @horario = Horario.new\n @horario.professor_id = @id_profe\n @horario.asignatura_id = @id_asig\n @horario.save()\n\n end", "title": "" }, { "docid": "8512e4156e27719b86a5c055ad41c617", "score": "0.6670728", "text": "def define_estado_pedido\n #obtenemos el objeto pedido del que se quiere cambiar su estado\n @pedido = Pedido.find(params[:id])\n # obtenemos el id del estado al que se cambiara\n # consultamos si el parametro pasado es A entonces el estado del pedido\n # es ACEPTADO caso contrario RECHAZADO\n @id_estado = params[:estado] == \"A\"? EstadoPedido.find_by_descripcionEstado(\"ACEPTADO\").id : EstadoPedido.find_by_descripcionEstado(\"RECHAZADO\").id\n # coloca a FALSE el campo :estadoaut todas los registros correspondientes\n # al pedido\n Autorizacion.cambia_estado_autorizaciones(@pedido.id)\n @autorizacion = @pedido.autorizacions.new(:fecha => Time.now.strftime(\"%Y-%m-%d\"),\n :estado_pedido_id => @id_estado,\n :usuario_id => 2,\n :estadoaut => TRUE)\n if @autorizacion.save\n # consulta el tipo de cambio de estado para mostrar un mensj. personalizado\n flash[:notice] = params[:estado] == \"A\" ? \"PEDIDO AUTORIZADO SATISFACTORIAMENTE\" : \"CAMBIO DE ESTADO DE PEDIDO REGISTRADO SATISFACTORIAMENTE\"\n else\n flash[:notice] = \"NO SE PUDO AUTORIZAR EL PEDIDO, INTENTE NUEVAMENTE POR FAVOR\"\n end\n redirect_to :controller => \"autorizacions\"\n end", "title": "" }, { "docid": "b672ef7e9b06aebf76f62b3843718b87", "score": "0.66642773", "text": "def create\n @anio_escolar = AnioEscolar.new(params[:anio_escolar])\n respond_to do |format|\n if @anio_escolar.save\n if @anio_escolar.activo == 1\n # Desactivar otros años escolares\n sql = 'update anios_escolares set activo = 0 where colegio_id = '+ @anio_escolar.colegio_id.to_s + ' And activo = 1 And id <> '+ @anio_escolar.id.to_s\n registros = AnioEscolar.connection.update(sql)\n end\n format.html { redirect_to @anio_escolar, notice: 'El registro fue creado satisfactoriamente.' }\n format.json { render json: @anio_escolar, status: :created, location: @anio_escolar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @anio_escolar.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ad275cb885a97d7f291e259bad0ac56", "score": "0.6651044", "text": "def set_entrada\n @entrada = Entrada.find(params[:id])\n\t @creador = \"\"\n end", "title": "" }, { "docid": "21abdb62de692dd20dc053e0641cb312", "score": "0.6610432", "text": "def create\n #obteniendo el campo de nombre\n @nombre = params[:entrada][\"nombre\"]\n #instanciando el formulario\n @entrada = Entrada.new(entrada_params)\n #consulta por nombre\n @entrada_name = Entrada.find_by(nombre: @nombre)\n @articulo_data = Articulo.find_by(nombre: @nombre)\n\n if @articulo_data\n \n if @entrada_name\n flash[:error] = \"El articulo ya esta registrado en las entradas.\"\n redirect_to \"/entradas/new\"\n else\n @entrada.save\n Entrada.last.update_attribute(:unidad, @articulo_data.unidad)\n Entrada.last.update_attribute(:precio, @articulo_data.precio)\n flash[:success] = \"La entrada se ha registrado.\"\n redirect_to \"/entradas/new\"\n \n end\n\n else\n flash[:error] = \"El articulo no esta dado de alta.\"\n redirect_to \"/entradas/new\"\n\n end\n \n end", "title": "" }, { "docid": "259a3ad54f2166c2fc82a9cb298e1503", "score": "0.66031677", "text": "def create\n @boleto = Boleto.new(boleto_params)\n @asientos = Asiento.where({is_active: true, autobus_id: @boleto.itinerario.autobus_id }).first\n @asientos.is_active = false\n @boleto.asiento = @asientos\n @asientos.save\n respond_to do |format|\n if @boleto.save\n format.html { redirect_to @boleto, notice: 'Boleto creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @boleto }\n else\n format.html { render action: 'new' }\n format.json { render json: @boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d89a38cf6314d6ad54870e856bef669a", "score": "0.66000724", "text": "def save_if_valid\n\n return false if Mercado.find(self.mercado_id).liga != self.seleccion.liga\n\n self.fecha = Time.now\n\n antigua = Oferta.where(:mercado_id => self.mercado_id, :seleccion_id => self.seleccion_id).first\n if antigua.present?\n if self.estado == CANCELADA\n antigua.valor = 0\n antigua.estado = CANCELADA\n else\n antigua.valor = self.valor\n end\n antigua.fecha = Time.now\n antigua.save\n\n antigua\n else\n self.save\n self\n end\n end", "title": "" }, { "docid": "fcc57203d1251ca6d4684eb0559cd714", "score": "0.65102285", "text": "def create \n @usuario = Usuario.new(params[:usuario])\n @usuario.institucion_id = usuario_actual.institucion_id unless @usuario_es_superadmin\n\n if @usuario.save\n flash[:notice] = 'Usuario creado con exito.'\n redirect_to(@usuario) \n else\n render :action => \"new\" \n end #save\n\n end", "title": "" }, { "docid": "e4a1e28df6edc9e97c4e5395004e9528", "score": "0.6490434", "text": "def consultarAnalisis() @db.consultarAnalisis end", "title": "" }, { "docid": "d773cb8c25690393cc608aafc5140cfb", "score": "0.64790505", "text": "def create\n @orden = Orden.new(params[:orden])\n @orden.personas_id=session[:id]\n @orden.fecha= Time.now\n @orden.estado = 'Pendiente por Recolectar'\n respond_to do |format|\n if @orden.save\n NUESTRO_LOG.info \"Se guardo la orden correctamente\"\n format.html { redirect_to(@orden, :notice => 'Orden was successfully created.') }\n format.xml { render :xml => @orden, :status => :created, :location => @orden }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orden.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c375053d1217c412a55d9131e5a00b37", "score": "0.64382833", "text": "def create\n\n @transaccionest = Transaccionest.new(transaccionest_params)\n\n #Seccion para verificar que la maq este verde antes de enviarle el credito. Peticion Nestor Client. Tambien se puede definir en una funcion callback rails, before action rails ok. ted. \n @maquinas_activas_verde = Maquinat.where(\"updated_at > ?\", (Time.now - 30.seconds)).ids # where(:updated_at > ( (Time.now - 4.hours) - 300.seconds) ) \n \n if (not @maquinas_activas_verde.include? @transaccionest.maquinat_id)\n redirect_to \"/transaccionests/new\", notice: \"X.Credito no enviado. MQ en ROJO sin conexion. Favor verificar.\" and return \n\n end\n\n\n # if @transaccionest.tipotransaccion == nil\n # @transaccionest.tipotransaccion = \"credito\"\n # end\n\n #Evaluar entrada y ajustar/cambiar parametros segun sea necesario:\n #@transaccionest.status = \"pendiente\"\n\n #@transaccionest\n # Transaccionest.where(:maquina_id => Maquinat.where(:serial=> params_serial).id).last pending\n # @param_serial = transaccionest_params[:serial] # Extraer el parametro :serial\n# @param_serial = @transaccionest.tipotransaccion #provisional mando el serial en esta campo. #index_transaccionest_params_only[:serial]\n \n# if ( @transaccionest.maquinat_id.nil? ) # != 1\n\n # @transaccionest.maquinat_id = Maquinat.where(:serial=> @param_serial).last.id\n # @transaccionest.maquinat_id = 1\n # @transaccionest.tipotransaccion = \"debito\" # provisiona\n\n # end\n \n \n\n respond_to do |format|\n if @transaccionest.save\n format.html { redirect_to new_transaccionest_path, notice: 'Procesando ok...' }\n format.json { render :show, status: :created, location: @transaccionest }\n else\n redirect_to \"/transaccionests/new\" and return # forzo el redireccionamiento en caso de no salvar(guardarse la entrada) de este objeto por razon de que si hacen click en enviar sin la cantidad a acreditar no afecte al programa ok. ted.\n #format.html { render :new }\n #format.json { render json: @transaccionest.errors, status: :unprocessable_entity }\n\n end\n end\n end", "title": "" }, { "docid": "5574564f74b676c76b97dbbfd5be2ea6", "score": "0.6429385", "text": "def set_gestion_usuario\n @gestion_usuario =Gestion::Usuario.all.find(params[:id]) \n #Le he agregao all porque sino arroja error de procedimiento almacenado\n end", "title": "" }, { "docid": "cc82c3a12d7e809742775926c550e512", "score": "0.6421472", "text": "def create\n @tema = Tema.new(tema_params)\n\n respond_to do |format|\n if @tema.save\n\n # dc tema a fost creata de un student, sa o adaug la alererile sale\n if User.find(@tema.user_id).rol == \"Student\"\n # @current_sesiune = Sesiune.where(\"data_end is null\").first\n # if @current_sesiune == nil\n # @current_sesiune = Sesiune.where(\"data_end is not null\").last\n # end\n AlegeriUserTema.create(tema_id: @tema.id, user_id: @tema.user_id, status_profesor: \"Pending\", status_student: \"Pending\", sesiune_id: get_current_sesiune.id)\n end\n\n if get_current_user and get_current_user.rol == \"Student\" # \"/domenius/\" + @tema.domeniu_id.to_s\n format.html { redirect_to alegerileMele_path, notice: 'Tema a fost creată.' }\n format.json { render action: 'show', status: :created, location: @tema }\n else\n format.html { redirect_to temeleMele_path, notice: 'Tema a fost creată.' }\n format.json { render action: 'show', status: :created, location: @tema }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: temeleMele_path.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eab07430b25ea951ad79b5bfe7593845", "score": "0.64143264", "text": "def lista_profes\n @asignaturas = Asignatura.where('lectiva=true').order('orden')\n @professors = Professor.all.order('name')\n @lectiva = true\n @id_asig = params[:id_asig]\n @id_curso = params[:id_curso]\n\n @horario = Horario.new\n @horario.curso_id = @id_curso\n @horario.asignatura_id = @id_asig\n\n @horario.save()\n\n end", "title": "" }, { "docid": "bd817f45a21fe4f0034621291f12a8c4", "score": "0.6410868", "text": "def trg_save\n self.gerenciar_acoes\n self.gerar_duplicatas if self.changed.include? \"plano_de_pagamento\" or self.changed.include? \"valor\"\n end", "title": "" }, { "docid": "ad13e77d8b09c7a5c9c2bacbff2033a3", "score": "0.6406105", "text": "def save\n @tramite = (params[:id])? Tramite.find(params[:id]) : Tramite.new\n @tramite.init_journal(current_user) if current_user\n @tramite.update_attributes(params[:tramite])\n #@tramite.prepare_fields\n if @tramite.valid?\n @tramite.save\n @tramite.verificar_registro_atencion(current_user) if current_user\n @tramite.update_estatus!('tramre',current_user) if current_user\n flash[:notice] = \"Trámite registrado correctamente\"\n redirect_to :controller => \"tramites\"\n else\n @defensores = Defensor.find(:all, :conditions => [\"activo = ? AND id = ?\", true, current_user.id])\n @defensores = Defensor.find(:all, :conditions => [\"activo = ?\", true]) if current_user.has_role?(:admin)\n @fiscalias = Fiscalia.find(:all, :conditions => [\"activa = ?\", true])\n render :action => \"new_or_edit\"\n end\n end", "title": "" }, { "docid": "f06dd7437dead2a7e90cea0bca7faa34", "score": "0.63891745", "text": "def solicitud_entregada(date = Date.today)\n self.fecha_entregada = date\n self.estado_id = ESTADO_ENTREGADA\n self.save!\n end", "title": "" }, { "docid": "bddad55abe302ba2894ab8177eca05d2", "score": "0.63793045", "text": "def create\n #Recuperamos las varibles POST que vinieron desde la acción new.\n \n @insumo = Producto.new(insumo_params)\n @insumo.empresa_id = @current_empresa.id\n \n \n #Verificamos si la tarea ha podido ser guardado correctamente.\n \n if @insumo.save()\n redirect_to insumos_path, :notice => \"El registro ha sido creado\";\n else\n render \"new\";\n end\n end", "title": "" }, { "docid": "eb93053f649b696207d62d19331bd06f", "score": "0.6376934", "text": "def new\n @bloquecomida = Bloquecomida.new\n\n last=Bloquecomida.find(:last,:order => \"orden\")\n \n @bloquecomida.orden = last.orden+1 \n @bloquecomida.usuario = usuario_actual\n end", "title": "" }, { "docid": "ead191b5cde5585624f7e34d8d82e088", "score": "0.63740164", "text": "def set_gestion_auditoria\n #gestion_auditoria =Gestion::Auditoria.includes(:registro,:usuario).limit(1).find(params[:id]) \n @gestion_auditoria =Gestion::Auditoria.find(params[:id])\n #Le he agregado all porque sino arroja error de procedimiento almacenado\n end", "title": "" }, { "docid": "0a5276140bf98c201a5b292b0b64b6fc", "score": "0.6370704", "text": "def new_or_edit\n @tramite = (params[:id])? Tramite.penal.find(params[:id]) : Tramite.penal.new\n @tramite.fechahora_atencion ||= Time.now.strftime(\"%Y/%m/%d\")\n @materias = Catalogo.materia.all\n @fiscalias = Fiscalia.find(:all, :conditions => [\"activa = ?\", true])\n @defensores = Defensor.find(:all, :conditions => [\"activo = ? AND persona_id = ?\", true, current_user.persona.id]) if current_user.has_role?(:defensor)\n @defensores = Defensor.find(:all, :conditions => [\"activo = ?\", true]) if current_user.has_role?(:admin) || current_user.has_role?(:jefedefensor)\n @defensores ||= Array.new\n end", "title": "" }, { "docid": "e570d134ad5c0a7fa3ae31d449dd9a89", "score": "0.6367429", "text": "def save\n @form = params['recolectar']\n @orden = Orden.where(:id => @form[:nombre]).first\n if @orden.nil? || @orden.estado == \"Pendiente por recolectar\" || @orden.estado == \"Entregada\"\n redirect_to(reco_path, :notice => t('ordenrecolector'))\n else\n @notice = Orden.rutaRecolectada(@orden)\n redirect_to(recorden_path(@orden.id), :notice => @notice)\n end\n end", "title": "" }, { "docid": "ae7dc01e3e3249f79e158fc0cb9e6582", "score": "0.6362806", "text": "def create\n @retiro = Retiro.new(retiro_params)\n \n if @retiro.save\n @num_contenedor = NumContenedor.find(@retiro.num_contenedors_id)\n @num_contenedor.update_attribute(:Activo, false)\n\n @valor = NumContenedor.where(asignations_id: @retiro.asignations_id, Activo: true).count#.select('COUNT(*) AS total')\n if @valor >= 1 \n @asignation = Asignation.find(@retiro.asignations_id)\n @asignation.update_attribute(:Activo, false)\n end\n redirect_to \"/retiro/\".to_s + @retiro.asignations_id.to_s, notice: 'Exito. Retiro fue creado.'\n else \n redirect_to \"/retiro/\".to_s + @retiro.asignations_id.to_s, notice: 'Error. Datos no guardados.'\n end\n end", "title": "" }, { "docid": "b74d0b071328ea052e9a09bfee20f76c", "score": "0.6361862", "text": "def encuentra_por_nombre\n puts \"\\n Encuentra record por nombre cientifico: #{nombre_cientifico}\"\n # Evita que el nombre cientifico este vacio\n if nombre_cientifico.blank?\n self.validacion = {estatus: false, msg: 'El nombre cientifico está vacío'}\n return\n end\n\n taxones = Especie.solo_publicos.where(\"LOWER(#{Especie.attribute_alias(:nombre_cientifico)}) = ?\", nombre_cientifico.limpia.downcase)\n\n if taxones.length == 1 # Caso mas sencillo, coincide al 100 y solo es uno\n puts \"\\n\\nCoincidio busqueda exacta\"\n self.validacion = {estatus: true, taxon: taxones.first, msg: 'Búsqueda exacta'}\n return\n\n elsif taxones.length > 1 # Encontro el mismo nombre cientifico mas de una vez\n puts \"\\n\\nCoincidio mas de uno directo en la base\"\n self.validacion = {taxones: taxones, msg: 'Existe más de una coincidencia'}\n return\n\n else\n puts \"\\n\\nTratando de encontrar concidencias con la base, separando el nombre\"\n # Parte de expresiones regulares a ver si encuentra alguna coincidencia\n nombres = I18n.transliterate(nombre_cientifico.limpia.limpiar.limpia_sql.downcase).split(' ')\n\n taxones = if nombres.length == 2 # Especie\n Especie.solo_publicos.where(\"LOWER(#{Especie.attribute_alias(:nombre_cientifico)}) LIKE '#{nombres[0]} % #{nombres[1]}'\")\n elsif nombres.length == 3 # Infraespecie\n Especie.solo_publicos.where(\"LOWER(#{Especie.attribute_alias(:nombre_cientifico)}) LIKE '#{nombres[0]}%#{nombres[1]}%#{nombres[2]}'\")\n elsif nombres.length == 1 # Genero o superior\n Especie.solo_publicos.where(\"LOWER(#{Especie.attribute_alias(:nombre_cientifico)}) LIKE '#{nombres[0]}'\")\n end\n\n if taxones.present? && taxones.length == 1 # Caso mas sencillo\n self.validacion = {estatus: true, taxon: taxones.first, msg: 'Búsqueda exacta'}\n return\n\n elsif taxones.present? && taxones.length > 1 # Mas de una coincidencia\n self.validacion = {taxones: taxones, msg: 'Existe más de una coincidencia'}\n return\n\n else # Lo buscamos con el fuzzy match y despues con el algoritmo levenshtein\n puts \"\\n\\nTratando de encontrar concidencias con el fuzzy match\"\n\n if Rails.env.development_mac?\n ids = []\n else\n ids = FUZZY_NOM_CIEN.find(nombre_cientifico.limpia, limit=CONFIG.limit_fuzzy).map{ |t| t.first}\n end\n\n\n if ids.present?\n taxones = Especie.solo_publicos.where(id: ids)\n taxones_con_distancia = []\n\n taxones.each do |taxon|\n # Si la distancia entre palabras es menor a 3 que muestre la sugerencia\n distancia = Levenshtein.distance(nombre_cientifico.limpia.downcase, taxon.nombre_cientifico.limpia.downcase)\n next if distancia > 2 # No cumple con la distancia\n taxones_con_distancia << taxon\n end\n\n if taxones_con_distancia.empty?\n puts \"\\n\\nSin coincidencia\"\n self.validacion = {estatus: false, msg: 'Sin coincidencias'}\n return\n else\n if taxones_con_distancia.length == 1\n if nombre_cientifico.downcase == taxones_con_distancia.first.nombre_cientifico.limpiar(true).downcase # Era el mismo, solo que tenia ssp. en vez de subsp.\n puts \"-#{nombre_cientifico.limpiar.estandariza}-#{taxones_con_distancia.first.nombre_cientifico.limpiar.estandariza}-\"\n self.validacion = {estatus: true, taxon: taxones_con_distancia.first, msg: 'Búsqueda exacta'}\n else\n self.validacion = {estatus: true, taxon: taxones_con_distancia.first, msg: 'Búsqueda similar'}\n end\n\n return\n else\n self.validacion = {taxones: taxones_con_distancia, msg: 'Existe más de una coincidencia'}\n end\n end\n\n else # No hubo coincidencias con su nombre cientifico\n puts \"\\n\\nSin coincidencia\"\n self.validacion = {estatus: false, msg: 'Sin coincidencias'}\n return\n end\n end\n\n end #Fin de las posibles coincidencias\n end", "title": "" }, { "docid": "7159ecd5da17c4720d394c041a741863", "score": "0.6355182", "text": "def informeAnteriores\n\n @persona=current_persona\n @zona=current_persona.zona\n @diarios= Diario.find(:all, :conditions =>[\"zona_id = ? AND unificado = ?\", @zona.id, 1], :order => \"fecha DESC\")\t\n\n end", "title": "" }, { "docid": "4c28849f94990b0b542d16e467a30ba1", "score": "0.6340402", "text": "def show\n if @request.estado ==\"_noLeido\"\n @request.estado = \"Leido\"\n @request.save\n end\n end", "title": "" }, { "docid": "e9a3e7b43401b7c63a65a9363ece0d2c", "score": "0.6310316", "text": "def trg_soma_itens\n self.pedido.gerenciar_acoes\n self.pedido.save\n end", "title": "" }, { "docid": "e9a3e7b43401b7c63a65a9363ece0d2c", "score": "0.6310316", "text": "def trg_soma_itens\n self.pedido.gerenciar_acoes\n self.pedido.save\n end", "title": "" }, { "docid": "390d7da8e023ccc923c50b87e85905b0", "score": "0.6298085", "text": "def create\n\t\t\n\t\t@actividad = Actividad.find(params[:asignacion_actividad][:actividad_id])\n \t@proyecto = @actividad.proyecto\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !AsignacionActividad.accessible_by(current_ability, :create).include?(@actividad.asignacion_actividades.first)\n\t\telse\n\t\t\tauthorize! :create, AsignacionActividad\n\t\tend\n \tif params[:asignacion_actividad][:usuario_id].to_s.blank? #(!defined? (params[:usuario_id])) && (defined? params[:usuario])\n p \"VACIOOO\"\n\n \t\t@asignacion_actividad= AsignacionActividad.new\n @usuarios = Usuario.page(params[:page]).search query: params[:asignacion_actividad][:usuario]\n \t\trespond_to do |format|\n \t\t\tformat.html { render '/asignacion_actividades/busqueda_filtrada', :actividad_id => @actividad.id, :usuario => params[:usuario] }\n end\n \telse\n \t\tp \"NOOO VACIOOO\"\n #aca agregar revision asignacion proyecto\n if en_proyecto(params[:asignacion_actividad][:usuario_id], @proyecto.id)\n @asignacion_actividad = AsignacionActividad.new(actividad_id: params[:asignacion_actividad][:actividad_id], usuario_id: params[:asignacion_actividad][:usuario_id])\n \t\t@asignacion_actividad.vigente = true\n if unica(@asignacion_actividad.usuario_id,@asignacion_actividad.actividad_id) == true\n\n \t respond_to do |format|\n \t if @asignacion_actividad.save\n \t format.html { redirect_to :controller => 'asignacion_actividades', :action => 'index', :actividad_id => @asignacion_actividad.actividad.id\n \t\t flash[:success] = 'Asignacion actividad fue creado satisfactoriamente.' }\n \t format.json { render :show, status: :created, location: @asignacion_actividad }\n \t else\n \t\t\t\tformat.html { render :new }\n \t\t\t\tformat.json { render json: @asignacion_actividad.errors, status: :unprocessable_entity }\n \t end\n end \n \t\telse\n \t respond_to do |format|\n \t\t format.html { redirect_to :controller => 'asignacion_actividades', :action => 'index', :actividad_id => @asignacion_actividad.actividad.id\n \t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n end\n \t\tend\n else \n respond_to do |format|\n format.html { redirect_to :controller => 'asignacion_actividades', :action => 'index', :actividad_id => params[:asignacion_actividad][:actividad_id]\n flash[:danger] = 'El usuario no se encuentra asignado al Proyecto' } \n end \n end \n \tend\n end", "title": "" }, { "docid": "9b3f401c6b257cf6c56be03f0cf93d39", "score": "0.62978095", "text": "def new_or_edit\n @tramite = (params[:id])? Tramite.find(params[:id]) : Tramite.new\n #@numero_expediente = @tramite.numero_expediente if @tramite\n @tramite.fechahora_atencion ||= Time.now.strftime(\"%Y/%m/%d\")\n @materias = Materia.nopenal.all\n @organos = Organo.juzgados_familiares + Organo.juzgados_civiles + Organo.salas_civiles + Organo.salas_familiares\n @tipos_juicios = TipoJuicio.all\n @defensores = Defensor.nopenal.find(:all, :conditions => [\"activo = ? AND persona_id = ?\", true, current_user.persona.id]) if current_user.has_role?(:defensor)\n @defensores = Defensor.nopenal.find(:all, :conditions => [\"activo = ?\", true]) if current_user.has_role?(:admin) || current_user.has_role?(:jefedefensor)\n @defensores ||= Array.new\n end", "title": "" }, { "docid": "6f28f8e7b8d00e02c167e4f18f567b82", "score": "0.62885666", "text": "def consultarDoctoresEspecialidad(especialidad) @db.consultarDoctoresEspecialidad(especialidad) end", "title": "" }, { "docid": "edcbdcce56b3d9a3526d9af19bd5da42", "score": "0.62835693", "text": "def set_entrada\n @entrada = Entrada.find(params[:id])\n end", "title": "" }, { "docid": "edcbdcce56b3d9a3526d9af19bd5da42", "score": "0.62835693", "text": "def set_entrada\n @entrada = Entrada.find(params[:id])\n end", "title": "" }, { "docid": "edcbdcce56b3d9a3526d9af19bd5da42", "score": "0.62835693", "text": "def set_entrada\n @entrada = Entrada.find(params[:id])\n end", "title": "" }, { "docid": "edcbdcce56b3d9a3526d9af19bd5da42", "score": "0.62835693", "text": "def set_entrada\n @entrada = Entrada.find(params[:id])\n end", "title": "" }, { "docid": "9f98fdcea38225c8ae2d65d01c6b7bc3", "score": "0.62705517", "text": "def create\n @odeme = Odeme.new(odeme_params)\n @odeme.date=Date.today\n @odeme.dagitici=current_user.ad_soyad\n\n if !Bakiye.exists?(teslim_yeri: (@odeme.teslim_yeri))\n flash[:notice] = \"Bu firmanın bakiye kaydı bulunmamaktadır. Lütfen oluşturunuz. !!\"\n redirect_to new_odeme_path\n else\n respond_to do |format|\n if @odeme.save\n @bakiye=Bakiye.find_by_teslim_yeri(@odeme.teslim_yeri)\n @[email protected]_miktari\n @bakiye.save\n format.html { redirect_to odemes_path, notice: 'Odeme was successfully created.' }\n format.json { render :show, status: :created, location: @odeme }\n else\n format.html { render :new }\n format.json { render json: @odeme.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "title": "" }, { "docid": "8e3d99d397573c963cda38290a167444", "score": "0.6267407", "text": "def set_estoquefinal\n if !Estoquefinal.where(cliente_id: current_user.cliente_id).exists?\n redirect_to root_path\n flash[:danger] = \"Voce não possui itens cadastrados no estoque final ainda!\"\n else\n @estoquefinal = Estoquefinal.where(cliente_id: current_user.cliente_id).first\n end\n \n end", "title": "" }, { "docid": "60052af6e130061680f7fb1f2f83389f", "score": "0.6252632", "text": "def create\n @volante = Volante.new(volante_params)\n \n @volante.f_generacion =Date.current.to_s\n\n @estudiante = Estudiante.find(@volante.estudiante_id)\n\n if @volante.concepto==\"PAGO INSCRIPCION\"\n @estudiante.update_attributes({\n :estado => \"Pre Inscrito\"\n \n });\n else\n @estudiante.update_attributes({\n :estado => \"Matricula en Proceso\"\n \n });\n end\n\n respond_to do |format|\n if @volante.save\n format.html { redirect_to @volante, notice: 'Volante creado exitosamente' }\n format.json { render :show, status: :created, location: @volante }\n else\n format.html { render :new }\n format.json { render json: @volante.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3f58d753e5abe7a2e707d64395b4cbc", "score": "0.6241719", "text": "def create\n @produto = Produto.new(params[:produto])\n\t @produto.idUser = current_user.id\n\n @entrega = Entrega.new(params[:entrega])\n @entrega.idMotorista = getMotorista\n @entrega.idUser = current_user.id\n @entrega.statusentrega = \"5\"\n @entrega.origem=getOrigem\n @entrega.destino=getDestino\n @entrega.data=getData\n @entrega.save\n @[email protected]\n respond_to do |format|\n if @produto.save\n \n format.html { redirect_to @produto, :notice => 'Produto cadastrado com sucesso.' }\n format.json { render :json => @produto, :status => :created, :location => @produto }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @produto.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e389b51963843d1470500f5f04d0050c", "score": "0.6233098", "text": "def seguimiento\n @remote_ip = ip\n @busqueda = params['s'] \n if !(Orden.where(:id => @busqueda).first.nil?)\n @orden = Orden.find(@busqueda)\n @historico = Historico.seguimiento1(@orden.id)\n else\n redirect_to (root_url)\n end\n end", "title": "" }, { "docid": "0488faf1a0c6c641442a48b81bfb7a82", "score": "0.6225328", "text": "def saveObject(params)\r\n \r\n @solicitudlabexa.usuario_id = @usuario_actual.id\r\n if params[:asignatura].nil?\r\n @solicitudlabexa.asignatura=Asignatura.new\r\n @solicitudlabexa.asignatura.titulacion_id=params[:titulacion][:titulacion_id] unless params[:titulacion].nil?\r\n @solicitudlabexa.asignatura.curso=params[:nivel]\r\n @solicitudlabexa.asignatura.id=0\r\n else\r\n @solicitudlabexa.asignatura_id = params[:asignatura][:id].to_i\r\n end\r\n\r\n logger.debug \"Asignaturaaass\"[email protected]_id.to_s\r\n \r\n @solicitudlabexa.fechasol=Date.today\r\n @solicitudlabexa.npuestos=params[:npuestos]\r\n @solicitudlabexa.curso=params[:nivel].to_s == '0' ? 'optativa' : params[:nivel].to_s\r\n @solicitudlabexa.comentarios=Iconv.conv('ascii//translit//ignore', 'utf-8', params[:comentarios].to_s)\r\n @solicitudlabexa.horaini=params[:horaini][:comienzo]\r\n @solicitudlabexa.horafin=params[:horafin][:fin]\r\n @solicitudlabexa.asignado=\"N\"\r\n \r\n pref=\"\"\r\n @especiales=Laboratorio.where('especial=?',\"t\").to_a \r\n for especial in @especiales do\r\n nombre=especial.ssoo.to_s\r\n if params[:\"#{nombre}\"].to_s!='in'\r\n pref+=especial.nombre_lab.to_s+'-'+nombre+'-'+params[:\"#{nombre}\"]+\";\"\r\n end\r\n end\r\n @solicitudlabexa.preferencias=pref\r\n if params[:fecha]=~ /[0-3]?[0-9]\\-[0-1]?[0-9]\\-[0-9]{4}/\r\n @solicitudlabexa.fecha=formato_europeo(params[:fecha])\r\n else\r\n @solicitudlabexa.fecha=nil\r\n end \r\n end", "title": "" }, { "docid": "791ad1a8d03544f4f4845e3578f623da", "score": "0.6224691", "text": "def agregar\n titulo(\"Agregar estudiante\")\n estudiante = Estudiante.build_using_questions\n if estudiante.guardar\n puts \"\\nBien! Se agrego el usuario\\n\\n\"\n else\n puts \"\\nError: No se agrego el usuario\\n\\n\"\n end\n end", "title": "" }, { "docid": "602a3c80bacf8e29abfb66fd7478f741", "score": "0.6222758", "text": "def create\n @cadastro = Cadastro.new(cadastro_params)\n \n @cadastro.flagativo = false\n @cadastro.dadatainclusao = Time.now\n @cadastro.ciclo_id = 1\n @cadastro.flagreentrada = false\n @cadastro.contador = Cadastro.where('flagreentrada = false').count + 1\n\n respond_to do |format|\n if @cadastro.save\n\n session[:cadastro_id] = @cadastro.id\n\n padrinho = Usuario.find_by_email(@cadastro.cpfpadrinho)\n\n if not padrinho == nil\n\n indicado = Indicado.new\n indicado.cadastro_1_id = padrinho.cadastro_id\n indicado.cadastro_2_id = @cadastro.id\n indicado.save\n\n end\n\n format.html { redirect_to new_dadosfinanceiro_path, notice: 'Cadastro criado com sucesso.' }\n\n else\n\n if padrinho\n padrinho.destroy\n end\n\n format.html { render :new }\n\n end\n end\n end", "title": "" }, { "docid": "84541720dbe33fe7008595168ef4bbfe", "score": "0.6220616", "text": "def control_compras\n compras = Compra.where(fecha: Time.now.to_date)\n @compras_del_dia = false\n if compras[0] == nil\n @compras_del_dia = true\n end\n end", "title": "" }, { "docid": "ba3ff4dffc2ab0bbd1385044f56e25a0", "score": "0.62183636", "text": "def create\n\n @asignatura = Asignatura.new\n @asignatura.codigo_asig=params[:asignatura][:codigo_asig]\n @asignatura.nombre_asig=params[:asignatura][:nombre_asig]\n @asignatura.caracter=params[:caracter]\n @asignatura.coeficiente_exp=params[:coeficiente_exp]\n @asignatura.curso=params[:curso]\n @asignatura.area_depto=params[:area]\n if params[:cuatrimestre]==\"anual\"\n @asignatura.cuatrimestre=0\n else\n @asignatura.cuatrimestre=params[:cuatrimestre]\n end\n @asignatura.abrevia_asig=params[:asignatura][:abrevia_asig]\n @asignatura.titulacion_id = Titulacion.find_by_nombre(params[:titulacion][:nombre]).id\n \n\n respond_to do |format|\n if @asignatura.save\n # flash[:notice] = 'Asignatura fue creada con &eacute;xito.'\n @asignaturas = Asignatura.find(:all,:order=>\"titulacion_id,curso,cuatrimestre\")\n @cuenta = @asignaturas.size \n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @asignatura, :status => :created, :location => @asignatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asignatura.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa49c39e476fb7c96fe21c3bcc138a16", "score": "0.62180275", "text": "def insere_cod_postagem\n self.notifica_codigo_postagem\n end", "title": "" }, { "docid": "c1a068ee8c3de469c7826a4d4c052d69", "score": "0.6215881", "text": "def pago_e_pode_reenviar?\n if self.pode_reenviar?\n return false # como reenviar se o cliente já recebeu??\n else\n self.reenvio += 1\n self.reenviado = true\n self.reenviado_em = Time.now.utc\n self.save(false)\n return true\n end\n end", "title": "" }, { "docid": "ef86379da33394d45fd89f97d7b8b5c5", "score": "0.6215019", "text": "def create\n\n\n @user = current_user\n @pessoa=Pessoa.search(@user.id)\n @sugestao_item_pautum = SugestaoItemPautum.new(sugestao_item_pautum_params)\n @sugestao_item_pautum.pessoa=@pessoa[0]\n @reuniao = Reuniao.find(@sugestao_item_pautum.reuniao) \n if Convocado.search(@pessoa[0].id, @reuniao.id) != [] #com esse if eu evito que se convoque a mesma pessoa 2 vezes\n respond_to do |format|\n if @sugestao_item_pautum.save\n format.html { redirect_to reuniao_path(@sugestao_item_pautum.reuniao), notice: 'Sugestao cadastrada.' }\n format.json { render :show, status: :created, location: @sugestao_item_pautum }\n else\n format.html { render :new }\n format.json { render json: @sugestao_item_pautum.errors, status: :unprocessable_entity }\n end\n end\n else\n\n redirect_to @reuniao , notice: 'Voce não pode sugerir nesta reunião.'\nend\n end", "title": "" }, { "docid": "695a6f8aaf52dd00f6d00153de66986e", "score": "0.6212237", "text": "def inicia_observador\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [21]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "e2daed268c434e84ea08a43dc294bb2c", "score": "0.6207326", "text": "def consultarEspecialidades() @db.consultarEspecialidades end", "title": "" }, { "docid": "6409f196f9e8780c5f16778869df69f3", "score": "0.620669", "text": "def insertarPelicula pelicula\n #puts \"insertar pelicula #{@peliculasDao.listar}\"\n if @peliculasDao.listar.size < @tamañoMaximo\n @peliculasDao.insert pelicula\n else \n return \n end\n end", "title": "" }, { "docid": "f0bcce6ed58b6c5579980e9c3faf248a", "score": "0.6205162", "text": "def estado_cuenta\n @linea = Linea.new\n @lineas = Linea.find(:all)\n @fondeos = Fondeo.find(:all, :order => \"fuente\")\n end", "title": "" }, { "docid": "825110ae01794b7c4fedb8bf3960d3f0", "score": "0.62007", "text": "def new\n\n # Borra Todas las notas antiguas e inservibles\n # SELETE FROM `notas` WHERE (resumen_id IS NULL AND created_at <= 'Hoy')\n # Nota.delete_all ([\"resumen_id IS ? AND created_at <= ?\", nil, Date.today])\n \n @resumenes = Resumen.creados_hoy.order(\"vocero_id DESC\")\n temas = Tema.joins(:resumenes).where('resumenes.created_at >= ?', Date.today)\n # @websites = Website.all\n @asuntos = Asunto.joins(:temas).where('temas.id' => temas).group(:id)\n \n @informe = Informe.new\n @informe.save\n if @resumenes\n @resumenes.each do |resumen|\n resumen.informe_id = @informe.id\n resumen.save\n end\n end\n # @informe.resumen = encabezado\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @informe }\n end\n end", "title": "" }, { "docid": "7d29a7b1025956ec231d83ab6feceec7", "score": "0.62002856", "text": "def create\n @orcamento = Orcamento.new(orcamento_params)\n if [email protected]_orcamentos.blank?\n if @orcamento.save\n flash[:notice] = \"Orçamento salvo com sucesso\"\n redirect_to @orcamento\n else\n render :new\n end\n else\n flash[:alert] = 'Adicione itens ao Orçamento'\n render :new\n end\n end", "title": "" }, { "docid": "df21f79ced33543da1ba50374a607067", "score": "0.618981", "text": "def create_orcamento\n \n @condigo = Orcamento.where(user_id: current_user.id).maximum(:codigoorcamento) \n @orcamento = Orcamento.new\n \n if @condigo \n @condigo += 1 \n @orcamento.codigoorcamento = @condigo \n else\n @orcamento.codigoorcamento = 1 \n end \n\n @orcamento.situacaoorcamento_id = 1\n @orcamento.nome = \"Orçamento \" + @orcamento.codigoorcamento.to_s\n @orcamento.user_id = current_user.id\n\n @orcamento.bairro_id = current_user.dadosuser.endereco.bairro_id\n @orcamento.latitude = current_user.dadosuser.endereco.latitude\n @orcamento.longitude = current_user.dadosuser.endereco.longitude\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to edit_orcamento_path(@orcamento), notice: 'Cadastro realizado.' }\n format.json { render :show, status: :created, location: @orcamento }\n else\n format.html { render :new }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6006cebd9d6b2cc68f33625b88adacd1", "score": "0.6189463", "text": "def create\n @destaque = Destaque.new\n @destaque.oferta = Oferta.find params[:id]\n @destaque.status = Status.find_by_descricao('Ativo')\n\n respond_to do |format|\n if @destaque.save\n format.html { redirect_to admin_destaques_path, :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @destaque, :status => :created, :location => @destaque }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @destaque.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d75d1271491567425e5f9cc60fac4855", "score": "0.61877984", "text": "def create\n @bakiye = Bakiye.new(bakiye_params)\n @bakiye.date=Date.today\n @bakiye.toplam_borc=0\n if Bakiye.exists?(teslim_yeri: @bakiye.teslim_yeri)\n flash[:notice] = \"Bu Firmanın bakiye kaydı bulunmaktadır. !!\"\n redirect_to new_urunler_path\n else\n respond_to do |format|\n if @bakiye.save\n format.html { redirect_to bakiyes_path, notice: 'Firmanın bakiye kaydı yapıldı.' }\n format.json { render :show, status: :created, location: @bakiye }\n else\n format.html { render :new }\n format.json { render json: @bakiye.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "title": "" }, { "docid": "9fca6ae9860696983c75eeddea7d22f1", "score": "0.6186246", "text": "def doacoesVencendo\n\n if usuario_logado && user.cadastro_id == 1\n @doacaosVencendo = Doacao.where('tempo > ? and flagenviada = false', Time.now).order(:created_at)\n else\n redirect_to root_path\n end\n\n end", "title": "" }, { "docid": "b7e083f3d5af1c91a0442f11d2481cd7", "score": "0.61845905", "text": "def create\n @enviar = params[:enviar]\n @id = session[:id]\n @orden= Orden.new(:nombre => @enviar['nombre'], :apellido => @enviar['apellido'], :fecha => Time.now, :estado => \"Pendiente por recolectar\", :personas_id => @id)\n @orden.save\n NUESTRO_LOG.info \"Se guardo la orden correctamente\"\n @orden = Orden.where(:personas_id => @id).order(\"created_at DESC\").first\n @paquetes = Paquete.where(:personas_id => @id, :ordens_id => nil )\n @paquetes.each do |paquete|\n @paquete = Paquete.find(paquete.id)\n @paquete.ordens_id = @orden.id\n @paquete.save\n NUESTRO_LOG.info \"Se guardo el paquete correctamente\"\n end\n @historico1= Historico.new(:ordens_id => @orden.id, :direccions_id => @enviar['direccion1'], :tipo => 'Recolectada')\n @historico= Historico.new(:ordens_id => @orden.id, :direccions_id => @enviar['direccion2'], :tipo => 'Entregada')\n @historico1.save\n @historico.save\n NUESTRO_LOG.info \"Se guardo el historico correctamente\"\n @monto = Enviar.montoTotal(@orden.id)\n @iva = @monto * 0.12\n Enviar.compania\n @factura = Factura.new(:companias_id => 1, :ordens_id =>@orden.id , :tipo_pagos_id => @enviar['tdc'], :costoTotal => @monto ,:iva => @iva)\n\n # redirect_to ordens_path\n respond_to do |format|\n if @factura.save\n NUESTRO_LOG.info \"Se guardo el tipopago correctamente\"\n format.html { redirect_to(@factura, :notice => t('tipopagocreado')) }\n format.xml { render :xml => @historico, :status => :created, :location => @historico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @historico.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94dff3a775e5cd0dec2fac540e0b99bc", "score": "0.6179951", "text": "def reservado(reservation_id)\n self.estado = \"reservado\"\n self.reservation_id = reservation_id\n self.save\n end", "title": "" }, { "docid": "7901647c255db7252c89ffc9bf62c77e", "score": "0.6174066", "text": "def new # modificacion para transacciones\n @solicitudrecurso = Solicitudrecurso.new \n \n #identifico los tipos distintos de recurso\n @tipos = Recurso.all.map{ |i| i.descripcion }.uniq\n \n # cargo los dias y horas posibles para los select\n @dias=Dia.where('en_uso = ?',\"t\").to_a\n @horas=Horario.where('en_uso = ?',\"t\").to_a\n\n #obtengo y formateo la fecha actual\n @[email protected]=formato_europeo(Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitudrecurso }\n end\n end", "title": "" }, { "docid": "33d966dc871e7d8d35dd7ad3bcb4394d", "score": "0.6172355", "text": "def valid_log_abonnement(id_log_abonnement)\n current_log_abonnement = self.log_abonnements.find(id_log_abonnement)\n abonnement = current_log_abonnement.abonnement\n \n #mise a jour des info du compte \n self.end_date = Date.today + 1.year\n self.assigned_memory = abonnement.assigned_memory\n self.status = 'active' \n \n #derniere mise a jour des info du compte et sauvegarde\n self.save\n end", "title": "" }, { "docid": "632f690dc1c5ca2a04d03f62904ac164", "score": "0.6170009", "text": "def create\n\t\t#@trabajador = Trabajador.new(nombres: )\n\t\t@trabajador = Trabajador.new()\n\tend", "title": "" }, { "docid": "2c7dee3cb445b081ae5df4d23cda5195", "score": "0.6166607", "text": "def create\r\n authorize! :create, SivicMinisteriodiscipulo\r\n sivic_discipulo_id = sivic_ministeriodiscipulo_params[:sivic_discipulo_id]\r\n sivic_ministerio_id = sivic_ministeriodiscipulo_params[:sivic_ministerio_id]\r\n \r\n existente = SivicMinisteriodiscipulo.where(:sivic_discipulo_id => sivic_discipulo_id, :sivic_ministerio_id => sivic_ministerio_id ) \r\n #debugger\r\n if existente.first\r\n respond_to do |format|\r\n format.html { redirect_to adicionaministerio_sivic_ministeriodiscipulo_path(sivic_discipulo_id), notice: 'Este ministério já encontra-se cadastrado.' }\r\n end \r\n return\r\n end\r\n\r\n @sivic_ministeriodiscipulo = SivicMinisteriodiscipulo.new(sivic_ministeriodiscipulo_params)\r\n #@sivic_ministeriodiscipulo.data_inclusao = Date.today \r\n\r\n if @sivic_ministeriodiscipulo.flag_ministerioativo\r\n @sivic_ministeriodiscipulos = SivicMinisteriodiscipulo.find_by_sivic_discipulo_id(sivic_discipulo_id)\r\n if @sivic_ministeriodiscipulos\r\n @sivic_ministeriodiscipulos.flag_ministerioativo = false\r\n @sivic_ministeriodiscipulos.save\r\n end\r\n end\r\n\r\n respond_to do |format|\r\n if @sivic_ministeriodiscipulo.save\r\n format.html { redirect_to adicionaministerio_sivic_ministeriodiscipulo_path(sivic_discipulo_id), notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_ministeriodiscipulo }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_ministeriodiscipulo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\nend", "title": "" }, { "docid": "4fdfe60b92587c65dd6e2e0928e17acc", "score": "0.6161346", "text": "def edicion(edicion)\n\t\t\t@edicion = edicion\n\t\tend", "title": "" }, { "docid": "4fdfe60b92587c65dd6e2e0928e17acc", "score": "0.6161346", "text": "def edicion(edicion)\n\t\t\t@edicion = edicion\n\t\tend", "title": "" }, { "docid": "1fe643835b0f0982ac1c50864f0faa31", "score": "0.6156728", "text": "def create\n @asignado = Asignado.new(params[:asignado])\n @asignado.esta_activo = false\n @asignado.save\n redirect_to lineasasignado_url(:id => @asignado.id)\n end", "title": "" }, { "docid": "ee29922305a263ea8a909ca0f63c256e", "score": "0.61565036", "text": "def inicializar\n @group = Group.find(params[:group_id])\n @asistencia=Enroll.new\n # @estudiantesConFallas=User.joins(enrolls: :failures).where({enrolls: {group: @group, failures:{created_at: (@dia.beginning_of_day)[email protected]_of_day,} }})\n \t\n\t @students=User.joins(:enrolls).where({enrolls: {group: @group }})\n @estudiantesAprobados = User.joins(:enrolls).where({enrolls: {group: @group, definitiva: 'aprobado' }}) \n \t\n end", "title": "" }, { "docid": "8d3aea8f69e6baa2757450e357e5a5d9", "score": "0.61474645", "text": "def set_datos_registro\n @datos_registro = DatosRegistro.find(params[:id])\n end", "title": "" }, { "docid": "50306beaa1aec97c5c6c19e7486b8f79", "score": "0.61471236", "text": "def create\n b = @batigrados.find(params[:even_sel])\n if params[:com_batigrado][:bati2] == \"1\" # CREER UN COM_BATIGRADO DU BATIGRADO ASSOCIE\n basso = @batigrados.find(b.batiasso_id)\n basso.com_batigrados << ComBatigrado.create(nom: params[:com_batigrado][:nom], prenom: params[:com_batigrado][:prenom],nom_grupo: params[:com_batigrado][:nom_grupo], email: params[:com_batigrado][:email], ttshirt: params[:com_batigrado][:ttshirt], tpant: params[:com_batigrado][:tpant], bati1: params[:com_batigrado][:bati1], bati2: params[:com_batigrado][:bati2], gradup: false, repas1: params[:arepas1], repas2: params[:arepas2], repas3: params[:arepas3], soiree: params[:asoiree], montant: basso.tarif2+(params[:asoirpay] == '1' ? 1 : 0)*( basso.tar_soiree ? basso.tar_soiree : 0 ), hbesoin: params[:ahbesoin], hprop: params[:ahprop], hadresse: params[:ahadresse], htelephone: params[:ahtelephone], gradactu: params[:com_batigrado][:gradactu], soirpay: params[:asoirpay], remarque: params[:aremarque],repenfvege: params[:arepenfvege], repenf: params[:arepenf], repadvege: params[:arepadvege], repad: params[:arepad])\n current_user.commandes << Commande.create(description: basso.titre, montant: basso.tarif2+(params[:asoirpay] == '1' ? 1 : 0)*( basso.tar_soiree ? basso.tar_soiree : 0 ))\n @com_batigrado = ComBatigrado.last\n @com_batigrado.commandes << current_user.commandes.last\n # params[:com_batigrado][:montant] = (params[:com_batigrado][:bati1] == '1' ? 1 : 0)*b.tarif1 + (params[:com_batigrado][:bati2] == '1' ? 1 : 0)*( b.tarif2 ? b.tarif2 : 0 )\n end\n # @eleves_all = @eleves.where(:user_id => current_user.id).all\n # @elefe = @eleves_all.where(:nom => params[:com_batigrado][:nom], :prenom => params[:com_batigrado][:prenom])\n\n # params[:com_batigrado][:montant] = (params[:com_batigrado][:bati1] == '1' ? 1 : 0)*b.tarif1 + (params[:com_batigrado][:bati2] == '1' ? 1 : 0)*( b.tarif2 ? b.tarif2 : 0 )\n # if @elefe.exists? #Eleve du GCC\n # b.com_batigrados << @elefe[0].com_batigrados.create(com_batigrado_params)\n # current_user.commandes << Commande.create(description: b.titre, montant: params[:com_batigrado][:montant])\n # @com_batigrado = ComBatigrado.last\n # @com_batigrado.commandes << current_user.commandes.last\n # respond_to do |format|\n # if @com_batigrados\n # format.html { redirect_to @com_batigrado, notice: \"Votre demande d'inscription a bien été enregistrée.\" }\n # format.json { render :show, status: :created, location: @com_batigrado }\n # else\n # format.html { render :new }\n # format.json { render json: @com_batigrado.errors, status: :unprocessable_entity }\n # end\n # end\n # else #Eleve exterieur\n # params[:com_batigrado][:montant] = (params[:com_batigrado][:bati1] == '1' ? 1 : 0)*b.tarif_ext\n if params[:com_batigrado][:nom_grupo] == \"Grupo Cultura Capoeira\"\n mont = b.tarif1 + (params[:com_batigrado][:soirpay] == '1' ? 1 : 0)*( b.tar_soiree ? b.tar_soiree : 0 )\n else\n mont = b.tarif_ext + (params[:com_batigrado][:soirpay] == '1' ? 1 : 0)*( b.tar_soiree ? b.tar_soiree : 0 )\n end\n params[:com_batigrado][:montant] = mont\n b.com_batigrados << ComBatigrado.create(com_batigrado_params)\n current_user.commandes << Commande.create(description: b.titre, montant: mont)\n @com_batigrado = ComBatigrado.last\n @com_batigrado.commandes << current_user.commandes.last\n respond_to do |format|\n if @com_batigrado.save\n format.html { redirect_to @com_batigrado, notice: \"Votre demande d'inscription a bien été enregistrée.\" }\n format.json { render :show, status: :created, location: @com_batigrado }\n else\n format.html { render :new }\n format.json { render json: @com_batigrado.errors, status: :unprocessable_entity }\n end\n end\n # end\n end", "title": "" }, { "docid": "b18a13a2996bea3381fdcf7592419adb", "score": "0.6146843", "text": "def insertarInicio(nodo)\n\t\tif(vacia)\n\t\t\tself.cabeza = nodo \n\t\telse\n\t\t\taux = cabeza\n\t\t\tself.cabeza = nodo \n\t\t\tself.cabeza.nodoSiguiente = aux\n\t\tend\t\n\tend", "title": "" }, { "docid": "53da96062a23d895c7732c82eee04223", "score": "0.6146223", "text": "def create\n @registro = Registro.new(params[:registro])\n @registro.inicio =Time.now\n @registro.fim [email protected]\n #@registro.classe_id= session[:cont_classe_id]\n #@registro.atribuicao_id= session[:cont_atribuicao_id]\n #@registro.unidade_id= session[:cont_unidade_id]\n #@registro.ano_letivo = Time.now.year\n #@registro.aluno_id= session[:cont_aluno_id]\n t=0\n\n @registro.aluno_id = session[:aluno_id]\n @registro.ano_letivo = Time.now.year\n @registro.unidade_id= session[:unidade_id]\n @registro.disciplina_id=session[:disciplina_id]\n @registro.professor_id=session[:professor_id]\n @registro.classe_id=session[:classe_id]\n @registro.atribuicao_id= session[:atribuicao_id]\n\n respond_to do |format|\n if @registro.save\n flash[:notice] = 'REGISTRO INDIVIDUAL DE ALUNO CADASTRADO.'\n format.html { redirect_to(@registro) }\n format.xml { render :xml => @registro, :status => :created, :location => @registro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registro.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d9c667ed4d1d62c723d4108ef1d5c4e", "score": "0.6144799", "text": "def create\n @fournisseur = Fournisseur.create(fournisseur_params)\n @fournisseurs = Fournisseur.all\n flash[:notice]=\"Fournisseur créé avec succès!!!\"\n \n end", "title": "" }, { "docid": "74bd21bf6895e2f17931500f92d8c88d", "score": "0.6143627", "text": "def create\n\n begin \n\n @usuario = Usuario.new(usuario_params)\n @usuario.cadastro_id = session[:cadastro_id]\n @usuario.datainclusao = Time.now\n @usuario.flagativo = false\n \n rescue\n flash[:danger] = \"Não foi possível salvar as informações. Contate o administrador1\"\n return redirect_to new_usuario_path \n end\n\n respond_to do |format|\n if @usuario.save\n\n session[:ObjLogon] = Usuario.where(:email => @usuario.email, :senha => @usuario.senha)\n session[:ObjLogon] = session[:ObjLogon].first\n\n format.html { redirect_to home_path, notice: 'Usuário criado com sucesso.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2780263aee8bb1480f5d6c4a181fb860", "score": "0.6139554", "text": "def create\n\n respond_to do |format|\n aux= params[:convocado][:pessoa_id]\n if aux.size > 1\n \n for x in aux\n if x == \"\"\n break#a ultima posição do array e um \"\" e isso não é um id por tanto da erro entao esse if resolve isso\n end\n @pessoa=Pessoa.find(x) #aqui eupego a pessoa com o id q ta no x\n\n @convocado = Convocado.new(convocado_params)#colocando o new dentro for me permite fazer varias convocaçoes com id diferentes o que evida erro se o id foce o mesmo nao seria create e sim update de fk de pessoa \n @reuniao = Reuniao.find(@convocado.reuniao) \n\n if Convocado.search(@pessoa.id, @reuniao.id) == [] #com esse if eu evito que se convoque a mesma pessoa 2 vezes\n @convocado.pessoa=@pessoa# passo o objeto para convocado\n @convocado.save\n end\n\n end\n @reuniao = Reuniao.find(@convocado.reuniao) \n\n\n format.html { redirect_to @reuniao, notice: 'Participacao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n\n\n format.html { redirect_to reuniao_path(@convocado.reuniao), notice: 'Desculpe mas,você não selecionou ninguem.' }\n end\n end\n end", "title": "" }, { "docid": "f7691084f9f1aa23bc88facfaf4100c9", "score": "0.6138196", "text": "def create\n @actividad = Actividad.new(actividad_params)\n\t\tauthorize! :create, Actividad\n @actividad.historial_estado_actividades.new(estado_actividad_id: EstadoActividad.find_by(nombre: 'Creada').id, actividad_id: @actividad.id)\n @habilidades = Habilidad.all\n @tipoActividades = TipoActividad.all\n if params[:actividad][:repetitiva] == \"1\"\n @actividad.repetitiva = true \n if params[:actividad][:frecuencia] == 'Por Semana'\n @actividad.frecuencia = 'Por Semana'\n case params[:actividad][:dia_semana]\n when \"1\"\n @actividad.dia_semana = 'Lunes'\n when \"2\"\n @actividad.dia_semana = 'Martes'\n when \"3\"\n @actividad.dia_semana = 'Miércoles'\n when \"4\"\n @actividad.dia_semana = 'Jueves'\n when \"5\"\n @actividad.dia_semana = 'Viernes'\n when \"6\"\n @actividad.dia_semana = 'Sábado'\n when \"7\"\n @actividad.dia_semana = 'Domingo'\n else\n @actividad.dia_semana = 'No Seleccionado'\n end\n elsif params[:actividad][:frecuencia] == 'Por Mes'\n @actividad.frecuencia = 'Por Mes'\n @actividad.dia_semana = nil\n else\n @actividad.frecuencia = 'No Seleccionado'\n end\n else\n @actividad.repetitiva = false\n @actividad.frecuencia = nil\n @actividad.dia_semana = nil\n\n end\n @actividad.active = true\n\t\t@objetivo_especifico = @actividad.objetivo_especifico\n @proyecto = @actividad.proyecto\n respond_to do |format|\n if @actividad.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n\t\t descripcion: \"Creación de la Actividad : #{@actividad.attributes}\",\n\t\t sesion_id: sesion.id ,\n\t\t proyecto_id: @actividad.proyecto.id)\n\t format.html { redirect_to @actividad,:objetivo_especifico_id => @actividad.objetivo_especifico_id \n\t\t flash[:success] = 'Actividad fue creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @actividad }\n else\n format.html { render :new, :objetivo_especifico_id => @actividad.objetivo_especifico_id }\n format.json { render json: @actividad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66b6145280c153339469e47abf10bae7", "score": "0.6134952", "text": "def create\n @connection = ActiveRecord::Base.establish_connection\n idFesta = params[:idFesta][:idFesta].to_i\n idUsuario = session[:idCadastro]\n comentario = params[:comentario]\n nota = params[:nota]\n dataHora = Time.now.to_formatted_s(:db)\n isActive = true\n\n sql = \"INSERT INTO AvaliacaoFesta(idFesta, idUsuario, comentario, nota, dataHora, isActive)\n VALUES(#{idFesta}, #{idUsuario}, '#{comentario}', #{nota}, '#{dataHora}', true);\"\n puts sql\n result = @connection.connection.insert(sql)\n\n flash[:success] = 'Avaliação postada com sucesso!'\n redirect_to \"/festa/#{idFesta}\"\n end", "title": "" }, { "docid": "1c52415b54401108301496c38b6fb3cd", "score": "0.61314416", "text": "def pedido\n\t\n\tend", "title": "" }, { "docid": "687836224d987b7479abcb078f08a46e", "score": "0.6131389", "text": "def create\n @mesa = Mesa.new(mesa_params)\n @mesa.recinto_id = Recinto.where(:encargado_id => current_usuario.id).first.id\n respond_to do |format|\n if @mesa.save\n format.html { redirect_to @mesa, notice: 'Mesa was successfully created.' }\n format.json { render :show, status: :created, location: @mesa }\n else\n format.html { render :new }\n format.json { render json: @mesa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f9dd3a0b2cf2adf02de27618714f212", "score": "0.6131185", "text": "def create\n isAllSave = false\n @usuario = Usuario.new(usuario_params)\n @usuario.cobranca = @usuario.associado ? 189 : 63\n @usuario.status = true\n if @usuario.indicacao != nil\n u = Usuario.find(@usuario.indicacao)\n @usuario.franquia = u.franquia\n else\n @usuario.errors.add(:indicacao, \"não pode ser nula\")\n end\n endereco = Endereco.new\n endereco.cep = params[:usuario][:cep]\n endereco.logradouro = params[:usuario][:logradouro]\n endereco.bairro = params[:usuario][:bairro]\n endereco.lote = params[:usuario][:numero]\n endereco.complemento = params[:usuario][:complemento]\n cidade = Cidade.find_by_nome(params[:usuario][:cidade]) ? Cidade.find_by_nome(params[:usuario][:cidade]) : Cidade.new(nome: params[:usuario][:cidade])\n estado = Estado.find_by_sigla params[:usuario][:estado]\n cidade.estado = estado\n endereco.usuario = @usuario\n\n conta = Conta.new(nome: @usuario.email, nivel_permissao: 1, password: @usuario.cpf_cnpj)\n # Usuario.transaction do\n isAllSave = @usuario.save\n isAllSave = isAllSave ? cidade.save : false\n conta.usuario = @usuario\n conta.email = @usuario.email\n isAllSave = isAllSave ? conta.save! : false\n endereco.cidade = cidade\n isAllSave = isAllSave ? endereco.save : false\n # end\n respond_to do |format|\n if isAllSave\n format.html { redirect_to @usuario, notice: 'Usuario foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render :json => @usuario.errors, status: :unprocessable_entity, notice: @usuario.errors }\n end\n end\n end", "title": "" }, { "docid": "02a64e45ceda008f9b60ae18aecbd472", "score": "0.61269295", "text": "def create\n save = true\n @recepciones = []\n #@fecha = params[:recepcion].first()\n\n Recepcion.transaction do\n params[:recepcion].each do |k, recepcion|\n r = Recepcion.new(recepcion)\n unless r.save!\n raise ActiveRecord::Rollback, \"Error de transacción Recepción!\"\n save = false\n flash[:error] = \"Existion un error no se pudo guardar los datos\"\n end\n @recepciones.push(r)\n end\n end\n if save\n flash[:notice] = \"Se guardaron los datos correctamente\"\n redirect_to :action => \"index\"\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "0869c7352dac6e2d773e8ddc715b7312", "score": "0.61175185", "text": "def registro_params\n params.require(:registro).permit(:pontuacao, :escala_id)\n end", "title": "" }, { "docid": "7e9416827614e8d20624851690e16538", "score": "0.6115872", "text": "def create_orden\n i_cita_id = params[:cita_id]\n\n @cita = Cita.where(\"id = ?\", i_cita_id)\n if @cita.empty?\n @error_code = 500\n @error_description = \"Numero de cita invalido\"\n else\n #buscar si ya existe\n @orden = Orden.where(:cita_id => @cita[0].id)\n \n if @orden.empty?\n #crear orden\n @orden = Orden.new(:cita_id => @cita[0].id,\n :estado_id => Orden::ESTADO_RECIBIDO)\n\n unless @orden.save\n @error_code = 500\n @error_description = \"Error al crear orden. #{@orden.errors}\" \n end\n \n else\n @error_code = 500\n @error_description = \"Cita ya ha sido ingresada.\"\n end\n \n end\n\n respond_to do |format|\n format.xml\n end\n \n end", "title": "" }, { "docid": "7e9416827614e8d20624851690e16538", "score": "0.6115872", "text": "def create_orden\n i_cita_id = params[:cita_id]\n\n @cita = Cita.where(\"id = ?\", i_cita_id)\n if @cita.empty?\n @error_code = 500\n @error_description = \"Numero de cita invalido\"\n else\n #buscar si ya existe\n @orden = Orden.where(:cita_id => @cita[0].id)\n \n if @orden.empty?\n #crear orden\n @orden = Orden.new(:cita_id => @cita[0].id,\n :estado_id => Orden::ESTADO_RECIBIDO)\n\n unless @orden.save\n @error_code = 500\n @error_description = \"Error al crear orden. #{@orden.errors}\" \n end\n \n else\n @error_code = 500\n @error_description = \"Cita ya ha sido ingresada.\"\n end\n \n end\n\n respond_to do |format|\n format.xml\n end\n \n end", "title": "" }, { "docid": "686a98518171e9b3c40dfb0941e25a31", "score": "0.6115833", "text": "def set_dato_estudiante\n @dato_estudiante = DatoEstudiante.find(params[:id])\n end", "title": "" }, { "docid": "b8f648f247b0d3f4ec7c0f05f4d4f957", "score": "0.6115164", "text": "def set_agregado\n @objeto = Agregado.find(params[:id])\n end", "title": "" }, { "docid": "4162cdf6d2d2e1b5af95b644aef6fe93", "score": "0.6114116", "text": "def inicia_pedido\n self.data_pedido = self.updated_at #Time.now.utc\n self.save(false)\n end", "title": "" }, { "docid": "677d1fd1fdc85288af7950f3806e2cad", "score": "0.6113361", "text": "def create\n @tese = Tese.new(params[:tese])\n @tese.profesor_id = params[:profesor_id]\n @tese.finalizado = false\n\n respond_to do |format|\n if @tese.save\n format.html { redirect_to @tese, notice: 'Tesis creada exitosamente' }\n format.json { render json: @tese, status: :created, location: @tese }\n else\n @profesor = Profesor.all\n format.html { render action: \"new\"}\n format.json { render json: @tese.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa1402410531ea910fea50d13a3e92d8", "score": "0.6111764", "text": "def create\n @episodio = Episodio.new\n @episodio.titulo = params[:episodio][:titulo]\n @episodio.duracao = params[:episodio][:duracao]\n @episodio.serie_id = Integer(params[:episodio][:serie_id])\n if @episodio.save\n @episodios = Episodio.where(serie_id: params[:episodio][:serie_id],ativo: true)\n render json: @episodios\n else\n render json: @episodio.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1324e7f70abddeaa369b21a548fd4d3d", "score": "0.6107904", "text": "def set_status\n\t \t#establecer status en BD\n\t \tself.status = \"created\"\n\t \tself.save #para que se guarde\n\t end", "title": "" }, { "docid": "1723ba79444efd4bbdb23cad91eaf656", "score": "0.6107208", "text": "def set_transacao_entrada\n @socio = Socio.find(params[:id])\n end", "title": "" }, { "docid": "c3af7706daba953bab26e95624fd5469", "score": "0.6101434", "text": "def create\n params[:comentario][:created_at_admin]=Time.now.to_s\n @comentario = Comentario.create(params[:comentario])\n #@comentario.created_at=Time.now\n @[email protected]\n @[email protected]\n ###OJO AQUI VALIDACION Y NOTIFICACION\n respond_to do |format| \n if @comentario.save && [email protected]?\n \t#@traductores=Usuario.where(:tipo=>'traductor')\t\n \t#@traductores.each do |traductor|\n \t# AvisoMailer.traductor(traductor).deliver\n #end\n if(params[:forito]=='true')\n format.html {\n render :text=>@comentario.id\n }\n else\n \t format.html { redirect_to(jeunes_foro_path(:id=>@foro), :notice => t('exito')) }\n end \n elsif @comentario.save && [email protected]?\n if(params[:forito]=='true')\n format.html {\n render :text=>@comentario.id\n }\n else\n \tformat.html { redirect_to(femmes_foro_path(:id=>@foro), :notice => t('exito')) }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comentario.errors, :status => :unprocessable_entity }\n end\n \n #AvisoMailer.aviso_foro(@comentario).deliver\n \n end\n end", "title": "" }, { "docid": "38c0cd77e4c5ab3b3d4fa38531546cf0", "score": "0.60981476", "text": "def cambiar_estado?(val)\n # Los estados superiores estan con numeros menores\n # Permiso.permite_ruta?(\"solicitudes\", @@estados[val.abs][0]) \n unless self.read_attribute(:estado) == val\n if val.abs < self.read_attribute(:estado).abs\n self.estado = val\n return self.save\n else\n return false\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "8e81a37b6355a19e3f9174dc6f5ed3af", "score": "0.60979706", "text": "def create\n\n\n @inscripcion_registro = current_user.inscripcion_registros.build(inscripcion_registro_params)\n\n #Se cuenta cuantas personas se han preinscrito a un grupo. Se cuenta con todos los registros no\n #importando que éstos no hayan sido validados. El dato se obtiene a través de todos los registros\n #de preinscripción, el id para el grupo actual se obtiene con @inscripcion_registro.grupo_id\n cupos = InscripcionRegistro.where(grupo_id: @inscripcion_registro.grupo_id).count\n\n #Se localiza si el usuatio tiene un id previo con ese mismo grupo. Si existe se le envia un mensaje\n # y no se permite guardar el registro por segunda ocasión.\n usuario = User.find(current_user.id)\n registro = InscripcionRegistro.find_by(user_id: usuario, grupo_id: @inscripcion_registro.grupo_id)\n\n #Si el cupo del grupo excede los 25 alunos se le muestra un mensaje al usuario donde se le indica\n #que deberá elegir un grupo distinto, el registro de inscripción no se guardará en la base dde datos_bancos\n #hay que agregar este metodo a las rb de el modelo correspondiente.\n if cupos > 40\n redirect_to new_inscripcion_registro_path, notice: \"El grupo ha alcanzado su ocupación máxima. Por favor elija otro grupo\"\n elsif registro.present? && registro.grupo_id == @inscripcion_registro.grupo_id\n redirect_to panel_alumnos_path, notice: \"Usted ya tiene registrada una solicitud con este grupo.\"\n else\n\n respond_to do |format|\n if @inscripcion_registro.save\n format.html { redirect_to @inscripcion_registro, notice: 'El registro de inscripción se creó correctamente.' }\n format.json { render :show, status: :created, location: @inscripcion_registro }\n else\n format.html { render :new }\n format.json { render json: @inscripcion_registro.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "acdfd70c9498f27080671c64606265cb", "score": "0.6095832", "text": "def registro_medico\n @usuario=Usuario.find_by(params[:id])\n end", "title": "" }, { "docid": "55f8f5b71c01a92ecbbf1a8f82185fdd", "score": "0.6095595", "text": "def calificacion_neutral\n \tself.estado = 2\n \tself.save\n end", "title": "" }, { "docid": "1d3dd80ebcf872acd4692f5be761501e", "score": "0.60934734", "text": "def ligar #criando um metodo para a classe\n puts 'O carro está pronto para iniciar seu trajeto'\n end", "title": "" }, { "docid": "41910a3737ef0c783c9e304ab4223472", "score": "0.6093071", "text": "def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "fd64dd255af5ee511efc15f470e994f8", "score": "0.6092886", "text": "def index\n #@pensumestudiante = EstudiantePensum.find(:first, :conditions => [ \"estudiante_id = ? and estado = 'activo'\", current_user.id])\n @usuarioactual = current_user\n @pensumestudiante = EstudiantePensum.find(:first, :conditions => [ \"estudiante_id = 1 and estado = 'activo'\"])\n #@pensumestudiante.id\n end", "title": "" }, { "docid": "c77eed41a8675063fa9f182d3314790c", "score": "0.6092544", "text": "def create\n @orc_reserva = OrcReserva.new(params[:orc_reserva])\n @ficha1= OrcFicha.find(:all, :conditions => ['id = ?',session[:ficha_id]])\n respond_to do |format|\n if @orc_reserva.save\n @ficha= OrcFicha.find(:all, :conditions => ['id = ?',@orc_reserva.orc_ficha_id])\n saldo_reservado = @ficha[0].saldo_reservado\n saldo_reservado = saldo_reservado + @orc_reserva.valor\n @ficha[0].saldo_reservado = saldo_reservado\n\n saldo = @ficha[0].saldo\n saldo = saldo - @orc_reserva.valor\n @ficha[0].saldo = saldo\n @ficha[0].save\n @orc_reserva.save\n\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_reserva) }\n format.xml { render :xml => @orc_reserva, :status => :created, :location => @orc_reserva }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_reserva.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41910a3737ef0c783c9e304ab4223472", "score": "0.60920405", "text": "def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end", "title": "" } ]
1a5819d5ba1c55f9a07f5ee5d4127f30
The English (or other language) friendly version of VM provisioning status
[ { "docid": "75a0d8bd6b62cd48cec6fb484befadf5", "score": "0.7975143", "text": "def display_provisioning_status\n case provisioning_status.to_s\n when 'initializing'\n 'Initializing'\n else\n 'Done'\n end\n end", "title": "" } ]
[ { "docid": "339607670a2cae5f459d1b52d60380e8", "score": "0.7674603", "text": "def display_status\n # Provisioning Status has priority\n if display_provisioning_status != 'Done'\n return display_provisioning_status\n end\n\n case status\n when 'running'\n 'Running'\n when 'stopping'\n 'Shutting Down'\n when 'shutoff'\n 'Powered Off'\n else\n status\n end\n end", "title": "" }, { "docid": "2e27ed2f79c75a01a9ba85258b8723cd", "score": "0.68974406", "text": "def status\n short_state_str=SHORT_VM_STATES[state_str]\n\n if short_state_str=='actv'\n short_state_str=SHORT_LCM_STATES[lcm_state_str]\n end\n\n short_state_str\n end", "title": "" }, { "docid": "bf65278076daac7e2e1c58649926d73f", "score": "0.68576396", "text": "def status\n short_state_str=SHORT_VM_STATES[state_str]\n\n if short_state_str==\"actv\"\n short_state_str=SHORT_LCM_STATES[lcm_state_str]\n end\n\n short_state_str\n end", "title": "" }, { "docid": "a11b9dd769a6555eb5861a1fc30aa61c", "score": "0.67261994", "text": "def inspect\n s = self.status()\n \"name [#{@name}]:\n is_available_via_ssh?[#{self.is_available_via_ssh?}],\n passthrough[#{@passthrough}],\n sshkey[#{@sshkey}],\n status[#{s}],\n sudo[#{@sudo}],\n vagrantfile[#{@vagrantfile}],\n verbosity console[#{@verbosity_console}] / log[#{@verbosity_logfile} - #{@logfile}]\\n\"\n end", "title": "" }, { "docid": "ad94afe51cac1a802f14a3d0c891437a", "score": "0.67075366", "text": "def get_parallels_vm_status(options)\n message = \"Information:\\tDetermining status of Parallels VM \"+options['name']\n command = \"prlctl list \\\"#{options['name']}\\\" --info |grep '^Status' |grep ^State |cut -f2 -d:\"\n status = execute_command(options,message,command)\n status = status.chomp.gsub(/\\s+/,\"\")\n return status\nend", "title": "" }, { "docid": "2cccf9042622ef07d17ed3afde4d6d16", "score": "0.6657694", "text": "def status\n \"#{@description} #{@status}\"\n end", "title": "" }, { "docid": "817771478a3832628200d9d6843b12c2", "score": "0.6653464", "text": "def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end", "title": "" }, { "docid": "8653d617a06043ddca852648856c9762", "score": "0.6615531", "text": "def humanized_status\n case self.status\n when 0\n then\n return _('page_status_visible_public_locked')\n when 1\n then\n return _('page_status_visible_unpublic_locked')\n when 2\n then\n return _('page_status_invisible_public_locked')\n when 3\n then\n return _('page_status_invisible_unpublic_locked')\n when 4\n then\n return _('page_status_visible_public')\n when 5\n then\n return _('page_status_visible_unpublic')\n when 6\n then\n return _('page_status_invisible_public')\n when 7\n then\n return _('page_status_invisible_unpublic')\n end\n end", "title": "" }, { "docid": "e249b661d9d73f3b9928dce8af62344a", "score": "0.65956485", "text": "def status\n inspect\n end", "title": "" }, { "docid": "34cd4315a87a957de948dbcd97140712", "score": "0.6595535", "text": "def status\n logger.info \"Retrieving Vagrant status for #{description}\"\n output = connection.execute!(:status).stdout\n Derelict::Parser::Status.new(output)\n end", "title": "" }, { "docid": "6fbdf40bf0b5660795d1bb37701c22fe", "score": "0.65875876", "text": "def display_name\n status\n end", "title": "" }, { "docid": "d5f6debdd1e3ade252c1e0456f5a231d", "score": "0.65801466", "text": "def status_text\n\t s = Enrollment::STATUS_NAMES[self.enrollment_status]\n\t \n\t if [Enrollment::STATUS_CLOSED,Enrollment::STATUS_FINALIZED].include? self.enrollment_status\n\t s += \"-#{Enrollment::COMPLETION_NAMES[self.completion_status]}\"\n\t end\n\t s\n\tend", "title": "" }, { "docid": "8983eb0c8ec9d306b44125cc10d30610", "score": "0.65665364", "text": "def vagrant_status\n out = \"\"\n Bundler.with_clean_env do\n out = `vagrant status --machine-readable`\n unless $CHILD_STATUS.exitstatus.zero?\n raise StandardError, \"Failed to run vagrant status\"\n end\n end\n out\nend", "title": "" }, { "docid": "fa02f3c2c866182b2f0980146f5c46c3", "score": "0.65387356", "text": "def show_vm_status(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"show vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/ Status = /)\r\n current[:vmstatus]=line.split('=')[1].strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "title": "" }, { "docid": "9dc0769f1f16e0bc5b4e8ea3960e5944", "score": "0.6528881", "text": "def provisioning_state\n properties.provisioningState\n end", "title": "" }, { "docid": "78a72940146859df7b476eb47518da2a", "score": "0.65238273", "text": "def status_to_s\n \tSTATUSES[self.status].humanize\n end", "title": "" }, { "docid": "b67ae2dd25b396699707e2dd6397c1b1", "score": "0.6507697", "text": "def status_verifikasi\n if self.status_verifikasi_verifikator == 0\n return \"Belum terproses\"\n elsif self.status_verifikasi_verifikator == 1\n return \"Layak\"\n elsif self.status_verifikasi_verifikator == 2\n return \"Tidak Layak\"\n elsif self.status_verifikasi_verifikator == 3\n return \"Perbaikan\"\n end\n end", "title": "" }, { "docid": "50e8196ac9a8666dec8c3f5db68dede6", "score": "0.64078724", "text": "def status_string\n if waiting_confirmation?\n return \"À confirmer\"\n elsif confirmed?\n return \"Confirmé\"\n elsif forgiven?\n return \"Pardonné\"\n else\n return \"Rejeté\"\n end\n end", "title": "" }, { "docid": "9258426e995352aa87abccc3eb0fae68", "score": "0.63527477", "text": "def find_status\n health = get_es_resource('/_cluster/health')\n health['status'].downcase\n end", "title": "" }, { "docid": "4f37683c12b1177afbbd2f93018f55c3", "score": "0.63456064", "text": "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "title": "" }, { "docid": "a08b8c211f8ed3183f7fbe48b430d79b", "score": "0.6336343", "text": "def xlate_status()\n return STATUS_XLATES[@status] if (STATUS_XLATES.has_key?(@status))\n return(@status.to_s) \n end", "title": "" }, { "docid": "a08b8c211f8ed3183f7fbe48b430d79b", "score": "0.6336343", "text": "def xlate_status()\n return STATUS_XLATES[@status] if (STATUS_XLATES.has_key?(@status))\n return(@status.to_s) \n end", "title": "" }, { "docid": "afcc191a84163a1eca26ccc625edecc3", "score": "0.63149047", "text": "def read_state\n read_vm_option('status').strip.to_sym\n end", "title": "" }, { "docid": "95fde6c3f9671f79e14854885ac4ed3a", "score": "0.62967706", "text": "def status_description\n self.status::DESCRIPTION\n end", "title": "" }, { "docid": "4bbd2505dffaeb35b29f4b18d1790b9c", "score": "0.629585", "text": "def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end", "title": "" }, { "docid": "3b8b64a15bbb0bafb710dfca3167d511", "score": "0.6289042", "text": "def get_status_text(status)\n return \"Failed\" if status.upcase == 'DOWN'\n return \"Passed\" if status.upcase == 'UP'\n\n return \"Unknown\"\nend", "title": "" }, { "docid": "ac489338bbc4518a744f5082affaed09", "score": "0.6282428", "text": "def status_name\n STATUSE.key(@status)\n end", "title": "" }, { "docid": "285ed294f714284c84abf656d87532b0", "score": "0.6236899", "text": "def vm_state(state)\n case state\n when 'poweredOn'\n 'RUNNING'\n when 'suspended'\n 'POWEROFF'\n when 'poweredOff'\n 'POWEROFF'\n else\n 'UNKNOWN'\n end\n end", "title": "" }, { "docid": "5556c982ab100a394525630bbd2face0", "score": "0.6235693", "text": "def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end", "title": "" }, { "docid": "f7758e0e7ddf76be5668a94674e98323", "score": "0.62012863", "text": "def pretty_status\r\n status.titleize\r\n end", "title": "" }, { "docid": "7af37753ca3d415215a956461b4fd76e", "score": "0.6172199", "text": "def vserver_status_to_string(code)\n case code\n when 0 then :DISABLED\n when 1 then :ALL_UP\n when 2 then :PARTIAL_UP\n when 3 then :FUNC_UP\n when 4 then :DOWN\n else :UNKNOWN\n end\nend", "title": "" }, { "docid": "592e5cbf74b7387aff19da54b5f8f75b", "score": "0.6171567", "text": "def info\n return 'STATE=d' if @state == 'd'\n\n if @vm.vm_info\n guest_ip = @vm.vm_info['guest.ipAddress']\n else\n guest_ip = @vm['guest.ipAddress']\n end\n\n used_cpu = @monitor[:used_cpu]\n used_memory = @monitor[:used_memory]\n netrx = @monitor[:netrx]\n nettx = @monitor[:nettx]\n diskrdbytes = @monitor[:diskrdbytes]\n diskwrbytes = @monitor[:diskwrbytes]\n diskrdiops = @monitor[:diskrdiops]\n diskwriops = @monitor[:diskwriops]\n\n if @vm.vm_info\n esx_host = @vm.vm_info[:esx_host_name].to_s\n else\n esx_host = @vm['runtime.host.name'].to_s\n end\n\n if @vm.vm_info\n guest_state = @vm.vm_info['guest.guestState'].to_s\n else\n guest_state = @vm['guest.guestState'].to_s\n end\n\n if @vm.vm_info\n vmware_tools = @vm.vm_info['guest.toolsRunningStatus'].to_s\n else\n vmware_tools = @vm['guest.toolsRunningStatus'].to_s\n end\n\n if @vm.vm_info\n vm_name = @vm.vm_info['name'].to_s\n else\n vm_name = @vm['name'].to_s\n end\n\n if @vm.vm_info\n vmtools_ver = @vm.vm_info['guest.toolsVersion'].to_s\n else\n vmtools_ver = @vm['guest.toolsVersion'].to_s\n end\n\n if @vm.vm_info\n vmtools_verst = @vm.vm_info['guest.toolsVersionStatus2'].to_s\n else\n vmtools_verst = @vm['guest.toolsVersionStatus2'].to_s\n end\n\n if @vm.vm_info\n rp_name = @vm.vm_info[:rp_list]\n .select do |item|\n item[:ref] == @vm.vm_info['resourcePool']._ref\n end\n .first[:name] rescue ''\n\n rp_name = 'Resources' if rp_name.empty?\n else\n rp_name = @vm['resourcePool'].name\n end\n\n str_info = ''\n\n str_info = 'GUEST_IP=' << guest_ip.to_s << ' ' if guest_ip\n\n if @guest_ip_addresses && !@guest_ip_addresses.empty?\n str_info << 'GUEST_IP_ADDRESSES=\"' << @guest_ip_addresses.to_s \\\n << '\" '\n end\n\n str_info << \"#{POLL_ATTRIBUTE[:state]}=\" << @state << ' '\n str_info << \"#{POLL_ATTRIBUTE[:cpu]}=\" << used_cpu.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:memory]}=\" << used_memory.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:netrx]}=\" << netrx.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:nettx]}=\" << nettx.to_s << ' '\n\n str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << ' '\n str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << ' '\n str_info << 'DISKRDIOPS=' << diskrdiops.to_s << ' '\n str_info << 'DISKWRIOPS=' << diskwriops.to_s << ' '\n\n str_info << 'VCENTER_ESX_HOST=\"' << esx_host << '\" '\n str_info << 'VCENTER_GUEST_STATE=' << guest_state << ' '\n str_info << 'VCENTER_VM_NAME=\"' << vm_name << '\" '\n str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' << vmware_tools << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \\\n << vmtools_verst << ' '\n str_info << 'VCENTER_RP_NAME=\"' << rp_name << '\" '\n\n # @vm.info_disks.each do |disk|\n # str_info << \"DISK_#{disk[0]}_ACTUAL_PATH=\\\"[\" <<\n # disk[1].ds.name << '] ' << disk[1].path << '\" '\n # end\n\n str_info\n end", "title": "" }, { "docid": "c12a20e58d38dcb5d813adb7d140573f", "score": "0.61569923", "text": "def status_information\n %i[unknown warning critical].map do |status|\n results[status].map { |result| \"#{status.upcase}: #{result}\" }\n end.flatten.compact.join(\"\\n\")\n end", "title": "" }, { "docid": "e756e69fbacfe5c149830ec1d7976790", "score": "0.61565137", "text": "def status_text\n return 'Unknown' if state.blank?\n\n return I18n.t(\"activerecord.attributes.export_job.status.#{state}\") unless in_progress?\n\n I18n.t('activerecord.attributes.export_job.status.in_progress') + progress_text\n end", "title": "" }, { "docid": "68aa362a97b40d6246d387e163f6d65f", "score": "0.6151287", "text": "def show_status_label_method\n \"#{self.status}\"\n end", "title": "" }, { "docid": "204fec0a8d9bb0a77cff2b12a1610501", "score": "0.61400473", "text": "def status\n info['status']\n end", "title": "" }, { "docid": "577d6d5a67e529f1f7c265101ffc2eaa", "score": "0.6134449", "text": "def to_status\n time = Time.now.to_i\n last = @db.execute(\"SELECT value from #{@settings} where key = 'LAST_SYNC'\").flatten[0].to_i\n\n sync_state = last == 0 || time > (last + @conf[:sync].to_i)\n\n status_str = ''\n monitor_ids = []\n\n if sync_state then\n status_str = \"SYNC_STATE=yes\\nMISSING_STATE=#{@conf[:missing_state]}\\n\"\n \n @db.execute(\"REPLACE INTO #{@settings} VALUES ('LAST_SYNC', #{time.to_s})\")\n end\n\n vms = DomainList.state_info(@host, @host_id)\n\n # ----------------------------------------------------------------------\n # report state changes in vms\n # ----------------------------------------------------------------------\n vms.each do |uuid, vm|\n next if vm[:ignore] == true\n\n if vm[:id] == -1\n filter = \"WHERE uuid = '#{uuid}'\"\n else\n # in ec2 id could first be -1 but later added, check also uuid\n filter = \"WHERE id = '#{vm[:id]}' OR uuid = '#{uuid}'\"\n end\n\n vm_db = @db.execute(\"SELECT * FROM #{@dataset} #{filter}\").first\n\n monitor_ids << uuid\n\n if vm_db.nil?\n @db.execute(\n \"INSERT INTO #{@dataset} VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n [uuid,\n vm[:id].to_i,\n vm[:name],\n vm[:deploy_id],\n time,\n 0,\n vm[:state],\n @conf[:hyperv]]\n )\n\n status_str << vm_to_status(vm)\n \n next\n end\n\n # Updates timestamp and uuid/deploy_id (e.g. VM recreated in KVM)\n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"state = '#{vm[:state]}', \" \\\n 'missing = 0, ' \\\n \"timestamp = #{time}, \" \\\n \"uuid = '#{uuid}', \" \\\n \"deploy_id = '#{vm[:deploy_id]}' \"\\\n \"#{filter}\"\n )\n\n if sync_state || vm_db[col_name_to_idx('state')] != vm[:state]\n status_str << vm_to_status(vm)\n end\n end\n\n # ----------------------------------------------------------------------\n # check missing VMs\n # ----------------------------------------------------------------------\n uuids = @db.execute(\"SELECT uuid FROM #{@dataset}\").flatten!\n uuids ||= []\n\n (uuids - monitor_ids).each do |uuid|\n vm_db = @db.execute(\n \"SELECT * FROM #{@dataset} WHERE uuid = '#{uuid}'\"\n ).first\n\n next if vm_db.nil?\n\n miss = vm_db[col_name_to_idx('missing')]\n\n if miss >= @conf[:times_missing]\n status_str << vm_db_to_status(vm_db, @conf[:missing_state])\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE uuid = \\\"#{uuid}\\\"\")\n else\n status_str << vm_db_to_status(vm_db) if sync_state\n \n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"timestamp = #{time}, \" \\\n \"missing = #{miss + 1} \" \\\n \"WHERE uuid = '#{uuid}'\"\n )\n end\n end\n\n status_str\n end", "title": "" }, { "docid": "7c0444854c377880bded5da1f9e3c0eb", "score": "0.61329496", "text": "def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend", "title": "" }, { "docid": "fe872ee4c79d0933dd673b350f3def9a", "score": "0.61286575", "text": "def task_status(proxmox, pve_node, task)\n status_info = proxmox_get(proxmox, \"nodes/#{pve_node}/tasks/#{task}/status\")\n \"#{status_info['status']}#{status_info['exitstatus'] ? \":#{status_info['exitstatus']}\" : ''}\"\n end", "title": "" }, { "docid": "c275e8641302ad39f5eaafb939ccf1ea", "score": "0.61254483", "text": "def status\n dist_service( service_name, 'status' )\n end", "title": "" }, { "docid": "6eb5433eccb4ec71e809d53577349c5f", "score": "0.61229944", "text": "def status_text(path)\n STATUS_TEXT[status(path)]\n end", "title": "" }, { "docid": "e3322ca9ca120e84f14f69fe88c453dc", "score": "0.611144", "text": "def status\n version.status\n end", "title": "" }, { "docid": "e3322ca9ca120e84f14f69fe88c453dc", "score": "0.611144", "text": "def status\n version.status\n end", "title": "" }, { "docid": "94d2a5cb4c4aaa416cf1708ac5bdf736", "score": "0.6108627", "text": "def monitor_vm\n vms_info('one')\n end", "title": "" }, { "docid": "35af3864c1680d52193e51f4ad0152d4", "score": "0.6106831", "text": "def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end", "title": "" }, { "docid": "b7a0ba61479ca4cb36f54311b76825f0", "score": "0.609557", "text": "def status_desc\n case self.proposal_status\n when 0\n 'Pending'\n when 1\n 'Accepted'\n when 2\n 'Declined'\n end\n end", "title": "" }, { "docid": "4f783fd06c128100ad49730aec783b79", "score": "0.60904706", "text": "def status_name\n STATUSES[status]\n end", "title": "" }, { "docid": "7a0660effc3e27d66433054e7a34feb8", "score": "0.60869694", "text": "def status\n info[\"Status\"]\n end", "title": "" }, { "docid": "4959a32148f6a281877d3633c3f4addc", "score": "0.6078986", "text": "def backup_status_desc\n status = if !confirmed?\n 'Authentication Required'\n elsif active?\n if lb = latest_backup\n lb.successful? ? 'OK' : 'Failed'\n else\n 'OK'\n end\n else\n 'Inactive'\n end\n if (status == 'Failed') && backup_broken?\n status = EternosBackup::BackupSourceError.new(self).short_error\n end\n status\n end", "title": "" }, { "docid": "0c100c4e48e6cedcfafff0f3d8dc9063", "score": "0.60618865", "text": "def status_description\n\t\treturn case self.status\n\t\t\twhen 'M' then 'modified'\n\t\t\twhen 'A' then 'added'\n\t\t\twhen 'R' then 'removed'\n\t\t\twhen 'C' then 'clean'\n\t\t\twhen '!' then 'missing'\n\t\t\twhen '?' then 'not tracked'\n\t\t\twhen 'I' then 'ignored'\n\t\t\telse\n\t\t\t\traise \"unknown status %p\" % [ self.status ]\n\t\t\tend\n\tend", "title": "" }, { "docid": "56c5736b78f2575f1a768acbbc594aa4", "score": "0.606013", "text": "def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end", "title": "" }, { "docid": "87272e81c2fbb988f4c808249d59379f", "score": "0.6050413", "text": "def puppet_status\n actual_status = @puppet_mclient.status\n log_current_status(actual_status)\n\n if UNDEFINED_STATUSES.include?(actual_status)\n Astute.logger.warn \"Error to get puppet status. \"\\\n \"#{task_details_for_log}.\"\n end\n\n actual_status\n end", "title": "" }, { "docid": "dfb8e6b8f365e4f76b2eec59f4046882", "score": "0.60486835", "text": "def get_deploy_target_status\n status = %x{ssh -o ConnectTimeout=5 #{Deployinator.deploy_host} uptime | awk '{print $2}' }.rstrip\n if status != 'up'\n status = \"<b>DOWN!</b>\"\n end\n \"#{Deployinator.deploy_host} is #{status}\"\n end", "title": "" }, { "docid": "2c03a878847e29deff8b6655dc73aa8d", "score": "0.60346997", "text": "def provisioning?\n status == \"PROVISIONING\"\n end", "title": "" }, { "docid": "a0319f01573668e9efa4f94a663e1356", "score": "0.6029981", "text": "def presence_status_message\n status = show_status\n total = 0\n pass = 0\n fail = 0\n abort = 0\n\n status.each_value { |suite_summary|\n # p suite_summary\n \n pass = pass + suite_summary[\"pass\"].to_i\n fail += suite_summary[\"fail\"].to_i\n abort += suite_summary[\"abort\"].to_i\n }\n total = pass + fail + abort\n \n \"Total:#{total} | Pass:#{pass} | Fail:#{fail} | Abort:#{abort}\"\n end", "title": "" }, { "docid": "08b47053c6fc0ef4dc569fa715a6e183", "score": "0.602971", "text": "def to_s\n return 'inactive' if inactive?\n\n # try to mimics stat behaviour to minimize readings\n result = status_string\n result += ', got TERM' if got_term?\n result += ', want down' if want_down?\n result += ', want up' if want_up?\n result\n end", "title": "" }, { "docid": "082d7092980280a2ebd9df8dc2449176", "score": "0.60260224", "text": "def status\n instance_get(:status)\n end", "title": "" }, { "docid": "fdef92c73c52cdb1c7403627e12ce361", "score": "0.6016582", "text": "def status\n return I18n.t('activerecord.attributes.item.building') if rq_prod_point > built_point\n if mob.blank?\n return I18n.t('activerecord.attributes.item.not_equiped')\n else\n return mob.name + I18n.t('activerecord.attributes.item.equiping')\n end\n end", "title": "" }, { "docid": "ec87a2d7e3feb4a3d7792fd5841db4d7", "score": "0.60147333", "text": "def status\n $stdout.puts \"The current status of the pow server is:\\n\\n\"\n result = %x{curl localhost/status.json --silent --header host:pow}\n json = JSON.parse(result)\n json.each_pair { |k,v| $stdout.puts \" #{k}: #{v}\" }\n $stdout.puts \"\\n\"\n end", "title": "" }, { "docid": "9dec33b59b764c3df60a884449283dd3", "score": "0.60136384", "text": "def get_status\n\t\tstatus\n\tend", "title": "" }, { "docid": "b037bdc223d0d8fe34fb01484934eded", "score": "0.5999294", "text": "def status_text\n case @state\n when 0\n H87Enchant::ST1\n when 1\n H87Enchant::ST2\n when 2\n H87Enchant::STQ\n when 3\n H87Enchant::ST3\n when 4\n H87Enchant::ST4\n when 5\n H87Enchant::ST5\n else\n ; 'ERRORE 01'\n end\n end", "title": "" }, { "docid": "6d4ed6069d3b1d31d280b8a46a815cc9", "score": "0.59876746", "text": "def get_vm_info()\n promise = @compute_client.virtual_machines.get(@rg_name, @instance_name)\n result = promise.value!\n OOLog.info(\"vm info :\"+result.body.inspect)\n return result.body\n end", "title": "" }, { "docid": "f5658c7e0886a436da1e07201dcaae07", "score": "0.5983831", "text": "def state\n if @lxc_details.nil?\n :missing\n else\n status = nil\n with_proxmox do |proxmox|\n vm_id_str = @lxc_details[:vm_id].to_s\n status =\n if proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc\").any? { |data_info| data_info['vmid'] == vm_id_str }\n status_info = proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc/#{@lxc_details[:vm_id]}/status/current\")\n # Careful that it is possible that somebody destroyed the VM and so its status is missing\n status = status_info.key?('status') ? status_info['status'].to_sym : :missing\n status = :exited if status == :stopped\n status\n else\n :missing\n end\n end\n status\n end\n end", "title": "" }, { "docid": "fd30084db7c605245108562cb0096ef4", "score": "0.59818476", "text": "def status\n \"#{@name}: #{@lives}/3 \"\n end", "title": "" }, { "docid": "778ce6d9a9f2bdd0bfbbf9ce45470878", "score": "0.5975812", "text": "def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end", "title": "" }, { "docid": "b2e32b4b2a9f1fff34f798f4a5d9138d", "score": "0.5967459", "text": "def print_status\n\t\tputs \"#{status}\"\n\tend", "title": "" }, { "docid": "89a0cfb0c392a1883a3bc3abd1fecf94", "score": "0.5966353", "text": "def status\n service.get(\"\")\n end", "title": "" }, { "docid": "64eeb81b621ce6947ccb2b4014491c77", "score": "0.5963821", "text": "def do_status\n return pretty_status(current_status)\n end", "title": "" }, { "docid": "fd634645896711941e5a79b5fa98f77f", "score": "0.5960143", "text": "def status\n value_for('status')\n end", "title": "" }, { "docid": "91b0782cd9443f2cee61e84056882d1f", "score": "0.59543896", "text": "def status()\n puts @status\n end", "title": "" }, { "docid": "57fedb072f600368673465d4f6feead1", "score": "0.59494954", "text": "def subscription_status()\n status = { \"active\" => \"label-success\",\n \"in_trial\" => \"label-default\",\n \"non_renewing\" => \"label-warning\",\n \"cancelled\" => \"label-danger\",\n \"future\" => \"label-primary\"\n }\n return status\n end", "title": "" }, { "docid": "389e779d4dd784a1bf52828aed6faabc", "score": "0.59472775", "text": "def status_str\n case self.status\n when ACTIVE\n \"Active\"\n when INACTIVE\n \"Inactive\"\n when CLOSED\n \"Closed\"\n when NO_STRIPE\n \"No Stripe Account\"\n when UNKNOWN\n \"Unknown\"\n else\n \"Invalid\"\n end\n end", "title": "" }, { "docid": "4537dbc3d51074024c320dd402340982", "score": "0.5943285", "text": "def status(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n stats = get_stats(secret)\n\n stats_str = <<-STATUS\n Currently using #{stats['cpu']} Percent CPU and #{stats['memory']} Percent Memory\n Hard disk is #{stats['disk']} Percent full\n Is currently: #{stats['roles'].join(', ')}\n Database is at #{stats['db_location']}\n Is in cloud: #{stats['cloud']}\n Current State: #{stats['state']}\n STATUS\n\n if my_node.is_appengine?\n app_names = []\n stats['apps'].each { |k, v|\n app_names << k\n }\n\n stats_str << \" Hosting the following apps: #{app_names.join(', ')}\\n\"\n\n stats['apps'].each { |app_name, is_loaded|\n next if !is_loaded\n next if app_name == \"none\"\n if !@app_info_map[app_name]['appengine'].nil?\n stats_str << \" The number of AppServers for app #{app_name} is: \" +\n \"#{@app_info_map[app_name]['appengine'].length}\\n\"\n end\n }\n end\n \n return stats_str\n end", "title": "" }, { "docid": "f920b9cdaa5b2e03b3efe089b1676eea", "score": "0.59400094", "text": "def status_text\n t(IMPORTING_STATUS[status])\n end", "title": "" }, { "docid": "011b35bd1b7d94719a405441d0109bcd", "score": "0.5937299", "text": "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "title": "" }, { "docid": "fcfff552f5a0ece236bf10011cc965f8", "score": "0.59279597", "text": "def status\n\t\t\tif `svstat #{@svcdir}` =~ /: (up|down)/\n\t\t\t\tst = $1.to_sym\n\t\t\t\tst = :unmonitored if GOD and st == :down\n\t\t\telse\n\t\t\t\tst = :unknown\n\t\t\tend\n\t\t\tst\n\t\tend", "title": "" }, { "docid": "421753896ebfc412860bb8f61b00f6df", "score": "0.59227437", "text": "def get_status_name\n case self.status\n when STATUS_NOT_APPLIED\n return I18n.t('workflow.status.not_applied')\n when STATUS_NOT_ISSUED\n return I18n.t('workflow.status.not_issued')\n when STATUS_ACTIVE\n return I18n.t('workflow.status.active')\n when STATUS_ACCEPTED\n return I18n.t('workflow.status.accepted')\n when STATUS_DENIED\n return I18n.t('workflow.status.denied')\n end\n end", "title": "" }, { "docid": "d8af09a9acbbf5c59e73a1d27b3fee4f", "score": "0.5922183", "text": "def get_current_state\n execute(:get_vm_status, VmId: vm_id)\n end", "title": "" }, { "docid": "7a3f0a4cd41b7aa32604da3aa2994452", "score": "0.5916606", "text": "def status\n complete? ? 'Completed' : 'Failed'\n end", "title": "" }, { "docid": "7f81b55fa2f53fb62aaaca4c9f6b8fba", "score": "0.59131974", "text": "def humanize_status\n case role_filling_status\n when 'ccm'\n 'CCM'\n when 'non_ccm'\n 'Nicht-CCM'\n when 'substitute'\n 'Vertretung'\n else\n 'Error: enum symbol is invalid'\n end\n end", "title": "" }, { "docid": "ba611d2d5f100dd3dcaa15fc519f0f69", "score": "0.5912875", "text": "def get_status_string(status)\n case status\n when :started, :scheduled then \"#{Tty.green}#{status}#{Tty.reset}\"\n when :stopped, :none then \"#{Tty.default}#{status}#{Tty.reset}\"\n when :error then \"#{Tty.red}error #{Tty.reset}\"\n when :unknown then \"#{Tty.yellow}unknown#{Tty.reset}\"\n end\n end", "title": "" }, { "docid": "697ec7495899a8b78207fd41469352a0", "score": "0.5904823", "text": "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "title": "" }, { "docid": "a56f2a79976579a43dd09d8d4d61f5b7", "score": "0.5901929", "text": "def status\n status = \"\"\n if points < 4000\n status = \"Baby Seeder\"\n elsif points < 8000\n status = \"Aspiring Gardener\"\n elsif points < 15000\n status = \"Garden Hero\"\n else\n status = \"Plant Wizard\"\n end\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.589726", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.589726", "text": "def status\n @status\n end", "title": "" }, { "docid": "a3849dfd8aee701d7ba0a6f2684f39c7", "score": "0.58946633", "text": "def status\n first_element_text('status')\n end", "title": "" }, { "docid": "5cbe3e519f41f9814fc2a6ee596f8aab", "score": "0.58913136", "text": "def mailout_status_display\n if self.mailout_status == 'n'\n return 'Not sent'\n end\n if self.mailout_status == 'r'\n return 'Send requested'\n end\n if self.mailout_status == 'i'\n return 'Send in progress'\n end\n if self.mailout_status == 's' \n return 'Sent'\n end\n end", "title": "" }, { "docid": "f57585b85ebcaeb8a4c6f584496a0f22", "score": "0.5891307", "text": "def status_name\n STATUS[self.status_id][0]\n end", "title": "" }, { "docid": "1e2d8df2029882c06a6ed99df2e505c9", "score": "0.588089", "text": "def status_codes\n get_info :production_status\n end", "title": "" }, { "docid": "cdc12eb088901cbe6631c8caa9e912bf", "score": "0.5879271", "text": "def status\n STATUSES[code] || 'Unknown'\n end", "title": "" }, { "docid": "25fe914421acc9b23387dbde38b78013", "score": "0.58702624", "text": "def status\n begin\n output = adm \"-z\", @resource[:name], :list, \"-p\"\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "title": "" }, { "docid": "bcd555de48ef60f34fd8db99ca4a99d5", "score": "0.58682543", "text": "def status\n begin\n output = adm '-z', @resource[:name], :list, '-p'\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "title": "" }, { "docid": "5cc8a55a7952d734f2e2b3cf48f7257e", "score": "0.5864432", "text": "def status_value(status)\n if status\n \"Active\"\n else\n \"Disabled\"\n end\n end", "title": "" }, { "docid": "70be0f1172f7490ed9623a189b9c2785", "score": "0.5858535", "text": "def status\n if @object.deadpooled_on\n 'deadpooled'\n elsif @object.acquired_by.any?\n 'acquired'\n elsif @object.initial_public_offering.present?\n 'IPOed'\n else\n 'alive'\n end\n end", "title": "" }, { "docid": "3aaf70904e5924df29a3a1ce3d1a057b", "score": "0.5854878", "text": "def status\n Status.find(self.status_id).name\n end", "title": "" }, { "docid": "79cb9b105d95f1b17d9440c1c1a0db25", "score": "0.5853816", "text": "def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end", "title": "" }, { "docid": "004b00c64882712ca414d001f73af0ef", "score": "0.5850389", "text": "def to_s\n \"#{represent_status} : #{description}\"\n end", "title": "" }, { "docid": "85ece90ffb51e732d772c84646a2813f", "score": "0.5850151", "text": "def status\n {\n 'body' => 'Service is up!'\n }\n end", "title": "" }, { "docid": "706ad276f76e43d06a2c118439ec0276", "score": "0.5848866", "text": "def description\n case @status\n when \"running\"\n \"#{@number}: INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"shutting-down\"\n \"(terminating) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"pending\"\n \"(booting) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n end\n end", "title": "" }, { "docid": "5139db973cf59d69287048332432961b", "score": "0.5848055", "text": "def status\r\n if @status == \"paid\"\r\n :completed\r\n elsif @tatus == \"refused\"\r\n :refused\r\n else\r\n :pending_payment\r\n end\r\n end", "title": "" } ]
e82360a1556365ac7efde2cf78e3bdd2
if we're running in Dotcom mode, we'll be lazy and just hide the content. otherwise, when running script/enterprisecutter, we'll bring these sections back
[ { "docid": "7d799cafc8332a57b9ca3d50365b6c28", "score": "0.0", "text": "def run(content, params={})\n start_replacement = '<div class=\"not-enterprise\">'\n end_replacement = '</div>'\n\n content = content.gsub(%r{<p>#{ENTERPRISE_START_STRING}</p>}, start_replacement)\n content = content.gsub(%r{<p>#{ENTERPRISE_END_STRING}</p>}, end_replacement)\n\n content\n end", "title": "" } ]
[ { "docid": "0685b5ab14512803ead783150abfed82", "score": "0.6609231", "text": "def thing_to_hide\n @log_window.hide_background_box #hide log window black box background\n @log_window.hide #hide log window\n hide_extra_gauges if $imported[\"YEA-BattleEngine\"] #hide extra gauges\n @info_viewport.visible = false #hide info viewport\n @spriteset.hide_enemy_hp_gauges if $imported[\"YEA-EnemyHPBars\"] == true #hide hp bar\n @spriteset.hide_popup if $imported[\"YEA-BattleEngine\"] == true && YEA::BATTLE::ENABLE_POPUPS #hide yanfly popup\n @spriteset.dispose_damage_sprites if $mog_rgss3_damage_pop == true #hide mog damage pop up\n if $imported[\"YSE-PartyComboCounter\"] == true #hide yami combo counter\n @sprite_combo_count.opacity = 0\n @sprite_combo_damage.opacity = 0\n @sprite_combo_congrat.opacity = 0\n end\n end", "title": "" }, { "docid": "286e1e55b0d0ebc92b28201be0c77722", "score": "0.6477234", "text": "def hide\n @ss.cmd = SNARL_HIDE\n send?\n end", "title": "" }, { "docid": "286e1e55b0d0ebc92b28201be0c77722", "score": "0.6477234", "text": "def hide\n @ss.cmd = SNARL_HIDE\n send?\n end", "title": "" }, { "docid": "52f39addebf6bff9be772be8fb9ba124", "score": "0.6327242", "text": "def hide; end", "title": "" }, { "docid": "d5e2a432fb6da02774f585c5072cc0d2", "score": "0.6278568", "text": "def hide_masthead\n @masthead_hidden = true\n end", "title": "" }, { "docid": "819e6f9018df9f4336d5ab49e89cdb95", "score": "0.6243769", "text": "def hide\n end", "title": "" }, { "docid": "875f285cb0493aa76edbe2d4e63e0243", "score": "0.62169105", "text": "def hide\r\n\t\tputs \"*hides* #{@name} is now hiding in his shell.\"\r\n\tend", "title": "" }, { "docid": "fa7c33f607c2e6d8adac62688b131959", "score": "0.61739594", "text": "def invisible_content\n contents.each do |content|\n if !content.active or !content.displayed?\n return true\n end\n end\n false\n end", "title": "" }, { "docid": "d84d43732eda02b4687072040cdb909c", "score": "0.6147727", "text": "def hide\n end", "title": "" }, { "docid": "d84d43732eda02b4687072040cdb909c", "score": "0.6147727", "text": "def hide\n end", "title": "" }, { "docid": "d84d43732eda02b4687072040cdb909c", "score": "0.6147727", "text": "def hide\n end", "title": "" }, { "docid": "1b22cfe98b7c5c7c946c6b9e602f0e7d", "score": "0.6142462", "text": "def hide_sites_menu\n browser.get_element_by_class('showFooterSelector').click if browser.get_element_by_id('bottom_sites_cont').displayed?\n end", "title": "" }, { "docid": "6d6de3f5ff82d2591246a6f18007a4e4", "score": "0.60071874", "text": "def hide_in_overview\n @hide_in_overview = true\n end", "title": "" }, { "docid": "c3eed6cb52d38d4d99ec078c29a61cc8", "score": "0.60021675", "text": "def hide!; end", "title": "" }, { "docid": "251f3e2cf2c15782a5f304545cdbf3c0", "score": "0.6000934", "text": "def ks_hidden_page(options, &block)\n options = normalize_page_options(options)\n options[:style] = \"display:none;\" + options[:style].to_s\n ks_page(options, &block)\n end", "title": "" }, { "docid": "56fc507a8a66ee937f12d45d7680f39a", "score": "0.5999849", "text": "def hide_bot_after_escalation\n return @hide_bot_after_escalation\n end", "title": "" }, { "docid": "b3792021183c15f24ee9147751b9746a", "score": "0.59916663", "text": "def unhide app\n app.perform_action :unhide\n end", "title": "" }, { "docid": "3e32b1ac1be298e5cd365bb88cf30d09", "score": "0.59401715", "text": "def hide\r\n super\r\n @mode = 0 # Set to first panel of window during hiding process\r\n refresh(@mode)\r\n end", "title": "" }, { "docid": "f2c292eef5afacc50f5f24e25a0e5730", "score": "0.5917225", "text": "def hide_sinergy_bar\n @s_view1.visible = false\n @s_view2.visible = false\n @s_view3.visible = false\n end", "title": "" }, { "docid": "84fe8fa66dffa9ee7779ec2b4607318f", "score": "0.59052", "text": "def hide_output\n puts \"<script>javascript:hideElement('runner')</script>\"\n end", "title": "" }, { "docid": "2c2f79e1a541e3c0421d471c44013cb9", "score": "0.59038585", "text": "def hide app\n app.perform_action :hide\n end", "title": "" }, { "docid": "0e17da205dc65f22a0462c4bac2eff12", "score": "0.58889437", "text": "def hide(content)\n\treturn \"<think>#{content}</think>\"\nend", "title": "" }, { "docid": "c4dbcd1d5ec4e6d169a7f38e48bdc78f", "score": "0.58796084", "text": "def hidebots()\n merge(hidebots: 'true')\n end", "title": "" }, { "docid": "940528287d002677f14a0eb9f71e9e23", "score": "0.5863095", "text": "def hide_banner?\n if !(OPTIONS[:banner])\n Whitewidow::Misc.new.spider\n end\n end", "title": "" }, { "docid": "3d0b90eb559b4fd891dee5d4c301cd69", "score": "0.58524585", "text": "def hide\n wrap_with_code(TERM_EFFECTS[:hide])\n end", "title": "" }, { "docid": "e94b8ce20a0a5da1d0853a038ee8de4a", "score": "0.5835575", "text": "def wrapper_visibility\n @options[:hide_on_load] = !@options[:initially_visible] if @options&.key?(:initially_visible)\n return '' unless @options[:hide_on_load]\n\n ' hidden'\n end", "title": "" }, { "docid": "f3c28858030d4dfab6bddd40f728fbd1", "score": "0.5834934", "text": "def hide_banner?\n Whitewidow::Misc.new.spider unless OPTIONS[:banner]\n end", "title": "" }, { "docid": "e199a1ddcdabe9699f0591e426d156c3", "score": "0.5827166", "text": "def hide_elements\n true\n end", "title": "" }, { "docid": "f7c8dcb0a8e07a9e31adcd84a87db7d2", "score": "0.5825508", "text": "def hide\n wrap_with_code(TERM_EFFECTS[:hide])\n end", "title": "" }, { "docid": "f7f22f6bbd2c7b27aaaeb1fd3fe631ed", "score": "0.5801114", "text": "def hide!\n @hidden = true\n end", "title": "" }, { "docid": "2e959305f2ce5e8aed62470fb35c5b2f", "score": "0.5798262", "text": "def hide_info?\n return false\n end", "title": "" }, { "docid": "6abed2ae32bbe779879cf762750a9f93", "score": "0.5790849", "text": "def hide_and_show\n @hide_and_show_data = ''\n yield\n \"<script type=\\\"text/javascript\\\">\\n\" +\n \"$(function() {\\n\" +\n @hide_and_show_data +\n \"});\\n</script>\\n\"\n end", "title": "" }, { "docid": "fd637788bfb34a347e3355523adfba8d", "score": "0.5789864", "text": "def thing_to_show_again\n @log_window.show_background_box #show log window black box background\n @log_window.show #show log window\n show_extra_gauges if $imported[\"YEA-BattleEngine\"] #show extra gauge\n @info_viewport.visible = true #show info viewport\n end", "title": "" }, { "docid": "9c4ce4a94f959f9e554351f7dced31e5", "score": "0.5787847", "text": "def hide!\r\n @visible = false\r\n end", "title": "" }, { "docid": "cbf05e49a17aaff3ed9d5d2d4be9ae4e", "score": "0.5778514", "text": "def hide\n wrap_with_sgr(TERM_EFFECTS[:hide])\n end", "title": "" }, { "docid": "90ad19d915e6cdd542fbb2550bcc7358", "score": "0.57726336", "text": "def hide\n damage(:visible) unless not @visible\n return (@visible = false)\n end", "title": "" }, { "docid": "f991b3fd186b6f24ba358524ad4dcfbf", "score": "0.5764622", "text": "def update_visibility\n if dsl.hidden?\n dsl.contents.each(&:hide)\n else\n dsl.contents.each(&:show)\n end\n end", "title": "" }, { "docid": "40b4d4ecc6d97e72fe92b242a73f8546", "score": "0.5738351", "text": "def non_interactive_mode(pry_instance, content); end", "title": "" }, { "docid": "40b4d4ecc6d97e72fe92b242a73f8546", "score": "0.5738351", "text": "def non_interactive_mode(pry_instance, content); end", "title": "" }, { "docid": "4cb06b6caea343b58db20cef5126782a", "score": "0.5718793", "text": "def invisible!; @visible = false; end", "title": "" }, { "docid": "661db8db1a5359df244521a8e44e096b", "score": "0.57174873", "text": "def hide_command!; end", "title": "" }, { "docid": "e5b7e6bb560eab931efbcd455ab22369", "score": "0.57084566", "text": "def hide\n super\n\n render\n end", "title": "" }, { "docid": "e5b7e6bb560eab931efbcd455ab22369", "score": "0.57084566", "text": "def hide\n super\n\n render\n end", "title": "" }, { "docid": "83041b10de3e5674149995b249715108", "score": "0.56799096", "text": "def hidden\r\n @hide = @userinterface.split(\"\")\r\n end", "title": "" }, { "docid": "416468207c375464bcba83e5cd84bc80", "score": "0.5664508", "text": "def dc_page_top()\n if @design and [email protected]_view.blank?\n# Evaluate parameters in design body \n eval(@design.body)\n end\n session[:edit_mode] > 0 ? render(partial: 'cmsedit/edit_stuff') : ''\nend", "title": "" }, { "docid": "4667689431bebc63e17a743066f3149b", "score": "0.5650087", "text": "def dc_page_top\n if @design && @design.rails_view.present?\n # Evaluate parameters in design body\n eval(@design.body)\n end\n session[:edit_mode] > 0 ? render(partial: 'cmsedit/edit_stuff') : ''\nend", "title": "" }, { "docid": "9d399cb344f3f729ebc4188d14865fa8", "score": "0.562047", "text": "def hide!\n # TODO actually mess with the blend modes instead of\n # just putting things way off canvas\n return if @hidden_by_kelly\n translate(100000, 10000)\n @hidden_by_kelly = true\n end", "title": "" }, { "docid": "8934a03e84bf9e407dc477ab1ed5ce68", "score": "0.5617102", "text": "def hide_element\n return check_authorization\n end", "title": "" }, { "docid": "e0c77f4cd74afaa1aeae7264f630b3fa", "score": "0.5616648", "text": "def hide!\n @visible=false\n end", "title": "" }, { "docid": "673f6bf61399574a044130e5ca8a0e16", "score": "0.5612675", "text": "def hide\n @visibility = false\n end", "title": "" }, { "docid": "f43c0b8f82a234f5495fc0803984da57", "score": "0.5604708", "text": "def render_content_presenter(content_page, options = {})\n content_page.hide_sections(options[:hide_sections]) if options[:hide_sections]\n content_page.fetch_template_overrides { |section_id| content_for(section_id)}\n content_page.to_html(options[:can_use_fallback])\n end", "title": "" }, { "docid": "9a896872c2aa0d7b6f6e994f5db5bb9c", "score": "0.55824023", "text": "def hide_uoc_info_form\n logger.info 'Hiding the Use of Collections Info form'\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end", "title": "" }, { "docid": "b7d015109a00265f819bb434f552a7e6", "score": "0.5571769", "text": "def hide_rest\n model = Sketchup.active_model\n ss = model.selection\n model.start_operation $exStrings.GetString(\"Hide Rest\")\n model.entities.each {|e| e.visible = false if not ss.contains?(e) }\n model.commit_operation\nend", "title": "" }, { "docid": "8cc70d734dc6266d8a600d814048316d", "score": "0.556891", "text": "def start_menu_hide_frequently_used_apps\n return @start_menu_hide_frequently_used_apps\n end", "title": "" }, { "docid": "8dae1bd4b04a2388ff312bbf351b8cd9", "score": "0.5568783", "text": "def do_visible\r\n remove_affects_with_keywords(\"invisibility\")\r\n output \"You are now visible.\"\r\n return\r\n end", "title": "" }, { "docid": "68205327417eaa6a315cd9a5512da2aa", "score": "0.55627453", "text": "def hideliu()\n merge(hideliu: 'true')\n end", "title": "" }, { "docid": "338398215780940bb9bb67294d5bfb2d", "score": "0.55623144", "text": "def hide\n ole_obj.Hide\n end", "title": "" }, { "docid": "354f30f842ed098d44cef37451d44998", "score": "0.5560876", "text": "def hidden?\n spin\n @app.hidden?\n end", "title": "" }, { "docid": "4ce3266bdb01672a1db4e84d4123f4cf", "score": "0.5557353", "text": "def show_tabs\n return false\n end", "title": "" }, { "docid": "5b866dd8442e0e0d11ed72ffba82e63c", "score": "0.55560744", "text": "def turn_widget_off() @do_not_show_widget = true end", "title": "" }, { "docid": "a6c8f0ded508729802f7e2fc46eeaeff", "score": "0.5544261", "text": "def hide\n\t\tprint \"\\n #{@name} loves to play hide and seek. He's a good hider.\"\n\t\tprint \"\\n Close your eyes, count to 10 and then go find him.\"\n\t\tfor i in 1..10 do\n\t\t\tputs \"\\n #{i} \\n\"\n\t\t\ti += 1\n\t\tend\n\t\tprint \"\\n Ok, Go find #{@name}!\"\n\t\tactions[:hides] += 1\n\tend", "title": "" }, { "docid": "4e54c40bab46a35a8aa98f63885c68e9", "score": "0.55372083", "text": "def hideanons()\n merge(hideanons: 'true')\n end", "title": "" }, { "docid": "86df56e28b7ed3dd95e5a38848c5b85f", "score": "0.55301183", "text": "def show_tabs\n false\n end", "title": "" }, { "docid": "86df56e28b7ed3dd95e5a38848c5b85f", "score": "0.55301183", "text": "def show_tabs\n false\n end", "title": "" }, { "docid": "ca38630bad16d561223fd3547b5d526e", "score": "0.5525121", "text": "def hide(&block)\n @hidden = true\n\n yield\n\n ensure\n @hidden = false\n end", "title": "" }, { "docid": "3d5d77cd92e18c3976164edc19254e6a", "score": "0.55222225", "text": "def show\n set_layout [false, false, false]\n end", "title": "" }, { "docid": "26bf4d74748fea325ff5884649bf0bb6", "score": "0.55173683", "text": "def hide_contact_details?(displayed_person_or_project)\n return true if Seek::Config.hide_details_enabled || !logged_in?\n !current_user.person.shares_project_or_programme?(displayed_person_or_project)\n end", "title": "" }, { "docid": "ffdf60f5ba04b4403fba3e4f0c275773", "score": "0.5517005", "text": "def hide\n self.visible = false\n end", "title": "" }, { "docid": "a6485169a3e9816e31e132cb2cbc10dd", "score": "0.55097497", "text": "def show_tabs\n return false\n end", "title": "" }, { "docid": "27c8eea970af05e92fdade4660cf58b8", "score": "0.5506844", "text": "def hide_brand\n hide_array = [:application, :dynamic]\n return 'hide-on-small-only' if hide_array.include?(current_layout)\n end", "title": "" }, { "docid": "dbc2912671e49c00fec8a93b4ab1aca7", "score": "0.55017847", "text": "def window_hidden\n end", "title": "" }, { "docid": "edcb91b885398b431757141673892047", "score": "0.5501457", "text": "def hidden\n 'style=\"display: none;\"'\n end", "title": "" }, { "docid": "83b4673c52dfbbca376018cc7ee57e88", "score": "0.55006826", "text": "def public_content(asking_user,force=false)\n pc = if force or user_can_view?(asking_user)\n unescaped_content\n else\n \"hidden\"\n end\n end", "title": "" }, { "docid": "ffa0d4b7327a879d432bf21e3d587f84", "score": "0.5493565", "text": "def can_force_hide_active?\n return true if $imported[:ve_target_arrow]\n return true if $imported[:mog_battle_cursor] != nil\n return false\n end", "title": "" }, { "docid": "ffa0d4b7327a879d432bf21e3d587f84", "score": "0.54931134", "text": "def can_force_hide_active?\n return true if $imported[:ve_target_arrow]\n return true if $imported[:mog_battle_cursor] != nil\n return false\n end", "title": "" }, { "docid": "d6177c69d16c845fc9e6f3ad2c0fa58b", "score": "0.54835606", "text": "def serve_hidden\n @serve_hidden || false\n end", "title": "" }, { "docid": "ea83ba6fb2ae496fee1a41a236d04d73", "score": "0.54821575", "text": "def hide_privacy_and_cookies\n return @hide_privacy_and_cookies\n end", "title": "" }, { "docid": "f45d47f4947210bd2b64eb753814ae6b", "score": "0.54793006", "text": "def hide_maintenance\n File.delete MAINTENANCE_PAGE\n end", "title": "" }, { "docid": "00728d6252ee35448037c8877b5e376c", "score": "0.5465787", "text": "def hidden?\n true if allow_display == false\n end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "fc03950593fd98048fc59a574ab71957", "score": "0.5464886", "text": "def invisible?; end", "title": "" }, { "docid": "9ed345eb68a1fbcc63539acf5ac0fee2", "score": "0.54601246", "text": "def show_head_info\n false\n end", "title": "" }, { "docid": "12cbb02cf6c16a51a378868997178a72", "score": "0.54495794", "text": "def hide_all_windows\n @help_window.visible = false\n @c_help_window.visible = false\n @overview_window.visible = false\n @role_window.visible = false\n @params_window.visible = false\n @states_window.visible = false\n @stats_window.visible = false\n end", "title": "" }, { "docid": "b6e6f21b609da33998048c64d3909f8f", "score": "0.5445662", "text": "def generate_showview?\n return (shell.base.options[:noshow] != true)\n end", "title": "" }, { "docid": "8a7338b87c9d199dbdab319ca22e3d84", "score": "0.5444584", "text": "def hide_terms_of_use\n return @hide_terms_of_use\n end", "title": "" }, { "docid": "8a0c506e0078565768aef8b82190ea49", "score": "0.54440206", "text": "def javascript_show_hide_if(opts={})\n options = {\n :operator => '==',\n :value => nil,\n :wrapper_element => 'div',\n :wrapper_id =>nil,\n :invoke_on_class => nil,\n :show => true,\n :css_class => \"hideable_box_with_border\",\n :condition => nil,\n :jsaction_show => nil,\n :jsaction_hide => nil\n }.update(opts)\n\n # if we are not actually building skip the generation of javascript\n # but yield so that any sub-questions and stuff can be processed.\n # If we are a force_show_followups situation, then we want to skip \n # processing the show/hide stuff and just render the code.\n if !@render || @force_show_followups\n yield if block_given?\n return\n end\n\n show = options[:show]\n wrapper_id = options[:wrapper_id]\n css_class = options[:css_class]\n\n if !wrapper_id\n @_unique_ids ||= 0\n wrapper_id = \"uid_#{@_unique_ids += 1}\"\n end\n condition = make_condition(options[:condition])\n show_actions = []\n hide_actions = []\n show_actions << options[:jsaction_show] if options[:jsaction_show]\n hide_actions << options[:jsaction_hide] if options[:jsaction_hide]\n if invoke_on_class = options[:invoke_on_class]\n show_actions << %Q|$$(\".#{invoke_on_class}\").invoke(\"show\")|\n hide_actions << %Q|$$(\".#{invoke_on_class}\").invoke(\"hide\")|\n else\n show_actions << \"Element.show('#{wrapper_id}')\"\n hide_actions << \"Element.hide('#{wrapper_id}')\"\n end\n add_observer_javascript(condition.name,show_actions.join(';'),!show)\n add_observer_javascript(condition.name,hide_actions.join(';'),show)\n \n cond_value = condition.evaluate\n hide = !block_given? || (show && !cond_value) || (!show && cond_value)\n @_hiding_js = hide\n if wrapper_element = options[:wrapper_element]\n wrapper = %Q|<#{wrapper_element} id=\"#{wrapper_id}\"|\n wrapper << %Q| class=\"#{css_class}\"| if css_class\n wrapper << %Q| style=\"display:none\"| if hide\n wrapper << '>'\n body wrapper\n end\n yield if block_given?\n body \"</#{wrapper_element}>\" if wrapper_element\n @_hiding_js = nil\n end", "title": "" }, { "docid": "eecb2d9a07ab21b4228dea9385882a0c", "score": "0.54342467", "text": "def show\n @exclude_banner = true\n end", "title": "" }, { "docid": "fe27e1ac8685520a6e55a0bd1d044b7e", "score": "0.54294705", "text": "def do_show_lang\n $document.at_css('#tryruby-lang-hider').toggle_class('hidden')\n end", "title": "" }, { "docid": "e384c7b64c4e84ace46369313a855dce", "score": "0.54277474", "text": "def hidden; end", "title": "" }, { "docid": "e384c7b64c4e84ace46369313a855dce", "score": "0.54277474", "text": "def hidden; end", "title": "" }, { "docid": "e384c7b64c4e84ace46369313a855dce", "score": "0.54277474", "text": "def hidden; end", "title": "" }, { "docid": "e384c7b64c4e84ace46369313a855dce", "score": "0.54277474", "text": "def hidden; end", "title": "" }, { "docid": "e64f61e0afe3a8f4a2674f6836558e1c", "score": "0.5423587", "text": "def omit_content_from_parent?\n Config.instance.separate_global_declarations &&\n render_as_page?\n end", "title": "" }, { "docid": "eb26dfa66df076d2e2fba6992dbc732f", "score": "0.542019", "text": "def hide_newsletter_form\n @seo_content_toggle, @newsletter_toggle = [true,true]\n end", "title": "" }, { "docid": "b40a2c3acb416ff6cc1b1130de60e74e", "score": "0.5415997", "text": "def hide\n Curses.hide_panel(@panel)\n end", "title": "" }, { "docid": "e378d495e87c6e6becf2fcd802978757", "score": "0.54076385", "text": "def page_content\n silk_editable? ? page_wrapper : raw(@_content_for[:layout])\n end", "title": "" } ]
f6f79f02190ed6c84c34628bfa47bb96
callseq: datum.to_csv return the datum as a CSV in the format: physical_id,inode_id,filename
[ { "docid": "49d736893fa8d93f5b4e8c83d5890b95", "score": "0.8047707", "text": "def to_csv\n \"#{first_physical_block_number},#{inode_number},#{filename}\"\n end", "title": "" } ]
[ { "docid": "354006eefd3ee05d7a4ca0642113115b", "score": "0.70277804", "text": "def to_csv\n end", "title": "" }, { "docid": "f7b2a6762031367aadb2ced97bd7de73", "score": "0.69082695", "text": "def to_csv\n id.to_s << \",\" << time_in.to_s << \",\" << time_out.to_s << \",\" << date.to_s << \",\" << description\n end", "title": "" }, { "docid": "f8adcc6f88cd2a3b258bbf5683fdfefa", "score": "0.6692529", "text": "def output_csv(data)\n CSV.open(OUTPUT_FILE, 'wb') do |csv|\n data.each do |datum|\n csv << datum\n end\n end\nend", "title": "" }, { "docid": "2999e1107323578661c68a346fb5c354", "score": "0.66666055", "text": "def to_csv\n File.write(@file_name, to_s)\n end", "title": "" }, { "docid": "7018b37e435f1cc1cd3dd6de163a4898", "score": "0.6610749", "text": "def to_csv\n to_return =[[@primary_key, \n @note.note_id,\n get_parent_primary_key,\n @uuid, \n @type,\n @filename,\n @filepath,\n @backup_location]]\n\n # Add in any child objects\n @child_objects.each do |child_object|\n to_return += child_object.to_csv\n end\n\n # Add in any thumbnails\n @thumbnails.each do |thumbnail|\n to_return += thumbnail.to_csv\n end\n\n return to_return\n end", "title": "" }, { "docid": "7018b37e435f1cc1cd3dd6de163a4898", "score": "0.6610749", "text": "def to_csv\n to_return =[[@primary_key, \n @note.note_id,\n get_parent_primary_key,\n @uuid, \n @type,\n @filename,\n @filepath,\n @backup_location]]\n\n # Add in any child objects\n @child_objects.each do |child_object|\n to_return += child_object.to_csv\n end\n\n # Add in any thumbnails\n @thumbnails.each do |thumbnail|\n to_return += thumbnail.to_csv\n end\n\n return to_return\n end", "title": "" }, { "docid": "d699c1855380d22599326cb9cf91890b", "score": "0.6517767", "text": "def to_csv\n \"\\\"#{ @timestamp }\\\", \\\"#{ @nick }\\\", \\\"#{ @ip }\\\", \\\"#{ @text }\\\", \\\"#{ @raw }\\\"\"\n end", "title": "" }, { "docid": "9ea4e71016c76a560b71f68eacae8010", "score": "0.6503405", "text": "def to_csv(*args)\n to(:csv, *args)\n end", "title": "" }, { "docid": "33bee63e627a805e222c5b4fd365d8e6", "score": "0.6475328", "text": "def to_generic_csv data, filename\n s = ''\n 0.upto(data.length - 1) {|i| s += data[i].map{|val| val.to_s}.join(',') + \"\\n\"}\n File.open(filename, 'w') do |f| \n f.puts s\n end \n end", "title": "" }, { "docid": "13a29675370b890ed3c331094f4268bd", "score": "0.6433253", "text": "def to_csv\n fetch.to_csv\n end", "title": "" }, { "docid": "fa93d3818b36861240b96cb632a0bbda", "score": "0.6387436", "text": "def to_csv\n d = get_data\n return \"Sorry, no records.\" if d.length == 0\n arr = []\n d.each {|row| arr.push(row.dup)}\n tbl = Ruport::Data::Table.new(:column_names => arr[0].keys)\n arr.each {|row|\n\ttbl << arr[0].keys.map {|k| row[k]}\n }\n \n return tbl.to_csv\n end", "title": "" }, { "docid": "e78d676ea9f882e5e58efae93de9aae6", "score": "0.63849187", "text": "def create_csv(table)\n time = Time.new()\n file_start = \"/extraction/csv/#{time.year}#{time.month}#{time.day}#{time.hour}#{time.min}#{time.sec}#{time.usec}\"\n CSV.open(\"public#{file_start}-data.csv\", \"w\") do |csv|\n csv << table.column_data\n table.row_data.each do |row|\n csv << row\n end\n end\n @filename << \"#{file_start}-data.csv\"\n\n #If ID data was tracked, generate id CSV as well\n if table.id_data.length > 0\n CSV.open(\"public#{file_start}-ids.csv\", \"w\") do |csv|\n csv << table.column_data\n table.id_data.each do |row|\n csv << row\n end\n end\n @filename << \"#{file_start}-ids.csv\"\n end\n end", "title": "" }, { "docid": "a3feb5433e49e77b519c04efdda097fa", "score": "0.6382532", "text": "def to_csv\n id.to_s << \",\" << first_name.to_s << \",\" << last_name.to_s << \",\" << age.to_s << \n \",\" << address.to_s\n end", "title": "" }, { "docid": "9d395df7851c2868ff225e575392f6db", "score": "0.63581616", "text": "def to_csv_file(path)\n J2R.to_csv_file(path, @table.csv_output)\n end", "title": "" }, { "docid": "1a3113ba1627b2255948249f0b0618f8", "score": "0.63432443", "text": "def to_csv(*args)\r\n find(:all).to_csv(*args) \r\n end", "title": "" }, { "docid": "b7c6b96b7619efdded339c96c449675d", "score": "0.62917787", "text": "def to_csv\n CSV.generate do |csv|\n csv << TaskEntry.column_names\n self.task_entries.each do |entry|\n csv << entry.attributes.values_at(*TaskEntry.column_names)\n\n end\n end\n end", "title": "" }, { "docid": "9284f789bb1d542c9793595c918410cf", "score": "0.6291207", "text": "def as_csv(*)\n CSV.generate do |csv|\n csv << attributes_with_unit\n nodes.each { |node| csv << node_row(node) }\n end\n end", "title": "" }, { "docid": "1c9872d0cb067d7bb5aa697c012f16b4", "score": "0.6281206", "text": "def to_csv\n tmp_pinned = \"N\"\n tmp_pinned = \"Y\" if @is_pinned\n [@primary_key, \n @note_id, \n tmp_pinned,\n @account.name, \n @folder.name, \n @cloudkit_last_modified_device, \n @cloudkit_creator_record_id, \n @title, \n @creation_time, \n @modify_time, \n @plaintext, \n @is_password_protected,\n @crypto_iterations,\n get_crypto_salt_hex,\n get_crypto_tag_hex,\n get_crypto_key_hex,\n get_crypto_iv_hex,\n get_encrypted_data_hex,\n @uuid]\n end", "title": "" }, { "docid": "551197b9551f337d30f7fd19ab30ec0e", "score": "0.62804544", "text": "def to_csv(filename)\n simple_position_csv(filename)\n standard_deviation_csv(filename)\n tags_lookout_csv(filename)\n extra_debug_files(filename)\n end", "title": "" }, { "docid": "2a29601c4b24bb409ffe4b159381c5ba", "score": "0.6270912", "text": "def create_csv(ds_to_include)\n case @record_type\n when 'exam_paper'\n outfile_name = 'exam_papers_key_metadata'\n when 'thesis'\n outfile_name = 'theses_key_metadata'\n else\n outfile_name = 'key_metadata'\n end\n outfile_path = @output_location + '/' + outfile_name + '.csv'\n CSV.open(outfile_path, 'a+') do |csv|\n csv << @headers if csv.count.eql? 0\n csv_row = get_csv_row(ds_to_include)\n csv << csv_row\n end\n end", "title": "" }, { "docid": "f9853d573bde2ce90de92156ae0c5faa", "score": "0.62484586", "text": "def to_csv\n [@primary_key, \n @name, \n @identifier,\n @notes.length,\n get_crypto_salt_hex,\n @crypto_iterations,\n get_crypto_key_hex]\n end", "title": "" }, { "docid": "1fc9383a29daa1d452ceb001e8443876", "score": "0.62465614", "text": "def export_csv\n export_string = \"#{id},#{type_string},#{name.gsub(/[\\,,\\s]/,\"\")},\"\n details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "title": "" }, { "docid": "8fc65fb06bd8df54b1fd3c9cf5eb09fd", "score": "0.6219793", "text": "def to_csv\n csv_data = []\n @order_scope.find_each do |order|\n if block_given?\n next unless yield order\n end\n csv_data += order_to_line_item_arr(order).map(&:to_csv)\n end\n csv_data_s = ([@columns.join(\",\") + \"\\n\"] + csv_data).flatten.join\n end", "title": "" }, { "docid": "aeb982d172f0022dd2803737b6ab9dbd", "score": "0.6214278", "text": "def to_csv\n rows.map { |row| row.join(';') }.join(\"\\n\")\n end", "title": "" }, { "docid": "3bda38bb8f6894b74ee6d0cb93d470d4", "score": "0.61824864", "text": "def export_to_csv\n group = Group.find(params[:id])\n outfile = \"group_people_\" + Time.now.strftime(\"%m-%d-%Y\") + \".csv\"\n\t\tsend_data(group.export_to_csv,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{outfile}\")\n end", "title": "" }, { "docid": "47470acc74eabd06328831855a1c6c8e", "score": "0.6162246", "text": "def to_csv\n\t\t\tattributes.values.join(\", \")\n\t\tend", "title": "" }, { "docid": "7ace0d038686056340d8fcb82105f0da", "score": "0.6150234", "text": "def to_csv(lat, long)\n distance_in_km = Geocoder::Calculations::distance_between(self, [lat, long], :units => :km)\n\n csv = []\n csv += [self.id, self.username, self.latitude, self.longitude, distance_in_km, self.plusminus.to_s, self.sorting_rate( lat, long).to_s ]\n end", "title": "" }, { "docid": "5774b363fb160ebcde588bda113d3a97", "score": "0.6143671", "text": "def to_csv_line\n [id, started_at, finished_at, frequency, frequency_other, time_spent,\n purpose_gathering, purpose_hobbitry, purpose_fuel, purpose_relaxation,\n favorite_place, once_receive, once_payment, important_nature, important_wood,\n important_gathering, important_water, important_climate, important_health,\n important_ground, relation].map{|field| %(\"#{field}\")}.join(';')\n end", "title": "" }, { "docid": "b9436e27238c74bcf8fbf28107047115", "score": "0.6134825", "text": "def to_csv\n Encoder.new(@header, @rows).to_csv(@local_config)\n end", "title": "" }, { "docid": "d8c7b5c571a4ddce1b62564d86730699", "score": "0.6132782", "text": "def to_csv\n [@primary_key, @name, @notes.length, @account.primary_key, @account.name]\n end", "title": "" }, { "docid": "726b7ea52e779fc9bca6bb4ad7b58629", "score": "0.611801", "text": "def write_to_csv(data)\n CSV.open('names_ids.csv', 'a+') do |csv|\n data.each do |member|\n csv << member\n end\n end\nend", "title": "" }, { "docid": "bc6fd3aa7a801da9f36a9fcaf03f4816", "score": "0.61164695", "text": "def to_csv\n\t\t\tstr = ''\n\t\t\tstr << ( columns.join(\",\") + \"\\n\" )\n\t\t\trows.each { |row|\n\t\t\t\tnext if is_hr(row)\n\t\t\t\tstr << ( row.map{|x|\n\t\t\t\t\tx = x.to_s\n\n\t\t\t\t\tx.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n\t\t\t\t}.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n\t\t\t}\n\t\t\tstr\n\t\tend", "title": "" }, { "docid": "e37713ecb8b0662fa14f5318b0f47310", "score": "0.61135226", "text": "def to_csv\n CSV::Table.new read_lines(true)\n end", "title": "" }, { "docid": "5fe4c80ac8f715cdc7e55bc369dc3f6b", "score": "0.6102153", "text": "def csv\n unique_identifiers = params[:ids]\n filename = params[:filename].empty? ? \"export-#{Time.current.to_s(:iso8601)}.csv\" : params[:filename] + '.csv'\n structural = params.fetch(:structural, '0').to_i.positive?\n\n digital_objects = Repo.where(unique_identifier: unique_identifiers)\n csv = Bulwark::StructuredCSV.generate(digital_objects.map { |d| d.to_hash(structural: structural) })\n\n send_data csv, type: 'text/csv', filename: filename, disposition: :download\n end", "title": "" }, { "docid": "51ee4ca8619968d1fe8b55ead8c94f03", "score": "0.6086978", "text": "def to_csv\n sort_rows\n\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n }.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n }\n str\n end", "title": "" }, { "docid": "7d03146cdad4d08a047b240e77e8bbb4", "score": "0.6086006", "text": "def to_csv\n [@primary_key, \n @note_id, \n @account.name, \n @folder.name, \n @title, \n @creation_time, \n @modify_time, \n @plaintext, \n @is_password_protected,\n @crypto_iterations,\n get_crypto_salt_hex,\n get_crypto_tag_hex,\n get_crypto_key_hex,\n get_crypto_iv_hex,\n get_encrypted_data_hex]\n end", "title": "" }, { "docid": "683815a294427be119f6cceee806a60f", "score": "0.60819405", "text": "def to_csv\r\n arr_rows =[]\r\n #get all the fields\r\n @rows.each do |row|\r\n row.flattern\r\n #collect field names from rows\r\n #we need this because there can be duplicated rows which we can't predict\r\n #like Pads or Batteries\r\n @fields |= row.fields\r\n end\r\n #Make a header row\r\n header = CSVRow.new @fields\r\n @fields.each do |f|\r\n header.set f, f\r\n end\r\n arr_rows.push header.to_csv\r\n\r\n #tell each row the combined fieldset\r\n #and convert it to CSV\r\n @rows.each do |row|\r\n row.fields @fields\r\n arr_rows.push row.to_csv\r\n end\r\n ret = arr_rows.join \"\\n\"\r\n return ret\r\n end", "title": "" }, { "docid": "e0a76c66ff5c8870fe6a7c606c6ce9fd", "score": "0.6079866", "text": "def write_csv\n original_info = get_original_info\n puts original_info\n updated_info = [\n original_info[\"id\"],\n # Concatenate original and new provenance with dspace special\n # character.\n # If we try to import a csv file with just the updated provenance,\n # it will *overwrite*, not append, so we need to keep the original.\n original_info[\"provenance\"] + \"||\" + METS.provenance\n ]\n CSV.open(@current_csv, \"a\") do |csv|\n csv << updated_info\n end\n end", "title": "" }, { "docid": "e94ebec9af2600ec425a457f951a2349", "score": "0.6077375", "text": "def to_csv\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n }.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n }\n str\n end", "title": "" }, { "docid": "b2b10dbd635811a43d1edb32d2a215b8", "score": "0.6072262", "text": "def to_csv\n CSV.generate do |csv|\n csv << HEADERS\n orders.each do |order|\n csv << csv_line(order)\n end\n end\n end", "title": "" }, { "docid": "12ac8868cc10fab536e69d7f1f644af3", "score": "0.6069192", "text": "def to_csv\n fields = CSV_OUT_FIELDS\n fields += EXTRA_CSV_OUT_FIELDS if @@will_lookup_by_handle\n\n header_line = fields.inject([]){|a,f| a << f.to_s}\n lines = [ header_line.join(CSV_DELIMITER) ]\n\n @collections.sort.each{|item_hdl, col_hdls|\n extra_fields = unless @@will_lookup_by_handle\n nil\n else\n @@dbresources.extra_csv_fields(item_hdl, col_hdls, CSV_DELIMITER, CSV_QUOTE)\n end\n lines << \"#{CSV_QUOTE}#{item_hdl}#{CSV_QUOTE}#{CSV_DELIMITER}#{CSV_QUOTE}#{col_hdls.join(VALUE_DELIMITER)}#{CSV_QUOTE}#{extra_fields}\"\n }\n lines.join(NEWLINE)\n end", "title": "" }, { "docid": "4847ab4a113994010865ed1cc492afdb", "score": "0.6030715", "text": "def write_data\n ::CSV.open(path, 'wb', file_options) do |csv|\n csv << headers\n data.each do |tuple|\n csv << ordered_data(tuple)\n end\n end\n end", "title": "" }, { "docid": "268113168326d322e0082c5595ff52c6", "score": "0.6024456", "text": "def as_csv(*)\n CSV.generate do |csv|\n csv << %w[\n key\n number_of_units\n electricity_output_capacity\\ (MW)\n heat_output_capacity\\ (MW)\n full_load_hours\n total_initial_investment_per_plant\\ (Euros)\n wacc\\ (factor)\n technical_lifetime\\ (years)\n ]\n\n nodes.each do |node|\n csv << node_row(node)\n end\n end\n end", "title": "" }, { "docid": "ad1fc9f9708805537c998ae25030725c", "score": "0.6000572", "text": "def save_as_csv\n CSV.open(\"./db/#{@name}.csv\", \"wb\") {|csv| @@D.to_a.each {|elem| csv << elem} }\n end", "title": "" }, { "docid": "34521dd455cbd67fc8f345147c30d18e", "score": "0.5987662", "text": "def to_csv(format=:short)\n output = ''\n columns = []\n case format\n when :long\n [\"id\", \"updated\", \"title\"].each { |c| columns << c }\n end\n unless @points.empty? # if there was at least one result\n @points.first.dimensions.map {|d| d.keys.first}.each { |c| columns << c }\n @points.first.metrics.map {|m| m.keys.first}.each { |c| columns << c }\n end\n output = CSV.generate_line(columns) \n @points.each do |point|\n output += point.to_csv(format)\n end\n output\n end", "title": "" }, { "docid": "f0c73a9c380df438f207315419ddcb8d", "score": "0.59838104", "text": "def to_csv_file(csv_filename, decimal_separator=',')\n File.open(csv_filename, 'w') do |csv_file|\n csv_file.puts 'tx_id;posting_date;amount;currency;payer_account_number;invoice_ref_type;invoice_ref;free_text;payer name and address'\n @messages.each do |cremul_msg|\n cremul_msg.lines.each do |cremul_msg_line|\n cremul_msg_line.transactions.each do |cremul_tx|\n tx_index = create_unique_tx_index(cremul_msg, cremul_msg_line, cremul_tx)\n csv_file.puts to_csv(tx_index, cremul_tx, decimal_separator)\n end\n end\n end\n end\n\n end", "title": "" }, { "docid": "aa8494fb5ecfa8b10839af1bd83cde53", "score": "0.5977959", "text": "def to_s\n return data.to_csv unless data.nil?\n CSV.generate_line(to_a)\n end", "title": "" }, { "docid": "2659ffbad6d1c9deac62e8b226fc9a23", "score": "0.59718406", "text": "def csv\n StructuredCSV.generate(metadata)\n end", "title": "" }, { "docid": "fc27e3bedd710b329223f6acb36c69ad", "score": "0.5965556", "text": "def export_csv\n fields = Person.column_names\n fields.push('tags')\n fields.push('notes')\n output = CSV.generate do |csv|\n # Generate the headers\n csv << fields.map(&:titleize)\n\n # Some fields need a helper method\n human_devices = %w(primary_device_id secondary_device_id)\n human_connections = %w(primary_connection_id secondary_connection_id)\n\n # Write the results\n @results.records.where(active: true).each do |person|\n csv << fields.map do |f|\n field_value = person[f]\n if human_devices.include? f\n human_device_type_name(field_value)\n elsif human_connections.include? f\n human_connection_type_name(field_value)\n elsif f == 'phone_number'\n if field_value.present?\n field_value.phony_formatted(format: :national, spaces: '-')\n else\n ''\n end\n elsif f == 'tags'\n person.tag_values.blank? ? '' : person.tag_values.join('|')\n elsif f == 'notes'\n person.comments.empty? ? '' : person.comments.map(&:content).join(\"\\n\")\n elsif @questions && @questions.map(&:text).include?(f)\n q = @questions.find { |question| question.text == f }\n person.answers.find_by(question: q)&.value\n else\n field_value\n end\n end\n end\n end\n send_data output, type: 'text/csv', filename: \"Search-#{Time.zone.today}.csv\"\n end", "title": "" }, { "docid": "78cf3623f13a1faf167bd1ce43cba061", "score": "0.59585387", "text": "def to_csv\n buf = \"\"\n transactions.each do |transaction|\n buf << transaction.to_csv\n end\n return buf\n end", "title": "" }, { "docid": "972be07fad21aa1f55a2de62b691364c", "score": "0.594921", "text": "def to_csv(path = nil)\n csv = csv_class.new((path ? File.open(path, 'w') : $stdout), :force_quotes => true)\n csv << columns.map {|c| c.name}\n each {|record| csv << record.to_a}\n end", "title": "" }, { "docid": "914d8c7605c12b5d60698af5135dfedc", "score": "0.59365565", "text": "def csv\n @date + \",\" + @name\n end", "title": "" }, { "docid": "aa6bf24642459623bfeab417246a8067", "score": "0.59272444", "text": "def report_csv_record(item, cluster_name, path)\n id = \"#{@settings['cluster_run']}-#{cluster_name}\"\n [\n item.get_guid,\n item.get_localised_name,\n id,\n item.get_cluster_thread_indexes[id],\n item.get_cluster_endpoint_status[id],\n item.get_digests.get_md5,\n File.join(item.get_localised_path_names.to_a),\n item.getTags.join('; '),\n path\n ]\n end", "title": "" }, { "docid": "71e7e6e0a299ca30f009954dea0f9158", "score": "0.5921968", "text": "def to_csv\n nombre_completo << \" - \" << debe\n end", "title": "" }, { "docid": "c07f62f37da5ac8902b40c7067ecb03f", "score": "0.5916553", "text": "def to_csv(file_name)\n rows = to_rows($res)\n File.open($options[:file] + \".csv\", \"w\") {|f| f.write(rows.inject([]) { |csv, row| csv << CSV.generate_line(row) }.join(\"\"))}\nend", "title": "" }, { "docid": "0d1d138a6c0af43c37deb62aef4eecba", "score": "0.5907943", "text": "def write_csv filename, opts={}\n Daru::IO.dataframe_write_csv self, filename, opts\n end", "title": "" }, { "docid": "0d1d138a6c0af43c37deb62aef4eecba", "score": "0.5907943", "text": "def write_csv filename, opts={}\n Daru::IO.dataframe_write_csv self, filename, opts\n end", "title": "" }, { "docid": "3ecc773302267dd1a38f7460798a54d8", "score": "0.5906228", "text": "def to_csv\n return \"\" if @links.count == 0\n str = CSV.generate do |csv|\n csv << [\"id\", \"name\", \"info\", \"collab_with\", \"count\"]\n @links.each do |link|\n source = find_node(link[:source])\n target = find_node(link[:target])\n csv << [source[:id], source[:name], source[:group], target[:id], link[:weight]]\n end\n end\n str\n end", "title": "" }, { "docid": "7820649550fa57590eafbe749eea58f2", "score": "0.5903313", "text": "def generate_csv\n CSV.open(\"outputs/#{@path}\", 'w') do |csv|\n csv << ['###########']\n csv << [\"# Output #{@path}\"]\n csv << ['###########']\n @order.items.each do |item|\n csv << [item[:quantity], ' ' + item[:product].name, ' ' + item[:product].taxed_price.to_s]\n end\n csv << []\n csv << [\"Sales Taxes: #{sprintf('%0.02f', @order.sales_taxes)}\"]\n csv << [\"Total: #{sprintf('%0.02f', @order.total)}\"]\n end\n end", "title": "" }, { "docid": "93e6d17aa507bc795be094c0cc4dff43", "score": "0.59001315", "text": "def to_csv(path = nil)\n out_io = path ? File.open(path, 'w') : $stdout\n csv = CSV.new(out_io, force_quotes: true)\n csv << column_names\n each { |record| csv << record.to_a }\n end", "title": "" }, { "docid": "f7f12cf21d09ef854f2b00197d2282c4", "score": "0.5899754", "text": "def export_csv(objects, fn)\n filename = I18n.l(Time.now, :format => :short) + \"-#{fn}\"\n content = objects.to_csv\n send_data content,\n :type => \"text/csv; charset=utf-8; header=present\",\n :disposition => \"attachment; filename=#{filename}\"\n end", "title": "" }, { "docid": "be5b6955bc14f910ed7c2ea3387fdac4", "score": "0.589058", "text": "def export_csv\n @outfile = \"transactions_\" + Time.now.strftime(\"%m-%d-%Y\") + \".csv\"\n @transactions = Transaction.find(:all)\n csv_string = ''\n @transactions.each do |transaction|\n csv_string += FasterCSV.generate do |csv|\n csv << [transaction.id, transaction.amount, transaction.created_at, transaction.updated_at, transaction.recipient.name, transaction.donor.name, transaction.rank, transaction.entity_id, transaction.ilike]\n end\n end\n send_data csv_string, :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{@outfile}\"\n end", "title": "" }, { "docid": "652edf304d8807f452d0e2fcfc77b66f", "score": "0.58880025", "text": "def to_csv\r\n flattern\r\n ret =[]\r\n @fields.each do |f|\r\n val = get f\r\n if val\r\n val = val.gsub /\"/, \"'\"\r\n val = \"\\\"#{val}\\\"\"\r\n else\r\n val = '\"\"'\r\n end\r\n ret.push val\r\n end\r\n ret = ret.join \",\"\r\n return ret\r\n end", "title": "" }, { "docid": "9186af7619bb7d31d2723722aecd0bea", "score": "0.58795464", "text": "def to_csv\n [@record_id, @email, @phone, @name_prefix, @first_name, @middle_name, @last_name, @name_suffix, @name_phonetic]\n end", "title": "" }, { "docid": "c266569aca7f81ccb9e9dc54437b4216", "score": "0.5873407", "text": "def to_csv(separator = ';', export_syms = self.class.data_symbols)\n to_a_s(export_syms).join(separator)\n end", "title": "" }, { "docid": "0f9f6572b7303ce8293108c3b3e4706b", "score": "0.5871206", "text": "def save_as_csv\n\tFile.open(\"/home/malala/Documents/THP/suite-nokogiri/db/emails.csv\", \"w\") {|f| f.write(@tabs.getting_the_townhall.inject([]) { |csv, row| csv << CSV.generate_line(row) }.join(\"\"))}\nend", "title": "" }, { "docid": "6de6dc672e2b5d3653f50a4b2467c79a", "score": "0.5869194", "text": "def write_csv filename, data\n ::CSV.open(filename, \"wb\") do |csv|\n data.each do |line|\n csv << line\n end\n end\n end", "title": "" }, { "docid": "8293d250c9fc70b42ad44c6a6de4b493", "score": "0.5859657", "text": "def to_csv(format=:short)\n output = ''\n columns = []\n case format\n when :long\n ['id', 'updated', 'title'].each { |c| columns << c }\n end\n unless @points.empty? # if there was at least one result\n @points.first.map {|d| columns << d.keys }\n end\n output = CSV.generate_line(columns) \n @points.each do |point|\n output += point.to_csv(format)\n end\n output\n end", "title": "" }, { "docid": "731dd4819d5b1b5b2701efef3b67907f", "score": "0.5859478", "text": "def csv(data)\n filename = \"data/#{@source[:registry_number]}.csv\"\n CSV.open(filename, \"wb\") do |csv|\n csv << [\n \"ИНН\",\n \"Полное наименование\",\n \"Краткое наименование\",\n \"Город\",\n \"Статус в СРО\",\n \"Допуск выдан\",\n \"Юридический адрес\",\n \"Номер свидетельства\",\n \"ОГРН\"\n ]\n\n data.each do |row|\n csv << [\n row[:inn],\n row[:name],\n row[:short_name],\n row[:city],\n Exporter.statuses[row[:status]],\n row[:resolution_date],\n row[:legal_address],\n row[:certificate_number],\n row[:ogrn]\n ]\n end\n end\n end", "title": "" }, { "docid": "a6650acfa324045c9595d368f9bad283", "score": "0.5859427", "text": "def to_csv\n \"#{@nom}:#{@taux}\"\n end", "title": "" }, { "docid": "68a54adcf21c61fe01d83fa15ac537c6", "score": "0.58591753", "text": "def save_to_csv\n CSV.open(@csv_file, 'w') do |csv|\n csv << [\"id\",\"meal_id\",\"customer_id\", \"employee_id\", \"delivered\"]\n @orders.each do |order|\n csv << [order.id, order.meal.id, order.customer.id, order.employee.id, order.delivered]\n # what I store in my csv are ids, so I get ids from all my models\n end\n end\n end", "title": "" }, { "docid": "080cbdbb3565cef2f7faff36223444e8", "score": "0.58517283", "text": "def to_csv(f = :as_string)\n if f == :as_string\n as_string = true\n f = ::StringIO.new\n end\n\n write_csv f\n \n if as_string\n f.rewind\n return f.read\n end\n \n nil\n ensure\n f.try(:close) if as_string\n end", "title": "" }, { "docid": "a0e2f12e083d4adb010437a91fbd560b", "score": "0.5851254", "text": "def csv\n exercise = Exercise.find(params[:id])\n @moves = exercise.moves\n send_data(\n Move.to_csv(@moves),\n :type => 'text/csv',\n :filename => exercise.title + '.csv',\n :disposition => 'attachment'\n )\n end", "title": "" }, { "docid": "8ddb386d31984dcc03eeee4721eadb22", "score": "0.5845469", "text": "def to_csv\n\t\t\"#{simple},#{secs},#{str},#{bytes},#{opcode.unpack('H*')[0]},#{duration}\"\n\tend", "title": "" }, { "docid": "f021c241eb6e5334553c5faf2bbbd33f", "score": "0.5843236", "text": "def to_csv\n participant_emails = @share_participants.map {|participant| participant.email}.join(\",\")\n parent_id = \"\"\n parent_name = \"\"\n if is_child?\n parent_id = @parent.primary_key\n parent_name = @parent.name\n end\n\n to_return = [@primary_key, @name, @notes.length, @account.primary_key, @account.name, participant_emails, parent_id, parent_name, \"\", @uuid]\n\n return to_return\n end", "title": "" }, { "docid": "05e06000cd78cabd2abdccd74b3e31c5", "score": "0.58427393", "text": "def write_to_csv(data,filename = \"new_scraped.csv\")\n\tCSV.open(filename, \"wb\") do |csv|\n\t \tdata.each {|x| csv << x}\n\tend\nend", "title": "" }, { "docid": "916125688b16156059abe27d5bb00113", "score": "0.58390915", "text": "def csv_export(filename, model, objects)\n attributes = csv_attribute_list model\n CSV.open(filename, 'wb') do |csv|\n write_headers csv, model, attributes\n break if objects.blank?\n\n write_data csv, attributes, objects\n end\n end", "title": "" }, { "docid": "b199af6f19683eead026f5a9f1cac054", "score": "0.5809444", "text": "def export_toCSV\n\n #get all engeeners and tasks from db\n @lenie = Engeener.find(:all)\n @tasks = Task.find(:all)\n\n #generate report file\n CSV.open('public/reports/dailystatus.csv', 'w') do |writer|\n @lenie.each do |l|\n writer << [l.imie + \" \" + l.nzwisko]\n writer << ['Task -- description', 'Time taken in hours']\n @tasks.each do |t|\n if t.engeener == l.nzwisko\n writer << [t.tresc, t.timetaken]\n end\n end\n writer << [nil, nil]\n end\n end\n\n #send the file to user\n send_file 'public/reports/dailystatus.csv'\n\n\n end", "title": "" }, { "docid": "75c35629a8d35b51b2e24328f947c084", "score": "0.5807637", "text": "def to_csv_value(column)\n value = public_send(column)\n return if value.nil?\n return value.to_csv if value.respond_to?(:to_csv)\n\n value.to_s\n end", "title": "" }, { "docid": "3ce354e762db15747db1c33d889f1255", "score": "0.5807054", "text": "def to_csv_row\n row = []\n row << id\n row << title\n row << user.name\n row << \"https://www.edisonnation.com/admin/ideas/#{to_param}\"\n row << (star? ? 'Y' : 'N')\n row << (patent_pending? ? 'Y' : 'N')\n row << (patent_issued? ? 'Y' : 'N')\n row << (prototype? ? 'Y' : 'N')\n row << attachments_count\n row += ratings.map(&:rating)\n row.map{|node| \"\\\"#{node.to_s.strip.gsub(',','').gsub('\"','`')}\\\"\"}.join(',')\n end", "title": "" }, { "docid": "5931eb204e3847c429dadc8fb78b4ba4", "score": "0.5805954", "text": "def to_csv(format = :short)\n output = ''\n columns = []\n\n # only output\n case format\n when :long\n [@id, @updated, @title].each { |c| columns << c }\n end\n\n # output all dimensions\n @dimensions.map {|d| d.values.first}.each { |c| columns << c }\n # output all metrics\n @metrics.map {|m| m.values.first}.each { |c| columns << c }\n\n output = CSV.generate_line(columns)\n\n end", "title": "" }, { "docid": "40cadd61a884b61092639060e9437f9a", "score": "0.5796054", "text": "def to_csv\n return \"#{@vid},#{@abbrevation},#{@name},#{@versionStatus}\"\n end", "title": "" }, { "docid": "6494e321b8b3e1811cd143565c8c210c", "score": "0.57794404", "text": "def write_object_to_csv\n begin\n CSV.open(@file_name, \"wb\") do |csv|\n @export_object.each do |row|\n csv << row\n end\n end \n rescue => exception\n raise FileWriteError, exception\n end\n end", "title": "" }, { "docid": "edbb9c243779a0a4766cbb262c133d4f", "score": "0.5779176", "text": "def to_csv\n \"#{@title},#{@rank}\"\n end", "title": "" }, { "docid": "7f911a23fe58a780812b8d7164ab3773", "score": "0.57785815", "text": "def export\n \n results=eval(\"#{model_class_name}.find(:all)\")\n outfile=eval(\"'#{model_name}_#{Time.now.strftime('%m-%d-%Y')}.csv'\")\n column_names=eval(\"#{model_class_name}.column_names\")\n \n csv_data = CSV.generate do |csv|\n csv << column_names\n results.each do |result| \n data_row = []\n column_names.each {|column| data_row << result[column]}\n csv << data_row\n end\n end\n\n send_data csv_data,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{outfile}\"\n \n end", "title": "" }, { "docid": "0e3beb23f5796dff533d82fc35afae6d", "score": "0.5775725", "text": "def to_csv\n ::CSV.generate do |csv|\n decorated.line_items.each do |item|\n csv << [item.quantity, \" #{item.description}\",\n \" #{item.total_amount_inc_tax}\"]\n end\n csv << []\n csv << [\"Sales Taxes: #{total_tax}\"]\n csv << [\"Total: #{total_amount}\"]\n end\n end", "title": "" }, { "docid": "519e57667e9a741618235d905de226f0", "score": "0.5767698", "text": "def save_to_csv(hash_data, file)\n hash_data.each do |v|\n row = v.to_h.values\n row.map!{ |x| x == \"N/A\" ? -999 : x}.map!{ |x| x ? x: -999}.map!{ |x| x == \"NaN\" ? -999 : x}\n row.map!{ |x| x =~ /%/ ? (x.gsub(',','').gsub('%','').to_f)/100 : x}\n row.map!{ |x| x =~ /k/i ? x.gsub(',','').to_f*1000 : x}\n CSV.open(file, \"a+\", {:col_sep => \"\\t\"}) do |csv|\n csv << $header if csv.count.eql? 0\n csv << row\n end\n end\nend", "title": "" }, { "docid": "0c7d08ca9643934d07ff31c3241ba549", "score": "0.57615376", "text": "def import_to_csv\n CSV.open('./output/data.csv', 'wb') do |csv|\n csv << ['Name of article', 'Image link', 'Text']\n @data.each do |article|\n csv << [article[:header], article[:imageLink], article[:text]]\n end\n end\n end", "title": "" }, { "docid": "61acd7f8b2585497723d1d04a2fb1003", "score": "0.57549405", "text": "def to_csv(**options)\n fields.to_csv(**options)\n end", "title": "" }, { "docid": "71712cfd38b462c7d12f1e1c70d8bb84", "score": "0.57534266", "text": "def to_csv\n order_items.map(&:to_csv).join(\"\\n\")\n end", "title": "" }, { "docid": "b175a0beeeafc84b991f2fae9a8f643e", "score": "0.5750729", "text": "def export_issues_csv\r\n sort_init 'issues.id', 'desc'\r\n sort_update\r\n\r\n search_filter_init_list_issues\r\n\t\t\t\t\t\r\n @issues = Issue.find :all, :order => sort_clause,\r\n\t\t\t\t\t\t:include => [ :author, :status, :tracker, :project ],\r\n\t\t\t\t\t\t:conditions => search_filter_clause\t\t\t\t\t\t\t\r\n\r\n export = StringIO.new\r\n CSV::Writer.generate(export, ',') do |csv|\r\n csv << %w(Id Status Tracker Subject Author Created Updated)\r\n @issues.each do |issue|\r\n csv << [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, _('(time)', issue.created_on), _('(time)', issue.updated_on)]\r\n end\r\n end\r\n export.rewind\r\n send_data(export.read,\r\n :type => 'text/csv; charset=utf-8; header=present',\r\n :filename => 'export.csv')\r\n end", "title": "" }, { "docid": "1410fab70084e5b7be60b71178d72c12", "score": "0.5747952", "text": "def export_csv(records, columns, params={})\n csv_string = CSV.generate(:force_quotes=>false, :headers=>columns, :write_headers=>true) do |csv|\n records.each do |r| \n csv << columns.map do |c| \n value = r.send(c.to_sym) if r.respond_to? c.to_sym\n # We want dates in long form, so have to convert them separately from other data types\n value.class == Date ? value.to_s(:long) : value.to_s\n end\n end\n end\n return csv_string\n end", "title": "" }, { "docid": "8cc6684bbc3acadbfca1fb5daa8c1500", "score": "0.57479465", "text": "def to_csv(columns: nil)\n attributes = members\n attributes = columns & attributes if columns\n\n row = attributes.map! { |column| to_csv_value(column) }\n\n ::CSV.generate_line(row)\n end", "title": "" }, { "docid": "00cc57c95e2910235590a5a71c021160", "score": "0.5746987", "text": "def csv_tool headers, data\n CSV.open('csvexperimentfile.csv', 'wb') do |csv|\n csv << headers\n\n data.each do |column|\n csv << column\n end\n end\nend", "title": "" }, { "docid": "1b1a4760732ebfc898a3c2c2e8a69e86", "score": "0.5744244", "text": "def ein2csv(dir, ein, fields, outfile)\n rows = []\n tmp = returns2arys(dir, ein, fields)\n tmp.each do |r|\n rows << r if r\n end\n if rows.empty?\n raise ArgumentError, \"Could not find any data for EIN #{ein}, skipping write of csv\"\n end \n CSV.open(outfile, \"w\") do |csv|\n csv << COMMON_FIELDS.merge(fields).values # MAINTENANCE: ensure return2ary method does this too\n rows.each do |row|\n csv << row\n end\n end\n end", "title": "" }, { "docid": "597fd442254259e49183799afeb520fa", "score": "0.57421935", "text": "def student_to_csv(student)\n\tstudent.values\nend", "title": "" }, { "docid": "1b04cccd6c56af89689ed964a5bdf94a", "score": "0.5736824", "text": "def csv_output\n delimited_output(\",\")\n end", "title": "" }, { "docid": "9e3a2e5ede3499c7f5daca43e17d742c", "score": "0.5732245", "text": "def export_data_file\n if @target_dataset_geo_id.start_with?('PV', 'RES')\n mandatory_headers = %w[name geo_id country]\n mandatory_values = [@target_area_name, @target_dataset_geo_id, @target_country_name]\n else\n mandatory_headers = %w[geo_id]\n mandatory_values = [@target_dataset_geo_id]\n end\n\n migration_data_directory.join(DATA_FILENAME).write(\n <<~CSV_CONTENTS\n #{(mandatory_headers + @combined_item_values.keys).join(',')}\n #{(mandatory_values + @combined_item_values.values).join(',')}\n CSV_CONTENTS\n )\n end", "title": "" }, { "docid": "d792de0150fdcacf5f560eb80a776f17", "score": "0.57216954", "text": "def event_to_csv\n\t\t@event = Event.find(params[:id])\n\n\t\tcsv_string = CSV.generate() do |csv|\n\t\t\tcsv << [@event.id,\n\t\t\t\t\[email protected],\n\t\t\t\t\[email protected],\n\t\t\t\t\[email protected]_open]\n\t\tend \n\n\t\tsend_data csv_string,\n\t\t\t:type => 'text/csv; charset=iso-88859-1; header=present',\n\t\t\t:disposition => \"attachment; filename=Event_#{@event.id}_#{@event.name}.csv\"\n\tend", "title": "" }, { "docid": "76d376aff30bac65978fb0eca921299f", "score": "0.5719115", "text": "def to_CSV(out_file)\n saver = CSVSaver.new\n saver.setInstances(self)\n out_file = File.new out_file\n saver.setFile(out_file);\n saver.writeBatch();\n end", "title": "" } ]
181b3450b5386531652c47235cb086de
Build an instance of SchemaVersionInstance
[ { "docid": "263252da80ab04241372fc9e20c76f7b", "score": "0.0", "text": "def get_instance(payload); end", "title": "" } ]
[ { "docid": "624698a2d82a32980d750c430ac9c101", "score": "0.6641963", "text": "def get_instance(payload)\n SchemaInstance.new(@version, payload)\n end", "title": "" }, { "docid": "03a8e7b10c1c05610da440e84a433440", "score": "0.59792465", "text": "def new_version(xmllist)\n Types::Version.new(self, xmllist)\n end", "title": "" }, { "docid": "0efe866a7961d5cbf801b11d38fa9d8d", "score": "0.5960146", "text": "def build_version_dsl\n @build_version_dsl\n end", "title": "" }, { "docid": "a93b2e35591f65279bbcf65927bfcd7d", "score": "0.59360147", "text": "def create_dynamic_version_model(options = {})\n cattr_accessor :versioned_class_name,\n :versioned_foreign_key, \n :versioned_table_name,\n :root_column,\n :non_versioned_columns,\n :version_association_options\n cattr_accessor :version_column if version_root?\n\n self.versioned_class_name = \"Version\"\n self.versioned_foreign_key = self.to_s.foreign_key\n self.versioned_table_name = \"#{table_name_prefix}#{base_class.name.demodulize.underscore}_versions#{table_name_suffix}\"\n self.version_column = 'version' if version_root?\n self.root_column = 'version_root_id'\n self.non_versioned_columns = [self.primary_key, self.root_column ]\n self.non_versioned_columns << self.version_column if version_root?\n self.version_association_options = { :class_name => \"#{self.to_s}::#{versioned_class_name}\",\n :foreign_key => versioned_foreign_key,\n :dependent => :delete_all }\n \n const_set(versioned_class_name, Class.new(ActiveRecord::Base))\n versioned_class.cattr_accessor :original_class\n versioned_class.original_class = self\n versioned_class.set_table_name versioned_table_name\n versioned_class.belongs_to self.to_s.demodulize.underscore.to_sym, \n :class_name => \"::#{self.to_s}\", \n :foreign_key => versioned_foreign_key\n \n Rails.logger.debug \"Working on #{self.to_s}\" \n \n class_eval do\n has_many :versions , version_association_options do\n # finds earliest version of this record\n def earliest\n @earliest ||= find(:first, :order => \"#{original_class.version_column}\")\n end\n \n # find latest version of this record\n def latest\n @latest ||= find(:first, :order => \"#{original_class.version_column} desc\")\n end\n end\n end\n \n # Well, I'm using an observer. I know this is more appropriate\n # but sheesh, it feels like a lot of extra code.\n const_set(\"VersionedObserver\", Class.new(ActiveRecord::Observer)).class_eval do\n observe self.parent.to_s.downcase.to_sym\n def after_save(model)\n Rails.logger.debug \"you are so totally observed.\"\n end\n end \n ActiveRecord::Base.observers = [self::VersionedObserver]\n ActiveRecord::Base.instantiate_observers\n \n \n end", "title": "" }, { "docid": "00f0f196ded1f3e6706d5adea5d304e0", "score": "0.5914547", "text": "def initialize_versioning\n create_schema_keyspace unless schema_keyspace_exists?\n create_versions_table unless versions_table_exists?\n end", "title": "" }, { "docid": "a0935228861c50a2a33053b5cd7e442f", "score": "0.58872473", "text": "def schema_creation # :nodoc:\n SchemaCreation.new(self)\n end", "title": "" }, { "docid": "a9a5b129c6099dc48707239971941889", "score": "0.57840776", "text": "def set_schema_version\n @schema_version = SchemaVersion.find(params[:id])\n end", "title": "" }, { "docid": "f33a3fdbf278c7877b1b2efd7f0f91d4", "score": "0.5765827", "text": "def build_schema(**args)\n return args[:serializer].new(self).build_schema(**args) if args[:serializer]\n\n if (serializer = find_serializer(args[:for]))\n return serializer.new(self).build_schema(**args)\n end\n\n Surrealist.build_schema(instance: self, **args)\n end", "title": "" }, { "docid": "dbb473890d575474ae39aa3ae97fbdc6", "score": "0.5750391", "text": "def create\n @schema_version = SchemaVersion.new(schema_version_params)\n\n respond_to do |format|\n if @schema_version.save\n format.html { redirect_to @schema_version, notice: 'Schema version was successfully created.' }\n format.json { render :show, status: :created, location: @schema_version }\n else\n format.html { render :new }\n format.json { render json: @schema_version.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b023372f22112f54007e49ec1403d8a", "score": "0.5717868", "text": "def create_with_version_info\n if self.class.instance_variable_get('@versionable')\n if disable_versionable_once\n create_without_version_info\n return\n end\n unless self.content_id\n self.content_id = self.class.connection.next_val_sequence(\"#{self.class.table_name}_$_content_id\")\n end\n unless self.version_number\n self.version_number = next_version_number\n self.is_current_version = true\n end\n create_without_version_info\n\n unless self.parent_version\n self.class.without_versionable {update_attribute :parent_version, self.id}\n end\n else\n create_without_version_info\n end\n end", "title": "" }, { "docid": "adcd567bf750521207b4fcfcb5587a68", "score": "0.56965005", "text": "def version\n return nil if @version.nil?\n @version_object = Version.new(@version, @name) if @version_object.nil?\n @version_object\n end", "title": "" }, { "docid": "aae46d23ed65e7f4ca349460efb27cc9", "score": "0.56544524", "text": "def schema_version; end", "title": "" }, { "docid": "86ad23873bedb1caede4cfd07ae85a53", "score": "0.5631828", "text": "def create_version\n return unless should_create_version?\n model = self.class.version_model\n user_key = self.class.user_model.to_s.underscore.to_sym\n attrs = {\n :number => model.count(\n :versionable_type => self.class,\n :versionable_id => self.id\n ),\n user_key => updated_by,\n :data => pending_version_attributes,\n :versionable_type => self.class,\n :versionable_id => self.id\n }\n\n if model.is_scoped? and self.class.properties[model.scope_key]\n attrs[model.scope_key] = self.send(model.scope_key)\n end\n\n model.create(attrs)\n\n end", "title": "" }, { "docid": "b1d2e00c7c617327a9cb67736a2f85fd", "score": "0.5620092", "text": "def version_obj\n version_cache.version_obj ||= begin\n if version_cache.wanted_version_number\n obj = versions.\n where(:number => version_cache.wanted_version_number).first\n unless obj || version_cache.self_version || version_cache.existing_version_wanted\n # versions.to_a # TODO: prefetch versions before building a new one?\n obj = versions.build({\n :number => version_cache.wanted_version_number,\n :versioned_attributes => versioned_attributes,\n :created_at => updated_at_was\n })\n end\n obj\n else\n editing_time = self.class.versioning_options[:editing_time]\n if !editing_time || version_updated_at <= (Time.now-editing_time.to_i) || updated_at > Time.now # allow future versions\n versions.build(:created_at => updated_at_was)\n end\n end\n end\n end", "title": "" }, { "docid": "8a41113de5da5e69b88a9e41147ddd7c", "score": "0.5605104", "text": "def make_version\n # check to see if this is a version record because it is we do nothing \n if self.original_uid.nil?\n #this is a new or updated record so make a new version\n dirty_props = (self.dirty_attributes.keys.map{|k| k.name.to_s }-['id','updated_at','provenance_comment','deleted_at']).join(', ')\n self.updated_comment = \"UPDATED_FIELDS: #{dirty_props}\"\n att = self.attributes\n att.delete(:id)\n att = att.merge(:deleted_at=> ::Time.now)\n att = att.merge({:original_uid => self.id})\n version = Yogo::Collection::Property.create(att)\n end #if\n end", "title": "" }, { "docid": "650e2d459e2f678f5b230b117e94f0ce", "score": "0.5596625", "text": "def index\n @schema_versions = SchemaVersion.all\n end", "title": "" }, { "docid": "e777cb41f08415799a0b4e1b2fff5c58", "score": "0.5595152", "text": "def builder(schema = nil)\n DbAgile::Core::Schema::Builder.new(schema)\n end", "title": "" }, { "docid": "22b1d1f83524d9337306c6b692b98a1a", "score": "0.55931616", "text": "def model\n Version.create_version(versionable, YAML::load(yaml).merge(draft: drafted?))\n end", "title": "" }, { "docid": "d67a6f6882aae3b9dc00af3338f828d5", "score": "0.5583808", "text": "def create_version(attributes = nil)\n versions.create(attributes || version_attributes)\n reset_version_changes\n reset_version\n end", "title": "" }, { "docid": "251475d1ca68b2a85592fc0b9c1c0681", "score": "0.5573207", "text": "def build_schema(camelize: false)\n Surrealist.build_schema(self, camelize: camelize)\n end", "title": "" }, { "docid": "c66d7f126d04eb0af914976880bd77f6", "score": "0.55504024", "text": "def create_version(attr)\n BoxVersion.create(tag, attr)\n end", "title": "" }, { "docid": "04a057257d3a9ffbb154c7f49346e983", "score": "0.5442936", "text": "def create_initial_version\n versions.create(version_attributes.merge(:number => 1))\n reset_version_changes\n reset_version\n end", "title": "" }, { "docid": "dc5ace40375448d820a60b75bee92ff8", "score": "0.5434755", "text": "def new(schema_identifier = nil)\n Schema::DatabaseSchema.new(schema_identifier)\n end", "title": "" }, { "docid": "54121b23df832cc1f8185d3ba82b287b", "score": "0.54235613", "text": "def build_version(val = NULL, &block)\n if block && !null?(val)\n raise Error, 'You cannot specify additional parameters to ' \\\n '#build_version when a block is given!'\n end\n\n if block\n @build_version_dsl = BuildVersionDSL.new(&block)\n else\n if null?(val)\n @build_version_dsl.build_version\n else\n @build_version_dsl = BuildVersionDSL.new(val)\n end\n end\n end", "title": "" }, { "docid": "fe0cb7dc1bae7fc096d02a0518fb31eb", "score": "0.5397324", "text": "def new\n @version = Version.find_by_done(false) || Version.create\n collect_data\n end", "title": "" }, { "docid": "4cb9e3f7fe1ba74d8370e99a9ab00168", "score": "0.5390627", "text": "def _initialize_version\n ReleaseAutomation::Versioner.new\n end", "title": "" }, { "docid": "9c7fff4a29eae388c47c182dbc460eb0", "score": "0.53830314", "text": "def load_or_create_schema!\n guid = @root['id'].to_i(16)\n \n @schema = Schema.find(:guid => guid) \n @schema ||= Schema.new(:name => @root['name'])\n @new = @schema.new? \n \n @schema.guid = guid if @new\n @schema.name = @root['name']\n @schema.load_schema_elements()\n end", "title": "" }, { "docid": "b4448064edbbd5ac989b505baef5aa82", "score": "0.5361952", "text": "def make_schema\n Property::Schema.new(self.to_s, :class => self)\n end", "title": "" }, { "docid": "4784ece186faad709138bb391f442d9d", "score": "0.5352772", "text": "def initialize\n @schema ||= _object\n end", "title": "" }, { "docid": "30c2370283a3d3c3195d4f6e17b89aed", "score": "0.53220516", "text": "def new\n @activity = Activity.find(params[:activity_id])\n @version = @activity.versions.build\n @version.update_sql = Change.activity_sql(params[:activity_id])\n @version.rollback_sql = Change.activity_suggested_rollback_sql(params[:activity_id]) \n @version_bump_type = Brazil::SchemaRevision::TYPE_MINOR\n \n asvc = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @activity.app.vc_path, :vc_uri => ::AppConfig.vc_uri, :vc_tmp_dir => ::AppConfig.vc_dir)\n @current_lastest = asvc.find_versions(@activity.schema).last\n @version.schema_version = asvc.find_next_schema_version(@activity.schema, @version_bump_type).to_s\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @version }\n end\n end", "title": "" }, { "docid": "93e73d5e4e1d4d986f80bcd2247fba94", "score": "0.53177494", "text": "def instance\n @schema ||= GraphQL::Schema.new begin\n TYPES.reduce({\n max_depth: Rails.config.max_depth,\n types: Types.explicit,\n }) do |schema, type|\n fields = @fields[type]\n unless fields.empty?\n # Build an object for each operation type.\n schema[type] = GraphQL::ObjectType.define do\n name type.to_s.capitalize\n description \"Root #{type.to_s} for this schema\"\n # Add a field for each operation.\n fields.each do |value|\n field value.name, field: value\n end\n # Add the global node ID lookup query.\n if Rails.config.global_ids && type == :query\n field :node, field: NodeIdentification.field\n end\n end\n end\n schema\n end\n end\n if Rails.config.global_ids\n @schema.node_identification = NodeIdentification\n end\n @schema\n end", "title": "" }, { "docid": "be82cdf27401d8938be4d0fdb7095f4f", "score": "0.5285836", "text": "def recreate_version_object\n model = recreate_model(self.versionable_type, self.version_attributes)\n model.id = self.versionable_id\n\n self.version_associations.each do |associated_object, associated_object_attributes|\n model.try \"#{associated_object.to_s}=\", recreate_model(associated_object, associated_object_attributes)\n end\n update_fields model, self.extra_info\n model\n end", "title": "" }, { "docid": "64f8dd244590a15f0e47f017fc6b59f4", "score": "0.52459526", "text": "def initialize(schema)\n @schema = schema\n end", "title": "" }, { "docid": "f3a7c01e7309740ee53a362c10a3c2f9", "score": "0.523383", "text": "def yaml_builder(schema = Schema.new)\n DbAgile::Core::Schema::Builder.new(schema)\n end", "title": "" }, { "docid": "24e1827b167ceabb43a68bf4dc4b8420", "score": "0.521718", "text": "def initialize(version)\n validate!(version)\n @yaml_version = version\n end", "title": "" }, { "docid": "823436d66a63c2418610466e5063f358", "score": "0.5212631", "text": "def make_version\n # check to see if this is a version record because it is we do nothing \n if self.original_uid.nil?\n #this is a new or updated record so make a new version\n dirty_props = (self.dirty_attributes.keys.map{|k| k.name.to_s }-['id','updated_at','provenance_comment','deleted_at']).join(', ')\n self.updated_comment = \"UPDATED_FIELDS: #{dirty_props}\"\n att = self.attributes\n att.delete(:id)\n att = att.merge({:original_uid => self.id})\n version = self.model.collection.items.create(att)\n version.destroy\n end #if\n end", "title": "" }, { "docid": "823436d66a63c2418610466e5063f358", "score": "0.5212631", "text": "def make_version\n # check to see if this is a version record because it is we do nothing \n if self.original_uid.nil?\n #this is a new or updated record so make a new version\n dirty_props = (self.dirty_attributes.keys.map{|k| k.name.to_s }-['id','updated_at','provenance_comment','deleted_at']).join(', ')\n self.updated_comment = \"UPDATED_FIELDS: #{dirty_props}\"\n att = self.attributes\n att.delete(:id)\n att = att.merge({:original_uid => self.id})\n version = self.model.collection.items.create(att)\n version.destroy\n end #if\n end", "title": "" }, { "docid": "b3a60852c2b739cab9b5fec16bbca561", "score": "0.520771", "text": "def schema(&block)\n ActiveRecord::Schema.define(version: 0, &block)\nend", "title": "" }, { "docid": "b3a60852c2b739cab9b5fec16bbca561", "score": "0.520771", "text": "def schema(&block)\n ActiveRecord::Schema.define(version: 0, &block)\nend", "title": "" }, { "docid": "aa682226dcc0952dc95c518f4fd46594", "score": "0.5183336", "text": "def make_version\n version = HockeyApp::Version.new(app, client)\n version.notes = self.notes\n version.notes_type = HockeyApp::Version::NOTES_TYPES_TO_SYM.invert[self.notes_type]\n version.notify = HockeyApp::Version::NOTIFY_TO_BOOL.invert[self.notify]\n version.status = HockeyApp::Version::STATUS_TO_SYM.invert[self.status]\n version.tags = self.tags\n version\n end", "title": "" }, { "docid": "c5e86f9c5adc2e09236b90be86eb5ecf", "score": "0.51537246", "text": "def initialize\n super\n\n @root_dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..'))\n\n @instance_lock = Mutex.new\n @@schema ||= schema\n end", "title": "" }, { "docid": "ec713a7fdbf686e30d67d506c76dab24", "score": "0.5138271", "text": "def initialize(instance)\n @form = instance.form_version.form\n @instance = instance\n @is_new = @instance.id.nil?\n @controls = []\n form_metadata = FD::Metadata::Form.new(instance.form_version.metadata)\n @tree, @controls = build_tree(form_metadata)\n @connections = build_connections(form_metadata)\n end", "title": "" }, { "docid": "c764dff862ee05cbe24f658715350d7b", "score": "0.5135309", "text": "def create_versioned_table(create_table_options = {})\n return if connection.table_exists?(versioned_table_name)\n\n # Our structure is a little different from AAV\n self.connection.create_table(versioned_table_name, create_table_options) do |t|\n t.column versioned_foreign_key, :integer\n t.column :version_from, :datetime\n t.column :version_to, :datetime\n end\n\n self.versioned_columns.each do |col|\n self.connection.add_column versioned_table_name, col.name, col.type,\n :limit => col.limit,\n :default => col.default,\n :scale => col.scale,\n :precision => col.precision\n end\n\n if type_col = self.columns_hash[inheritance_column]\n self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type,\n :limit => type_col.limit,\n :default => type_col.default,\n :scale => type_col.scale,\n :precision => type_col.precision\n end\n\n # We index a few more things compared with AAV\n [versioned_foreign_key, :version_from, :version_to].each do |col|\n self.connection.add_index versioned_table_name, col\n end\n end", "title": "" }, { "docid": "c2c716007205075d33d2713e149cb5b9", "score": "0.513299", "text": "def version\n return nil if self.new_record?\n @version ||= recreate_version_object\n end", "title": "" }, { "docid": "d0a5c1ffda26f0abc36a9807bd0f2dfd", "score": "0.5125387", "text": "def create_instance(version, version_of_artifact, direct_url, mediation_url)\n cv_instance = Instance.new(name: \"Commuted Value Service #{version}\",\n version_of_artifact: version_of_artifact)\n cv_instance.endpoints << Endpoint.create(\n name: \"commutedValueService#{version}\",\n description: \"Direct endpoint to version #{version}\",\n endpoint_type: 'Direct',\n url: direct_url)\n cv_instance.endpoints << Endpoint.create(\n name: \"Development.WESB.commutedValueService#{version}\",\n description: \"WESB mediation to version #{version}\",\n endpoint_type: 'WESB mediation',\n url: mediation_url)\n cv_instance\nend", "title": "" }, { "docid": "af5e6bc3db0e58786cbad3336f9fcc8e", "score": "0.5102555", "text": "def schema\n @schema ||= schema_versions[\"relaton-models\"]\n end", "title": "" }, { "docid": "dacfd77c47b75794e5169dcbafe407e0", "score": "0.50962514", "text": "def create_schema\n client.create_schema parse_class, schema\n end", "title": "" }, { "docid": "a86e0e02630de2f9f9e8af42dafc51ae", "score": "0.50812304", "text": "def make_own_schema\n Property::Schema.new(nil, :superschema => self.class.schema)\n end", "title": "" }, { "docid": "f6dab383c119da15c6b8fc892b847d4f", "score": "0.5077441", "text": "def initialize version\n @version = Gem::Version.new version\n end", "title": "" }, { "docid": "666af5a3b9d29c296a719c3683d9749f", "score": "0.50593", "text": "def _versions\n _create_versions unless _versions_exists?\n @db[:_versions]\n end", "title": "" }, { "docid": "de07110b93d7e21ef8d2cd04edf6f85b", "score": "0.5047984", "text": "def schema\n @schema ||= Schema.new\n end", "title": "" }, { "docid": "ea9c1a17517393eae06402abb1db5a26", "score": "0.5002798", "text": "def initialize(wsdl_url)\n self.doc = Wasabi.document wsdl_url\n self.show_schemas = parse_wsdl_schemas\n self.schemas = Nokogiri::XML::Schema(show_schemas.join)\n rescue Nokogiri::XML::SyntaxError => e\n puts \"Error for #{show_schemas}\"\n raise e\n end", "title": "" }, { "docid": "42585d6b03dacba4de1016a12f722da5", "score": "0.49841753", "text": "def init_model(attrs, options, version)\n klass = version_reification_class(version, attrs)\n\n # The `dup` option and destroyed version always returns a new object,\n # otherwise we should attempt to load item or to look for the item\n # outside of default scope(s).\n model = if options[:dup] == true || version.event == \"destroy\"\n klass.new\n else\n version.item || init_model_by_finding_item_id(klass, version) || klass.new\n end\n\n if options[:unversioned_attributes] == :nil && !model.new_record?\n init_unversioned_attrs(attrs, model)\n end\n\n model\n end", "title": "" }, { "docid": "6afda30f0ba957230893bace9c13cdf3", "score": "0.49816993", "text": "def Version(value)\n case value\n when String,\n Integer,\n Float,\n -> val { val.respond_to?(:to_ary) }\n Version.new(value)\n when -> val { val.respond_to?(:to_version) }\n value.to_version\n else\n raise TypeError, \"Cannot convert #{value.inspect} to Version\"\n end\n end", "title": "" }, { "docid": "8b14aaf91d12e9b42fe87e76738a0035", "score": "0.49642408", "text": "def schema_version=(schema_version)\n if schema_version.nil?\n fail ArgumentError, 'invalid value for \"schema_version\", schema_version cannot be nil.'\n end\n @schema_version = schema_version\n end", "title": "" }, { "docid": "567c9e12c0edef093c4399312941a969", "score": "0.49594772", "text": "def validate_schema(schema); schema.is_a? Veritable::Schema ? schema.validate : Veritable::Schema.new(schema).validate; end", "title": "" }, { "docid": "921ab7a3e5855063cf038864481ea433", "score": "0.49440983", "text": "def call\n register_new_version\n schema\n rescue ActiveRecord::RecordNotUnique\n if retried\n raise\n else\n self.retried = true\n retry\n end\n end", "title": "" }, { "docid": "279ee1477203b5872f56df50fd54a713", "score": "0.49327296", "text": "def initialize(hosts, meep_schema_version, options = {})\n self.hosts = hosts\n self.meep_schema_version = meep_schema_version || DEFAULT_VERSION\n self.options = options || {}\n end", "title": "" }, { "docid": "2681e9cdb86c51312808ed5715d4455f", "score": "0.493043", "text": "def new(segments, prerelease = nil)\n self.class.allocate.tap do |version|\n version.segments = segments\n version.prerelease = prerelease\n end\n end", "title": "" }, { "docid": "1237768d2412e2de7171e21cc3d1506a", "score": "0.49232286", "text": "def initialize(version = nil, logger = Logger.new(STDERR))\n self.logger = logger\n @version = version\n unless @version\n @version = RailsappFactory.versions(RUBY_VERSION).last || '4.1'\n end\n self.logger.info(\"RailsappFactory.new(#{version.inspect}) called - version set to #{@version}\")\n raise ArgumentError.new(\"Invalid version (#{@version})\") if @version.to_s !~ /^[2-9](\\.\\d+){1,2}(-lts)?$/\n self.gem_source = 'https://rubygems.org'\n self.db = defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'\n # 5 minutes\n self.timeout = 300\n # clears build vars\n destroy\n # clear template vars\n clear_template\n # use default ruby\n use(nil)\n end", "title": "" }, { "docid": "bf1175c516edf5cee77dd7f521f4e368", "score": "0.49187556", "text": "def schema_version_params\n params.require(:schema_version).permit(:schema_id, :version, :mysql_dump, :mysql_distrib, :comment)\n end", "title": "" }, { "docid": "e673e65d9dea8ae50c530ef85610955d", "score": "0.49183157", "text": "def initialize(fw_version = nil)\n set_version_context(fw_version)\n end", "title": "" }, { "docid": "cc78e4785813d19c6dfca5523796f561", "score": "0.49182418", "text": "def build(name = nil, scope: nil, **attributes, &block)\n type = (attributes[:type] || inner_class.infer_type)&.to_sym\n defaults = ::JSON::SchemaDsl::Builder\n .type_defaults[type].merge(name: name, type: type)\n builder = new(inner_class.new(defaults), scope: scope)\n Docile.dsl_eval(builder, &config_block(attributes, &block))\n end", "title": "" }, { "docid": "1a2b210f8b89f48ea88b0f3a6ef5dbbb", "score": "0.49140406", "text": "def test_class_create\n real = FoobarMod::Version.new(1.0)\n\n assert_same real, FoobarMod::Version.create(real)\n assert_nil FoobarMod::Version.create(nil)\n assert_equal v(\"5.1\"), FoobarMod::Version.create(\"5.1\")\n\n ver = '1.1'.freeze\n assert_equal v('1.1'), FoobarMod::Version.create(ver)\n end", "title": "" }, { "docid": "1ea9c2f6c9c569002a72ed48fcccfc83", "score": "0.48994923", "text": "def create_new_version(add_version_number = false)\n current_instance = self.class.find(self.id).clone\n current_instance.is_current_version = false\n current_instance.parent_version = self.id\n current_instance.version_number = next_version_number if add_version_number\n current_instance.save\n # delete the older versions if there are too many versions (as defined by max_amount)\n if max_amount = self.class.instance_variable_get('@versionable_options')[:max_amount]\n versions_by_number = self.versions.sort {|a,b| a.version_number <=> b.version_number}\n (versions_by_number.size - max_amount).times do |i|\n versions_by_number[i].delete\n end\n end\n end", "title": "" }, { "docid": "7f9daea7f1bd8f1951c8bfb59f163d5c", "score": "0.4896194", "text": "def schema_version\n @schema_version ||= begin\n last_migration = select(:migrations, :order => :version, :direction => 'DESC', :limit => 1).first\n last_migration ? last_migration['version'] : 0\n rescue Mysql2::Error => e\n e.message =~ /doesn\\'t exist/ ? 0 : raise\n end\n end", "title": "" }, { "docid": "b3d1985935f0578ac194cb6bfcbc86d5", "score": "0.4885897", "text": "def apply_version!(*args)\n raise ArgumentError if args.empty?\n set_version_args(*args)\n if version_number == version_cache.wanted_version_number\n version_cache.self_version = true\n return\n end\n version_cache.self_version = false\n unless version_obj\n raise VersionNotFoundError.new(\"version #{version_cache.wanted_version_number} does not exist\")\n end\n version_cache.original_version_number ||= version_number\n self.attributes = version_attributes\n self.version_number = version_cache.wanted_version_number\n if time = version_obj.created_at\n self.updated_at = time\n self.version_updated_at = time\n end\n nil\n end", "title": "" }, { "docid": "69d751f2bf1a6b2b57402551d8dd5363", "score": "0.4883027", "text": "def initialize( database, schemas )\n @name = self.class.name(schemas)\n @database = database\n @version_lookup = {}\n @schema_lookup = {}\n @entity_lookup = {}\n\n schemas.each do |schema|\n @version_lookup[schema.name] = {} unless @version_lookup.member?(schema.name)\n @version_lookup[schema.name][schema.version] = schema unless @version_lookup[schema.name].member?(schema.version)\n \n @schema_lookup[schema.name] = schema unless @schema_lookup.member?(schema.name)\n \n schema.entities.each do |entity|\n @entity_lookup[entity.name] = entity unless @entity_lookup.member?(entity.name)\n end\n end \n end", "title": "" }, { "docid": "248b52f00e98fa271369ec2f8b48dfb5", "score": "0.48804626", "text": "def initialize(version, allow_wildcards = true)\n @version = version\n @version = WILDCARD if !@version && allow_wildcards\n\n major, tail = major_or_minor_and_tail @version\n minor, tail = major_or_minor_and_tail tail\n micro, qualifier = micro_and_qualifier tail\n\n concat [major, minor, micro, qualifier]\n validate allow_wildcards\n end", "title": "" }, { "docid": "c3fc8e7a306eeffeae0da35ea139f34b", "score": "0.48779604", "text": "def create_index_for_version!(version)\n search_repository(version).create_index! force: true\n ruby_object_repository(version).create_index! force: true\n end", "title": "" }, { "docid": "f1d1fd6d92aa9aadeca46690ff9315ef", "score": "0.4874205", "text": "def initialize_migration(version)\n migration_proxy = self.class.get_migration(version)\n @migration = migration_proxy.send(:migration)\n end", "title": "" }, { "docid": "12323f6c40685e20083781000f3c7e9d", "score": "0.48668993", "text": "def initialize(args)\n args.each do |k,v|\n instance_variable_set(\"@#{k}\", v) unless v.nil?\n end\n # set to false if it has not been set already\n # @base ||= false\n\n profile, path = nil\n # if(@version_store)\n profile = @version_store.find{|v| v[:std] == @std}[:profiles].find{|p| p[:doc] == @version }[:path]\n path = @version_store.detect{|v| v[:std] == @std}[:path]\n # else\n # # path = self.class.get_schema_location\n # # profile = File.path(path+ @@HL7_VERSIONS[@version])\n # end\n\n @xml = Ox.parse(IO.read(profile))\n\n # added = File.path(path+'added.xml')\n begin\n added = File.path(path+'/added/coded-tables.xml')\n @added = Ox.parse(IO.read(added))\n rescue => e\n puts e.message\n end\n\n # set flag if this is base or custom schema\n @base = (@xml.Export.Document.Category.attributes[:std] == '1')\n\n end", "title": "" }, { "docid": "eeb27df2d3774c044acbad8522b37ecc", "score": "0.4866509", "text": "def schema_version\n Ebay::Schema::VERSION.to_s\n end", "title": "" }, { "docid": "b09f39e7100eabcc5583478f3a69fd9a", "score": "0.48636386", "text": "def create_schema(schema_name); end", "title": "" }, { "docid": "33edfe09a3c5fe85b8c06517ba5ff5de", "score": "0.48635903", "text": "def initialize(*vars)\n schema = vars[0]\n if schema\n @version = schema.version\n @model_descriptions = schema.entities.map do |e|\n CoreData::ModelDescription.new(e)\n end\n end\n end", "title": "" }, { "docid": "dd7b9257750099fd24b7f2c5d15c206f", "score": "0.48577765", "text": "def create\n load_schemas\n end", "title": "" }, { "docid": "39fde3f9f533a996f25c23a0ebffbed3", "score": "0.48433113", "text": "def generate_solr_schema( index_builder )\n solr_schema = index_builder.solr_schema_xml()\n assert( !solr_schema.nil?, \"The index_builder.solr_schema method returned nil.\" )\n assert( solr_schema.is_a?(String), \"index_builder.solr_schema did not return a string value.\" )\n # TODO: If/when there is a DTD to validate the Solr XML against - use it!\n end", "title": "" }, { "docid": "497c0738fd58b6a56b91127434436a05", "score": "0.48408735", "text": "def at_version( other_version )\n self.class.new(@dirname, other_version)\n end", "title": "" }, { "docid": "6688d36a9685080d7ef3c141a82e3ee3", "score": "0.4840552", "text": "def generate_version!\n raise _('generate_version! requires a published template') unless published\n\n args = {\n attributes: {\n version: version + 1,\n published: false,\n org: org\n }, save: true\n }\n deep_copy(**args)\n end", "title": "" }, { "docid": "c8af87dab55b65431138e1d36121cbff", "score": "0.48315427", "text": "def load_schema!\n load_tables\n load_views\n if @temp_schema then\n @temp_schema.load_schema!\n end\n @schema_version = self.current_version\n nil\n end", "title": "" }, { "docid": "a2335292eb51dee758fa4132fd94c1c4", "score": "0.48264936", "text": "def create_version(xml_params)\n # Set the returned hash to default values\n result_hash ={\"success\" => \"No\", \"details\" => \"\", \"error\" => \"No\"}\n \n # Perform the create version in the DB to check values. Expected source from XML\n # option1 = Product Name\n # value = Version name\n \n # First verify that the product exists\n if Product.where(:name => xml_params['api_request']['option1'] ).first != nil\n # Verify that the version doesn't exist\n if Version.where(:version => xml_params['api_request']['value'], :product_id => Product.where(:name => xml_params['api_request']['option1']).first.id ) != []\n result_hash[\"error\"] = \"Yes\"\n result_hash[\"details\"] = \"Error. The version already exists for this product.\"\n # If it doesn't exist, create the version now\n else\n version = Version.new(:version => xml_params['api_request']['value'], :product_id => Product.where(:name => xml_params['api_request']['option1']).first.id )\n if version.save\n result_hash[\"details\"] = \"Version created successfully.\"\n result_hash[\"success\"] = \"Yes\"\n else\n result_hash[\"details\"] = \"Error creating version.\"\n result_hash[\"error\"] = \"Yes\"\n end\n end\n # Set message for product not found\n else\n result_hash[\"error\"] = \"Yes\"\n result_hash[\"details\"] = \"Invalid product. Unable to create version.\"\n end\n \n return result_hash\n end", "title": "" }, { "docid": "40150792ec57f47978d3550b63a88722", "score": "0.48243085", "text": "def withBuild(build)\n @version = build\n self\n end", "title": "" }, { "docid": "dd75f7de5e446ed28050a4c826c6b9f1", "score": "0.4820132", "text": "def generate_version(test_plan)\n # find the time at 5 minute interval\n search_time = START_TIME - (START_TIME.min % 5).minutes - START_TIME.sec\n # build version name using the time\n version_name = 'automation' + search_time.strftime('%Y_%m_%d-%H_%M')\n\n # Do a query for the version\n version = Version.where(:version => version_name, :product_id => test_plan.product_id).first\n \n # If verrsion doesn't exist, create it\n if version == nil\n version = Version.create(:version => version_name, :product_id => test_plan.product_id, :description => 'Generated by automation tool.')\n LOGGER.info \"#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')} INFO: Version created (ID: #{version.id})\"\n else\n LOGGER.info \"#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')} INFO: Version exists (ID: #{version.id})\"\n end\n \n version \nend", "title": "" }, { "docid": "4f791892fac1fe45c4005a81b6450473", "score": "0.48184475", "text": "def initialize name, version\n @name = name\n @version = version\n end", "title": "" }, { "docid": "406ebf2c82ced60d20f43bf219e99e85", "score": "0.48162106", "text": "def version_object\n version_cache.version_obj\n end", "title": "" }, { "docid": "6c3d184a2d4c0fb435dbb2f0b75e453e", "score": "0.48156035", "text": "def lookup_by_version(subject, version)\n key = \"#{subject}#{version}\"\n schema = @schemas_by_subject_version[key]\n\n return schema unless schema.nil?\n\n hash = read_from_disk_cache(@schemas_by_subject_version_path)\n if hash\n @schemas_by_subject_version = hash\n @schemas_by_subject_version[key]\n end\n end", "title": "" }, { "docid": "0f74e6e2480e56d741285938a4a70946", "score": "0.4805103", "text": "def create_versioned_table(create_table_options = {})\n # create version column in main table if it does not exist\n if !self.content_columns.find { |c| [version_column.to_s, 'lock_version'].include? c.name }\n self.connection.add_column table_name, version_column, :integer\n self.reset_column_information\n end\n\n return if connection.table_exists?(versioned_table_name)\n\n self.connection.create_table(versioned_table_name, create_table_options) do |t|\n t.column versioned_foreign_key, :integer\n t.column version_column, :integer\n end\n\n self.versioned_columns.each do |col|\n self.connection.add_column versioned_table_name, col.name, col.type,\n :limit => col.limit,\n :default => col.default,\n :scale => col.scale,\n :precision => col.precision\n end\n\n if type_col = self.columns_hash[inheritance_column]\n self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type,\n :limit => type_col.limit,\n :default => type_col.default,\n :scale => type_col.scale,\n :precision => type_col.precision\n end\n \n # Add columns to store the versioned types\n versioned_association_reflections.values.reject{|x| x.macro != :belongs_to}.each do |reflection|\n if reflection.options[:polymorphic]\n self.connection.add_column versioned_table_name, versioned_association_foreign_key(reflection.foreign_key), :integer\n self.connection.add_column versioned_table_name, versioned_association_foreign_key(reflection.foreign_type), :string\n else\n self.connection.add_column versioned_table_name, versioned_association_foreign_key(reflection.foreign_key), :integer\n end\n end\n\n self.connection.add_index versioned_table_name, versioned_foreign_key, :name => \"idx_#{versioned_table_name}_parent\"\n end", "title": "" }, { "docid": "14c051a6280bcf099444720400038d83", "score": "0.48000708", "text": "def schema(&block)\n Schema.new &block\n end", "title": "" }, { "docid": "e2c857bec05e6966649eddf75c930483", "score": "0.47977665", "text": "def index_factory\n raise \"Internal logic error!\" if @options[:suppressBuildRef]\n\n SimpleIndexBuilder.new(@processed_docs, @converter, @paths, @deploy_info,\n @options[:resolveDocid])\n end", "title": "" }, { "docid": "53a5f7c58b7750ca47105fa60bb6f4d9", "score": "0.47952405", "text": "def initialize(val)\n val ||= \"\"\n super(val)\n begin\n @parsed_version = ::Gem::Version.create(self)\n rescue ArgumentError\n @parsed_version = nil\n end\n end", "title": "" }, { "docid": "5a01a2f800d5a8ee556144162194c8d4", "score": "0.47948065", "text": "def initialize_schema_migrations_table\n sm_table = ActiveRecord::Migrator.schema_migrations_table_name\n\n unless table_exists?(sm_table)\n create_table(sm_table, :id => false) do |schema_migrations_table|\n schema_migrations_table.column :version, :string, :null => false\n end\n add_index sm_table, :version, :unique => true,\n :name => \"#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}\"\n\n # Backwards-compatibility: if we find schema_info, assume we've\n # migrated up to that point:\n si_table = Base.table_name_prefix + 'schema_info' + Base.table_name_suffix\n\n if table_exists?(si_table)\n ActiveSupport::Deprecation.warn \"Usage of the schema table `#{si_table}` is deprecated. Please switch to using `schema_migrations` table\"\n\n old_version = select_value(\"SELECT version FROM #{quote_table_name(si_table)}\").to_i\n assume_migrated_upto_version(old_version)\n drop_table(si_table)\n end\n end\n end", "title": "" }, { "docid": "f1efc72acce414a7467e2b7561c46982", "score": "0.47933862", "text": "def instance(payload, schema, namespace='')\n return payload if payload.is_a?(Deimos::SchemaClass::Base)\n\n constants = modules_for(namespace) + [schema.underscore.camelize.singularize]\n klass = constants.join('::').safe_constantize\n return payload if klass.nil? || payload.nil?\n\n klass.new(**payload.symbolize_keys)\n end", "title": "" }, { "docid": "f0a5ef43852b16529714214d3322ebd3", "score": "0.47919112", "text": "def clone\n attrs = as_document.except(\"_id\")\n if attrs.delete(\"versions\")\n attrs[\"version\"] = 1\n end\n self.class.new(attrs)\n end", "title": "" }, { "docid": "135eb049bf7b4e3a2ddea274fef17e3c", "score": "0.47749025", "text": "def schema\n\t\t\t@schema ||= Schema.loaded_schemas[\"%016x\" % @values[:schema]]\n\t\tend", "title": "" }, { "docid": "d4f51392e7fb00133428bd3c5fe3321f", "score": "0.47701782", "text": "def initialize(version)\n raise ArgumentError, \"Malformed version number string #{version}\" unless\n self.class.correct?(version)\n\n self.version = version\n end", "title": "" }, { "docid": "ef3d957cb2a8628352099d8b816ee778", "score": "0.47679773", "text": "def create_dao(clazz)\n version = version_for_dao\n clazz.instance version\n end", "title": "" }, { "docid": "60f7360354e2f309ae74198406b3d050", "score": "0.47655207", "text": "def __versions__\n @versions ||= Versions.new(self)\n end", "title": "" }, { "docid": "f2b9226e002e6cad6fc4863e82f77743", "score": "0.47617784", "text": "def createVersion_3(type, versionName, versionDescription)\n return createVersion_4(type, versionName, versionDescription, false)\n end", "title": "" }, { "docid": "81144abb49051b8d342956d445099a16", "score": "0.47530943", "text": "def version(number)\n Version.find(:model_classname => _classname, :instance_id => neo_id, :number => number) {|query| query.first.nil? ? nil : query.first.end_node}\n end", "title": "" }, { "docid": "41c06e75411166835dc71a33bbcb9047", "score": "0.4750348", "text": "def version_cache\n @version_cache ||= Struct.new(\n :wanted_version_number,\n :original_version_number,\n :existing_version_wanted,\n :wanted_attributes,\n :new_version_number,\n :version_obj,\n :version_args,\n :original_version_obj,\n :self_version\n ).new\n end", "title": "" }, { "docid": "92b38ef3f51e0fe8d6880add31786bad", "score": "0.47502834", "text": "def new\n @app_version = @app.app_versions.new(params[:app_version])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "title": "" } ]
13473ba53574ae7619f47c47e27d8d39
Start from the top because there is only one path from there. The solution at the top can be broken into the subproblems of the adjacent values on the next row. The solution is the minimum of those two subproblem solutions + the value at the top (or current node) as you traverse down. Base case: If you reach the bottom of triangle, just return the current value Boundary conditions: If the col goes < 0 or greater than row + 1, return Infinity because you dont ever want to choose that as the minimum
[ { "docid": "387d129e887d03a0e1559a5045068ecd", "score": "0.54563403", "text": "def minimum_total(triangle, m = 0, n = 0, memo = {})\n return triangle[m][n] if m == triangle.size - 1\n\n memo[[m+1, n]] ||= minimum_total(triangle, m + 1, n)\n memo[[m+1, n+1]] ||= minimum_total(triangle, m + 1, n + 1)\n\n triangle[m][n] + [memo[[m+1, n]], memo[[m+1, n+1]]].min\nend", "title": "" } ]
[ { "docid": "37fbd9beb9d761620222accf548a307a", "score": "0.6811514", "text": "def solution(a)\n # [1, -INFINITY, -INFINITY, -INFINITY, -INFINITY, -INFINITY]\n # [1,-1, 1, 10, 0, -1] row = 1. start_val = 1\n # [1,-1, 1, 10, 0, -1] row = 2. start_val = -1\n # [1,-1, 1, 10, 0, -1] row = 3. start_val = 1\n # [1,-1, 1, 10, 9, 8] row = 4. start_val = 10\n # [1,-1, 1, 10, 9, 8] row = 5. start_val = 9\n\n dp = [a[0]] + [MININT] * (a.size - 1)\n (1..a.size - 1).each do |row|\n start_index = row - 1\n start_val = dp[start_index]\n\n # we may only move forward up to 6 spots\n end_col = [a.size - 1, start_index + 6].min\n puts \"start_val: #{start_val}. Inner loop start_col: #{row} / end_col: #{end_col}\"\n\n (row..end_col).each do |col|\n puts \"row: #{row}, col: #{col}\"\n dp[col] = [dp[col], start_val + a[col]].max\n end\n p dp\n puts\n end\n\n \"Answer: #{dp.last}\"\nend", "title": "" }, { "docid": "21c8056a8c49f177a59ba835eaa87272", "score": "0.63588035", "text": "def minimum_total(triangle)\n return triangle[0][0] if triangle.size < 2\n (triangle.size - 2).downto(0).each { |i|\n 0.upto(triangle[i].size - 1).each { |j|\n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n }\n }\n \n triangle[0][0]\nend", "title": "" }, { "docid": "9ee775f3e517fdfbde6abff84b2d3fe5", "score": "0.6333694", "text": "def find_min_path(i, j)\n return 1 if i == 0 || j == 0\n return find_min_path(i-1, j) + find_min_path(i, j-1)\nend", "title": "" }, { "docid": "8ce180701d1e52c96a10f83d5621afbf", "score": "0.6213363", "text": "def min_path_sum matrix\n rows, cols = matrix.size, matrix.first.size\n\n # Stores minimum path sum from row i, column j to bottom right of matrix\n table = (0...rows).map { (0...cols).map { 0 } }\n\n # Base case: Along bottom row, we can only go right (so min path is always to\n # the right)\n table[rows-1][cols-1] = matrix[rows-1][cols-1]\n for j in 2..cols\n table[rows-1][cols-j] = matrix[rows-1][cols-j] + table[rows-1][cols-j+1]\n end\n\n # Base case: Along rightmost column, we can only go down\n for i in 2..rows\n table[rows-i][cols-1] = matrix[rows-i][cols-1] + table[rows-i+1][cols-1]\n end\n\n # Recursive case: Minimum path from current location is the minimum of the sum\n # of the bottom or the right paths\n for i in 2..rows\n for j in 2..cols\n table[rows-i][cols-j] = matrix[rows-i][cols-j] +\n [table[rows-i+1][cols-j], table[rows-i][cols-j+1]].min\n end\n end\n\n table[0][0]\nend", "title": "" }, { "docid": "166bb258b0a98ada0408f6acb45a4e00", "score": "0.6200234", "text": "def min_path_sum(grid)\n row = grid.length\n col = grid[0].length\n\n i, j = 0, 0\n\n while i < row && j < col\n if i == 0 && j != 0\n grid[i][j] = grid[i][j] + grid[i][j - 1]\n elsif i != 0 && j == 0\n grid[i][j] = grid[i][j] + grid[i - 1][j]\n elsif i != 0 && j != 0\n grid[i][j] = grid[i][j] + [grid[i][j - 1], grid[i - 1][j]].min\n end\n\n i += 1\n j += 1\n end\n\n grid[-1][-1]\nend", "title": "" }, { "docid": "a758781115e180a51e5685c1c4b33ba1", "score": "0.617829", "text": "def dp_min_sum(pyramid)\n last_row = pyramid.pop\n # memoize last row\n results = last_row.map { |el| Node.new(el.to_i, [el]) }\n\n while pyramid.length > 0\n last_row = pyramid.pop\n\n results = last_row.map.with_index do |el, i|\n left_child = results[i]\n right_child = results[i+1]\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n sum = el.to_i + min_child.sum\n path = [el] + min_child.path\n Node.new(sum, path)\n end\n end\n return results.first.sum, results.first.path\nend", "title": "" }, { "docid": "a35a4733771d1068bcf9c7ab54568fa9", "score": "0.6117853", "text": "def triangle_recursive(row)\n if row == 0\n return [1]\n else\n previous_row = triangle_recursive(row-1)\n return compute_row(previous_row)\n end\nend", "title": "" }, { "docid": "bd0d8ce2e4d379fd4e40a534684542a9", "score": "0.602865", "text": "def min_path(triangle)\n min_path_helper(triangle, level = triangle.size - 1)\nend", "title": "" }, { "docid": "f2eb79cdce0e2fdd0095c6b404f9c87d", "score": "0.5962699", "text": "def find_minimum\n current = @root\n\n while current.left && !current.nil?\n current = current.left\n return current.value if current.left.nil?\n end\n end", "title": "" }, { "docid": "1e792ad267a1a306798538a2b86d2619", "score": "0.5959325", "text": "def minimum_total(triangle)\n return 0 if !triangle || triangle.empty? || triangle[0].empty?\n return triangle[0][0] if triangle.size < 2\n\n i = triangle.size - 2\n while i >= 0 do \n for j in 0...triangle[i].size do \n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n end\n end\n\n triangle[0][0]\nend", "title": "" }, { "docid": "d022f2d08be531464e0bf2f0ac0891b7", "score": "0.59143925", "text": "def find_path_brute_force( board, start_point )\n options = get_options( start_point, board )\n\n # Bottom right corner\n if options.length == 0\n return { points: [start_point], best_value: get_value( start_point, board ) }\n end\n\n # If there's only one option, this works fine still.\n first_result = find_path_brute_force( board, options.first )\n second_result = find_path_brute_force( board, options.last )\n if first_result[:best_value] > second_result[:best_value]\n return {\n points: [start_point] + first_result[:points],\n best_value: first_result[:best_value] + get_value( start_point, board )\n }\n else\n return {\n points: [start_point] + second_result[:points],\n best_value: second_result[:best_value] + get_value( start_point, board )\n }\n end\nend", "title": "" }, { "docid": "227b34f853f7be76ed0e2200fdec9441", "score": "0.5848948", "text": "def minimum_value\n current = self\n \n while current.left_child != nil do\n current = current.left_child\n end\n \n return current.data\n end", "title": "" }, { "docid": "24d3f701029f144636dae38532feb7d9", "score": "0.58184016", "text": "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "title": "" }, { "docid": "782a2719cabd9a1284a8fd0223ba4faa", "score": "0.57869244", "text": "def min_path\n if @layers.count == 2\n return [ top ] + [ @layers[1].min ]\n end\n\n left_min_path = left_child.min_path\n left_min_path_sum = left_min_path.inject(0, :+)\n right_min_path = right_child.min_path\n right_min_path_sum = right_min_path.inject(0, :+)\n\n if left_min_path_sum < right_min_path_sum\n [ top ] + left_child.min_path \n else\n [ top ] + right_child.min_path\n end\n end", "title": "" }, { "docid": "1866a0528a850fba120640c48317a021", "score": "0.5765714", "text": "def solve\n \n # Clean up.\n reset_visiting_state\n \n # Enqueue start position.\n @queue = []\n enqueue_cell([], @start_x, @start_y)\n \n # Loop as long as there are cells to visit and no solution has\n # been found yet.\n path = nil\n until path || @queue.empty?\n path = solve_visit_cell\n end\n \n if path\n # Mark the cells that make up the shortest path.\n for x, y in path\n @path[x][y] = true\n end\n else\n puts \"No solution found?!\"\n end\n end", "title": "" }, { "docid": "bcab01d99dc90970fc51e241d4525b33", "score": "0.5763451", "text": "def find_solution\n open = [{:cell => @start_cell, :parent => nil, :distance => 0}]\n closed = []\n\n while !open.empty?\n # Find the lowest movement cost\n current_node = open.min{ |a,b| a[:distance] <=> b[:distance]}\n\n # Check if we reached the end cell\n if is_end?(current_node[:cell])\n return current_node[:distance]\n end\n\n # Find immediate neighbors\n current_neighbors = find_neighbors(current_node[:cell])\n current_neighbors.each { | neighbor |\n if closed.find { | node | node[:cell].eql?(neighbor[:cell])}.nil?\n # Find if the cell is already in the open list\n existing_open = open.find { |node | node[:cell].eql?(neighbor[:cell])}\n if existing_open\n # Find the shorter distance to the cell\n current_distance = existing_open[:distance]\n new_distance = current_node[:distance] + neighbor[:distance]\n existing_opened[:distance] = new_distance if current_distance > new_distance\n else\n # Add the new visited cell to the open list\n neighbor[:distance] = neighbor[:distance] + current_node[:distance]\n open << neighbor\n end\n end\n }\n closed << current_node\n open.delete(current_node)\n end\n 0\n end", "title": "" }, { "docid": "bd21cdd54ec0227ddd25926b171bedb7", "score": "0.5762389", "text": "def min_coordinates\n\t\t\treturn @min_coordinates if @min_coordinates\n\n\t\t\t# Initialize\n\t\t\t# Convert to square matrix by adding zero filled rows or columns.\n\t\t\tif @width < @height\n\t\t\t\tm = @matrix.map do |row|\n\t\t\t\t\trow.dup.fill(0, @width, @height - @width)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm = @matrix.map {|row| row.dup}\n\t\t\t\t(@width - @height).times do\n\t\t\t\t\tm << Array.new(@width, 0)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 1\n\t\t\tm.each do |row|\n\t\t\t\tmin = row.min\n\t\t\t\tnext row.dup if min.zero?\n\t\t\t\[email protected] {|i| row[i] -= min}\n\t\t\tend\n\n\t\t\t# Step 2\n\t\t\[email protected] do |j|\n\t\t\t\tmin = m.map{|row| row[j]}.min\n\t\t\t\tnext if min.zero?\n\t\t\t\tm.each{|row| row[j] -= min}\n\t\t\tend\n\n\t\t\tloop do\n\t\t\t\t# Step 3\n\t\t\t\tassign, cover = assign_or_cover(m)\n\t\t\t\tif assign\n\t\t\t\t\treturn @min_coordinates = assign.sort.select do |i, j|\n\t\t\t\t\t\ti < @height and j < @width\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Step 4\n\t\t\t\trows_cover, cols_cover = cover\n\t\t\t\t# complement set\n\t\t\t\trows_cover_cmp = (0...@size).to_a - rows_cover\n\t\t\t\tcols_cover_cmp = (0...@size).to_a - cols_cover\n\n\t\t\t\tmin = Float::INFINITY\n\t\t\t\trows_cover_cmp.each do |i|\n\t\t\t\t\tcols_cover_cmp.each do |j|\n\t\t\t\t\t\tv = m[i][j]\n\t\t\t\t\t\tmin = v if v < min\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\trows_cover_cmp.each do |i|\n\t\t\t\t\tcols_cover_cmp.each do |j|\n\t\t\t\t\t\tm[i][j] -= min\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\trows_cover.each do |i|\n\t\t\t\t\tcols_cover.each do |j|\n\t\t\t\t\t\tm[i][j] += min\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "8ba8fb0e94d8232f0d75a2c7e09095be", "score": "0.5742072", "text": "def path_min_sum(matrix, x,y)\n\tdef inner(matrix,x,y)\n\t\treturn matrix[x][y] if x==0\n\t\treturn matrix[x][y]+[path_min_sum(matrix,x-1,y),path_min_sum(matrix,x,y-1),path_min_sum(matrix,x,y+1)].reject{|x| x==nil}.min\n\tend\n\treturn nil if (x<0 or y<0 or x>=matrix.length or y>=matrix.length)\n\treturn $PathSums[x][y] unless $PathSums[x][y]==nil\n\t$PathSums[x][y]=inner(matrix,x,y)\n\treturn $PathSums[x][y]\nend", "title": "" }, { "docid": "61b4ce15e57a212b8e2c9c31a9e80ee4", "score": "0.5740316", "text": "def recursive_min_sum(head)\n current = head\n current.sum = current.value.to_i\n current.path = [current.value]\n\n unless current.left && current.right\n current.sum = current.value.to_i\n current.path = [current.value]\n current\n else\n left_child = recursive_min_sum(current.left)\n right_child = recursive_min_sum(current.right)\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n current.sum += min_child.sum\n current.path += min_child.path\n current\n end\nend", "title": "" }, { "docid": "afca1fecd4ca3aa290ee030211bb7316", "score": "0.5735345", "text": "def solution\n @solution ||= cells.first.shortest_path_to(cells.last)\n end", "title": "" }, { "docid": "6d1bcc1292f530dcf9440e0f326a140b", "score": "0.5722823", "text": "def min_cost(costs)\n prev_color_path1 = 0\n prev_color_path2 = 1\n path1 = costs[0][prev_color_path1]\n path2 = costs[0][prev_color_path2]\n \n if costs[0][2] < path1\n if path1 < path2\n path2 = path1\n prev_color_path2 = prev_color_path1\n path1 = costs[0][2]\n prev_color_path1 = 2\n end\n elsif costs[0][2] < path2\n if path2 < path1\n path1 = path2\n prev_color_path1 = prev_color_path2\n path2 = costs[0][2]\n prev_color_path2 = 2\n end\n end\n\n costs[1..-1].each do |cost|\n min1 = nil\n min1idx = nil\n # for first path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path1\n if min1\n if amt < min1\n min1 = amt\n prev_color_path1 = idx\n else\n next\n end\n else\n min1 = amt\n min1idx = idx\n end\n end\n path1 += min1\n\n \n min2 = nil\n min2idx = nil\n # for second path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path2\n if min2\n if amt < min2\n min2 = amt\n prev_color_path2 = idx\n else\n next\n end\n else\n min2 = amt\n min2idx = idx\n end\n end\n \n path2 += min2\n end\n\n path1 < path2 ? path1 : path2\nend", "title": "" }, { "docid": "609cbb4093860f68b22955abc9172e70", "score": "0.5721278", "text": "def compute\n # the position of the largest integer in the current row\n index = 0\n\n # the maximum sum\n maximum_sum = 0\n\n @triangle.each_with_index do |line, line_index|\n # the first line is guaranteed to have 1 number, so that is the initial maximum_sum\n if line_index == 0\n maximum_sum = line[index]\n else\n # get the adjacent integers in the next row\n left_integer = line[index]\n right_integer = line[index + 1]\n # get the maximum integer, add it to the sum, and update the index to point to it\n if left_integer >= right_integer\n maximum_sum += left_integer\n # index stays the same\n else\n maximum_sum += right_integer\n index += 1\n end\n end\n end\n \n maximum_sum\n end", "title": "" }, { "docid": "fc9feae213ebd143657bc41b94d6e46e", "score": "0.5720912", "text": "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "title": "" }, { "docid": "29ddc0223c4516137227efbac86e51c5", "score": "0.5708803", "text": "def min\n return nil if empty?\n\n root = @root\n while root\n return root unless root.left\n root = root.left\n end\n\n root\n end", "title": "" }, { "docid": "bde11b711833d79bd0352d3707f42ddd", "score": "0.5699617", "text": "def min_path_sum2(grid)\n m = grid.size - 1 \n n = grid[0].size - 1 \n arr = Array.new(m+1) {Array.new(n+1, 0)}\n # Two dimensional array , initialization has a trap\n # if arr = Array.new(m, Array.new(n, 0)) , change one element , all lines' elements will be changed.\n (n+1).times do |i| \n if i == 0\n arr[0][0] = grid[0][0]\n else\n arr[0][i] = arr[0][i-1] + grid[0][i]\n end \n end \n flag = grid.transpose\n (m+1).times do |i| \n if i == 0\n arr[0][0] = grid[0][0]\n else\n arr[i][0] = arr[i-1][0] + grid[i][0]\n end \n end \n (1..m).each do |i| \n (1..n).each do |j| \n arr[i][j] = [arr[i][j-1], arr[i-1][j]].min + grid[i][j]\n end \n end \n arr.last.last\nend", "title": "" }, { "docid": "2524e893c48df667963c33212dff5bf0", "score": "0.5695377", "text": "def min_cost_climbing_stairs(arr)\n next_one, next_two = 0, 0\n curr = 0\n\n (arr.length - 1).downto(0).each do |i|\n curr = arr[i] + min(next_one, next_two)\n next_two = next_one\n next_one = curr\n end\n\n return min(next_one, next_two)\nend", "title": "" }, { "docid": "8ffb6c54bd855e028ecce4e4fb32c62b", "score": "0.56946796", "text": "def step_one\n matrix.map_rows! do |row|\n min = row.min\n row.map { |cell| cell - min }\n end\n end", "title": "" }, { "docid": "af887fc95b8a85a2ab4f5b465bf98745", "score": "0.56892097", "text": "def find_min(nums)\n left = 0\n right = nums.length - 1\n\n while left + 1 < right\n mid = left + (right - left) / 2\n return nums[0] if nums[left] < nums[mid] && nums[mid] < nums[right] # non-pivot clause\n\n if nums[left] > nums[mid]\n right = mid\n else\n left = mid\n end\n end\n [nums[left], nums[right]].min\nend", "title": "" }, { "docid": "501571f461cb74b0813f82a28962aeca", "score": "0.56808096", "text": "def path_min_sum(matrix, x,y)\n\tdef inner(matrix,x,y)\n\t\treturn matrix[x][y] if x==0 and y==0\n\t\treturn matrix[x][y]+path_min_sum(matrix,x-1,y) if (x>0 and y==0)\n\t\treturn matrix[x][y]+path_min_sum(matrix,x,y-1) if (x==0 and y>0)\n\t\treturn matrix[x][y]+[path_min_sum(matrix,x-1,y),path_min_sum(matrix,x,y-1)].min\n\tend\n\treturn $PathSums[x][y] unless $PathSums[x][y]==nil\n\t$PathSums[x][y]=inner(matrix,x,y)\n\treturn $PathSums[x][y]\nend", "title": "" }, { "docid": "c5a76f8e106e29a69a087f24a135cba5", "score": "0.5660153", "text": "def min\n min = @valor[0][0]\n i = 0\n self.fil.times do |i|\n j = 0\n self.col.times do |j|\n if (@valor[i][j] < min)\n min = @valor[i][j]\n end\n j=j+1\n end\n i=i+1\n\tend\n min\n end", "title": "" }, { "docid": "46dcc22fce75a1978e932eaa25aa657d", "score": "0.56514573", "text": "def solution(s)\n grid = s.split(/\\n/).map { |row| row.split(/\\s/).map(&:to_i) }\n \n search = ->(table) do\n table.map do |row|\n row.each_cons(4).map do |seg|\n seg.reduce(:*)\n end.max\n end.max\n end\n\n squeeze = ->(table, opts={inverse: false}) do\n table.map.with_index do |row,depth|\n row.rotate(opts[:inverse] ? -depth : depth)\n end.transpose\n end\n\n [\n search[grid], # horizontal\n search[grid.transpose], # vertical\n search[squeeze[grid]], # down_diagonals\n search[squeeze[grid, inverse: true]] # up_diagonals\n ].max\nend", "title": "" }, { "docid": "8ea18cdba4b6806cfb6e66bd9ac0b293", "score": "0.563119", "text": "def DP_solve(a)\n max, head, tail = 0, 0, 0\n cur_head = 0\n sum = [ [0, a[0]].max ] # base case\n (1...a.size).each do |j|\n sum[j] = [0, sum[j-1] + a[j]].max # bottom-up\n cur_head = j if sum[j-1] == 0 and sum[j] > 0\n if sum[j] > max\n head = cur_head\n tail = j\n max = sum[j]\n end\n end\n return max, head, tail\nend", "title": "" }, { "docid": "637a897a56744abefcfed2c5920a726f", "score": "0.5619638", "text": "def solution(x, a)\n leaves = {}\n path = 0\n for i in (0..a.count - 1)\n leaf = a[i]\n if leaf <= x\n unless leaves[leaf]\n path += 1 \n return i if path == x\n end\n leaves[leaf] = true\n end\n end\n return -1\nend", "title": "" }, { "docid": "2871573e7d2eda03823d6d9c4f5fdfe6", "score": "0.5612869", "text": "def max_sum_triangle\r\n\r\n\tnumber = \"75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 \"\r\n\tnumber += \"40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 \"\r\n\tnumber += \"38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23\"\r\n\r\n\t# Place triangle in an array which is easier to manipulate\r\n\t@triangle = []\r\n\tcounter = 0\r\n\tnumber = number.split(\" \")\r\n\twhile number.length > 0\r\n\t\tcounter += 1\r\n\t\trow = []\r\n\t\tcounter.times { row << number.shift }\r\n\t\t@triangle << row\r\n\tend\r\n\r\n\t# Recursion method that returns the greater sum of the current cell and \r\n\t# each of the two adjacent cells in the next row\r\n\tdef add_num(row, col)\r\n\t\t# If last row, simply return the cell number\r\n\t\treturn @triangle[row][col].to_i if row == @triangle.length-1\r\n\r\n\t\t# Find the adjacent two cells in the next row and add current cell's value\r\n\t\ta = add_num(row+1,col) + @triangle[row][col].to_i\r\n\t\tb = add_num(row+1,col+1) + @triangle[row][col].to_i\r\n\t\t# Return the greater of the two sums\r\n\t\treturn [a,b].max\r\n\r\n\tend\r\n\r\n\t#Start the recursion at cell 0,0\r\n\tputs add_num(0,0)\r\nend", "title": "" }, { "docid": "64dadee776bdafd9e37c37c2396493ba", "score": "0.5606384", "text": "def find_minimum_value\n if self.left_child\n self.left_child.find_minimum_value\n else\n self.value\n end\n end", "title": "" }, { "docid": "c3a06cab7ea0c9079c1d53b47f46b2ef", "score": "0.56050986", "text": "def find_from(current, left)\n total = current[0].reduce(:+)\n if left.length == 3\n fejs = left.permutation(3).to_a.select { |f, e, j|\n t1 = f + e + current[0][1]\n t2 = e + j + current[-1][-1]\n t1 == t2 && t2 == total\n }\n fejs.empty? ? [] : fejs.map { |fej|\n f, e, j = fej\n current + [[j, current[-1][-1], e], [f, e, current[0][1]]]\n }\n else\n left.flat_map { |inner|\n outer = total - current[-1][-1] - inner\n if (left - [inner]).include?(outer)\n find_from(current + [[outer, current[-1][-1], inner]],\n left - [inner, outer])\n else\n []\n end\n }\n end\nend", "title": "" }, { "docid": "0ed7e56e71fb8d74c9739488166fa28b", "score": "0.5599218", "text": "def minimum\n sides.map(&:value).min\n end", "title": "" }, { "docid": "2479e95691eccc4fd3a914e379335ad4", "score": "0.5585138", "text": "def min\n min = get(0,0)\n\tfor i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) < min)\n min = get(i,j)\n end\n end\n end\n min\n end", "title": "" }, { "docid": "f990b7fbe686e88b403e6e19cc4428ce", "score": "0.55810386", "text": "def minimumBribes(q)\n q.each_with_index.inject(0) do |bribes, (actual, index)|\n return bribes if q[index + 1].nil?\n\n index_diff = actual - index - 1\n maximun_distance = actual - 2\n distance = if index_diff <= 0 && maximun_distance >= 0 then\n q[maximun_distance...index].all? { |x| x > actual } ? 1 : 0\n else\n [index_diff, 0].max\n end\n\n debug(actual, distance, index_diff, bribes)\n\n if distance > 2\n return \"Too chaotic\"\n break\n end\n bribes + distance\n end\nend", "title": "" }, { "docid": "ab443a9e7dea0609a85ea01bc44b328d", "score": "0.5576163", "text": "def find_min(arr)\n return arr[0] if arr.length == 1\n\n left = 0\n right = arr.length - 1\n\n loop do\n mid = (left + right) / 2\n\n prev_value = arr[mid - 1]\n curr_value = arr[mid]\n next_value = arr[mid + 1]\n\n return curr_value if prev_value && prev_value > curr_value\n return next_value if next_value && curr_value > next_value\n\n curr_value < arr[right] ? right = mid - 1 : left = mid + 1\n end\nend", "title": "" }, { "docid": "950ac088773e126430549e5eb439dce6", "score": "0.5549782", "text": "def minimumBribes(q)\n bribe = 0\n # reverse iteration\n for i in (q.size - 1).downto(0)\n # if line configuration is not possible\n if (q[i] - (i + 1)) > 2\n puts \"Too chaotic\"\n return\n end\n # check bribes at left \n for e in ([q[i] - 2, 0].max..i)\n bribe += 1 if q[e] > q[i]\n end\n end\n\n puts bribe\nend", "title": "" }, { "docid": "b31064bd7638810c8d715ca069160c2e", "score": "0.5545935", "text": "def min_cost_climbing_stairs(cost)\n cost = cost + [0]\n table = Array.new(cost.length) { nil }\n table[0] = cost[0]\n table[1] = cost[1]\n\n table.each_with_index do |_val, i|\n next if i < 2\n table[i] = [table[i-1], table[i-2]].min\n table[i] += cost[i]\n end\n\n table.last\nend", "title": "" }, { "docid": "16c9e5f22079a99f5f419bbe6a55f02a", "score": "0.5538476", "text": "def min_ops(n)\n\n # Step 1:\n # Create a table containing the minimum operations\n # needed to reach n given our permitted operators.\n all_parents = Array.new\n all_min_ops = [0] + [nil] * n\n\n (1..n+1).each do |k|\n curr_parent = k - 1\n curr_min_ops = all_min_ops[curr_parent] + 1\n [2, 3].each do |i|\n if k % i == 0\n parent = k / i\n num_ops = all_min_ops[parent] + 1\n if num_ops < curr_min_ops\n curr_parent, curr_min_ops = parent, num_ops\n end\n end\n end\n all_parents[k], all_min_ops[k] = curr_parent, curr_min_ops\n end\n\n # Step 2: Trace back to find the optimal choices\n # made in the previous step.\n numbers = Array.new\n k = n\n while k > 0\n numbers << k\n k = all_parents[k]\n end\n puts numbers.size - 1\n numbers.reverse\nend", "title": "" }, { "docid": "de92ec3a29ec4cb2c3b8597f4ec41cc5", "score": "0.5479165", "text": "def solve\n dp = H.times.map { [nil] * W }\n dp[0][0] = 1 << 60\n dp[1][0] = A[0][0] + A[1][0] + C\n dp[0][1] = A[0][0] + A[0][1] + C\n\n (1...W).each do |x|\n dp[0][x] = [A[0][x - 1] + C + A[0][x],\n dp[0][x - 1] + C + A[0][x] - A[0][x - 1]].min\n end\n (1...H).each do |y|\n dp[y][0] = [A[y - 1][0] + C + A[y][0],\n dp[y - 1][0] + C + A[y][0] - A[y - 1][0]].min\n end\n (1...H).each do |y|\n (1...W).each do |x|\n now = A[y][x]\n dp[y][x] = [\n A[y - 1][x] + C + now,\n A[y][x - 1] + C + now,\n dp[y - 1][x] + C + now - A[y - 1][x],\n dp[y][x - 1] + C + now - A[y][x - 1]\n ].min\n end\n end\n\n dp.flatten.min\nend", "title": "" }, { "docid": "b0f8faa4ff30c04262ecda9528f9451f", "score": "0.54745066", "text": "def min_cost_climbing_stairs(cost)\n cost = cost + [0]\n\n last = cost[1]\n last_last = cost[0]\n\n cost[2..-1].each do |cost|\n new_cost = cost + [last, last_last].min\n last_last = last\n last = new_cost\n end\n\n last\nend", "title": "" }, { "docid": "1f8c33a6f5265f4addab0d3b6d8f5384", "score": "0.5472957", "text": "def left_hand_solve\n until @buckets[0] == @target\n fill_left\n until @buckets[0].zero?\n left_to_right\n break if @buckets.include?(@target)\n empty_right\n break if @buckets.include?(@target)\n left_to_right\n break if @buckets.include?(@target)\n end\n end\n end", "title": "" }, { "docid": "08ecddc588344e35dd57ce0c427f6798", "score": "0.5465945", "text": "def minimax (args)\n node = args[:node] || self.node\n depth = args[:depth] || 10\n maximize_it = args[:maximize]\n value = node.value\n nodes = node.nodes\n\n if nodes.empty? || depth == 0\n return node.value\n\n # we want to pick the child with the HIGHEST value\n elsif maximize_it\n biggest_value = MIN_INT\n nodes.each do |child_node|\n value = minimax({node: child_node, maximize: false, depth: depth-1})\n # pick the bigger of the two\n biggest_value = [value, biggest_value].max\n end\n return biggest_value\n\n # we want to pick the child with the SMALLEST value\n elsif !maximize_it\n smallest_value = MAX_INT\n nodes.each do |child_node|\n value = minimax({node: child_node, maximize: true, depth: depth-1})\n smallest_value = [value, smallest_value].min\n end\n return smallest_value\n end\n end", "title": "" }, { "docid": "b55eb407e195a3d7bed26dba2d0f4259", "score": "0.5456255", "text": "def solve(points)\r\n min_dis = BigDecimal(\"-1\")\r\n p min_dis.class\r\n \r\n min_route = []\r\n (1..points.length-1).to_a.permutation(points.length-1).to_a.each do |route|\r\n route.unshift(0)\r\n #p route\r\n dis = BigDecimal(\"0\")\r\n (0...route.length-1).each do |i|\r\n dis += Math.sqrt((BigDecimal(points[route[i]][0].to_s) - BigDecimal(points[route[i+1]][0]))**2 + (BigDecimal(points[route[i]][1]) - BigDecimal(points[route[i+1]][1]))**2)\r\n end\r\n dis += Math.sqrt((BigDecimal(points[route[route.length-1]][0]) - BigDecimal(points[route[0]][0]))**2 + (BigDecimal(points[route[route.length-1]][1]) - BigDecimal(points[route[0]][1]))**2)\r\n #p dis\r\n if min_dis == -1 || min_dis > dis\r\n #p dis.class\r\n min_dis = dis\r\n min_route = route\r\n end\r\n end\r\n\r\n p min_dis.class\r\n print \"{{\"\r\n (0...min_route.length).each do |i|\r\n print \"#{min_route[i]+1},\"\r\n end\r\n print \"1},#{min_dis}}\\n\"\r\n #p min_dis\r\n #p min_route\r\n\r\nend", "title": "" }, { "docid": "a2525d07fe99ee759fd804584727ffb1", "score": "0.5443386", "text": "def minimumBribes(q)\n sum = 0\n q.each_with_index do |v,i|\n if v-(1+i) > 2\n puts \"Too chaotic\"\n return\n end\n bound = [v-2,0].max\n (bound..i-1).each do |j|\n sum+=1 if q[j] > v\n end\n end\n puts sum\nend", "title": "" }, { "docid": "cb72673aab8d221b7190604dcf8ec01b", "score": "0.5442255", "text": "def local_min(arr)\n mid = arr.length/2\n min = arr[mid]\n upper = arr.length-1\n lower = 0\n\n while !(arr[mid+lower+1] > min && arr[mid+lower-1] > min)\n # byebug\n #Calculate a new mid point and upper and lower bound.\n if arr[mid+1] < min \n lower = mid\n else\n upper = mid\n end\n mid = ((upper - lower) / 2) \n min = arr[mid + lower] \n end\n min\nend", "title": "" }, { "docid": "25e7b9a4914839602b2c61015556f8d6", "score": "0.54313064", "text": "def min_value\n if @head.nil?\n return nil\n else\n if head.left\n min_value = min_search(head.left).data\n else\n min_value = head.data\n end\n end\n return min_value\n end", "title": "" }, { "docid": "ff9b9650e06f5331f25e29d2a107ae15", "score": "0.5428919", "text": "def min_cost_climbing_stairs(cost)\n [step(cost, 0), step(cost, 1)].min\nend", "title": "" }, { "docid": "bc0c6a01be96c78280e5b4be82530a02", "score": "0.5426436", "text": "def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend", "title": "" }, { "docid": "e638638e8ace7f7bebe66fccdab9ff35", "score": "0.5418892", "text": "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", "title": "" }, { "docid": "e1e44972d24355109554e806a87fe6c5", "score": "0.54158735", "text": "def compute(triangle)\n line = 0\n while line < triangle.length-1\n triangle[line+1].each_index do |idx|\n triangle[line+1][idx] += [triangle[line][idx], triangle[line][idx+1]].max\n end\n line += 1\n end\n return triangle[line]\nend", "title": "" }, { "docid": "d9a0181f733bc3aa13f7f2dc4b49f182", "score": "0.54074717", "text": "def DFSb(v, vf) #wyszukiwanie mostow w grafie\n $d[v] = $cv\n low = $cv\n $cv = $cv + 1\n 0.upto($n-1) do |i|\n if $a[v][i] > 0 and i != vf\n if $d[i] == 0\n temp = DFSb(i, v)\n low = temp if temp < low\n else\n low = $d[i] if $d[i] < low\n end\n end\n end\n if vf > -1 and low == $d[v]\n $a[vf][v] = 2\n $a[v][vf] = 2\n end\n return low\nend", "title": "" }, { "docid": "653c38e34b29428bc7400a4e1bd9c866", "score": "0.5405912", "text": "def bottom_boundary(input, top, left)\n zero_position = nil\n\n puts \"bottom_boundary top: #{top} left: #{left}\"\n\n (top..input.length - 1).each do |i|\n puts \"loop, i=#{i}\"\n if input[i][left] == 0\n zero_position = i\n else\n return zero_position\n end\n end\n\n zero_position\nend", "title": "" }, { "docid": "9f44842553672c74c2902f81fe60e826", "score": "0.5391347", "text": "def solve_visit_cell\n # Get the next path.\n path = @queue.shift\n # The cell to visit is the last entry in the path.\n x, y = path.last\n \n # Have we reached the end yet?\n return path if x == @end_x && y == @end_y\n \n # Mark cell as visited.\n @visited[x][y] = true\n \n for dx, dy in DIRECTIONS\n if dx.nonzero?\n # Left / Right\n new_x = x + dx\n if move_valid?(new_x, y) && !@vertical_walls[ [x, new_x].min ][y]\n enqueue_cell(path, new_x, y)\n end\n else\n # Top / Bottom\n new_y = y + dy\n if move_valid?(x, new_y) && !@horizontal_walls[x][ [y, new_y].min ]\n enqueue_cell(path, x, new_y)\n end\n end\n end\n puts \"QUEUE #{@queue}\"\n nil # No solution yet.\n end", "title": "" }, { "docid": "0170c3de8698cee3004461aaa0b165ed", "score": "0.53840625", "text": "def binary_serach_all_zero_row(top, bottom)\n mid_index = top + (bottom - top) / 2\n all_zeros = true\n\n if bottom < top\n bottom = top\n end\n\n if top > bottom\n top = bottom\n end\n\n if top == bottom\n mid_index = top\n end\n\n if @not_all_zero_row_index[mid_index]\n all_zeros = false\n else\n unless @all_zero_row_index[mid_index]\n lower, upper = get_optimized_col_bounds\n (lower..upper).each do |i|\n cell = @matrix[mid_index][i]\n\n if cell != 0\n all_zeros = false\n @not_all_zero_col_index[i] = true\n @not_all_zero_row_index[mid_index] = true\n @number_of_cell_visited += 1\n break\n end\n\n @number_of_cell_visited += 1\n end\n\n @all_zero_row_index[mid_index] = true\n end\n end\n\n if all_zeros\n return mid_index\n elsif top == bottom\n return nil\n else\n new_top = mid_index + 1\n new_bottom = bottom\n result = binary_serach_all_zero_row(new_top, new_bottom)\n return result if result\n\n new_top = top\n new_bottom = mid_index - 1\n return binary_serach_all_zero_row(new_top, new_bottom)\n end\n end", "title": "" }, { "docid": "1e1e8ec03d9546fbd9723b3eac79ddc3", "score": "0.5379932", "text": "def adjacent_mines(row, col)\n 0\n end", "title": "" }, { "docid": "1e1e8ec03d9546fbd9723b3eac79ddc3", "score": "0.5379932", "text": "def adjacent_mines(row, col)\n 0\n end", "title": "" }, { "docid": "1e1e8ec03d9546fbd9723b3eac79ddc3", "score": "0.5379932", "text": "def adjacent_mines(row, col)\n 0\n end", "title": "" }, { "docid": "ec16a9e55b14f031937a3c5270a635ad", "score": "0.53599143", "text": "def floyd_warshall_variation()\n edges = %w( 0,1 1,2 2,3 1,3 )\n num = edges.join.gsub(\",\",\"\").split(\"\").uniq.size\n\n a = Array.new(num) { Array.new(num) { Array.new(num) } }\n \n # initialize\n num.times do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = Float::INFINITY\n a[i][j][k] = 0 if i == j\n a[i][j][k] = 1 if edges.include? \"#{i},#{j}\"\n end\n end\n end\n\n # run\n (1..num-1).each do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = [\n a[i][j][k-1] +\n a[i][k][k-1] * a[k][j][k-1]\n ].min\n end\n end\n end\n\n # print\n num.times do |i|\n num.times do |j|\n puts \"#{i},#{j}: #{a[i][j][num-1]}\"\n end\n end\n\nend", "title": "" }, { "docid": "0ec4c76c787fbd7cc959c9bde1c7e221", "score": "0.53543216", "text": "def lower_triangular?\n return false unless square?\n iter = iterator\n while iter.has_next?\n item = iter.next\n return false if item[1] > item[0] && item[2] != 0\n end\n true\n end", "title": "" }, { "docid": "c306518fcc47fa4da4d6128bce5dd30f", "score": "0.5352627", "text": "def manhattan_heuristic(open_squares)\n smallest_f = nil\n smallest_f_point = nil\n open_squares.each do |neighbor|\n g_score = calculate_g(neighbor)\n h_score = calculate_h(neighbor)\n f_score = h_score + g_score\n if smallest_f.nil? || f_score < smallest_f\n smallest_f = f_score\n smallest_f_point = neighbor\n end\n end\n smallest_f_point\n end", "title": "" }, { "docid": "fa72bd619b9eb918308b3870ccae4631", "score": "0.5350468", "text": "def find_min_in_nested_arrays(src)\nrow_index = 0\nouter_results = []\nwhile row_index < src.count do\n element_index = 0\n smallest_integers = 100\n while element_index < src[row_index].count do\n if src[row_index][element_index] < smallest_integers\n smallest_integers = src[row_index][element_index]\n end\n element_index += 1\n end\n outer_results << smallest_integers\n row_index += 1\n end\n outer_results\nend", "title": "" }, { "docid": "f5b3711f93dc6c900ed5995e1911c284", "score": "0.5340779", "text": "def solution\n answer = self.clone.solve\n answer.nil? ? nil : answer.grid.map {|row| row.map {|cell| cell.first}}\n end", "title": "" }, { "docid": "adfda3b497e8fc59754d3df8a8827850", "score": "0.5332314", "text": "def calculate_minimum_hp(dungeon)\n return 1 if dungeon.empty?\n n = dungeon.size\n m = dungeon[0].size\n max_int = 2 ** (0.size * 8 - 1)\n dp = Array.new(n + 1) {\n Array.new(m + 1)\n }\n \n dp[n][m - 1], dp[n - 1][m] = 1, 1\n (n - 1).downto(0).each { |i|\n (m - 1).downto(0).each { |j|\n energy = [dp[i][j + 1] || max_int, dp[i + 1][j] || max_int].min - dungeon[i][j]\n puts \"#{energy}\"\n dp[i][j] = energy > 0 ? energy : 1\n }\n }\n \n dp[0][0]\nend", "title": "" }, { "docid": "aba0daece5cf6a576859e0b3b266602f", "score": "0.53263336", "text": "def breadth_first(value)\n\tend", "title": "" }, { "docid": "faa24334abd550ab19c25325656b482f", "score": "0.5318984", "text": "def solution(a)\n left_sum = a.first\n right_sum = a.drop(1).reduce(:+)\n min_diff = (left_sum - right_sum).abs\n\n a.take(a.length - 1).drop(1).each do |element|\n left_sum += element\n right_sum -= element\n\n current_diff = (left_sum - right_sum).abs\n\n if current_diff < min_diff\n min_diff = current_diff\n end\n end\n min_diff\nend", "title": "" }, { "docid": "45b1419b7bd6dd5f78a3fbef1a383548", "score": "0.5313452", "text": "def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend", "title": "" }, { "docid": "c8d961ab0da82d87c3ffbcf45be6dfdb", "score": "0.5313218", "text": "def find_min_element_iterative(root)\n return nil if !root\n while root.left_child\n root = root.left_child\n end\n root\nend", "title": "" }, { "docid": "9c03d75f905a4e7fe34f82c070483023", "score": "0.5306927", "text": "def solve(array)\n ##Set minimum to be the last element.\n minimum = array[-1]\n\n ## Iterate until we reach the change.\n array.each_with_index do |element, index|\n if array[index] < array[index - 1]\n minimum = array[index]\n break\n end\n end\nend", "title": "" }, { "docid": "b90b7314006a42c482d73833555a12b7", "score": "0.53028065", "text": "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |vertex, data|\n data[:cost]\n end\n vertex\nend", "title": "" }, { "docid": "3a1b5b6b7cdff380206b38483e20c1cd", "score": "0.52940655", "text": "def find_min(root)\n return root if root.nil? || root.left.nil?\n find_min(root.left)\nend", "title": "" }, { "docid": "32b216749ab9580298acd21c1c33fa0f", "score": "0.52920115", "text": "def find_solution\n if solve(@start_point[0], @start_point[1])\n @maze.each { |row| puts row.join(\"\") }\n else\n puts \"no solution found\"\n end\n end", "title": "" }, { "docid": "72c512790f7b7e92515bb866ba405b55", "score": "0.5288961", "text": "def solve\n rows = File.readlines( 'resources/0081_matrix.txt' )\n rows.map! {|row| row.scan( /\\d+/ ).map( &:to_i )}\n\n g = ProjectEuler::Graph.new\n w, h = rows[0].length, rows.length\n\n # Weight the paths between nodes according to the text file. Each path\n # is two-way, with the cost equal to the value at the destination node.\n # Process the left column and top row separately, to prevent roll-over\n # across matrix boundaries.\n (1...w).each {|i| g.connect( i - 1, i, rows[0][i], rows[0][i - 1] )}\n (1...h).each {|j| g.connect( j*w - w, j*w, rows[j][0], rows[j - 1][0] )}\n\n # Now we can weight the bulk of the matrix. Splitting construction of\n # these connections results in no spurious -1 node (a side effect of\n # running from 0 instead of 1).\n (1...w).each do |i|\n (1...h).each do |j|\n g.connect( j*w + i - 1, j*w + i, rows[j][i], rows[j][i - 1] )\n g.connect( (j*w - w) + i, j*w + i, rows[j][i], rows[j - 1][i] )\n end\n end\n\n # Add the weight of the first node, since it isn't included in the total.\n rows[0][0] + g.dijkstra( 0, w*h - 1 )\n end", "title": "" }, { "docid": "9fd828ca5422dab350e84951919872bb", "score": "0.5288803", "text": "def solution\n\n return self if solved?\n\n while [hidden_singles, naked_singles].any?\n end\n\n return self if solved?\n\n\n # Brute force\n i = each_empty_cell.sort_by { |cell, n| legal_values(n).size }.first.try :last\n\n legal_values(i).map do |value|\n fill(i, value).solution\n end.compact.select { |n| n.solved? }.first\n end", "title": "" }, { "docid": "dbe760f36ab3eb442280e1865bc8bfd5", "score": "0.52825034", "text": "def floyd_warshall\n p = VoteMatrix.zero_with_candidates(vote_candidates)\n\n # for i from 1 to C\n # for j from 1 to C\n # if (i ≠ j) then\n # if (d[i,j] > d[j,i]) then\n # p[i,j] := d[i,j]\n # else\n # p[i,j] := 0\n row_count.times do |i|\n row_count.times do |j|\n next if i == j\n\n if self[i, j] > self[j, i]\n p[i, j] = self[i, j]\n else\n p[i, j] = 0\n end\n end\n end\n\n # for i from 1 to C\n # for j from 1 to C\n # if (i ≠ j) then\n # for k from 1 to C\n # if (i ≠ k and j ≠ k) then\n # p[j,k] := max ( p[j,k], min ( p[j,i], p[i,k] )\n row_count.times do |i|\n row_count.times do |j|\n next if i == j\n\n row_count.times do |k|\n next if i == k || j == k\n\n p[j, k] = [p[j, k], [p[j, i], p[i, k]].min].max\n end\n end\n end\n\n p\n end", "title": "" }, { "docid": "be9a92a9d521ce5ff525215c25454df4", "score": "0.5281708", "text": "def is_lowest?(heightmap, row, col)\n adj(heightmap, row, col).all? do |adj_value|\n heightmap[row][col] < adj_value\n end\nend", "title": "" }, { "docid": "7b6c608ed47b424256ad0b08493efd18", "score": "0.52787226", "text": "def left_to_diagonal_right_approach\n largest_prod = 0\n for each_row in (0..15)\n for each_col in (0..15)\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\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", "title": "" }, { "docid": "6aecd7a6b0c0440502911db74fe68223", "score": "0.5268263", "text": "def solution(a)\n # write your code in Ruby 2.2\n left, right = 0, a.reduce(:+)\n min = 0\n (1...a.size).to_a.each do |i|\n left = left + a[i-1]\n right = right - a[i-1]\n diff = (left - right).abs\n if i == 1\n min = diff\n else\n min = diff < min ? diff : min\n end\n end\n min\nend", "title": "" }, { "docid": "2fd67b087847dd697fa239bc4e7bd115", "score": "0.5266299", "text": "def find_best_move(brd)\n\n # Shortcircuit first move so 5 is always choosen\n return 5 if empty_squares(brd).count == 9\n\n\n best_val = -INFINITY\n best_move = nil\n\n brd.each do |cell, status|\n if status == INITIAL_MARKER\n brd[cell] = COMPUTER_MARKER\n move_val = minimax(brd, 0, 'player')\n brd[cell] = INITIAL_MARKER\n if move_val > best_val\n best_val = move_val\n best_move = cell\n end\n end\n end\n return best_move\n end", "title": "" }, { "docid": "d2f35c4ce86228e0d8d451ca0c72cec9", "score": "0.5265907", "text": "def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end", "title": "" }, { "docid": "d2f35c4ce86228e0d8d451ca0c72cec9", "score": "0.5265907", "text": "def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end", "title": "" }, { "docid": "caf01198c095a4e95a25b0e6c2b9051e", "score": "0.52565676", "text": "def recurse_bottom_right_to_top_left(x1, y1, x2, y2)\n bottom_right_to_top_left x1, y1, x2, y2\n recurse_top_left_to_bottom_right x1 + 1, y1, x2, y2 - 1 if x2 - x1 > 0\n end", "title": "" }, { "docid": "f32b75b4505e651b1545d011eeb83e1b", "score": "0.5255607", "text": "def max_sum_path(arr)\n queue = [[0, 0]]\n n = arr.size\n sums = Array.new(n) { |cell| Array.new(n, -100) }\n sums[0][0] = arr[0][0]\n\n while !queue.empty? do\n row, col = queue.shift\n directions = [[0, 1], [1, 0]]\n directions.each do |drow, dcol|\n nrow, ncol = row + drow, col + dcol\n if nrow.between?(0, n - 1) && ncol.between?(0, n - 1)\n sums[nrow][ncol] = [sums[nrow][ncol], sums[row][col] + arr[nrow][ncol]].max\n queue << [nrow, ncol]\n end\n end\n end\n sums[n - 1][n - 1]\nend", "title": "" }, { "docid": "fcc2284e30b17e49b60450448bb228d1", "score": "0.5254932", "text": "def max_path_sumI arr\n for i in (arr.length-2).downto(0)\n for j in 0...arr[i].length\n arr[i][j] += (arr[i+1][j] > arr[i+1][j+1] ? arr[i+1][j]: arr[i+1][j+1])\n end\n end\n arr[0][0]\nend", "title": "" }, { "docid": "5b02c3569a0a10dd92874408696076d7", "score": "0.52537245", "text": "def min_cost(stairs)\n min_step_cost = [stairs[0], stairs[1]]\n idx = 2\n while idx < stairs.length\n min_step_cost[idx] = stairs[idx] + [min_step_cost[idx - 1], min_step_cost[idx - 2]].min\n idx += 1\n end\n p min_step_cost\n [min_step_cost[-2], min_step_cost[-1]].min\nend", "title": "" }, { "docid": "8177e2338342fbfef778f02d1c1aed4b", "score": "0.5251801", "text": "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "title": "" }, { "docid": "9fff43cec099136cfc5e51cfbbf0637e", "score": "0.5251524", "text": "def solution(a)\n # write your code in Ruby 2.2\n return 0 if a.length == 3\n range = a[1...-1]\n min = Float::INFINITY\n max_ending = 0\n range.inject(0) do |max, y|\n if max_ending + y > 0\n max_ending += y\n if min == Float::INFINITY\n max = [max, max_ending].max\n min = y\n else\n min = y if y < min\n max = [max, max_ending - min].max\n end\n else\n max_ending = 0\n min = Float::INFINITY\n end\n max\n end\nend", "title": "" }, { "docid": "214c3372fb3cf184c1ba4b135db79018", "score": "0.5250577", "text": "def check_prow\n @prow = 0 if @prow < 0\n if @prow > @maxrow-1\n @prow = @maxrow-1\n end\n if @pcol > @maxcol-1\n @pcol = @maxcol-1\n end\n @pcol = 0 if @pcol < 0\n end", "title": "" }, { "docid": "2fb41f42eaac0096cfc3f1280ff57862", "score": "0.5248557", "text": "def interpolation_search_internal(value)\n return [false, 0] if @inner.size == 0\n left = 0\n right = @inner.size - 1\n return [false, 0] if value < @inner[left]\n return [false, right + 1] if value > @inner[right]\n while left <= right\n if left == right\n candidate = left\n else\n candidate = (left + (right - left) * (value - @inner[left]) / (@inner[right] - @inner[left]).to_f).round\n end\n return [false, left] if candidate < left\n return [false, right + 1] if candidate > right\n if @inner[candidate] == value\n return [true, candidate]\n elsif value < @inner[candidate]\n right = candidate - 1\n else\n left = candidate + 1\n end\n end\n return [false, left]\n end", "title": "" }, { "docid": "9d89ec880e0a97807f033171f109cef4", "score": "0.5244641", "text": "def solution(h)\n h.inject([1, [h.first]]) do |(blocks, stack), n|\n next [blocks+1, stack.push(n)] if stack.last < n\n stack.pop while stack.any? && stack.last > n\n next [blocks, stack] if stack.last == n\n \n [blocks+1, stack.push(n)]\n end.first\nend", "title": "" }, { "docid": "8f0e138c9c5aa24ad4be3a67e59372c6", "score": "0.523643", "text": "def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end", "title": "" }, { "docid": "6dab5d8abaa854d4d56af4fbff3d12d6", "score": "0.5230199", "text": "def solve(input)\n left = 0 \n right = input.length - 1\n area = 0 \n while(left < right)\n if !input[left]\n left += 1\n next\n end\n if !input[right]\n right += 1\n next\n end\n height = [input[left], input[right]].min\n width = right - 1 - left\n area = [area, (height * width)].max\n if input[left] < input[right]\n left += 1\n else\n right += 1\n end\n end\n p area\nend", "title": "" }, { "docid": "b4c8b7f8d0f5caa1d8f32ec07e34bcc0", "score": "0.5225269", "text": "def getSumsByRow(tri, row)\n\t#for every element in current line\n\tfor i in 0..tri[row].length-1\n\t\t#add to the lagest of the child nodes\n\t\ttri[row][i] += [tri[row+1][i], tri[row+1][i+1]].max\n\tend\n\t#if the row only has one element\n\tif tri[row].length == 1\n\t\t#return it\n\t\treturn tri[row][0]\n\telse\n\t\t#or else recurse \n\t\treturn getSumsByRow(tri, row-1)\n\tend\nend", "title": "" }, { "docid": "60fd0955eb5af7ca0f3becc87ec2447a", "score": "0.5222861", "text": "def left_to_right_approach\n largest_prod_of_all_rows = 0\n for each_row in (0..19)\n curr_largest_prod_in_row = left_to_right_helper($grid_of_numbers[each_row])\n if curr_largest_prod_in_row > largest_prod_of_all_rows\n largest_prod_of_all_rows = curr_largest_prod_in_row\n end\n end\n \n return largest_prod_of_all_rows\nend", "title": "" }, { "docid": "9fe255fc1fe6724a5c3d7d048fbb802f", "score": "0.52221704", "text": "def row_reduce_below\n\t\ttop_row = 0\n\t\tleft_column = 0\n\n\t\twhile (top_row < @num_rows) && (left_column < @num_cols)\n\t\t\t# Find the nearest row with a non-zero value in this column.\n\t\t\t# Exchange that row with this one. If this is the last row, there\n\t\t\t# are no rows below to pivot into place, so don't bother.\n\t\t\tif top_row < (@num_rows - 1)\n\t\t\t\tpivot_row = top_row\n\t\t\t\tpivot_successful = false\n\t\t\t\twhile !pivot_successful && (pivot_row < @num_rows)\n\t\t\t\t\tif @rows[pivot_row][left_column] != 0\n\t\t\t\t\t\tif top_row != pivot_row\n\t\t\t\t\t\t\ttemp = @rows[top_row]\n\t\t\t\t\t\t\t@rows[top_row] = @rows[pivot_row]\n\t\t\t\t\t\t\t@rows[pivot_row] = temp\n\t\t\t\t\t\tend\n\t\t\t\t\t\tpivot_successful = 1\n\t\t\t\t\telse\n\t\t\t\t\t\tpivot_row += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif !pivot_successful\n\t\t\t\t\tleft_column += 1\n\t\t\t\t\tnext # Work on the next column.\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# We can have a zero leading element in this row if it's\n\t\t\t# the last row and full of zeroes.\n\t\t\tif @rows[top_row][left_column] != 0\n\t\t\t\t# Clear this column.\n\t\t\t\tfor row in (top_row+1)..(@num_rows-1)\n\t\t\t\t\tcurrent_row_lead = @rows[row][left_column]\n\t\t\t\t\tif current_row_lead != 0\n\t\t\t\t\t\t@rows[row].bits ^= @rows[top_row].bits\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tleft_column += 1\n\t\t\ttop_row += 1\n\t\tend\n\tend", "title": "" }, { "docid": "2f20777cf5434e0b1af57b6fee6d63ee", "score": "0.5219129", "text": "def problem_66\n max = [0,0]\n (2..1000).each do |d|\n top,bot = d.sqrt_frac {|t,b| (t*t - d*b*b) == 1}\n next unless top\n max = [max,[top,d]].max\n puts \"#{d} #{top} #{bot}\"\n end\n max[1]\nend", "title": "" } ]
ff49baa14ccd120b7fb8f3a68dace791
GET /contacts GET /contacts.json
[ { "docid": "4ad7df2d75fc4db6fddc0db28ee450fa", "score": "0.0", "text": "def index\n @contacts = Contact.find(:all, :order => 'name')\n \n end", "title": "" } ]
[ { "docid": "8eea3a2e86364d38226af95d61abd66e", "score": "0.845876", "text": "def contacts\n get('contacts')\n end", "title": "" }, { "docid": "680464823216e7f4871a0a4894b924aa", "score": "0.83591413", "text": "def contacts()\n get('contactsList')\n end", "title": "" }, { "docid": "9a91b474d4fb12729cd46425fc407da1", "score": "0.8198962", "text": "def get_contacts\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "1f091a8c1de3f52ce7a8a65675b39eee", "score": "0.78721195", "text": "def index\n contacts = Contact.all\n\n render json: contacts\n end", "title": "" }, { "docid": "db036fa4b829b95467922f91b16d9505", "score": "0.78630775", "text": "def index\n @contacts = Contact.all\n\n render json: @contacts\n end", "title": "" }, { "docid": "5601706bb6ad656d3e4ca7fd563a4eb5", "score": "0.7813795", "text": "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n PassaporteWeb::Entities::Profile::Contacts)\n end", "title": "" }, { "docid": "b5a68395dd9943fde02e8ecc1bcb6570", "score": "0.7802116", "text": "def index\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "b5a68395dd9943fde02e8ecc1bcb6570", "score": "0.7802116", "text": "def index\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "6c28b11411bf98aacfb49823cc947f01", "score": "0.7797465", "text": "def contacts\n GET base_url \"/contacts\"\n end", "title": "" }, { "docid": "858daf1ca19f26952d0dd388cfe1945c", "score": "0.77857494", "text": "def contacts(params = {})\n get_contacts(params)\n end", "title": "" }, { "docid": "96e93b47bdc631e97f7d309bb2bb4aa5", "score": "0.77605045", "text": "def get_contacts_request\n url = @url_base + \"/api/v1/user/contacts\"\n @response = RestClient.get(url, \n {\n \"Content-Type\" => \"application/json\",\n \"X-User-Email\" => \"[email protected]\"\n }\n ) \n @data = JSON.parse @response.body\n @contact = @data.first\n end", "title": "" }, { "docid": "064f9e180d3f96c3047631b6cc4d7191", "score": "0.77507246", "text": "def index\n @contacts = current_user.contacts\n\n render json: @contacts\n end", "title": "" }, { "docid": "064f9e180d3f96c3047631b6cc4d7191", "score": "0.77507246", "text": "def index\n @contacts = current_user.contacts\n\n render json: @contacts\n end", "title": "" }, { "docid": "4a3ada9c96ad2ec6b7aac81c41c7203a", "score": "0.7711013", "text": "def index\n @contacts = Contact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "4a3ada9c96ad2ec6b7aac81c41c7203a", "score": "0.7711013", "text": "def index\n @contacts = Contact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "82011e3ad9aa8877ecd5ae97bf344ce8", "score": "0.7684202", "text": "def index\n @contacts = User.find(current_user.id).contacts\n render json: { contacts: @contacts }, status: :ok\n end", "title": "" }, { "docid": "ed369119663639e9b8cb9fb05a4808e4", "score": "0.7637641", "text": "def contacts_info(contacts)\n request(:get, '/api/contact_info/', {:contacts=>contacts}).data\n end", "title": "" }, { "docid": "82f8a333a6f4d5d3cc12f7925a7a71d9", "score": "0.76324636", "text": "def index\n @contacts = current_user.contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "eacb3f0b77466bfd48ab3e2f6af2af3e", "score": "0.74902886", "text": "def get_contacts(params = {})\n Services::ContactService.get_contacts(params)\n end", "title": "" }, { "docid": "7d30409fdf2839adcf7944d3d89144bb", "score": "0.74704826", "text": "def index\n @contacts = Contact.all\n\n # Search\n @contacts = @contacts.search(params[:q]) if params[:q]\n\n # Filter for relationship\n @contacts = @contacts.relationship(params[:relationship]) if params[:relationship]\n\n # Order by\n @contacts = @contacts.order(params[:order].gsub(':', ' ')) if params[:order]\n\n # Pagination\n if (params[:offset] && params[:limit])\n @contacts = @contacts.page(1).per(params[:limit]).padding(params[:offset])\n else\n @contacts = @contacts.page(1).per(25)\n end\n\n\n render json: @contacts if stale?(etag: @contacts.all, last_modified: @contacts.maximum(:updated_at))\n end", "title": "" }, { "docid": "868c3b717dfdd4fddf8639332cd76e39", "score": "0.7467012", "text": "def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(params)\n parse_contacts response_body(response)\n end", "title": "" }, { "docid": "426d760cc40f9b3428fef86492072e2b", "score": "0.7408035", "text": "def get_contact(contact_id)\n request :get,\n \"/v3/contacts/#{contact_id}.json\"\n end", "title": "" }, { "docid": "0a3ee43585d5198f4e7e8e1caa7fb1ce", "score": "0.7334313", "text": "def get_contacts\n @user = current_user\n if @user\n render json: @user.meetings.map { |meeting| { :contacts => meeting.users } }\n else\n render json: {error: 'Contacts not found.'}\n end\n end", "title": "" }, { "docid": "cf078ed48a5bc99160ce26d4af6559ea", "score": "0.7307217", "text": "def get_contact_details(id)\n get(\"contacts/#{id}.json\")\n end", "title": "" }, { "docid": "cf078ed48a5bc99160ce26d4af6559ea", "score": "0.7307217", "text": "def get_contact_details(id)\n get(\"contacts/#{id}.json\")\n end", "title": "" }, { "docid": "b3770cc602cb442c7974b8cf49732e34", "score": "0.7301899", "text": "def query_contacts(options = nil)\n require_relative 'contact'\n @api.cursor(Contact, get_base_api_path() + \"/contacts\", options)\n end", "title": "" }, { "docid": "b3770cc602cb442c7974b8cf49732e34", "score": "0.7301899", "text": "def query_contacts(options = nil)\n require_relative 'contact'\n @api.cursor(Contact, get_base_api_path() + \"/contacts\", options)\n end", "title": "" }, { "docid": "b3770cc602cb442c7974b8cf49732e34", "score": "0.7301899", "text": "def query_contacts(options = nil)\n require_relative 'contact'\n @api.cursor(Contact, get_base_api_path() + \"/contacts\", options)\n end", "title": "" }, { "docid": "151c4f2f0a55a6c23ebf62385b1f6cb5", "score": "0.72857535", "text": "def show\n render json: @contact, status: 200\n end", "title": "" }, { "docid": "b32be607d87a6ffd3c01aa34e1961387", "score": "0.7275428", "text": "def index\n if params[:search]\n @contacts = Contact.where(:user_id => current_user.id)\n @contacts = @contacts.where(:name => /#{params[:search]}/i)\n else\n @contacts = Contact.where(:user_id => current_user.id)\n end\n\n if @contacts.nil?\n @contacts = []\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render_for_api :contact, :json => @contacts }\n end\n end", "title": "" }, { "docid": "9f141f30fef9074c0ebb375a286d189e", "score": "0.72412497", "text": "def index\n @contacts = Contact.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {odata: @contacts }}\n end\n end", "title": "" }, { "docid": "03aa0c170b0baed07747bd79a6c095ff", "score": "0.7239941", "text": "def get_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.get_contacts ...\"\n end\n # resource path\n local_var_path = \"/contacts\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#get_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c14f4fffb6688e9794b3530041b5e755", "score": "0.72397476", "text": "def read_contacts\n contacts_json = File.read(\"contacts.json\")\n return JSON.parse(contacts_json, { symbolize_names: true })\n end", "title": "" }, { "docid": "0a8669a95b9da1fc2432e4ffc04b37d9", "score": "0.722382", "text": "def get_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi#get_contacts ...\"\n end\n \n # resource path\n path = \"/Contacts\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 = []\n data, status_code, headers = @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 => 'Array<APIContact>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#get_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "5584be54cca1a2051f29da86f79d50be", "score": "0.7221972", "text": "def index\n @contactos = Contacto.all\n render json:@contactos\n end", "title": "" }, { "docid": "92859ef3ca77b16109d0e9ddb8a54821", "score": "0.7221668", "text": "def index\n @contact_people = ContactPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_people }\n end\n end", "title": "" }, { "docid": "ceb6fa22bac99850cef8221da01994db", "score": "0.71984655", "text": "def index\n contacts = Contact.all\n respond_with(contacts)\n end", "title": "" }, { "docid": "b726e5bdaa45ac838ffa79657a8e789d", "score": "0.71977687", "text": "def index\n @account_contacts = @account.account_contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @account_contacts }\n end\n end", "title": "" }, { "docid": "e00d8e1c1a2b7e6092cf5e6e091795e7", "score": "0.71934247", "text": "def index\n @customer_contacts = CustomerContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @customer_contacts }\n end\n end", "title": "" }, { "docid": "eca03107539927f2c59979d1028aad9f", "score": "0.7190016", "text": "def get_user_contacts(options={})\n response = get(\"get_user_contacts/\", options)\n end", "title": "" }, { "docid": "725e24804cee3e5fa28af6db6dab5bca", "score": "0.7166739", "text": "def index\n respond_with(contacts)\n end", "title": "" }, { "docid": "c49b4fbc045d0f1d3a35acd3171b4662", "score": "0.7165422", "text": "def index\n respond_with @contacts = Contact.all\n end", "title": "" }, { "docid": "21355021878051bdca61d00026ee0a2b", "score": "0.716034", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "9e37a80f2da8b313bdeb5e50fd5642c0", "score": "0.7149875", "text": "def index\n @contact_numbers = ContactNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_numbers }\n end\n end", "title": "" }, { "docid": "bb6bb612135869cac70e107cf7fbe6ec", "score": "0.7130532", "text": "def index\n @contacts = Contact.all\n respond_with @contacts\n end", "title": "" }, { "docid": "be7902e8f4fc40471335028e283626ed", "score": "0.71263254", "text": "def index\n @contacts = Contact.all\n respond_with(@contacts)\n end", "title": "" }, { "docid": "be7902e8f4fc40471335028e283626ed", "score": "0.71263254", "text": "def index\n @contacts = Contact.all\n respond_with(@contacts)\n end", "title": "" }, { "docid": "0d74252ce44ae0c19be60ed3bcabd6d1", "score": "0.7122979", "text": "def index\n @contact_infos = ContactInfo.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_infos }\n end\n end", "title": "" }, { "docid": "87a7c242efb3c99de45052afad958040", "score": "0.71074116", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "87a7c242efb3c99de45052afad958040", "score": "0.71074116", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "1335867704cf4951ffd3f58cdc00cba5", "score": "0.7102693", "text": "def show\n\t @contact = Contact.find(params[:id])\n\t \n\t respond_to do |format|\n\t format.html # show.html.erb\n\t format.json { render json: @contact }\n\t end\n\t end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "e1a07aa5cc6d40f29e4886e73f0e307b", "score": "0.7097764", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "9d0da9ac34c860eb4735dcea7a181324", "score": "0.7092194", "text": "def show\n @contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "9d0da9ac34c860eb4735dcea7a181324", "score": "0.7092194", "text": "def show\n @contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "6d73125ce563bb9a8bde3b998b2aff9d", "score": "0.70895547", "text": "def index\n @contact_numbers = ContactNumber.all\n\n render json: @contact_numbers\n end", "title": "" }, { "docid": "6d73125ce563bb9a8bde3b998b2aff9d", "score": "0.70893097", "text": "def index\n @contact_numbers = ContactNumber.all\n\n render json: @contact_numbers\n end", "title": "" }, { "docid": "b7f42cb9652b9cccb1c5f368d1d85f16", "score": "0.70841205", "text": "def get_contacts_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.get_contacts_0 ...\"\n end\n # resource path\n local_var_path = \"/contacts\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#get_contacts_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "1b399ac185ba93c537ef60748318267c", "score": "0.7082711", "text": "def index\n @contact_details = ContactDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_details }\n end\n end", "title": "" }, { "docid": "752e1c5b0ac4b17ff88ab1b8fb738f0d", "score": "0.7074982", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "title": "" }, { "docid": "edfdbb11c527b849da56ca6dd65114c4", "score": "0.7049916", "text": "def get_contacts(limit = 100, offset = 0, conditions = {})\n params = extract_query_params conditions\n\n params['limit'] = limit\n params['offset'] = offset\n\n request :get,\n '/v3/contacts.json',\n params\n end", "title": "" }, { "docid": "fe167a5e40be8002c9916c61a5478637", "score": "0.7046409", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contact }\n end\n end", "title": "" }, { "docid": "fe167a5e40be8002c9916c61a5478637", "score": "0.7046409", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contact }\n end\n end", "title": "" }, { "docid": "ccedea31467c3837ae0f2cc27133f36b", "score": "0.70431906", "text": "def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n format.json do\n render :json => {\n :content => json_for_contact(@contact),\n :location => contact_path(@contact)\n }\n end\n\n end\n end", "title": "" }, { "docid": "74519716cc54398e2815da8427395543", "score": "0.70405364", "text": "def index\n @matters = Matter.conditional_pagesort(params, {:includes => :contact})\n @contacts = Crm::Contact.where(\"name #{like} ?\", \"%#{params[:q]}%\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts.map(&:attributes) }\n end\n end", "title": "" }, { "docid": "5fb408d0b6600514ac30e09da71dafe9", "score": "0.7032095", "text": "def show\r\n @contact = Contact.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @contact }\r\n end\r\n end", "title": "" }, { "docid": "c14c09acb36d2dfb2db0335ce1f10b8b", "score": "0.70274305", "text": "def api_contacts_get(opts = {})\n api_contacts_get_with_http_info(opts)\n nil\n end", "title": "" }, { "docid": "6dc9adbbf0fda6436362f37dfb0e26f8", "score": "0.7021656", "text": "def index\n @contact_notes = current_user.contacts.find(params[:contact_id]).contact_notes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_notes }\n end\n end", "title": "" }, { "docid": "5adb02007cbcd29c46cdcb5c83cfed84", "score": "0.7019655", "text": "def contacts\n payload = @common_payload.clone\n @log.debug(\"contacts payload: #{JSON.pretty_generate(payload)}\")\n response = @site['getAlertContacts'].get :params => payload, :accept => :json\n result = parse_response(response)\n @log.debug(\"contacts result: #{JSON.pretty_generate(result)}\")\n result['stat'] == 'ok' ? result['alertcontacts']['alertcontact'] : nil\n end", "title": "" }, { "docid": "28dcdc79758c8af855fea0f15f72b758", "score": "0.6971494", "text": "def show\n @contact_list = ContactList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_list }\n end\n end", "title": "" }, { "docid": "9313130fed35db2e743dafb059e55909", "score": "0.6964357", "text": "def contact(contact_id, params = {})\n response = get(\"contacts/#{contact_id}.json\", params)\n end", "title": "" }, { "docid": "2213643afd1168c4585ce8409d10f7ae", "score": "0.69546956", "text": "def index\n\t@contacts = Contact.find(:all)\n\n end", "title": "" }, { "docid": "14445723345f202577c91ae208cb2a8c", "score": "0.69476146", "text": "def get_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DataApi.get_contacts ...\"\n end\n # resource path\n local_var_path = \"/contacts\"\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?\n query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].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 = ['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 => 'ContactsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataApi#get_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4c96512db5b51c427af6994f6490f6bf", "score": "0.69444007", "text": "def index\n\t\t@contacts = Contact.all\n\tend", "title": "" }, { "docid": "310476151e44beb744a75b61b0845178", "score": "0.6939055", "text": "def list_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactApi.list_contacts ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling ContactApi.list_contacts\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}/contacts'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<SchemasContactResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ContactApi.list_contacts\",\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: ContactApi#list_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "540870b946175971d141cccf087a6646", "score": "0.6918553", "text": "def contacts\n @contacts ||= ContactsService.new(@http_client)\n end", "title": "" }, { "docid": "6e7e7b1775fae18f54e89c83213be28c", "score": "0.69163156", "text": "def index\n response.headers['X-Total-Count'] = @contacts.count.to_s\n @contacts = @contacts.page(params[:page]) if params[:page].present?\n @contacts = @contacts.per(params[:per]) if params[:per].present?\n \n render json: @contacts\n end", "title": "" }, { "docid": "385234820fee5ed169f920009d6ec58e", "score": "0.69147164", "text": "def contacts(opts = {})\n find_collection(\"contacts\", opts)\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69067913", "text": "def index\n @contacts = Contact.all\n end", "title": "" } ]
d79d46bd2d5a279e6f95bc89f6a019ae
Count number of items that match the given tag types
[ { "docid": "f7912b534311b8fd9aadbf99965ec645", "score": "0.6685034", "text": "def count_element(*types)\n stack.select { |level| types.include? level.first }.size\n end", "title": "" } ]
[ { "docid": "13fc7c508c8f2a8565f859a530ffc3ee", "score": "0.74823916", "text": "def count(item, tag)\n items = item.downcase.split\n type = items[0]\n subtype = items[1]\n case type\n when 'objective' then count_objectives(item, tag, subtype)\n when 'endpoint' then count_endpoints(subtype)\n end\n end", "title": "" }, { "docid": "068156c86b869888a5b0ba57093ce319", "score": "0.7470795", "text": "def count_tag tag, counts, iscope\n counts\n end", "title": "" }, { "docid": "676ca2ad38124b2bbdae9258ec95450c", "score": "0.7398492", "text": "def count_items(type = Item)\n self.count { |x| x.kind_of? type }\n end", "title": "" }, { "docid": "f48561c166df2d9ac10f99af16035ca9", "score": "0.7365729", "text": "def count_tags(items=nil)\n items ||= @items\n tags = items.map { |i| i[:tags] }.flatten.delete_if{|t| t.nil?}\n tags.inject(Hash.new(0)) {|h,i| h[i] += 1; h }\nend", "title": "" }, { "docid": "ee0de4ad1f30094f1430d9397539aeda", "score": "0.70336324", "text": "def count_tag tag, counts\n typeset.each do |type|\n subscope = itemscope.where('rcprefs.entity_type = ?', type)\n # Winnow the scope by restricting the set to Rcprefs referring to recipes in which EITHER\n # * The Rcpref's comment matches the tag's string, OR\n # * The recipe's title matches the tag's string, OR\n # * the recipe is tagged by the tag\n matchstr = \"%#{tag.name}%\"\n # r1 = Recipe.joins(:user_pointers).where(\"recipes.title ILIKE ? and rcprefs.user_id = 3\", matchstr)\n # ids1 = subscope.joins(\"INNER JOIN recipes ON recipes.id = rcprefs.entity_id and recipes.title ILIKE '%salmon%' and rcprefs.user_id = 3\")\n # ids1 = subscope.joins(%Q{INNER JOIN recipes ON recipes.id = rcprefs.entity_id and recipes.title ILIKE matchstr and rcprefs.user_id = 3})\n # ids1 = subscope.joins(%Q{INNER JOIN recipes ON recipes.id = rcprefs.entity_id and recipes.title ILIKE matchstr}).where(\"rcprefs.user_id = 3\")\n sss1 = subscope.joins(%Q{INNER JOIN recipes ON recipes.id = rcprefs.entity_id}).where(\"recipes.title ILIKE ?\", matchstr)\n sss1 = sss1.where(\"rcprefs.user_id = #{@id}\") if @id\n sss1 = sss1.to_a.uniq { |rr| \"#{rr.entity_type}#{rr.entity_id}\"}\n\n sss2 = subscope.find_by_sql( %Q{SELECT * FROM rcprefs where rcprefs.comment ILIKE '#{matchstr}' } ).uniq { |rr| \"#{rr.entity_type}#{rr.entity_id}\"}\n\n sss3 = subscope.joins(\"INNER JOIN taggings ON taggings.entity_type = rcprefs.entity_type and taggings.entity_id = rcprefs.entity_id and taggings.tag_id = #{tag.id}\")\n sss3 = sss3.to_a.uniq { |rr| \"#{rr.entity_type}#{rr.entity_id}\" }\n\n counts.incr sss1 # One extra point for matching in one field\n counts.incr sss2\n counts.incr sss3\n this_round = (sss1+sss2+sss3).uniq\n counts.incr this_round, 30 # Thirty points for matching this tag\n end\n end", "title": "" }, { "docid": "51e707c00a33d2b11633a11883f56b0d", "score": "0.6898671", "text": "def tag_counts(options = {})\n return [] if tag_list.blank?\n\n options[:conditions] = self.class.send(:merge_conditions, options[:conditions], self.class.send(:tags_condition, tag_list))\n self.class.tag_counts(options)\n end", "title": "" }, { "docid": "78e9b136a560989b19fa01f63e66a6b3", "score": "0.6891218", "text": "def count_tag tag, counts\n tagset = tagging_match tag\n if self.respond_to? :name_match\n # Get an array of entities that are a string match for the tag\n matchset = name_match tag\n counts.incr tagset # One extra point for matching in one field\n counts.incr matchset\n counts.incr (tagset+matchset).uniq, 30 # Thirty points for matching this tag\n end\n counts.incr tagset, 30 # One extra point for matching in one field\n end", "title": "" }, { "docid": "6ef3e0121e6c3e33ec5066542dd836e6", "score": "0.68813086", "text": "def count(type_uri); end", "title": "" }, { "docid": "720e1855f766237dced715bdaf6ca404", "score": "0.6870846", "text": "def method_tags_count\n count = sub_question_type_tags.sum { |t| t.method_tags_count }\n (count > 0) ? count : 1\n end", "title": "" }, { "docid": "5a3b02592dadda4b9719406c9ab20671", "score": "0.6858521", "text": "def count\n return items.size if items.all?(&:nil?)\n\n if type == 'String'\n items.reject(&:blank?).count.to_d\n else\n items.filter_to_type(type).count.to_d\n end\n end", "title": "" }, { "docid": "5f31d2f3b2ec3b4e635bfd08fc13f492", "score": "0.68532497", "text": "def tag_counts\n Gutentag::Tag.distinct.joins(:taggings)\n .where(gutentag_taggings: {taggable_type: name})\n end", "title": "" }, { "docid": "75f6dd31008417c7ce2bfed4815b902a", "score": "0.67801696", "text": "def tag_counts(options = {})\n\t\t\tTag.find(:all, find_options_for_tag_counts(options))\n end", "title": "" }, { "docid": "75f6dd31008417c7ce2bfed4815b902a", "score": "0.67801696", "text": "def tag_counts(options = {})\n\t\t\tTag.find(:all, find_options_for_tag_counts(options))\n end", "title": "" }, { "docid": "70a565c172635c688e92e2d279139449", "score": "0.67356855", "text": "def item_count(items)\n items.count { |item| item_satisfy?(item) }\n end", "title": "" }, { "docid": "36fe181292eacf1de685bb3d164502f1", "score": "0.67289007", "text": "def tag_count\n\t@number_of_tags = Listing.tag_counts_on(:tags)\n end", "title": "" }, { "docid": "6a1eb93c26ca889f3143dfbb9bee867e", "score": "0.67266744", "text": "def tag_counts(options = {})\n Tag.find(:all, find_options_for_tag_counts(options))\n end", "title": "" }, { "docid": "5ee1defd9600ff258e69fa48328078e1", "score": "0.67162174", "text": "def count_with_type(type)\n with_type(type).length\n end", "title": "" }, { "docid": "5ee1defd9600ff258e69fa48328078e1", "score": "0.67162174", "text": "def count_with_type(type)\n with_type(type).length\n end", "title": "" }, { "docid": "3a6c659e8caa0ab0094fc03a9b0053dc", "score": "0.6708179", "text": "def tag_count(elements)\n count_of = Hash.new(0) # note the default value of 0\n elements.to_a.each do |tag|\n count_of[tag.name()] += 1\n count_of.merge_totals(tag_count(tag.elements))\n end\n return count_of\nend", "title": "" }, { "docid": "6a32a91ed5848b58c1079aeaf65c350b", "score": "0.6703894", "text": "def tag_counts(options = {})\n\t\t\tTag.find(:all, find_options_for_tag_counts(options))\n\t\tend", "title": "" }, { "docid": "c6696ded74844d81af03be1ed5402a1f", "score": "0.66823334", "text": "def tag_counts(options = {})\n Tag.find(:all, find_options_for_tag_counts(options))\n end", "title": "" }, { "docid": "c3e99d4aec8a81c5cc836c7153d5d46b", "score": "0.6679677", "text": "def tag_counts(options = {})\n self.class.tag_counts({ :conditions => self.class.send(:tags_condition, tag_list) }.reverse_merge!(options))\n end", "title": "" }, { "docid": "c3e99d4aec8a81c5cc836c7153d5d46b", "score": "0.6679677", "text": "def tag_counts(options = {})\n self.class.tag_counts({ :conditions => self.class.send(:tags_condition, tag_list) }.reverse_merge!(options))\n end", "title": "" }, { "docid": "fa1d6dcf91f810d8fa4b78249d02338d", "score": "0.6659261", "text": "def double_count(tag, tags, count)\r\n doubles = tags.select{|t| t.name == tag.name}\r\n return count if doubles.size < 2\r\n doubles.map(&:count).sum\r\n end", "title": "" }, { "docid": "9ba63ad5b45cf37724030e0c31f729d5", "score": "0.66420126", "text": "def tag_counts(options = {})\n self.class.tag_counts({ :conditions => self.class.send(:tags_condition, tag_list) }.reverse_merge!(options))\n end", "title": "" }, { "docid": "08d7021fb6885abc036087f1b93e82f1", "score": "0.6589938", "text": "def tag_counts(options = {})\n tags = Tag.joins(:taggings).\n where(\"#{Tagging.table_name}.taggable_type\" => base_class.name)\n \n if options[:tags]\n tags = tags.where(\"#{Tag.table_name}.name\" => options.delete(:tags))\n end\n \n unless descends_from_active_record?\n tags = tags.joins(\"INNER JOIN #{quoted_table_name} ON \" +\n \"#{quoted_table_name}.#{primary_key} = #{Tagging.quoted_table_name}.taggable_id\")\n tags = tags.where(type_condition)\n end\n \n if scoped != unscoped\n sub = scoped.except(:select).select(\"#{quoted_table_name}.#{primary_key}\")\n tags = tags.where(\"#{Tagging.quoted_table_name}.taggable_id IN (#{sub.to_sql})\")\n end\n \n tags.counts(options)\n end", "title": "" }, { "docid": "d5b5d6634fdbcd1c71b355bf41b2d973", "score": "0.65866417", "text": "def tag_counts(options = {})\n return [] if tag_list.blank?\n self.class.tag_counts(options.merge(:tags => tag_list))\n end", "title": "" }, { "docid": "94205838731b7a65ba1499e5a90c1fae", "score": "0.65793985", "text": "def tag_counts(options={})\r\n Tag.find(:all, self.class.find_options_for_tag_counts(options))\r\n end", "title": "" }, { "docid": "552a6c13a7ffae5f60169672c0760944", "score": "0.6527993", "text": "def count_tag tag, counts\n # Intersect the scope with the set of entities tagged with tags similar to the given tag\n tagscope = itemscope.where tag_id: TagServices.new(tag).similar_ids\n tagset = tagscope.to_a\n counts.incr tagset # One extra point for matching in one field\n\n matchset = TaggingServices.match tag.name, itemscope # Returns an array of Tagging objects\n counts.incr matchset\n\n this_round = (tagset+matchset).uniq\n counts.incr this_round, 30 # Thirty points for matching this tag\n end", "title": "" }, { "docid": "094e3df585efce5c413fd2ffc03de089", "score": "0.649942", "text": "def tag_count\n count = {}\n post_tags.each do |post, tags|\n tags.each do |t|\n count[t] ||= 0\n count[t] += 1\n end\n end\n count\n end", "title": "" }, { "docid": "27ad116217fd219ca0f206a58a2534a1", "score": "0.6491685", "text": "def tag_counts_on(context, options = {})\r\n Tag.find(:all, find_options_for_tag_counts(options.merge({:attribute => context.to_s})))\r\n end", "title": "" }, { "docid": "c8caa62e439f849215fa97190b7754e7", "score": "0.64837337", "text": "def question_tag_count\n\t\t# find the params of question tags\n\t\ttags = params[:question][:tags]\n\t\t# count the no of tags for that particular question\n\t\t@scn_tag_count = tags.split(\",\").count\n\tend", "title": "" }, { "docid": "eaf16e0ffb9b108922bb01e5044adb93", "score": "0.6482837", "text": "def count_tags(data, tags)\n tags_count = {}\n tags.each do |line|\n tags_count[line] = 0\n end\n\n data.each_with_index do |alignment, index|\n tags.each do |tag|\n alignment.Alignment.each do |aln|\n if aln.tag_name == tag\n tags_count[tag] = tags_count[tag] + 1\n end\n end\n end\n end\n return tags_count\n end", "title": "" }, { "docid": "52bc00f00319c0772bedbb4f77a343fe", "score": "0.6474324", "text": "def tags_and_counts\n\t\t#get the items belonging to this list\n\t\titems = self.items\n\t\titems.tag_counts_on(:tags).order(taggings_count: :desc)\n\tend", "title": "" }, { "docid": "948daab246e2b727d82e9e2909430777", "score": "0.64583534", "text": "def get_tag_occurences (tag)\n return PostTag.count(:conditions => [\"tag_id = ?\", tag.id])\n end", "title": "" }, { "docid": "14a757dc7e7f8c4f56b73ad69db4c3b4", "score": "0.64517325", "text": "def number_of_tags\n total = 0\n\n self.tags.each do |tag, amount|\n total += amount\n end\n\n return total.to_f\n end", "title": "" }, { "docid": "017f52f405a6338693af0b251fa27cb5", "score": "0.6433861", "text": "def ticket_tag_counts\n Tagging.all(:taggable_id => tickets.map(&:id), :taggable_type => 'Ticket').group_by(&:tag_id)\n end", "title": "" }, { "docid": "4ab66b11f17942efbd74492cde6021d3", "score": "0.64146113", "text": "def tag_counts(options = {})\n # Tag.find(:all, find_options_for_tag_counts(options))\n opt = find_options_for_tag_counts(options)\n Tag.select(opt[:select]).where(opt[:conditions]).joins(opt[:joins]).group(opt[:group]).having(opt[:having]).order(opt[:order]).limit(options[:limit])\n end", "title": "" }, { "docid": "223f8931b8af11ec6eca127cd40ab83b", "score": "0.6389105", "text": "def count_tag tag, counts, iscope\n nname = tag.normalized_name || Tag.normalizeName(tag.name)\n iscope, sort_key, pluck_key = orderingscope iscope\n pluck_key ||= sort_key\n counts.include iscope.where('normalized_name LIKE ?', \"%#{nname}%\"), pluck_key\n counts.include iscope.where(normalized_name: nname), pluck_key\n super\n end", "title": "" }, { "docid": "4e75b93d5922ac5367b07d6bb98d4da3", "score": "0.63555485", "text": "def all_with_counts\n taggings\n .reselect(\"#{tag_alias}, count(*) as count\")\n .group(tag_alias)\n end", "title": "" }, { "docid": "2a47cbd70be29554bbd12ca5b2c38138", "score": "0.6314331", "text": "def usage_count\n taggings.count\n end", "title": "" }, { "docid": "931e60ea0265728b1407b1c980baee0f", "score": "0.63024724", "text": "def attachment_tag_count\n\t\t# find the params of attachment tags\n\t\ttags = params[:case_media_attachment][:tags]\n\t\t# count the no of tags for that particular attachment\n\t\t@media_tag_count = tags.split(\",\").count\n\tend", "title": "" }, { "docid": "a646635f0b5d8489b474e24e00799174", "score": "0.62913036", "text": "def count\n __types__.count\n end", "title": "" }, { "docid": "ef7a3e2c003f10e5462df20e41e091af", "score": "0.6283448", "text": "def arity fieldname\n case fieldname.downcase\n when /_tags$/\n tagtype = fieldname.sub /_tags$/, ''\n tagtype = [\"Culinary Term\", \"Untyped\"] if tagtype==\"Other\"\n visible_tags(:tagtype => tagtype).count\n when \"list\", \"lists\"\n ListServices.find_by_listee(object).count\n end\n end", "title": "" }, { "docid": "0da3de99fa154a311a3bd65e561467b5", "score": "0.6281993", "text": "def matching_count(out_labels)\n (self.labels.collect {|e| e.tag}.uniq & out_labels.collect {|e| e.tag}.uniq).size\n end", "title": "" }, { "docid": "360cd0a67e8c83bdf0aa28ea158abd2b", "score": "0.6274691", "text": "def count_tag(module_matched, total)\r\n\t\t\"#{module_matched} out of #{total}\"\r\n\tend", "title": "" }, { "docid": "e77fad1e19118f5968418fb7707890bb", "score": "0.6270851", "text": "def term_count\n tag_names.size + wildcards.size + metatags.count { !_1.name.in?(UNLIMITED_METATAGS) }\n end", "title": "" }, { "docid": "f4d808b2849d628961ec48086a218944", "score": "0.6268643", "text": "def count_per_type()\n @counts = Hash.new 0\n\n @media.each do |f|\n @counts[f[1].type] += 1\n end\n end", "title": "" }, { "docid": "2133595ade30a5cc61d91eaf359380f7", "score": "0.62327695", "text": "def inventory_counts\n type_counts = ItemType.all.inject({}) do |types, it|\n types[it.name] = 0;\n types\n end\n\n type_counts.merge(Hash[items.item_types.aggregate(:name, :name.count)])\n end", "title": "" }, { "docid": "8607650d3049923038860654e2cdeb5b", "score": "0.6222052", "text": "def count_filtered_notams(filter) # 'red' or 'blue'\n self.notams.select do |notam|\n notam.filter_selected_in(filter)\n end.size\n end", "title": "" }, { "docid": "16dbbdb234176058a781804203559251", "score": "0.62101287", "text": "def count(types, query, options=nil)\n query = {'q' => query} if query.is_a?(String)\n get do |req|\n req.url \"#{@name}/#{types}/_count\", query\n req.body = options if options\n end\n end", "title": "" }, { "docid": "6ac5a4ae78609eba9fe730154c5e8435", "score": "0.6180939", "text": "def read_count \n \n count = 0\n \n self.each do |tag|\n count += tag.count\n end\n \n return count\n \n end", "title": "" }, { "docid": "b834bb3a4728cee37ec96fd9add532fa", "score": "0.61571676", "text": "def count(type, state)\n sum = 0\n @jiras.count { |j| next unless j.type == type && j.state == state; sum += 1 }\n sum\n end", "title": "" }, { "docid": "b2dd3ef44dfe65f805062fcc1978bbdc", "score": "0.61467725", "text": "def count_items(items)\n items.each_with_object({}) do |item, obj|\n sym = item.strip.downcase.to_sym\n raise 'Item not found' unless @products.has_key?(sym)\n\n obj[sym] = 1 + (obj[sym] || 0)\n end\n end", "title": "" }, { "docid": "3133fc9138afe1cdbeb86e4052bffe1a", "score": "0.61431915", "text": "def activity_type_count(labels, index)\n ((type = labels[index]).include? ' (') ? type.split(' ')[1].delete('()').to_i : 0\n end", "title": "" }, { "docid": "faae3c551e244ed527e5f22b85974f2d", "score": "0.61181027", "text": "def tags_count\n #is the flat count of tags\n @tag_group = Employee.send('by_' + params[:tags_type], :reduce => true, :group => true)\n respond_to do |format|\n format.json {render :json => @tag_group.to_json}\n end\n end", "title": "" }, { "docid": "dbfde828bc89b89565a8a44109158c76", "score": "0.6100678", "text": "def tag_count( tagged_tickets )\n\t\ttag_count_array = []\n\t\tticket_array = tagged_tickets\n\t\tticket_array.each do | ticket |\n\t\t\t count_exists = tag_count_exists?( ticket[ 'tag' ], tag_count_array )\n\t\t\tif count_exists[ 'exists' ]\n\t\t\t\ttag_count_array[ count_exists[ 'matched_index' ] ][ 'count' ] += 1\n\t\t\t\ttag_count_array[ count_exists[ 'matched_index' ] ][ 'ticket_ids' ] |= [ ticket[ 'id' ] ]\n\t\t\telse\n\t\t\t\tnew_tag_count = create_count_hash( ticket[ 'tag' ], ticket[ 'id' ])\n\t\t\t\ttag_count_array.push( new_tag_count )\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn tag_count_array\n\tend", "title": "" }, { "docid": "6776eea1309ee73035d96dbb4e3f23fe", "score": "0.6084556", "text": "def tag_counts\n Picture.tag_counts :conditions => ['pictures.gallery_id = ?', id]\n end", "title": "" }, { "docid": "6776eea1309ee73035d96dbb4e3f23fe", "score": "0.6084556", "text": "def tag_counts\n Picture.tag_counts :conditions => ['pictures.gallery_id = ?', id]\n end", "title": "" }, { "docid": "e657440e5c0e37f88336b661acbb1d2b", "score": "0.60830957", "text": "def hit_count(types, instance)\n \"#{hits_root(types, instance)}:hit_count\"\n end", "title": "" }, { "docid": "c0b4c97358525dfe473d4364aa58a0e5", "score": "0.6053498", "text": "def num_items\n\t\tnum = 0\n\t\tMEDIA_TYPES.each do |media|\n\t\t\tnum += self.send \"num_#{media}\"\n\t\tend\n\t\tnum\n\tend", "title": "" }, { "docid": "93cbca484a038f095ae55ad24f5fca26", "score": "0.6051931", "text": "def count\n Tagging.count(:package_id, :conditions => \"tag_id = #{self.id}\")\n end", "title": "" }, { "docid": "1ce0afc3e0eae47ffe6d34fb713dde2c", "score": "0.60382503", "text": "def badges_count_for_type(badge_type)\n self.badges.where(:badge_type => badge_type).count\n end", "title": "" }, { "docid": "92809261fb368012970734de5218617c", "score": "0.60240936", "text": "def count_bags_inside(bag_rules, bag_type)\n inside_bag_count = 0\n current_rules = bag_rules.select { |bag_rule| bag_rule.outside_bag_type == bag_type }\n\n if current_rules.length == 0\n return inside_bag_count\n end\n\n current_rules.map do |rule|\n # count the inside bags\n inside_bag_count = inside_bag_count + rule.inside_bag_count\n # count all the bags inside the inside bags\n inside_bag_count = inside_bag_count + rule.inside_bag_count * count_bags_inside(bag_rules, rule.inside_bag_type)\n end\n\n inside_bag_count\nend", "title": "" }, { "docid": "c3df9fd90256d1ce41c0be2073e0c0fa", "score": "0.60046124", "text": "def item_count(manifest = nil, **)\n related_items_count(manifest, :active)\n end", "title": "" }, { "docid": "c3b28761f3f701c82663a77fe1574448", "score": "0.60037947", "text": "def count_total_element(type, filter = {})\r\ncount = 0\r\nfilter_count = 0\r\nDir.glob(Rails.root.join('po', self.locale_code, '*.po')).each do |t|\r\n trans_file = \"#{File.basename(t)}_#{type}.yml\"\r\n my_file = Rails.root.join('po', self.locale_code, trans_file)\r\n self.po_to_yml if !File.exist? my_file\r\n translation ||= {}\r\n if File.exist? my_file\r\n translation[trans_file] = YAML.load(File.open(my_file, 'r'))\r\n translation.each do |file, fdata|\r\n count += fdata.keys.count\r\n fdata.each {|k, d|\r\n filter_count += 1 if filter && k =~ filter\r\n }\r\n end\r\n end\r\nend\r\ncount = \"#{filter_count.to_s} / #{count.to_s}\" if filter\r\nreturn count\r\nend", "title": "" }, { "docid": "5339f4070a9614c837976b574d4c3d8b", "score": "0.5999081", "text": "def count(tag = nil)\n files(tag).size\n end", "title": "" }, { "docid": "002b9688b6fb47d0f2a071a641cdcb50", "score": "0.59747183", "text": "def stats_for_entity_type ## retreive stats for an enitity\n tag_names = Tag.joins(entity_identifiers: :entity_type).where(\"entity_types.name = '#{tag_params['entity_type']}'\").pluck(:tag_name)\n tag_names = tag_names.each_with_object(Hash.new(0)) { |elem, result| result[elem] += 1 }\n render json: tag_names.each_with_object([]) { |(key, value), result| result << { tag: key, count: value } }\n end", "title": "" }, { "docid": "eb0a4df4f65fe1016cf8094653975f89", "score": "0.5961139", "text": "def count_tags\n\t\t# checking the setting media tags is there or not\n\t\tif current_user.setting\n\t\t\t# count the media tag count id more than 0\n\t\t\tif current_user.setting.media_tag_limit.to_i > 0\n\t\t\t\t# count limit for that media attachment tag\n\t\t\t\t@tag_count = current_user.setting.media_tag_limit.to_i\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "b58772fd98bc47d95af23de701d4f5e0", "score": "0.595135", "text": "def extract_items_counts\n items_counts = []\n extrac_data.each do |follower|\n items_counts << follower[@content_type].to_i\n end\n return items_counts\n end", "title": "" }, { "docid": "63efdd62a5feb970ff7d9d81174c8ee9", "score": "0.5949747", "text": "def sum_label_counts(type=false, ids = false)\n options = {:item_id => self.id}\n options.merge!(:type => type) if type\n options.merge!(:user_id => {'$in' => ids}) if ids\n \n count_array = self.labels.collection.group(['item_id'], options, {'count' => 0}, \"function(doc, prev) {prev.count += 1;}\")\n\t\t#~ count_array = []\n if count_array.length > 0\n #~ return count_array.first['count']\n #~ result = count_array.first['count'].scan(/.*](\\d)/)\n result = count_array.first['count'].to_s.split('.')\n\t\t\treturn (result.empty?)? 0 : result.flatten.first.to_f\n else\n \n return 0\n end\n end", "title": "" }, { "docid": "5bf9f0708f778b831fd084ca026ffaf6", "score": "0.59479797", "text": "def flag_in_count_for(type)\n flag_in_counts[type] || 0\n end", "title": "" }, { "docid": "911b49dc26e3a4f77e6c5ab990d3502e", "score": "0.5940853", "text": "def count_similar()\n \treturn Integer(@browser.fetch(\"_sahi._count(\\\"_#{@type}\\\", #{concat_identifiers(@identifiers).join(\", \")})\"))\n end", "title": "" }, { "docid": "9971406a8c9ae259aa56156efb62736a", "score": "0.5936472", "text": "def count_item_sets(item_sets)\n threaded_count(item_sets)\n end", "title": "" }, { "docid": "7bf30d2337b76704f4bb302951af628d", "score": "0.59305423", "text": "def all_tag_counts(options = {})\n options = options.dup\n options.assert_valid_keys :start_at, :end_at, :conditions, :at_least, :at_most, :order, :limit, :on, :id\n\n ## Generate conditions:\n options[:conditions] = sanitize_sql(options[:conditions]) if options[:conditions]\n\n ## Generate scope:\n tagging_scope = ActsAsTaggableOn::Tagging.select(\"#{ActsAsTaggableOn::Tagging.table_name}.tag_id, COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) AS tags_count\")\n tag_scope = ActsAsTaggableOn::Tag.select(\"#{ActsAsTaggableOn::Tag.table_name}.*, #{ActsAsTaggableOn::Tagging.table_name}.tags_count AS count\").order(options[:order]).limit(options[:limit])\n\n # Current model is STI descendant, so add type checking to the join condition\n unless descends_from_active_record?\n taggable_join = \"INNER JOIN #{table_name} ON #{table_name}.#{primary_key} = #{ActsAsTaggableOn::Tagging.table_name}.taggable_id\"\n taggable_join = taggable_join + \" AND #{table_name}.#{inheritance_column} = '#{name}'\"\n tagging_scope = tagging_scope.joins(taggable_join)\n end\n\n # Conditions\n tagging_conditions(options).each { |condition| tagging_scope = tagging_scope.where(condition) }\n tag_scope = tag_scope.where(options[:conditions])\n\n # GROUP BY and HAVING clauses:\n having = [\"COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) > 0\"]\n if options[:at_least]\n having.push sanitize_sql([\"COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) >= ?\",\n options.delete(:at_least)])\n end\n if options[:at_most]\n having.push sanitize_sql([\"COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) <= ?\",\n options.delete(:at_most)])\n end\n having = having.compact.join(' AND ')\n\n group_columns = \"#{ActsAsTaggableOn::Tagging.table_name}.tag_id\"\n\n unless options[:id]\n # Append the current scope to the scope, because we can't use scope(:find) in RoR 3.0 anymore:\n tagging_scope = generate_tagging_scope_in_clause(tagging_scope, table_name, primary_key)\n end\n\n tagging_scope = tagging_scope.group(group_columns).having(having)\n\n tag_scope_joins(tag_scope, tagging_scope)\n end", "title": "" }, { "docid": "f5dbf9421d0b854b23c997fda5a159fd", "score": "0.5906603", "text": "def asset_count(asset_type = nil) \n 0\n end", "title": "" }, { "docid": "faa2b09d8b4759a1e90ae4b6fb850eb7", "score": "0.590617", "text": "def type_count\n puts \"#Types count\"\n @endpoint_stats.each_key do |k|\n next if k==\"_all\"\n g = \"<#{URI.encode(k)}>\"\n @endpoint_stats[k]['types'].each_key do |t|\n type = \"<#{URI.encode(t)}>\"\n q = \"SELECT distinct $type $n $dn (str($label) AS $slabel) { GRAPH #{g} { SELECT $type (COUNT(DISTINCT $s) AS $dn) (COUNT($s) AS $n) {$s a $type . FILTER ($type=#{type})}} OPTIONAL {$type rdfs:label $label}}\"\n new_uri = @sparql_url+\"?query=#{q}&format=json\"\n req = @http.request_get(URI(new_uri))\n res = JSON.parse(req.body)\n res[\"results\"][\"bindings\"].each do |tpl|\n typek = tpl['type']['value']\n @endpoint_stats[k]['types'][typek]['count'] = tpl['n']['value'].to_i\n @endpoint_stats[k]['types'][typek]['distinct_count'] = tpl['dn']['value'].to_i\n if tpl.has_key? 'slabel'\n @endpoint_stats[k]['types'][typek]['label'] = tpl['slabel']['value']\n else\n @endpoint_stats[k]['types'][typek]['label'] = \"\"\n end\n end\n end\n puts \"\\t[#{k}]\"\n end\n end", "title": "" }, { "docid": "35958974a2e2eeea9c726eedf1829d87", "score": "0.58990437", "text": "def count(*args)\n all(*args).size\n end", "title": "" }, { "docid": "b1ba4ebd5ffc5bfbf0c153d4fe337a06", "score": "0.5896568", "text": "def count(options = {})\r\n options.stringify_keys!\r\n options.assert_valid_keys(*%W[type keyword])\r\n resp = connection.get(custom_method_collection_url(:count, options), headers)\r\n resp.body.to_i\r\n end", "title": "" }, { "docid": "6a42f3615099c10c4ca60ea4ed6cf62c", "score": "0.58929616", "text": "def count(type_uri)\n @data[type_uri].size\n end", "title": "" }, { "docid": "b07110753f3f1a0e412e76a9bea3dba4", "score": "0.5889817", "text": "def count_tags(rel)\n rel.select('*').\n select{count(~id).as(tags_count)}.\n group_by_all_columns.\n order(\"tags_count DESC\").\n isolate_group_by_as(self)\n end", "title": "" }, { "docid": "dbcad77305a28a0ebdc10f5fc888d830", "score": "0.5888945", "text": "def count_tags\n\t\t# checking the the scn tags is existed or not\n\t\tif devise_current_user.setting\n\t\t\t# Count the no of scn tag limit for the each question from setting\n\t\t\t@scn_tag_limit = devise_current_user.setting.scn_tag_limit.to_i\n\t\tend\n\tend", "title": "" }, { "docid": "4fe7557394ae6dfe948852dbcd07381a", "score": "0.5883836", "text": "def asset_type_counts(active_only=true)\n if active_only\n Asset.operational.where(:organization => self).group(:asset_type_id).count\n else\n Asset.where(:organization => self).group(:asset_type_id).count\n end\n end", "title": "" }, { "docid": "42e4137e20255b3d8713268ba42b00f3", "score": "0.5882569", "text": "def stop_types_count\n stops && stops.map(&:type).uniq.count\n end", "title": "" }, { "docid": "4deb6bc787c1781c8a04d7a1a259db4d", "score": "0.58820087", "text": "def countags\n render json: @tags.size, status: 200\n end", "title": "" }, { "docid": "41f79f72cdc32d3543280eff167e4480", "score": "0.58768475", "text": "def quantity_of_type(word_type)\n trains.count {|train| train.type == word_type}\n end", "title": "" }, { "docid": "41f79f72cdc32d3543280eff167e4480", "score": "0.58768475", "text": "def quantity_of_type(word_type)\n trains.count {|train| train.type == word_type}\n end", "title": "" }, { "docid": "fba6159aaa6a7564b1c0ad9254259883", "score": "0.58716875", "text": "def matched_count\n results.map(&:matched_count).reduce(&:+)\n end", "title": "" }, { "docid": "98afb2a4576f2b37a7bb311e5711bcee", "score": "0.5861584", "text": "def find_options_for_tag_counts(options = {})\n options.assert_valid_keys :start_at, :end_at, :conditions, :at_least, :at_most, :order, :limit, :on\n \n scope = scope(:find)\n start_at = sanitize_sql([\"#{Tagging.table_name}.created_at >= ?\", options.delete(:start_at)]) if options[:start_at]\n end_at = sanitize_sql([\"#{Tagging.table_name}.created_at <= ?\", options.delete(:end_at)]) if options[:end_at]\n\n type_and_context = \"#{Tagging.table_name}.taggable_type = #{quote_value(base_class.name)}\"\n \n conditions = [\n type_and_context,\n options[:conditions],\n scope && scope[:conditions],\n start_at,\n end_at\n ]\n \n conditions = conditions.compact.join(' AND ')\n\n joins = [\"LEFT OUTER JOIN #{Tagging.table_name} ON #{Tag.table_name}.id = #{Tagging.table_name}.tag_id\"]\n joins << sanitize_sql([\"AND #{Tagging.table_name}.context = ?\",options.delete(:on).to_s]) unless options[:on].nil?\n joins << \"LEFT OUTER JOIN #{table_name} ON #{table_name}.#{primary_key} = #{Tagging.table_name}.taggable_id\"\n joins << scope[:joins] if scope && scope[:joins]\n\n at_least = sanitize_sql(['COUNT(*) >= ?', options.delete(:at_least)]) if options[:at_least]\n at_most = sanitize_sql(['COUNT(*) <= ?', options.delete(:at_most)]) if options[:at_most]\n having = [at_least, at_most].compact.join(' AND ')\n group_by = \"#{Tag.table_name}.id, #{Tag.table_name}.name HAVING COUNT(*) > 0\"\n group_by << \" AND #{having}\" unless having.blank?\n\n { :select => \"#{Tag.table_name}.id, #{Tag.table_name}.name, COUNT(*) AS count\", \n :joins => joins.join(\" \"),\n :conditions => conditions,\n :group => group_by\n }.update(options)\n end", "title": "" }, { "docid": "e00824f64e89c633150c84a61f9c3160", "score": "0.586007", "text": "def ok_count\n my_count = 0\n @my_results['ok'].each do |_code, contexts|\n contexts.each do |_context, description|\n my_count += description.size\n end\n end\n my_count\n end", "title": "" }, { "docid": "ceb03a50055b815d56fda78154582cbc", "score": "0.5855316", "text": "def tags\n counts = {}\n\n files.map do |file|\n Post.new(file).tags.each do |tag|\n counts[tag] ||= 0\n counts[tag] += 1\n end\n end\n\n return counts\n end", "title": "" }, { "docid": "b14b6bdccb2f3b68ff313665f3b13eed", "score": "0.5853625", "text": "def count\n search_results.values.collect(&:size).sum\n end", "title": "" }, { "docid": "b59d9ebe494061e3651425063ea960ab", "score": "0.5849242", "text": "def count_occurrences(vehicles)\n puts \"car => #{vehicles.count(\"car\")}\"\n puts \"SUV => #{vehicles.count(\"SUV\")}\"\n puts \"truck => #{vehicles.count(\"truck\")}\"\n puts \"motorcycle => #{vehicles.count(\"motorcycle\")}\"\nend", "title": "" }, { "docid": "421a2a02a799985a289e9fbf2c602f9a", "score": "0.58460367", "text": "def tag_list_count\n\t\t\terrors[:tag_list] << \"10 tags maximum\" if tag_list.count > 13\n\t\tend", "title": "" }, { "docid": "91985c3202e33d4082d8cb9d728e6a33", "score": "0.5845651", "text": "def test_array_should_count_for_items\n a1 = [1,2,3]\n \n assert_equal a1.count_for(1), 1\n \n a2 = %w(a a b c)\n assert_equal a2.count_for(\"a\"), 2\n \n a3 = %w(a b c)\n assert_equal a3.count_for(\"x\"), 0\n \n a4 = [1,:a, nil]\n assert_equal a4.count_for(nil), 1\n end", "title": "" }, { "docid": "4bcd6bc1d88de4cb3907a9c2eeb68c8d", "score": "0.5834852", "text": "def subtags_count\n to_s.count(HYPHEN) + 1\n end", "title": "" }, { "docid": "ecd7a3b41a44290f011094860b284d32", "score": "0.5833307", "text": "def category_item_count(category)\n c = category.is_a?(EquipmentCategory) ? category : EquipmentCategory.find(category)\n c.as_same_category? ? equipments.in_as_same_category(c.as_same_category).size : equipments.in_category(c).size \n end", "title": "" }, { "docid": "11c4f346523c4321e184cadc63fd5a74", "score": "0.58242697", "text": "def hit_count(tag_relation, session_id)\n\t\tTag.where(:session_id => session_id).where(:status => true).count\n\tend", "title": "" }, { "docid": "39e0b3210945d55b28ab3827e1710708", "score": "0.5822042", "text": "def find_options_for_tag_counts(options = {})\n options.assert_valid_keys :start_at, :end_at, :conditions, :at_least, :at_most, :order, :limit, :on\n\n scope = scope(:find)\n start_at = sanitize_sql([\"#{Tagging.table_name}.created_at >= ?\", options.delete(:start_at)]) if options[:start_at]\n end_at = sanitize_sql([\"#{Tagging.table_name}.created_at <= ?\", options.delete(:end_at)]) if options[:end_at]\n \n type_and_context = \"#{Tagging.table_name}.taggable_type = #{quote_value(base_class.name)}\"\n type_and_context << sanitize_sql([\"AND #{Tagging.table_name}.context = ?\", options.delete(:on).to_s]) unless options[:on].nil?\n \n conditions = [\n type_and_context,\n start_at,\n end_at\n ]\n\n conditions = conditions.compact.join(' AND ')\n conditions = merge_conditions(conditions, options.delete(:conditions)) if options[:conditions]\n conditions = merge_conditions(conditions, scope[:conditions]) if scope\n\n joins = [\"LEFT OUTER JOIN #{table_name} ON #{table_name}.#{primary_key} = #{Tagging.table_name}.taggable_id\"]\n joins << scope[:joins] if scope && scope[:joins]\n\n at_least = sanitize_sql(['COUNT(*) >= ?', options.delete(:at_least)]) if options[:at_least]\n at_most = sanitize_sql(['COUNT(*) <= ?', options.delete(:at_most)]) if options[:at_most]\n having = [at_least, at_most].compact.join(' AND ')\n \n # note that it makes sense here to group by both (and allow both to \n # be selected) since we're enforcing that tags that normalize to the\n # same thing can't exist. this means there will never be a case when\n # one normalized tag has multiple non-normalized representations,\n # meaning we still have a proper set when grouping by either column\n group_by = \"#{Tagging.table_name}.normalized, #{Tagging.table_name}.tag HAVING COUNT(*) > 0\"\n group_by << \" AND #{having}\" unless having.blank?\n \n { :select => \"#{Tagging.table_name}.tag, COUNT(*) AS count\",\n :joins => joins.join(\" \"),\n :conditions => conditions,\n :group => group_by\n }.update(options)\n end", "title": "" }, { "docid": "238820f531c69110c138539eb22c6b4d", "score": "0.5821841", "text": "def total\n sum = 0\n @keywords_for_tag.each_key {|key|\n sum += @keywords_for_tag[key].count\n }\n sum\n end", "title": "" } ]
aad1eeb63047cf9684e1d7d6428de4e4
POST /guild/officers POST /guild/officers.json
[ { "docid": "a24702d58ad050e84defd1ddcd99679a", "score": "0.64992154", "text": "def create\n\t\t@guild_officer = GuildLinkOfficer.new(guild_officer_params)\n\t\t@guild_officer.guild = @guild\n\n\t\trespond_to do |format|\n\t\t\tif @guild_officer.save\n\t\t\t\tback_page = guild_officers_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Officer was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_officer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "6ee6e39dec2571ea83653b491aebcd10", "score": "0.61897254", "text": "def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "title": "" }, { "docid": "8724de5f66eeab5b1966cdd679485ed8", "score": "0.60974306", "text": "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render json: @officer, status: :created, location: @officer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc433db5596da183238cc6cdedfff114", "score": "0.6034867", "text": "def create\n @officer = Officer.new(officer_params)\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render :show, status: :created, location: @officer }\n else\n format.html { render :new }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6d5b13609007bfebdd8ef2054db3704", "score": "0.5576699", "text": "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n temp_password = SecureRandom.hex\n @officer.change_password temp_password\n UserMailer.creation_notice(@officer, temp_password).deliver\n format.html { redirect_to @officer, \\\n :notice => \"Officer was successfully created. An e-mail has been sent to #{@officer.email}.\" }\n format.json { render :json => @officer, :status => :created, :location => @officer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68408a3b4c12c613ea53f1bd3a33cccf", "score": "0.54887223", "text": "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "534cd9de98f3612438ee629acb7174dc", "score": "0.5481236", "text": "def index\n\t\t@guild_officers = @guild.officers.where.not(id: @guild.owner.id)\n\tend", "title": "" }, { "docid": "9ee0c24182c77b3ced7c0a3b7bec69a5", "score": "0.542145", "text": "def create\n @kickoff = Kickoff.new(params[:kickoff])\n\n respond_to do |format|\n if @kickoff.save\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully created.' }\n format.json { render json: @kickoff, status: :created, location: @kickoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "277b8d1f57d6e8fd178eb2a2dabf60be", "score": "0.540394", "text": "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n flash[:notice] = 'Officer was successfully created.'\n format.html { redirect_to(@officer) }\n format.xml { render :xml => @officer, :status => :created, :location => @officer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e495ecfe1efae24e2205374c0f13a58b", "score": "0.53712153", "text": "def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end", "title": "" }, { "docid": "0d0baea561f11a63dde75d97ee130949", "score": "0.53456926", "text": "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @officer }\n end\n end", "title": "" }, { "docid": "10c05508ba6210ef060cd91c5c5642e3", "score": "0.5334831", "text": "def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end", "title": "" }, { "docid": "a490847c283c14be9b87aad933eeddc0", "score": "0.53335637", "text": "def create\n user = User.initialize_user(params[:email])\n\n @officer = Officer.new(name: params[:name], surname: params[:surname], user: user)\n\n if @officer.save\n otp = Devise.friendly_token(20)\n user.update(password: otp)\n OfficerMailer.with(user: user, current_pass: otp).credential_mail.deliver_now\n respond_to do |format|\n format.js\n format.html { redirect_to administrator_add_user_url(current_user.administrator.id), notice: 'Officer successfully created'}\n end\n else\n format.html { redirect_to administrator_add_user_url(current_user.administrator.id), alert: @officer.print_pretty_errors}\n end\n end", "title": "" }, { "docid": "084cce3bb7e9c7488b97aa865b11fbe5", "score": "0.5331863", "text": "def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end", "title": "" }, { "docid": "c9f1b919d923116fa1f0ad9611815b57", "score": "0.5292277", "text": "def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "280f1cec73d524fb47874c4734bd5756", "score": "0.5290336", "text": "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @officer }\n end\n end", "title": "" }, { "docid": "cc6e9634fe63375431a776a53d3ee982", "score": "0.52806205", "text": "def guild_officer_params\n\t\t\tparams.require(:guild_officer).permit(:user_id)\n\t\tend", "title": "" }, { "docid": "b589a58e1627a2339fd22816471b0c37", "score": "0.5274173", "text": "def create\n @face_off = FaceOff.new(face_off_params)\n\n respond_to do |format|\n if @face_off.save\n format.json { render json: @face_off, status: :created }\n else\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb4f4549676f82ec5f7517311bba2303", "score": "0.52179706", "text": "def destroy\n\t\[email protected](params[:id])\n\t\trespond_to do |format|\n\t\t\tback_page = guild_officers_url\n\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\tformat.html { redirect_to back_page, notice: 'Officer was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "fa2c5ca4f3cd8dbbd9361e4dbb031e14", "score": "0.51821625", "text": "def create\n @fighter = Fighter.new(fighter_params)\n\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to admin_fighters_path, notice: 'Fighter was successfully created.' }\n format.json { head :ok }\n else\n format.html { render :new }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e0f9ceb9a25109d0795f47a26133dc9", "score": "0.5163255", "text": "def create\n @attendee = Attendee.new(attendee_params)\n\n respond_to do |format|\n if @attendee.save\n format.json { render json: @attendee.to_json, status: :created }\n else\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "883a1c7df8781fb205bf1b5c416fb59f", "score": "0.5144257", "text": "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "title": "" }, { "docid": "100e943fffe26b0bcf12961ddabfd8db", "score": "0.51366574", "text": "def create\n @job_offer.owner = current_administrator\n unless current_administrator.bant?\n @job_offer.employer = current_administrator.employer\n end\n @job_offer.job_offer_actors.each{|job_offer_actor|\n if job_offer_actor.administrator\n job_offer_actor.administrator.inviter ||= current_administrator\n end\n }\n\n respond_to do |format|\n if @job_offer.save\n format.html { redirect_to [:admin, :job_offers], notice: t('.success') }\n format.json { render :show, status: :created, location: @job_offer }\n else\n format.html { render :new }\n format.json { render json: @job_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7612e20f6db064f1538c4e327c4fd60", "score": "0.51140404", "text": "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2986dffdaea0ec59ee532818fc352edf", "score": "0.510572", "text": "def index\n @officers = Officer.all\n end", "title": "" }, { "docid": "2986dffdaea0ec59ee532818fc352edf", "score": "0.510572", "text": "def index\n @officers = Officer.all\n end", "title": "" }, { "docid": "f07d21256d66a3973fac904d73788dcb", "score": "0.50679964", "text": "def create\n @offer = current_user.offers.build(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Oferta utworzona pomyślnie.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c740e80136fe368db73a231b45b14d2b", "score": "0.50645614", "text": "def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n cookies[:auth_token] = @hacker.auth_token\n @hacker.create_initial_data\n Notifier.account_created(@hacker).deliver\n format.html { redirect_to entries_url, notice: \"Hacker #{@hacker.email} was successfully created.\" }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "760cbad2330d3277d108a1f437a1f01a", "score": "0.5063558", "text": "def create\n @auto_offer = AutoOffer.new(auto_offer_params)\n\n respond_to do |format|\n if @auto_offer.save\n format.html { redirect_to offers_path, notice: 'Auto offers ware successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf6a8e20bc6afcee8404f76ad9bdd540", "score": "0.50394315", "text": "def create\n #@fighter = Fighter.new(fighter_params)\n \n # create fighter under the curent users fighters - we may want to undo this\n # for the future so they we can display a list of all the fighters\n @fighter = current_user.fighters.build(fighter_params)\n\n\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e3b2c089c2831b8d3a511a021f9d3ba", "score": "0.50155085", "text": "def create\n @trainer = Trainer.new(params[:trainer])\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, :notice => 'Trainer was successfully created.' }\n format.json { render :json => @trainer, :status => :created, :location => @trainer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d6436452da2d1dbc603f8499d28ff3", "score": "0.49944994", "text": "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "title": "" }, { "docid": "41dfaa2897c1b4d06292331577e06a34", "score": "0.49937588", "text": "def create\n @attendee = Attendee.new(params[:attendee])\n\n respond_to do |format|\n if @attendee.save\n format.html { redirect_to attendees_path, flash: { success: \"#{@attendee.name} was successfully created.\" } }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5773e088a0ef9d80c2f4d35cbfcd41ef", "score": "0.49792796", "text": "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "title": "" }, { "docid": "0e1358ffc1c5e9b81dc2e467994caa04", "score": "0.49740732", "text": "def partners\n end", "title": "" }, { "docid": "6cb84785a80ff70c5a1313e07466a152", "score": "0.49681056", "text": "def create\n @fornecedor = Fornecedor.new(fornecedor_params)\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.save # TODO: deal with validates errors messages\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @fornecedor }\n else\n format.html { render :new, error: 'Erro.' }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5b6398449d5a851b1692d470b0a9344", "score": "0.4966206", "text": "def officer_params\n params.require(:officer).permit(:name, :email, :description, :image)\n end", "title": "" }, { "docid": "52efd4a95d1dbe6477a8b06e492288d0", "score": "0.49593544", "text": "def create\n @trafficofficer = Trafficofficer.new(trafficofficer_params)\n\n respond_to do |format|\n if @trafficofficer.save\n format.html { redirect_to @trafficofficer, notice: 'Trafficofficer was successfully created.' }\n format.json { render :show, status: :created, location: @trafficofficer }\n else\n format.html { render :new }\n format.json { render json: @trafficofficer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbf4804faf8c853bfbb8d27913d30cc1", "score": "0.4956178", "text": "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4e4aeabf30b773739584740361e20a0", "score": "0.49533677", "text": "def create\n @trainer = Trainer.new(params[:trainer])\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render json: @trainer, status: :created, location: @trainer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "665bb716a9b846cffe2b68397a2a244e", "score": "0.49436393", "text": "def create\n @telefone_fornecedor = TelefoneFornecedor.new(telefone_fornecedor_params)\n\n respond_to do |format|\n if @telefone_fornecedor.save\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_fornecedor }\n else\n format.html { render :new }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b59663963d56782c8ab23ac6c5263e5", "score": "0.4942825", "text": "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5de5f6041ea80f3ed4ca5a1258812c79", "score": "0.49328575", "text": "def offices\n \n end", "title": "" }, { "docid": "67bdc3c814ed08d2f5c1ccd5dfb6a392", "score": "0.49301338", "text": "def create\n @zone_updater = ZoneUpdater.new(params[:zone_updater])\n\n respond_to do |format|\n if @zone_updater.save\n format.html { redirect_to @zone_updater, notice: 'Zone updater was successfully created.' }\n format.json { render json: @zone_updater, status: :created, location: @zone_updater }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone_updater.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5cc99c61046ba322931bab0b86cec81f", "score": "0.4924654", "text": "def create\n @raffle = Raffle.new(raffle_params)\n @raffle.collected_money = 0\n respond_to do |format|\n if @raffle.save\n for follower in @raffle.user.followers\n notification = Notification.new()\n notification.content = \"#{@raffle.user.name} just released the raffle #{@raffle.name}\"\n notification.user_id = follower.id\n notification.raffle_id = @raffle.id\n notification.save\n end\n format.html { redirect_to @raffle, notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbba4c4ce25bfbf13cad5c91d83174f6", "score": "0.49033087", "text": "def create\n inc_id = 1\n unless @event.attendees.blank?\n inc_id = @event.attendees.last.attendee_id.gsub(@event.token_for_id, \"\").to_i + 1\n end\n params[:attendee][:attendee_id] = @event.token_for_id + \"%04d\" % inc_id\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join(\";\") unless params[:attendee][:a_platform].nil?\n params[:attendee][:a_market_segment] = params[:attendee][:a_market_segment].join(\";\") unless params[:attendee][:a_market_segment].nil?\n params[:attendee][:confirmation_token] = Array.new(10) {[*'0'..'9', *'a'..'z'].sample}.join\n params[:attendee][:a_sector] = \"N/A\"\n params[:attendee][:e_ext_number] = 0\n params[:attendee][:e_lada] = 0\n params[:attendee][:e_zip_code] = \"N/A\"\n @attendee = Attendee.new(params[:attendee])\n \n respond_to do |format|\n if @attendee.save\n #AttendeeMailer.welcome_email(@attendee).deliver!\n format.html { redirect_to @attendee, notice: t(:successfully_created) }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3807bd2b456f061697f909f3792badd", "score": "0.48990747", "text": "def create\n @dayoff = Dayoff.new(params[:dayoff])\n\n respond_to do |format|\n if @dayoff.save\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully created.' }\n format.json { render json: @dayoff, status: :created, location: @dayoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46f59c82e2bd7f0fe2ed0e72fb2c9b47", "score": "0.48978075", "text": "def create\n @attendee = Attendee.new(attendee_params)\n\n if @attendee.save\n render :status => 200,\n :json => { :success => true,\n :info => \"Attendee Created\",\n :data => {} }\n else\n render :status => :unprocessable_entity,\n :json => { :success => false,\n :info => resource.errors,\n :data => {} }\n end\n end", "title": "" }, { "docid": "85bfc2277d03343d04bf710a40ac9706", "score": "0.48976898", "text": "def create\n @offer = Offer.new(params[:offer])\n \n respond_to do |format|\n if @offer.save\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0462505cb63acea3699d26fa9d33593c", "score": "0.4884215", "text": "def create\n @attendee = Attendee.new(attendee_params)\n\n respond_to do |format|\n if @attendee.save\n format.html { redirect_to @attendee, :notice => 'Attendee was successfully created.' }\n format.json { render :json => @attendee, :status => :created, :location => @attendee }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attendee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "702db175eb7ded0d0519eb327585a7eb", "score": "0.48739883", "text": "def create\n @offender = Offender.new(params[:offender])\n\n respond_to do |format|\n if @offender.save\n flash[:notice] = 'Offender was successfully created.'\n format.mobile { redirect_to(admin_offender_path(@offender)) }\n format.html { redirect_to(admin_offender_path(@offender)) }\n format.xml { render :xml => @offender, :status => :created, :location => @offender }\n else\n format.mobile{ render :action => \"new\" }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offender.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88b8a29ff695baeeb57b430af7e37ddd", "score": "0.48694277", "text": "def create\n @officer = Officer.create(officer_params)\n # this attaches images when clicked to upload\n @officer.image.attach(officer_params[:image])\n\n if @officer.save\n redirect_to officers_path\n else\n render :new\n end\n end", "title": "" }, { "docid": "5099f066e83a91872e848e75231593eb", "score": "0.4867506", "text": "def create\n @requester = Requester.new(requester_params)\n\n respond_to do |format|\n if @requester.save\n format.html { redirect_to @requester, notice: 'Requester was successfully created.' }\n format.json { render :show, status: :created, location: @requester }\n else\n format.html { render :new }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b1596274842fffc811de7a4c7eade08", "score": "0.48635462", "text": "def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "282a43234cd399a4b7c4a2368825c59b", "score": "0.48620364", "text": "def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e4513a981f4d5f6ab0ad9d3b3fe2f5f7", "score": "0.48552284", "text": "def create\n\n @intervention = Intervention.new(intervention_params)\n @intervention.author_id = current_user.employee.id\n\n zendesk_ticket_intervention(@intervention)\n\n respond_to do |format|\n if @intervention.save\n format.html { redirect_to @intervention, notice: 'Intervention was successfully created.' }\n format.json { render :show, status: :created, location: @intervention }\n else\n format.html { render :new }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc5378fa6c2e1da33e42eda70305010f", "score": "0.4855041", "text": "def create\n @trainer = Trainer.new(trainer_params)\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render :show, status: :created, location: @trainer }\n else\n format.html { render :new }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc5378fa6c2e1da33e42eda70305010f", "score": "0.4855041", "text": "def create\n @trainer = Trainer.new(trainer_params)\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render :show, status: :created, location: @trainer }\n else\n format.html { render :new }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "337acde9a51936190e723b125706417e", "score": "0.48509437", "text": "def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: \"Retailer was successfully created.\" }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entry }\n end\n end\n end", "title": "" }, { "docid": "16dd78cca11c5d256cd08cb82e034373", "score": "0.48436368", "text": "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "098be7c020fc5b6e8ea62500709cbdae", "score": "0.4842479", "text": "def create\n @auction = Auction.new(auction_params)\n @auctioneer = @auction.auctioneers.build \n @auctioneer.user_id = current_user.id\n respond_to do |format|\n if @auction.save && @auctioneer.save\n Notifier.welcome(current_user.email).deliver\n format.html { redirect_to @auction, notice: 'Auction was successfully created.' }\n format.json { render :show, status: :created, location: @auction }\n else\n format.html { render :new }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f02fcc5aafdbb0d8a48444f54af180c6", "score": "0.48410276", "text": "def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67f2e0d3390966742694b2ef3e8cef76", "score": "0.48298213", "text": "def index\n if params[:name].present?\n @json = Punk::API.beers_name!(params[:name])\n elsif params[:abv_gt].present?\n @json = Punk::API.beers_abv_gt!(params[:abv_gt])\n elsif params[:abv_lt].present?\n @json = Punk::API.beers_abv_lt!(params[:abv_lt])\n else\n @json = Punk::API.all_beers!(params)\n end\n\n render json: {\n beers: @json\n }\n create(@json)\n end", "title": "" }, { "docid": "6b0a0d6213d769f4e85a70fe8e60322c", "score": "0.48252466", "text": "def create\n # @retailer = Retailer.new(params[:retailer])\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6878bed403d2116473364abfc907c84b", "score": "0.4820274", "text": "def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bcc2ba0c2d2df1c9ef9fe1f78a5645e", "score": "0.4819788", "text": "def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save\n\t\[email protected]_notification\n\t\[email protected]\n\n format.html { redirect_to offers_path(:playerid => current_player.playerid)}\n\t\t#offer_path(@offer, :playerid=> current_player.playerid), notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbd5063ef0a77374af43614df86f6b5b", "score": "0.48130873", "text": "def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96d77886ed23f18f9d9a08ef9a978f91", "score": "0.48128447", "text": "def create\n @offerte_regel = OfferteRegel.new(offerte_regel_params)\n\n respond_to do |format|\n if @offerte_regel.save\n format.html { redirect_to @offerte_regel, notice: 'Offerte regel was successfully created.' }\n format.json { render :show, status: :created, location: @offerte_regel }\n else\n format.html { render :new }\n format.json { render json: @offerte_regel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b6f07addbc4e23261ea8e95232eeb86", "score": "0.48115152", "text": "def create\n @users = User.all\n\n @event = current_user.events.build(event_params.except(:invites))\n\n respond_to do |format|\n if @event.save\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\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", "title": "" }, { "docid": "387e0055c200ef944ea382755f59db4c", "score": "0.48093593", "text": "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34822ad4f503cb85240bc589bdf19def", "score": "0.48093432", "text": "def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend", "title": "" }, { "docid": "b6d8648388b2b572724d45e0fcb8f8b9", "score": "0.48085025", "text": "def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d009a52b24507803d1246bb2e776682", "score": "0.4808366", "text": "def create\n @loan_officer = LoanOfficer.new(loan_officer_params)\n\n respond_to do |format|\n if @loan_officer.save\n format.html { redirect_to @loan_officer, notice: 'Loan officer was successfully created.' }\n format.json { render :show, status: :created, location: @loan_officer }\n else\n format.html { render :new }\n format.json { render json: @loan_officer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58413cd1002d248f074b6bd4c0dbed17", "score": "0.48058495", "text": "def create\r\n p intervention_params\r\n @intervention = Intervention.new(intervention_params)\r\n\r\n @intervention.status = \"Pending\"\r\n\r\n @intervention.author_id = session[:author_id]\r\n @the_author = Employee.find(session[:author_id])\r\n @the_employee = User.find(params[:employee_id])\r\n\r\n \r\n # @intervention. = params[:current_employee]\r\n logger.info(intervention_params)\r\n\r\n# --------------------------------- ZENDESK ----------------------------------\r\n# --------------------------------- ZENDESK ----------------------------------\r\nputs \"this is the employee id #{params[:employee_id]}\"\r\n\r\n\r\nZendeskAPI::Ticket.create!($client,\r\n :priority => \"low\",\r\n :subject => \"#{@intervention.author_id} from #{@the_employee.first_name}\",\r\n\r\n\r\n :comment => { :body => \"The Author is : #{@the_author.first_name} \r\nclient is : #{@intervention.customer.company_name}\r\ncustomer ID is : #{@intervention.customer_id}\r\nbuilding ID is : #{@intervention.building_id} \r\nBattery ID is : #{@intervention.battery_id} \r\nColumn ID is : #{@intervention.column_id} \r\nElevator ID (if specified) is : #{@intervention.elevator_id} \r\nEmployee (if specified) is : #{@the_employee.first_name}\r\nDescription of report : #{@intervention.report}\"}\r\n\r\n)\r\n\r\n# --------------------------------- ZENDESK ----------------------------------\r\n# --------------------------------- ZENDESK ----------------------------------\r\n\r\n\r\n respond_to do |format|\r\n if @intervention.save\r\n format.html { redirect_to @intervention, notice: 'Intervention was successfully created.' }\r\n format.json { render :show, status: :created, location: @intervention }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "b46299db4225e7b73ff1bd3dacecffe2", "score": "0.48036367", "text": "def create\n\t\t@owner = Prover.find(params[:owner])\n\t\[email protected](Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "7a5b19fb254a4eadea94ea02fc5fdde9", "score": "0.47943535", "text": "def create\n @fighter = Fighter.new(fighter_params)\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14532682750a6ac47291275b19f71743", "score": "0.4794339", "text": "def create (attendee)\n\n # respond_to do |format|\n\n # Sends email to user when user is created.\n ItineraryMailer.sample_email(attendee).deliver_now\n\n\n # format.html { redirect_to attendee, notice: 'Attendee was successfully created.' }\n # format.json { render :show, status: :created, location: attendee }\n # else\n # format.html { render :new }\n # format.json { render json: @attendee.errors, status: :unprocessable_entity }\n # end\n end", "title": "" }, { "docid": "617d80ee04803e552497eec393c35293", "score": "0.47914872", "text": "def create\n @add_on = @game.add_ons.new(add_on_params)\n\n respond_to do |format|\n if @add_on.save\n format.html { redirect_to @game, notice: 'Add on was successfully created.' }\n format.json { render :show, status: :created, location: @add_on }\n else\n format.html { render :new }\n format.json { render json: @add_on.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5d9d360f055d7068f555eaf5c5965ca", "score": "0.47896764", "text": "def create\n @dockerserver = Dockerserver.new(dockerserver_params)\n\n respond_to do |format|\n if @dockerserver.save\n format.html { redirect_to @dockerserver, notice: 'Dockerserver was successfully created.' }\n format.json { render :show, status: :created, location: @dockerserver }\n else\n format.html { render :new }\n format.json { render json: @dockerserver.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "177c6ee065c3dee71586f8fe84f8f415", "score": "0.47875187", "text": "def create\n @employer = Employer.new(employer_params)\n\n respond_to do |format|\n if @employer.save\n UserNotifier.send_signup_email(@employer).deliver\n format.html { redirect_to @employer, notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.4786322", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "47e77040a50430441b901dc0a9ea0210", "score": "0.47847345", "text": "def officer_params\n params.require(:officer).permit(:first_name, :last_name, :rank, :ssn, :active, :unit_id)\n end", "title": "" }, { "docid": "9a1bdc6049868dab275a7cf1842e52bb", "score": "0.4781717", "text": "def create\n @edrife = Edrive.new(edrife_params)\n\n respond_to do |format|\n if @edrife.save\n format.html { redirect_to @edrife, notice: 'Edrive was successfully created.' }\n format.json { render :show, status: :created, location: @edrife }\n else\n format.html { render :new }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b36ba93a395464c56cdca63200b0955c", "score": "0.4780438", "text": "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officer }\n end\n end", "title": "" }, { "docid": "470d6df7dfccadda13b8e25c4d549edd", "score": "0.47755852", "text": "def create\n @cliente = Cliente.new(cliente_params)\n\n respond_to do |format|\n if @cliente.save\n #--ADICIONADO\n if params[:cliente][:perfil_ids]\n \t\t params[:cliente][:perfil_ids].each do |ss|\n \t\t\t @cliente.perfilclientes.create(:cliente_id => @cliente.id, :perfil_id => ss)\n \t\t end\n end\n #--ADICIONADO\n format.html { redirect_to clientes_url, notice: 'Cliente criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @cliente }\n else\n format.html { render action: 'new' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8047b42db62c6e41a28dde569f408a0b", "score": "0.47729468", "text": "def create\n megam_rest.post_appdefn(to_hash)\n end", "title": "" }, { "docid": "1662aa01a27de40a2c0020583d471dec", "score": "0.47725913", "text": "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "title": "" }, { "docid": "b516cdf4ae5e4f86f827d3f90c051c79", "score": "0.47700682", "text": "def set_officer\n @officer = Officer.find(params[:id])\n end", "title": "" }, { "docid": "b516cdf4ae5e4f86f827d3f90c051c79", "score": "0.47700682", "text": "def set_officer\n @officer = Officer.find(params[:id])\n end", "title": "" }, { "docid": "b516cdf4ae5e4f86f827d3f90c051c79", "score": "0.47700682", "text": "def set_officer\n @officer = Officer.find(params[:id])\n end", "title": "" }, { "docid": "0ee50e095d46fc955c4ddd0c3ca89c85", "score": "0.47677782", "text": "def users(name, args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&name#{name}\"\n path = __method__.to_s\n http_post(path, query)\n end", "title": "" }, { "docid": "f63fa2f960c138711214dddfcfb6af1e", "score": "0.4766229", "text": "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e5fb03977925d50487ed17f60e9cc323", "score": "0.47657445", "text": "def create_voted_beer\n render json: BreweryDb::CreateVotedbeer.new(params[:beerId]).create\n end", "title": "" }, { "docid": "49ec9bbc7ef18296c582e56e65a61d00", "score": "0.47655255", "text": "def create\n @assigner = Assigner.new(assigner_params)\n\n respond_to do |format|\n if @assigner.save\n format.html { redirect_to @assigner, notice: 'Assigner was successfully created.' }\n format.json { render :show, status: :created, location: @assigner }\n else\n format.html { render :new }\n format.json { render json: @assigner.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "120e8c68f25f82190b672095faba7bf8", "score": "0.47641894", "text": "def create_intervention_ticket\n client = ZendeskAPI::Client.new do |config|\n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n \n ZendeskAPI::Ticket.create!(client, \n :subject => \"Building: #{@intervention.building_id} requires intervention\", \n :comment => { \n :value => \n \"The Requester: #{Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name }\n The Customer (Company Name): #{@intervention.customer.company_name}\\n\n Building ID: #{@intervention.building_id}\\n\n Battery ID: #{params[:battery]}\\n\n Column ID: #{if (params[:column] == \"None\") then \"\" else params[:column] end} \n Elevators ID: #{if (params[:elevator] == \"None\" ) then \"\" else params[:elevator] end}\n #{if (@intervention.employee_id) then \"The employee to be assigned to the task: #{@intervention.employee.first_name} #{@intervention.employee.last_name}\" end}\n \n Description:#{@intervention.report}\"\n }, \n :requester => { \n \"name\": Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name \n },\n \n :type => \"problem\",\n :priority => \"normal\"\n )\n end", "title": "" }, { "docid": "059fa884b6ca6c0197cc93872c1ce551", "score": "0.4761492", "text": "def create\n @drop_off = DropOff.new(drop_off_params)\n @drop_off.user = current_user\n\n respond_to do |format|\n if @drop_off.save\n format.html { redirect_to calendar_index_path, notice: 'Drop off was successfully created.' }\n format.json { render :show, status: :created, location: @drop_off }\n else\n format.html { render :new }\n format.json { render json: @drop_off.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ffbbbf6c58001f509a932d594c2e067", "score": "0.4759725", "text": "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "title": "" }, { "docid": "bb0bdc750e22e4d3a6c2106c25c35c19", "score": "0.47596905", "text": "def create\n @hero_seeker = HeroSeeker.new(hero_seeker_params)\n\n respond_to do |format|\n if @hero_seeker.save\n format.html { redirect_to @hero_seeker, notice: 'Hero seeker was successfully created.' }\n format.json { render :show, status: :created, location: @hero_seeker }\n else\n format.html { render :new }\n format.json { render json: @hero_seeker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dee7c5fdaa9ebc336e7dbc24097a5a76", "score": "0.4754053", "text": "def create\n @attendee = current_user.attendees.build( :paper => @paper )\n\n respond_to do |format|\n if @attendee.save\n format.html do \n flash[:notice] = 'Attendee was successfully created.'\n redirect_to paper_path(@paper)\n end\n format.xml { render :xml => @attendee, :status => :created, :location => @attendee }\n format.js { render :partial => 'papers/attendees' }\n else\n format.html do\n flash[:notice] = 'Error trying to create Attendee.'\n redirect_to paper_path(@paper)\n end\n format.xml { render :xml => @attendee.errors, :status => :unprocessable_entity }\n format.js { render :text => 'Some error ocurred', :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "497a4c936900cb3d2ab006ebef16dded", "score": "0.4752783", "text": "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "title": "" }, { "docid": "40d87887f5e3cfac517014564dfc9228", "score": "0.4751338", "text": "def create\n\t\t@public_officer = PublicOfficer.find(params[:public_officer_id])\n\t\t@commission = @public_officer.commissions.find(params[:commission_id])\n\t\t@trip = @commission.trips.find(params[:trip_id])\n\t\t@detail = @trip.detail\n\t\t@flight = @detail.flights.new(params[:flight])\n\n\t\trespond_to do |format|\n\t\t\tif @flight.save\n\t\t\t\tformat.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n\t\t\t\tformat.json { render json: @flight, status: :created, location: @flight }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @flight.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
bb7ef50bb261f2b08abcec6816a9da41
Returns list of uncommited/untracked files as reported by git status.
[ { "docid": "7d3c2b99930e728d1de39cffc82d9994", "score": "0.76043624", "text": "def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end", "title": "" } ]
[ { "docid": "20acf3eb7ee7d233c30d04e361432735", "score": "0.8367702", "text": "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "title": "" }, { "docid": "20acf3eb7ee7d233c30d04e361432735", "score": "0.8367702", "text": "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "title": "" }, { "docid": "16ad177d8766d528a5d2bef41dabee59", "score": "0.7949428", "text": "def get_uncommitted_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-n', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"Changed files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend", "title": "" }, { "docid": "796d31d7a256913969e119ef32f9c970", "score": "0.7858047", "text": "def uncommitted_files\n svn('status', '--ignore-externals').split(\"\\n\").reject { |line| line =~ /^X\\s/ }\n end", "title": "" }, { "docid": "1c2562e3cf4cc2f05b7756a6833e71ec", "score": "0.759202", "text": "def uncommitted_files\n `hg status`.scan(/^(A|M|R|!|\\?) (\\S.*)$/).map{ |match| match.last.split.last }\n end", "title": "" }, { "docid": "b29acf4b8a370cc6f4be92eb6d111340", "score": "0.697779", "text": "def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end", "title": "" }, { "docid": "fba622c3ffd4001ffb1ab339505786d5", "score": "0.6929143", "text": "def uncommitted_merge_files\n merge_state.uncommitted_merge_files\n end", "title": "" }, { "docid": "1bd759da7ef779011244896243825ed9", "score": "0.6869004", "text": "def check_changed_files(git)\n git.status.select {|file| file.type || file.untracked }\n end", "title": "" }, { "docid": "63f53f0b9d400e6cb003e82f63918506", "score": "0.6848623", "text": "def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end", "title": "" }, { "docid": "8d949d68cebed9158435dc27b11505f3", "score": "0.67857504", "text": "def get_unknown_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-un', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"New files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend", "title": "" }, { "docid": "64a91398561a6f6f5ab6330362db79a5", "score": "0.6598226", "text": "def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end", "title": "" }, { "docid": "18999d21eb4937c12de7ff1393f640fa", "score": "0.64837974", "text": "def all_files_except_git\n Dir.glob('*', File::FNM_DOTMATCH).delete_if { |file| file =~ /\\A\\.{1,2}\\z|\\A\\.git\\z/ }\n end", "title": "" }, { "docid": "5570274ceb6326fb06c35c5830f2a380", "score": "0.63715374", "text": "def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end", "title": "" }, { "docid": "345495f4d41ce78a0511f8141fea725d", "score": "0.63712436", "text": "def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\n end", "title": "" }, { "docid": "3643b46fc37fae5b206dcbde47a6a5af", "score": "0.63645965", "text": "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "title": "" }, { "docid": "7f9ef221b511d407a238089c2876500d", "score": "0.6248532", "text": "def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end", "title": "" }, { "docid": "adfefe728112c169a6afdf5e417b375a", "score": "0.6237173", "text": "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "title": "" }, { "docid": "adfefe728112c169a6afdf5e417b375a", "score": "0.6237173", "text": "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "title": "" }, { "docid": "83f9ced9322995291fc3dddf680dc8d9", "score": "0.60338616", "text": "def gitignores\n %w[/tmp/librarian/]\n end", "title": "" }, { "docid": "890c1e7d0a2ddbc898142f1059ca48fa", "score": "0.59826505", "text": "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "title": "" }, { "docid": "f062cf221634c04567bd9d30cb3a7878", "score": "0.5969127", "text": "def excluded_files() = []", "title": "" }, { "docid": "5aef6adf7d2d60f482bc8412500f15d5", "score": "0.5961163", "text": "def has_untracked_changes? \n not [repo.changed, repo.untracked].flatten.select do |k| \n k.include?(\".craft\") || k.eql?(\"persistent.sfs\") || k.eql?(\"quicksave.sfs\") \n end.empty?\n end", "title": "" }, { "docid": "464cadbcf22c38e24dc7a94ee9887108", "score": "0.5938676", "text": "def all_changed_files\n Set.new\n .merge(git.added_files.to_a)\n .merge(git.modified_files.to_a)\n .merge(git.renamed_files.map { |x| x[:after] })\n .subtract(git.renamed_files.map { |x| x[:before] })\n .to_a\n .sort\n end", "title": "" }, { "docid": "baab603980a7963ec1f4ebc9c897214c", "score": "0.5914217", "text": "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "title": "" }, { "docid": "b40f16f5a5caf440b07eca71f811ede1", "score": "0.5903339", "text": "def staged\n @files.select { |k, f| f.sha_index != \"0000000000000000000000000000000000000000\" && f.type != nil }\n end", "title": "" }, { "docid": "96eb854ac1e86f635362ab5886cc9e85", "score": "0.5881684", "text": "def svn_status(current_dir)\n modified_files = []\n `svn status #{current_dir}`.split(/\\n/).map do |file|\n file =~ /(\\?|\\!|\\~|\\*|\\+|A|C|D|I|M|S|X)\\s*([\\w\\W]*)/\n\n if file =~ /^M/\n modified_files << file.split[-1]\n elsif file =~ /^C/\n raise \"ERROR: file found in conflict: #{file.split[-1]}\"\n end\n end\n return modified_files\nend", "title": "" }, { "docid": "2055de02d2dfbbeb120facb93fd58847", "score": "0.5877982", "text": "def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end", "title": "" }, { "docid": "cd4c18feb16f6445cdfc2888b0eddc51", "score": "0.5850552", "text": "def unprocessed_files\n Dir.glob(@data_location + '/*.jl').sort\n end", "title": "" }, { "docid": "8edf70e7d8be9ad37e43d6445da04bb7", "score": "0.5845726", "text": "def ignored_files\n all_files.select { |f| ignore_matcher.matched?(f) }\n end", "title": "" }, { "docid": "aa223078a4c7dabc6d6b16d7fa2d3b5a", "score": "0.5784137", "text": "def filter_git_diff_issues(issues)\n modified_files_info = git_modified_files_info()\n return issues.select { |i| \n modified_files_info[\"#{i['file']}\"] != nil\n }\n end", "title": "" }, { "docid": "caa2f48f67f3e26d31cf05d23a697e04", "score": "0.5763335", "text": "def ignored\n @ignored ||= []\n @ignored.map(&:to_s)\n end", "title": "" }, { "docid": "479fe6ba5257d20b3d7b116004ce8be4", "score": "0.5754837", "text": "def modified_files\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs)\n end", "title": "" }, { "docid": "af92ec95a0d357fad9715bfef2241c02", "score": "0.56904006", "text": "def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end", "title": "" }, { "docid": "57412d07e44f887041b0393de9c4fdbd", "score": "0.56669945", "text": "def working_files\n files.map {|f| working_file f}\n end", "title": "" }, { "docid": "29cc259c0d79cab3462c433616cee2ba", "score": "0.5642885", "text": "def ignorable_paths\n []\n end", "title": "" }, { "docid": "ecf59072d3c739957c0d048920fd7405", "score": "0.5631095", "text": "def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end", "title": "" }, { "docid": "0f5527cfd6946096c6f88dfd69ad288d", "score": "0.56185555", "text": "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACM --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "title": "" }, { "docid": "29a36daf568f5dda06e655aa58a33dd9", "score": "0.5610356", "text": "def get_exclusions\n return \"\" if !has_git_ignores? || !has_git? \n git_ignore = File.join PWD, \".gitignore\"\n exclusions = `cat #{git_ignore}`.split(\"\\n\") \n # ensure we remove any commented out .gitignores\n exclusions = exclusions.select { |exclusion| exclusion[0,1] != '#' }\n exclusions = exclusions - @task_config[:always_include] \n if @dry_run\n puts wrap_top(\"EXCLUSIONS:\")\n puts exclusions.join(\"\\n\") \n end\n exclusions\n end", "title": "" }, { "docid": "52ce8154aac631e20889d2e815019775", "score": "0.5583028", "text": "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "title": "" }, { "docid": "b78e4d2eb84a33276d8c6e6047cb81ca", "score": "0.55567616", "text": "def target_files\n @target_files ||= (git.modified_files - git.deleted_files) + git.added_files\n end", "title": "" }, { "docid": "9fb16b79926cd30e5a10ad1f15c65683", "score": "0.5519064", "text": "def filter_git_diff_issues(issues)\n modified_files_info = git_modified_files_info\n return [] if modified_files_info.empty?\n\n filtered_issues = []\n issues.each do |issue|\n file = issue[\"file\"].to_s\n next if modified_files_info[file].nil? || modified_files_info[file].empty?\n\n filtered_errors = issue[\"errors\"].select { |error| modified_files_info[file].include?(error[\"line\"].to_i) }\n filtered_issues << { \"file\" => file, \"errors\" => filtered_errors } unless filtered_errors.empty?\n end\n filtered_issues\n end", "title": "" }, { "docid": "55a36a672c398e641ef39af9de932cf8", "score": "0.5517472", "text": "def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end", "title": "" }, { "docid": "a75986370e8b5a8163f58f16bbd86b20", "score": "0.5517162", "text": "def check_clean_status_task\n raise \"The current working copy contains modifications\" if `#{git} ls-files -m`.split(\"\\n\").any?\n end", "title": "" }, { "docid": "47ac85d1f36e9cad6af77fc75d6421f2", "score": "0.5507081", "text": "def find_all_ignored\n skipped = []\n\n rubocop = YAML.load_file('./.rubocop.yml')\n rubocop['AllCops']['Exclude'].each do |ignored|\n skipped << ignored.split('/')[0]\n end\n\n skipped\nend", "title": "" }, { "docid": "a557e2789920eb253d83a521107080dd", "score": "0.5500668", "text": "def ignored\n [\n '.agignore',\n '.cvsignore',\n '.gitignore',\n '.hgignore',\n ].map do |file_with_ignore_patterns|\n if File.exist? file_with_ignore_patterns\n patterns = File.read(file_with_ignore_patterns).split(\"\\n\")\n patterns.map do |pattern|\n next if pattern =~ /^#/\n next if pattern =~ /^\\s*$/\n \"-not \\\\( -path \\\"*#{pattern}*\\\" -prune \\\\)\"\n end.compact.join(' ')\n else\n ''\n end\n end.join(' ') + [\n \"-not \\\\( -path \\\"*\\\\.git*\\\" -prune \\\\)\"\n ].join(' ')\nend", "title": "" }, { "docid": "a17d6206372fc0d29f7067f984bf73f8", "score": "0.5498635", "text": "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "title": "" }, { "docid": "44f4ff2020a447c490332135872558de", "score": "0.54862064", "text": "def gitignore_list(dir)\n @gitignore_list ||= {}\n @gitignore_list[dir] ||= []\n\n ilist = []\n if File.exists?(dir + '/.gitignore')\n File.read(dir + '/.gitignore').split(\"\\n\").each do |line|\n Dir[dir + '/' + line].each do |f|\n fn = f.sub(/^#{dir}\\//, '')\n ilist << fn unless ilist.include?(fn)\n end\n end\n end\n @gitignore_list[dir] = ilist\n end", "title": "" }, { "docid": "b30e40157651e946deb5cfe575816d75", "score": "0.54848385", "text": "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "title": "" }, { "docid": "f9a154b7df8bcbd92164ffc88aa12e43", "score": "0.54807997", "text": "def changed_files\n # FIXME: Implement properly once changed detection is available.\n files\n end", "title": "" }, { "docid": "24918607d916746de9eaeea0c41aecf6", "score": "0.54769164", "text": "def ignored\n ignores.map {|ignore| ignore.ignoreable}\n end", "title": "" }, { "docid": "658c8e187dcbabe60837c52d0074bfd0", "score": "0.5451894", "text": "def filter_nonexistent(modified_files); end", "title": "" }, { "docid": "c3aacf727fc6c1f048125540155a152d", "score": "0.5431574", "text": "def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end", "title": "" }, { "docid": "1150ffcc36a1e1ae9304a93b5d7f9ced", "score": "0.5431249", "text": "def tracked?(path)\n Overcommit::Utils.execute(%W[git ls-files #{path} --error-unmatch]).success?\n end", "title": "" }, { "docid": "f0fa2d6930970fc2eafe1089973d9581", "score": "0.54209733", "text": "def dependent_files\n processed.map(&:abs_path).compact.select { |fn| File.exist?(fn) }\n end", "title": "" }, { "docid": "b4732108e204b788ec16e8bceed81b9e", "score": "0.5420328", "text": "def tracked_files; end", "title": "" }, { "docid": "d75278d203bb3b2f37e6a7e6bcf7df1a", "score": "0.5394139", "text": "def dirty?(exclude_spec=false)\n repo_status = false\n\n return repo_status unless File.directory?(path)\n\n Dir.chdir(path) do\n %x(git update-index -q --ignore-submodules --refresh)\n repo_status = \"Could not update git index for '#{path}'\" unless $?.success?\n\n unless repo_status\n %x(git diff-files --quiet --ignore-submodules --)\n repo_status = \"'#{path}' has unstaged changes\" unless $?.success?\n end\n\n unless repo_status\n %x(git diff-index --cached --quiet HEAD --ignore-submodules --)\n repo_status = \"'#{path}' has uncommitted changes\" unless $?.success?\n end\n\n unless repo_status\n # Things that may be out of date but which should stop the updating\n # of the git repo\n our_exclusions=[\n 'build/rpm_metadata',\n 'dist/'\n ]\n\n untracked_files = %x(git ls-files -o -d --exclude-standard --exclude=#{our_exclusions.join(' --exclude=')})\n\n if $?.success?\n unless untracked_files.empty?\n untracked_files.strip!\n\n if untracked_files.lines.count > 0\n repo_status = \"'#{path}' has untracked files\"\n end\n end\n else\n # We should never get here\n raise Error, \"Failure running 'git ls-files -o -d --exclude-standard' at '#{path}'\"\n end\n end\n end\n\n repo_status\n end", "title": "" }, { "docid": "859dd5b415897e1fb81e2292b33b6585", "score": "0.53716874", "text": "def releases_including_skipped()\n files = []\n\n cmd.ssh(\"ls -m #{releases_dir}\") do |stdout|\n files.concat(stdout.read.split(/[,\\s]+/))\n end\n\n return files\n end", "title": "" }, { "docid": "f08b02e40ef4cbbfa23874e5f8f00568", "score": "0.53544825", "text": "def all_incomplete_todos\n (global_incomplete_todos + local_incomplete_todos).uniq\n end", "title": "" }, { "docid": "4639f479fb84319f19030a096a013e83", "score": "0.5352516", "text": "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "title": "" }, { "docid": "d6fc0df77077d1ae9b247d2490f08f50", "score": "0.5348655", "text": "def repository_status(repo)\n untracked_files = 0\n modified_files = 0\n deleted_files = 0\n\n #- +:index_new+: the file is new in the index\n #- +:index_modified+: the file has been modified in the index\n #- +:index_deleted+: the file has been deleted from the index\n #- +:worktree_new+: the file is new in the working directory\n #- +:worktree_modified+: the file has been modified in the working directory\n #- +:worktree_deleted+: the file has been deleted from the working directory\n repo.status do |status|\n if status[1].include?(:worktree_new) || status[1].include?(:index_new)\n untracked_files += 1\n elsif status[1].include?(:worktree_modified) || status[1].include?(:index_modified)\n modified_files += 1\n elsif status[1].include?(:worktree_deleted) || status[1].include?(:index_deleted)\n deleted_files += 1\n end\n end\n\n return {\n untracked_files: untracked_files,\n modified_files: modified_files,\n deleted_files: deleted_files,\n clean: modified_files == 0 && deleted_files == 0\n }\nend", "title": "" }, { "docid": "46d8a4289b68cbd95da0fe8a1dc3cf19", "score": "0.53438115", "text": "def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end", "title": "" }, { "docid": "46d8a4289b68cbd95da0fe8a1dc3cf19", "score": "0.53438115", "text": "def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end", "title": "" }, { "docid": "7522afbaaa1589f0be6976dbcf3cf804", "score": "0.53422284", "text": "def check_results\n bin = prettier_path\n raise \"prettier is not installed\" unless bin\n return run_check(bin, \".\") unless filtering\n ((git.modified_files - git.deleted_files) + git.added_files)\n .select { |f| f[matching_file_regex] }\n .map { |f| f.gsub(\"#{Dir.pwd}/\", \"\") }\n .map { |f| run_check(bin, f) }\n end", "title": "" }, { "docid": "b2c706c3a7978477ed1d7568b01b18da", "score": "0.5336614", "text": "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "title": "" }, { "docid": "b1c377496b9129680d3d73ddfb3b8431", "score": "0.5313219", "text": "def ignored_tracked_fields\n @ignored_tracked_fields ||= HistoryTracker.ignored_tracked_fields\n end", "title": "" }, { "docid": "211f4de49086fe7d048ed148a7b28bca", "score": "0.53083175", "text": "def filter_matched_files\n matched_files = []\n\n unless file_extensions.empty?\n extensions = file_extensions.reduce do |total, extension|\n total + \"|\" + extension.downcase\n end\n extensions_regex = \"^(.+\" + extensions + \")$\"\n (git.modified_files + git.added_files).each do |file|\n matched_files += [file] unless file.downcase.match(extensions_regex).nil?\n end\n end\n\n unless file_patterns.empty?\n (git.modified_files + git.added_files).each do |line|\n file_patterns.each do |pattern|\n matched_files += [line] unless line.downcase.match(pattern.downcase).nil?\n end\n end\n end\n\n return [matched_files].flatten.compact\n end", "title": "" }, { "docid": "96e045dd4a9859790d283ff374ebb3b1", "score": "0.52987075", "text": "def files_changed_as_set(files)\n changed_files = files.select { |file| git.modified_files.include? file }\n not_changed_files = files.select { |file| !changed_files.include? file }\n all_files_changed = not_changed_files.empty?\n no_files_changed = changed_files.empty?\n return all_files_changed || no_files_changed\nend", "title": "" }, { "docid": "681bd50709749860bbac9911bb63c37a", "score": "0.5296679", "text": "def files(dir)\n Dir[dir + '/**/*'].reject do |filename|\n File.directory?(filename) ||\n filename =~ /(~|\\.orig|\\.rej|\\.bak)$/\n end\n end", "title": "" }, { "docid": "04a09659a509b3dc33ba71651e14ffaf", "score": "0.5276698", "text": "def modified_files\n file_stats.count { |file| file.status == :modified }\n end", "title": "" }, { "docid": "ac9ea76ce0e774742c11a241fb005467", "score": "0.52699333", "text": "def ignore\n @ignore ||= []\n end", "title": "" }, { "docid": "20aa80a8eb4a6c25eded9db37479f084", "score": "0.5254102", "text": "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "title": "" }, { "docid": "eda4ea8289d6615c0e7dd49a93976eaa", "score": "0.52361995", "text": "def report_files_that_dont_have_st_sync_active(options)\n inactive_files = []\n active_files = []\n total_file_count = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading content AT files\",\n options\n ) do |content_at_file|\n data_json_file = content_at_file.corresponding_data_json_file\n total_file_count += 1\n lang_and_date_code = [\n content_at_file.language_code_3_chars,\n content_at_file.extract_date_code\n ].join\n if data_json_file.contents.index('\"st_sync_active\":false')\n inactive_files << lang_and_date_code\n $stderr.puts \" - doesn't have st_sync_active\".color(:blue)\n else\n active_files << lang_and_date_code\n end\n end\n inactive_files_count = inactive_files.length\n active_files_count = active_files.length\n if inactive_files_count > 0\n $stderr.puts \"\\n\\n#{ inactive_files_count } files that DON'T HAVE st_sync_active:\"\n $stderr.puts '-' * 80\n inactive_files.each { |e| $stderr.puts e }\n $stderr.puts\n end\n if active_files_count > 0\n $stderr.puts \"\\n\\n#{ active_files_count } files that HAVE st_sync_active:\"\n $stderr.puts '-' * 80\n active_files.each { |e| $stderr.puts e }\n $stderr.puts\n end\n summary_line = \"Found #{ inactive_files_count } of #{ total_file_count } files that don't have st_sync_active at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n end", "title": "" }, { "docid": "186457a85260caea56007dac6f9ccc5d", "score": "0.52285284", "text": "def affected_files\n Dir[@result_dir + '/*.{ttf,eot,woff,svg}'].reject { |f| f[@file] }\n end", "title": "" }, { "docid": "3efa501191711dcd779b2a974d877bbf", "score": "0.52273935", "text": "def files\n if !@files\n files = Dir.glob(\"#{working_dir}/*\").map {|f| f.split(working_dir)[1][1..-1]}\n files.delete config_file\n @files = files\n end\n return @files\n end", "title": "" }, { "docid": "510ec21980710a4f29892d4626ea8427", "score": "0.52273226", "text": "def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end", "title": "" }, { "docid": "44a0b962d39b7be7a43bf4d98d8f126f", "score": "0.52270854", "text": "def target_files\n @target_files ||= git.modified_files + git.added_files\n end", "title": "" }, { "docid": "355f4c376069e1c17dc5a223358259d2", "score": "0.52253675", "text": "def show_changed_files(status)\n status.each_line do |line|\n if line =~ /^#\\t/ # only print out the changed files (I think)\n if line =~ /new file:|modified:|deleted:/\n puts \" #{line}\" \n else\n puts \" #{line.chop}\\t\\t(may need to be 'git add'ed)\" \n end\n end\n end\nend", "title": "" }, { "docid": "1e150c67bbe01fbb0430c9d8d48252a4", "score": "0.522432", "text": "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end", "title": "" }, { "docid": "0e0a82d128e2f888fc4bc6d99afaa905", "score": "0.52114236", "text": "def all_commits\n `git --git-dir=#{git_dir} log --all --pretty='%H'`.split(/\\n/).uniq\n end", "title": "" }, { "docid": "6823fdf1fe39336483e9ea15b42829a4", "score": "0.52098596", "text": "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "title": "" }, { "docid": "35b3d9579ad7441760582a1e85f8ebc6", "score": "0.52076894", "text": "def get_svn_filelist( dir='.' )\n\tlist = IO.read( '|-' ) or exec 'svn', 'st', '-v', '--ignore-externals', dir\n\n\t# Split into lines, filter out the unknowns, and grab the filenames as Pathnames\n\t# :FIXME: This will break if we ever put in a file with spaces in its name. This\n\t# will likely be the least of our worries if we do so, however, so it's not worth\n\t# the additional complexity to make it handle that case. If we do need that, there's\n\t# always the --xml output for 'svn st'...\n\treturn list.split( $/ ).\n\t\treject {|line| line =~ /^(\\?|(\\s*|--- .*)$)/ }.\n\t\tcollect {|fn| Pathname(fn[/\\S+$/]) }\nend", "title": "" }, { "docid": "86860f211d8d52cfcbaeef28e7c5f7e3", "score": "0.5206285", "text": "def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end", "title": "" }, { "docid": "b68eb4fe3ebf73f937537b89037fc51f", "score": "0.52057266", "text": "def repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end", "title": "" }, { "docid": "3079ef35073f5f9a48b15c414341d72c", "score": "0.5197313", "text": "def removed_infections\n return [] unless prev_scan\n current_infections = scan.infections.collect{|infection| infection.file}\n prev_scan.infections.select{|infection| !current_infections.include?(infection.file)}\nend", "title": "" }, { "docid": "d97457e67c17a41a2e8758f904c9164c", "score": "0.5196025", "text": "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "title": "" }, { "docid": "31e9473e596b2d2197f36232c611b6ea", "score": "0.5195689", "text": "def deleted_files\n file_stats.count { |file| file.status == :deleted }\n end", "title": "" }, { "docid": "c4be1c2887179cd6a59887e275810eae", "score": "0.5189985", "text": "def blacklisted_dir_entries\n %w[. ..]\n end", "title": "" }, { "docid": "b929bcdbac8fe2a6841bf6ef74b9aba3", "score": "0.5186909", "text": "def no_extension_files(base_dir, wildcard, non_exts = [])\n list = []\n unless non_exts.empty?\n list = Dir.glob(File.join(base_dir, wildcard, \"{#{non_exts.join(',')}}\"))\n end\n list\n end", "title": "" }, { "docid": "e78e1dc530c68a74a625df09c66790e3", "score": "0.51791847", "text": "def lint_results\n bin = eslint_path\n raise 'eslint is not installed' unless bin\n return run_lint(bin, '.') unless filtering\n ((git.modified_files - git.deleted_files - git.renamed_files.map { |r| r[:before] }) + git.added_files + git.renamed_files.map { |r| r[:after] })\n .select { |f| target_extensions.include?(File.extname(f)) }\n .map { |f| f.gsub(\"#{Dir.pwd}/\", '') }\n .map { |f| run_lint(bin, f).first }\n end", "title": "" }, { "docid": "980e5c9f164504d6efba84b4c6f4604a", "score": "0.5177584", "text": "def getFilesFromDiff(diff)\n files = []\n diff.lines.map(&:chomp).each do |line|\n if line.start_with? '+++ b/'\n line[\"+++ b/\"] = \"\"\n # try to remove anything after a tab character\n # this is needed by --check 0\n begin\n line[/\\t.*$/] = \"\"\n # IndexError is raised if no tab characters are found\n rescue IndexError\n end\n files << line\n end\n end\n return files\n end", "title": "" }, { "docid": "25dedd2eccb1043058e1705824627959", "score": "0.516342", "text": "def removed; status[:removed] || []; end", "title": "" }, { "docid": "efdd9571aa60c4218d75fd3fcc9c1d1e", "score": "0.5159081", "text": "def all_commit_times\n `git --git-dir=#{git_dir} log --all --pretty='%at'`.split(/\\n/).uniq\n end", "title": "" }, { "docid": "b53f5b46844a1448b2bc07985455eac2", "score": "0.51574093", "text": "def prompt_git_status\n if !is_git?\n return \"\"\n end\n stat = `git status`\n res = \"\"\n res += ( stat.include?(\"ahead\") ? \"^\" : \"\" )\n res += ( stat.include?(\"modified\") ? \"*\" : \"\" )\n res += ( stat.include?(\"untracked\") ? \"+\" : \"\" )\n res += ( stat.include?(\"deleted\") ? \"-\" : \"\" )\n res!=\"\" ? \"[#{res}]\".magenta : \"\"\nend", "title": "" }, { "docid": "91c98fbbb4e23e8be4b1283fc31c7fb1", "score": "0.51488423", "text": "def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end", "title": "" }, { "docid": "91c98fbbb4e23e8be4b1283fc31c7fb1", "score": "0.51488423", "text": "def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end", "title": "" }, { "docid": "fd98ebdffe41c72921d14dde1f0e6bc3", "score": "0.51470417", "text": "def all_modified_files_coverage\n unless @project.nil?\n @all_modified_files_coverage ||= begin\n modified_files = git.modified_files.nil? ? [] : git.modified_files\n added_files = git.added_files.nil? ? [] : git.added_files\n all_changed_files = modified_files | added_files\n @project.coverage_files.select do |file|\n all_changed_files.include? file.source_file_pathname_relative_to_repo_root.to_s\n end\n end\n\n @all_modified_files_coverage\n end\n end", "title": "" }, { "docid": "0c10abfd3a8562b32e7379a1c6dac687", "score": "0.51415807", "text": "def get_repo_status\n args = {:clone => CONFIG[\"local\"][\"clone\"]}\n st = `#{Templates.status(args)}`\n current_branch = st.split(\"\\n\")[0][3..-1].split(\"...\")[0]\n modified_files = st.split(\"\\n\")[1..-1].join(\"\\n\")\n [current_branch, modified_files]\n end", "title": "" }, { "docid": "34e501e2da19dda66e248f3579b817a4", "score": "0.5137996", "text": "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "title": "" }, { "docid": "dc5e6373ca11cf34f3135beeed082661", "score": "0.5137064", "text": "def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end", "title": "" }, { "docid": "73a53b48d35295dd0d90bdabd713129d", "score": "0.5123803", "text": "def test_clean_checkout_should_not_remove_tracked_files\n with_sandboxed_git do |proj_dir, git|\n tracked_file = File.join(proj_dir, 'tracked.txt')\n FileUtils.touch tracked_file\n sandbox_git_add_and_commit(proj_dir, File.basename(tracked_file))\n untracked_file = File.join(proj_dir, 'untracked.txt')\n git.clean_checkout\n assert File.exist? tracked_file\n assert_false File.exist? untracked_file\n end\n end", "title": "" } ]
7523a182237f378517b869e661533ed2
==> Output the final result into indicated file
[ { "docid": "68f914235ef7faf316c7ce075c322b7a", "score": "0.0", "text": "def output_to_json container, filename\n puts \"output_to_file #{filename}\"\n outputFile = File.open(filename, 'w')\n linecount = 0\n container.each do |key, value|\n linecount += 1\n print(linecount.to_s + \"\\r\") if linecount % 1000 == 0\n sorted_value = value.sort do |a, b|\n a[\"visit_time\"] <=> b[\"visit_time\"]\n end\n outputFile.puts sorted_value.to_json\n end\n outputFile.close\nend", "title": "" } ]
[ { "docid": "0d59b5b1ced95310528f5cb9f3207528", "score": "0.758007", "text": "def output(result)\n if options[:output]\n File.write(options[:output], result)\n else\n puts result\n end\n\n result\n end", "title": "" }, { "docid": "f48b623fd4f619f48ea92910d1667364", "score": "0.75435925", "text": "def writeFile\n File.open(ARGV[1], \"w+\") do |f|\n $results.each{\n |result|\n f.puts(result)\n }\n end\nend", "title": "" }, { "docid": "0f42b13abe4c782fd8c6b2c8b48a23b6", "score": "0.7466002", "text": "def print_to_file\n\tFile.open('1to100incl.txt', \"w\") do |file|\n\t\[email protected] {|element| file.puts element }\n\tend\nend", "title": "" }, { "docid": "792905dbe986edc607f54d12d2654a3f", "score": "0.7380473", "text": "def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end", "title": "" }, { "docid": "e9048bf820b00413e0bb8339b46e15be", "score": "0.7254733", "text": "def output_file\n @output\n end", "title": "" }, { "docid": "c9c5687d6efa06f6d9ac47e83f55ef2c", "score": "0.7241454", "text": "def writeOut(fname=\"out\")\n File.open(fname, \"w\").write(@mResult)\n end", "title": "" }, { "docid": "2e726ce1e5106d0ce3b0436298b38d69", "score": "0.71605104", "text": "def output_to_file\n @output=:file\n end", "title": "" }, { "docid": "f7072aa0fba1e60aabdfcadc50e74eef", "score": "0.71538275", "text": "def output_to_file\n File.open(\"mips_results.txt\", \"w\") do |f|\n in_file = \"\"\n disassemble.each { |instruction| in_file << instruction + \"\\n\" }\n f.write(in_file)\n end\n end", "title": "" }, { "docid": "9dec655bdde21297ba35b05320ef2fa4", "score": "0.71149635", "text": "def output(filename)\r\n outs = File.new(filename , \"w\")\r\n outs.puts self.to_s\r\n outs.close\r\n end", "title": "" }, { "docid": "bd2a460f17867b8fa573ff65cf4932f4", "score": "0.7111133", "text": "def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end", "title": "" }, { "docid": "561819462797def981149c44a4ce4922", "score": "0.7067776", "text": "def output_to_file(dir,algorithm, path, cost,n, running_time)\n file_path = \"#{dir}/#{algorithm.to_s}_#{n}_output.txt\"\n FileUtils.rm file_path, :force => true\n file = File.new(file_path, \"w\")\n # write the path to file\n path.each do |vertex|\n file.puts \"#{vertex}\"\n end\n file.puts \"Total Cost: #{cost}\"\n file.puts \"Running Time: #{running_time}\"\n end", "title": "" }, { "docid": "002917dce64bfdb82f8b4566db8909de", "score": "0.70119685", "text": "def exportfile arr\n begin\n file = File.open(\"result.txt\", \"w\")\n text = showResulf arr\n file.puts text\n file.close\n binding.pry\n rescue IOError => e\n puts \"Can not write file. Please try again after there.\"\n ensure\n file.close unless file.nil?\n end\nend", "title": "" }, { "docid": "8adc6ea6841c1c64ca9ad9bb5bf14f0f", "score": "0.6984031", "text": "def write(output_to); end", "title": "" }, { "docid": "4c950b2b0f97c3caeadf3507fceb8eea", "score": "0.69596", "text": "def output_to_file (products_hash, brands_hash)\n\t_sales_report_header\n\t_products_header\n\tproducts_section(products_hash)\n\tend_of_section\n\t_brands_header\n\tbrands_section(brands_hash)\n\tend_of_section\n\t$report_file.puts 'THIS REPORT HAS BEEN CREATED BY MROHDE'\nend", "title": "" }, { "docid": "92e5e2a2b4546cd7574e8c9a6c17c108", "score": "0.6953171", "text": "def write_file( fname )\n File.open(fname, \"w\") do |f|\n f << TDP.application.result\n end\n TDP.application.result = String.new\n# puts \"...written to #{fname}\"\n end", "title": "" }, { "docid": "4cf3ae320753524c989f02e3c3cca717", "score": "0.69368994", "text": "def save_to_file\n File.open(\"results/#{seq_name}\"+\".txt\", 'w') { |file|\n \n n=1\n \n @actions.each do |a|\n file.puts a.description\n n +=1 \n end\n } \n \n end", "title": "" }, { "docid": "a1c9ba196ce1bbc004c67c00b53308c1", "score": "0.6896277", "text": "def generate_output\n write_average_fitness('output/average.txt')\n write_best_fitness('output/best.txt')\n write_survivors('output/survivors.txt')\n write_traits('output/traits.txt')\n end", "title": "" }, { "docid": "7755aad293412e5f178046f7271bb714", "score": "0.6875723", "text": "def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://github.com/kryszan/cloudy]cloudy[/url]\\\\m/ [/sup][/align]\"\n\t\tend\n\tend", "title": "" }, { "docid": "debc6ea4e70146dc2d3d78d972ced2df", "score": "0.6837767", "text": "def work_received(results)\n # write results to disk\n @@output_file.puts results\n end", "title": "" }, { "docid": "d28cc6855cb614ec0aaf48c36d2f208f", "score": "0.6817562", "text": "def write_it( output_file, final_content )\n File.open(output_file, \"w\") {|f| f.write( final_content ) }\n end", "title": "" }, { "docid": "e5f58241daddf6e0d73ef8af7e3187d9", "score": "0.6813365", "text": "def write_results_to_file(content, filetype)\n case filetype\n when :html\n append = \".html\"\n when :htmlv\n filetype = :html\n append = \"_Verbose.html\"\n when :text\n append = \".txt\"\n when :textv\n filetype = :txt\n append = \"_Verbose.txt\"\n when :xml\n append = \".xml\"\n when :xmlv\n filetype = :xml\n append = \"_Verbose.xml\"\n end\n\n file_dialog = Wx::FileDialog.new(self, \"Export #{filetype.to_s.upcase} Results As\", \"\", \"SSLSmart#{append}\", \"*.*\", Wx::FD_SAVE| Wx::FD_OVERWRITE_PROMPT)\n file_dialog.show_modal\n path = file_dialog.get_path\n return if(path == nil || path == \"\")\n begin\n File.open(path, 'w') do |f|\n f.puts content\n end\n rescue => ex\n $log.error(ex.message)\n Wx::MessageDialog.new(nil, \"Error Occured!!\\nPlease see log files for more details\", \"\", Wx::OK ).show_modal()\n end\n end", "title": "" }, { "docid": "d26bc5b507ecc73b3f99fc8466c5d143", "score": "0.6761672", "text": "def add_to_all_results_file(filename,output)\n self.add_to_file(filename,output)\n end", "title": "" }, { "docid": "d3cc0a7e902c1d29c0c5609ee2ce4b64", "score": "0.6749819", "text": "def to_log(output, result)\n\tFile.open(\"./result.txt\", \"a\") do |f|\n\t\tf.puts \"Test case: Delete User - #{output}, #{result} \"\n\tend\nend", "title": "" }, { "docid": "630fee06a424c9da4ded2c296425d26b", "score": "0.6703723", "text": "def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end", "title": "" }, { "docid": "f48a3062d6beea4410d36f506ee5bb4e", "score": "0.66686666", "text": "def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end", "title": "" }, { "docid": "f48a3062d6beea4410d36f506ee5bb4e", "score": "0.66686666", "text": "def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end", "title": "" }, { "docid": "07ac43aae8403ad603266b9476422ae0", "score": "0.6668186", "text": "def file_finished(file_result)\n if file_result.error_count > 0 \n out.print 'x'\n elsif file_result.warning_count > 0\n out.print '*'\n else\n out.print '.'\n end\n end", "title": "" }, { "docid": "e7b9eb740966d87112fae28b94917b51", "score": "0.6664993", "text": "def output(filename)\n @output = \" #{filename}\"\n end", "title": "" }, { "docid": "bf7b68a933dcb6cf43b9156a77868afa", "score": "0.6633626", "text": "def writeOut\n\t\t\n\tend", "title": "" }, { "docid": "ecffeba119a8b532a6582b06309732d3", "score": "0.66179013", "text": "def write_to_file(filename) # Take name and status of file, output and save it to a new file\n completed = @all_tasks.map(&:to_machine).join(\"\\n\")\n IO.write(filename, completed)\n end", "title": "" }, { "docid": "48e96142a6bc06219e610a5fd53c4a26", "score": "0.6613446", "text": "def output(contents, filename = \"output.html\")\n out_file = File.new(filename, \"w\")\n out_file.puts(contents)\n out_file.close\n end", "title": "" }, { "docid": "cc9b1eea7e3851c4243d4c91745e0720", "score": "0.6578061", "text": "def quickout results\r\n\tout = File.open('out.txt','w')\r\n\tout.sync=true\r\n\t\r\n\tresults.each_pair do |k,v|\r\n\t\tname, images, interwikimap = k, *v\r\n\t\t\r\n\t\tout.puts \"* [[#{name}]]\"\r\n\t\tout.puts images.to_a.map{|img, langs| \r\n\t\t\t\"** [[:commons:File:#{img}|]] na #{langs.uniq.map{|l| \"[[:#{l}:#{interwikimap[l.to_s]}|#{l}]]\"}.join ','}\"\r\n\t\t}\r\n\tend\r\n\t\r\n\tout.close\r\n\t\r\n\treturn ['out.txt']\r\nend", "title": "" }, { "docid": "ccdbd7b9cae536856f464dfd74e51ea5", "score": "0.65695566", "text": "def write_spec_to_file!\n formatted_output = format_output(output, extension)\n abs_path = File.join(write_path, suggested_filename)\n\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, formatted_output)\n end", "title": "" }, { "docid": "84f55e6b14286df22d938ec0ecb0ac0d", "score": "0.655937", "text": "def output_file\n @output_file ||= Tempfile.new(\"#{@blast_command}_out\")\n end", "title": "" }, { "docid": "64eed94c1205f71e73053bf86460aeb9", "score": "0.6511512", "text": "def flush_to_file(hit_list)\n File.open($config[:output], 'a') do |file|\n file.puts(hit_list)\n end\nrescue => e\n puts \"Error writing to output file #{$config[:output]}\"\n raise e\nend", "title": "" }, { "docid": "20c71c78a77c33a6fa31b2e7ee836176", "score": "0.6504508", "text": "def write\n path = \"#{site.root}/_site/#{output_file}\"\n File.open(path, 'w') do |f|\n f.write(@output)\n end\n end", "title": "" }, { "docid": "f2f6e4e5fdafdbff31384bd215aacf2c", "score": "0.65022933", "text": "def output(value)\n @output_file = value\n end", "title": "" }, { "docid": "464774580b903c4fb9288c13a3410eb7", "score": "0.6501561", "text": "def perform\n $stdout.write \"Outputting file to #{filepath_string}\\n\"\n CSV.open(filepath_string, \"wb\") do |csv|\n csv << output_header_row\n orders.each do |order|\n csv << order.output_row\n end\n end\n end", "title": "" }, { "docid": "bc8e2a572dc2c7879cdab9e23bae86fb", "score": "0.6499673", "text": "def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.6499661", "text": "def output; end", "title": "" }, { "docid": "10dce3bdb54edfc682fe4ead6d41acc0", "score": "0.64825875", "text": "def save_output\n\n end", "title": "" }, { "docid": "79df037d46ab802cfe628c7beb7002b1", "score": "0.6470393", "text": "def create_output_file(content)\n\t\t\tf = File.new(@params[:output_file], 'w')\n\t\t\tf << content\n\t\t\tf.close\n\t\tend", "title": "" }, { "docid": "7a9578cf2fef5f8a11bf7ab01e24c646", "score": "0.6457691", "text": "def output_to_csv\n if (@values[:result] != nil)\n @additions << calculate_worktime\n filename = get_entry(\"Specify output file: \")\n p = Menu.data_handler.find_person_by_id(@values[:id])\n CSVWriter.output(filename, p, @values[:result], @additions)\n else\n puts \"Nothing to write right now.\"\n end\n end", "title": "" }, { "docid": "4272ca3f50827f157f17077e94bbd5a5", "score": "0.64537627", "text": "def generate (path)\n File.open(path, \"w\") do |f|\n @output.each do |line|\n f.puts line\n end\n end \n end", "title": "" }, { "docid": "e852990ccb6403d73a4893534da872d6", "score": "0.6450667", "text": "def write_output_file(output_file, body)\n File.open(output_file, 'w:UTF-8') do |file|\n file.puts $HTML_header\n file.puts body\n file.puts $HTML_footer\n end\nend", "title": "" }, { "docid": "2bba36c39ee84108af85169bf6efcaa8", "score": "0.64449185", "text": "def write_file(out_file, output)\n File.open(out_file, 'w') { |f| output.each { |l| f.write(\"#{l}\\n\") } }\n end", "title": "" }, { "docid": "859a58bedd25bba7fd40129ff0ecf336", "score": "0.6434667", "text": "def output_file\n create_directory!\n\n File.join(output_directory, 'undercover.txt')\n end", "title": "" }, { "docid": "df5095ec3eeb5c29c3e64d16d7d5a8e8", "score": "0.6396172", "text": "def write_output\n # If an output directory is given, open a file & write to it\n if output = self.output\n @path_decls.each do |path, decls|\n name = snake_case(decls.name.name.to_s.dup)\n file_path = File.join(output, \"#{name}.rbs\")\n File.open(file_path, 'w') do |io|\n stdout.puts \"Writing output to file: #{file_path}\"\n RBS::Writer.new(out: io).write([decls])\n end\n end\n # If no output directory is given write to STDOUT\n else\n RBS::Writer.new(out: stdout).write(@path_decls.values)\n end\n end", "title": "" }, { "docid": "4b92627cca54dce3daaa7752650ed397", "score": "0.63717127", "text": "def print_output(up_result)\n puts \"################# STDOUT #####################\"\n puts up_result.stdout\n puts \"################# STDERR #####################\"\n puts up_result.stderr\n puts \"################# END #####################\"\n end", "title": "" }, { "docid": "9e16178a2cafc06789dece177fa24bc4", "score": "0.63645697", "text": "def write_result(capital)\n capital_2digits = '%.2f' % capital\n stream = \"\\n\" + Date.current.to_s + \": Calculated capital requirement = \" + capital_2digits + \" EUR.\" # Paragraph 11(3) No.2 E-Geldgesetz 2010\n if capital < 350000.00\n stream += \" However, at least 350000.00 EUR.\" # Paragraph 11(1) E-Geldgesetz 2010\n end\n File.open(File.expand_path(File.dirname(__FILE__) + \"/../../tmp/inout/current_capital_requirement.txt\"), 'a') {|f| f.write(stream) }\n return\n end", "title": "" }, { "docid": "cdbae01c40c7309a1e919ae93cb09300", "score": "0.63604456", "text": "def output \n\tFile.open(\"#{@file_out}\", \"w+\") do |f|\n\t f.puts \"#{@encrypted_text}\"\n\tend \nend", "title": "" }, { "docid": "adc5cec7e2a061ef925c217a5a50ef29", "score": "0.63458866", "text": "def write_output\n rows = data_to_rows\n CSV.open(@filename, 'wb') do |csv|\n rows.each {|row| csv << row}\n end\n end", "title": "" }, { "docid": "abff326cba21be88594becc066135448", "score": "0.6338849", "text": "def execute(options={})\n build_headers\n write_data(@output)\n end", "title": "" }, { "docid": "39eb2a43ae056ce573e63eccebede338", "score": "0.63268423", "text": "def write_obj_file output_path\n File.open(output_path, 'w') do |f|\n @vbuffer.each_triple do |a,b,c|\n f.puts \"v #{a} #{b} #{c}\"\n end\n @vnbuffer.each_triple do |a,b,c|\n f.puts \"vn #{a} #{b} #{c}\"\n end\n @fbuffer.each_triple do |a,b,c|\n f.puts \"f #{a+1}//#{a+1} #{b+1}//#{b+1} #{c+1}//#{c+1}\"\n end\n end\n self\n end", "title": "" }, { "docid": "388aa32398d4e502d6bab78043b79601", "score": "0.63101864", "text": "def output_file\n [\n output_root,\n feed_name,\n batch_id + \".\" + output_extension\n ].join(\"/\")\n end", "title": "" }, { "docid": "c88e641aa8c50439635c3809a33ca36f", "score": "0.6306971", "text": "def process_page_results(output_file_name, result_items)\n file = output_file(output_file_name)\n\n result_items.each do |result|\n file.write(\"#{result['id']},#{result['full_name']},#{result['language']}\\n\")\n end\nend", "title": "" }, { "docid": "921e066ca62f8dd815a86b8a1a0b4793", "score": "0.6289927", "text": "def write_to_file(filename)\n IO.write(filename, @all_tasks.map(&:display).join(\"\\n\"))\n\tend", "title": "" }, { "docid": "3f690cf2409a32bfe4b6f4ae96faeae8", "score": "0.6284313", "text": "def export(filename)\n\t\tout = File.open(filename, 'w+')\n\t\t\n\t\t# Write file eader information\n\t\tout.puts '# ' + \"#{@input_file} :: #{@fileinfo}\"\n\t\toutstr = \"\"\n\t\t@output_ary.each { |e| \n\t\t\toutstr += \"#{e[:name]}_#{e[:unit]}\\t\"\n\t\t}\n\t\tout.puts outstr.rstrip\n\n\t\t(0..@output_ary[0][:values].size - 1).each { |i|\n\t\t\toutstr = \"\"\n\t\t\t@output_ary.each { |e| \n\t\t\t\toutstr += \"#{'%.8e' % e[:values][i]}\\t\"\n\t\t\t}\n\t\t\tout.puts outstr.rstrip\n\t\t}\n\n\t\tout.close\n\tend", "title": "" }, { "docid": "baef4658671c5d0bce518df59a6149dd", "score": "0.62466663", "text": "def output_to_file message\n @log_file.puts message\n @log_file.flush\n end", "title": "" }, { "docid": "32f678dbac00b5a6b899bd686b340a8d", "score": "0.6246333", "text": "def log(output)\n file = File.open(\"./output/#{Date.today.to_s}.txt\", \"a\")\n file.puts(\"#{output}\\n\")\n end", "title": "" }, { "docid": "5ba9c78c34edcef59d5aa446f9896387", "score": "0.6240977", "text": "def file_output output_lines, friend\n # using 'write_to' method with given parameters\n write_to \"#{friend}.txt\" do |file|\n file.write output_lines[0]\n file.write output_lines[1]\n end\nend", "title": "" }, { "docid": "11e0436689f11df42284874808bb33db", "score": "0.6233616", "text": "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search.id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "title": "" }, { "docid": "bcccbd05e665eee5550d243f7cc435da", "score": "0.6229929", "text": "def generate_output_file(zip_out, contents); end", "title": "" }, { "docid": "144a6fab8938c99a39ab9df12cb47527", "score": "0.6213885", "text": "def saveOutput\r\n tmpFile = \"#{@responseDir}/#{@fileName}.response\"\r\n if File.exists?(tmpFile)\r\n File.delete(tmpFile)\r\n end\r\n \r\n file = File.open(tmpFile, \"w\")\r\n file.write printXml\r\n file.close\r\n \r\n lstFile = \"listfile.txt\"\r\n if File.exists? lstFile\r\n File.delete(lstFile)\r\n end\r\n \r\n file = File.open(lstFile, \"w\")\r\n file.write tmpFile\r\n file.close\r\n end", "title": "" }, { "docid": "d2a2d33e3ef774467ba64214d6e079c2", "score": "0.6213856", "text": "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search_id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "title": "" }, { "docid": "70dee5d9c18bd5c0c49e1ff1b791a3a6", "score": "0.6211492", "text": "def handleFileOutput(code)\n open('output.txt', 'w') do |f|\n f << code\n end\n puts \"Compressed file successfully saved as output.txt\\n\\n\"\nend", "title": "" }, { "docid": "c924fdd8449fc1736488dff0d7728d4b", "score": "0.6188121", "text": "def create_mark_output_file(mark_output_file_path)\n # Write test output contents to file.\n File.open(mark_output_file_path, \"w+\") do |file|\n # file.write(collect_mark_file_content)\n\n file.puts(collect_mark_file_content)\n end\n end", "title": "" }, { "docid": "513ca98d1117e1823a090d33d3316a3f", "score": "0.6187048", "text": "def putOut(output, isVerbose=true)\n\tif((!$quiet && !isVerbose) || (isVerbose && $verbose))\n\t\tputs output\n\tend\n\tif($save2File)\n\t\t$file.write(\"[\" + Time.now.to_s + \"] \" + output + $/)\n\tend\nend", "title": "" }, { "docid": "f228d27777c14e9bc6843b4b8d2827bb", "score": "0.6184476", "text": "def output(data); end", "title": "" }, { "docid": "11b58d62f2a9056047480118aa1bd0aa", "score": "0.61761576", "text": "def write_out(rows)\n File.open(file_name, 'w') do |f|\n f.puts rows\n end\n end", "title": "" }, { "docid": "7f64349c7dfacbf8659c3ad0cd04f6d5", "score": "0.6174268", "text": "def save\n render unless result\n if File.exist?(output)\n mode = File.stat(output).mode\n File.chmod(mode | 0000220, output)\n File.open(output, 'w'){ |f| f << result }\n File.chmod(mode, output)\n else\n File.open(output, 'w'){ |f| f << result }\n File.chmod(0440, output) # change to read-only mode\n end\n end", "title": "" }, { "docid": "bd134fbce00dd9209a121568fa5dd9ed", "score": "0.61577386", "text": "def output\n @output ||= File.open(File.join(output_final_directory_path, Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME), 'w')\n end", "title": "" }, { "docid": "dfd6628314d1098d37ee608b9788a7a8", "score": "0.6157548", "text": "def write_data\n \n puts \"Writing out new HR data\"\n processed_record =\".\"\n output_file = File.open(OUTPUT_FILE, 'w')\n \n @completed_users.each do |user| \n output_file.puts user.to_s \n STDERR.print processed_record\n end #basic puts but driven to open file\n \n output_file.close #closes\n puts \"\\nCompleted writing out new HR data \\n#{@completed_users.length} records processed\"\n\nend", "title": "" }, { "docid": "e0e8a0ca5b3e9a6972b7f70d6e7ffe5b", "score": "0.6155976", "text": "def write\n @log.debug('Creating temporary file...')\n tmp = Tempfile.new('oneacct_export')\n @log.debug(\"Temporary file: '#{tmp.path}' created.\")\n @log.debug('Writing to temporary file...')\n write_to_tmp(tmp, fill_template)\n copy_to_output(tmp.path, @output)\n ensure\n tmp.close(true)\n end", "title": "" }, { "docid": "0f04fee6fd12c20dffda9c945bc096ee", "score": "0.6155411", "text": "def public_json_output_file(info, file)\n # format as JSON\n results = JSON.pretty_generate(info)\n\n write_output(file, results)\n\nend", "title": "" }, { "docid": "583af0a8976990e7f2a50fdb3cab4468", "score": "0.61531746", "text": "def write_report filename=nil\n\t\toutput_string = ''\t\t\n\t\tself.sort_drivers_by_miles.each do |key,driver|\n\t\t\toutput_string += \"#{driver.trip_report_str} \\n\"\n\t\tend\n\t\tunless filename.nil?\n\t\t\tFile.write(filename, output_string)\n\t\tend\n\t\tputs output_string\n\t\toutput_string\n\tend", "title": "" }, { "docid": "a8059695b96e7a805225a6433eec603b", "score": "0.6151498", "text": "def write_content(file_out)\n file_out.puts(@array)\n end", "title": "" }, { "docid": "0a66938a18e85387408c70ee6a57b474", "score": "0.61510193", "text": "def output\n @out\n end", "title": "" }, { "docid": "2421d04e6a433be3014597555c3bf98b", "score": "0.6150325", "text": "def output(obj)\n io.puts Yajl::Encoder.encode(obj.merge('job_data' => job_for_output))\n io.flush\n end", "title": "" }, { "docid": "c727f70a1b630975953aefa88d8d739b", "score": "0.6138217", "text": "def store_results_file\r\n\taFile = File.new(\"./random_number_result.txt\", \"r+\")\r\n\taFile.truncate(0)\r\n\tnumber = generate_random_number\r\n\tputs aFile.syswrite(\"#{number}\")\r\nend", "title": "" }, { "docid": "abbe3022dd0aaa423ac2bfc1247e3a0f", "score": "0.6133771", "text": "def report(output)\n end", "title": "" }, { "docid": "5fb44248d93f2864adce3912d7d16046", "score": "0.61249965", "text": "def write_traits(output_file)\n open(output_file, 'a') { |f|\n f.puts \"=========#{@generation}========\"\n @all_persons.each do |person|\n f.puts \"#{person.get_chromosome.get_sequence}\"\n end\n }\n end", "title": "" }, { "docid": "57ab434486f6bf59e73358fa107d2fad", "score": "0.61237866", "text": "def output\n super(@file_format => @file_path)\n end", "title": "" }, { "docid": "d3ec5177a036dbc4b089431a57c403bc", "score": "0.61217594", "text": "def output=(io); end", "title": "" }, { "docid": "8726dcdd01cf16e4ce3d54b82d54ecb6", "score": "0.6120516", "text": "def print_file_sales_report_ascii\n $report_file.puts sales_report_ascii\nend", "title": "" }, { "docid": "cca6545ae855a5566d2c623b1b82d3b5", "score": "0.61202216", "text": "def after_resolution\n output.puts\n end", "title": "" }, { "docid": "2b9748635c2fcabfbfbaaf5539c9053f", "score": "0.6119346", "text": "def output_json_file\n File.write('results.json', { data: data }.to_json)\n end", "title": "" } ]
c20ada995592af9caa3500de1a26ec6e
Default string representation of the text segment.
[ { "docid": "9ad45ca8aa4f030203644ced38a95d41", "score": "0.0", "text": "def to_s\n self.word_form + self.space\n end", "title": "" } ]
[ { "docid": "5e5406b4aab60251e0d221b59875df43", "score": "0.674374", "text": "def default(text)\n text.to_s\n end", "title": "" }, { "docid": "03ef61bd34c5d2a0629ecd96742efcb0", "score": "0.6489721", "text": "def to_s\n @segment\n end", "title": "" }, { "docid": "99add04761063ab2aa6b3338f458246b", "score": "0.6288633", "text": "def text\n \"STRAT\"\n end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "f90ee5f1e9fb242c7b578d7f1755466f", "score": "0.62111866", "text": "def text; end", "title": "" }, { "docid": "3c042a7cdc58cdbd46a01fb1990de450", "score": "0.6173887", "text": "def to_s\n segments.inject('') do |str,seg|\n str << (seg.is_a?(Symbol) ? \":#{seg}\" : seg)\n end\n end", "title": "" }, { "docid": "c9edbcb092e1fa0b4daf4cfe7e12f6cb", "score": "0.6118858", "text": "def to_s\n text\n end", "title": "" }, { "docid": "c9edbcb092e1fa0b4daf4cfe7e12f6cb", "score": "0.6118858", "text": "def to_s\n text\n end", "title": "" }, { "docid": "a63dfcb2980e7c47b8cc803bd87652fe", "score": "0.611318", "text": "def text\n @text.join('')\n end", "title": "" }, { "docid": "e58feb8009644285f9344556c1484b8c", "score": "0.6109167", "text": "def to_s\n text.to_s\n end", "title": "" }, { "docid": "b9355aea0f7c7792d6301289b9cca621", "score": "0.6108291", "text": "def text\n to_s\n end", "title": "" }, { "docid": "dd35c1ae31acccc4650c729c905a94b3", "score": "0.60761875", "text": "def defaultText()\n if @meta_data[@platform].key?(:text)\n return @meta_data[@platform][:text]\n else\n return ''\n end\n end", "title": "" }, { "docid": "7d7d73eaac4afdcbc8083217e2c2309f", "score": "0.60586977", "text": "def raw_text\n \"\"\n end", "title": "" }, { "docid": "2b1630c81ece782fc3c78070dddf96b6", "score": "0.6058283", "text": "def to_s\n \"#{@text}: #{@context}\"\n end", "title": "" }, { "docid": "80d9e6f54a283427f515a1a2a0128c7a", "score": "0.60390425", "text": "def to_s\n text\n end", "title": "" }, { "docid": "44144af896765f5307637f1e008ac7be", "score": "0.60327846", "text": "def to_s; \"Doc-#{target}\\n#{text}\" end", "title": "" }, { "docid": "fde73356ed5cb671728f044056ba62fd", "score": "0.60023063", "text": "def text(*)\n super\n end", "title": "" }, { "docid": "2329e6ff895e53f55ca13d1e167d547a", "score": "0.59995073", "text": "def text text\n end", "title": "" }, { "docid": "a740778c5d8357857cf2e8d5d0623b43", "score": "0.59825045", "text": "def to_s\n\t\t\tcase status\n\t\t\twhen :new\n\t\t\t\t'+++'+text\n\t\t\twhen :old\n\t\t\t\t'---'+text\n\t\t\twhen :range\n\t\t\t\t'@@'+text\n\t\t\twhen :ins\n\t\t\t\t'+'+text\n\t\t\twhen :del\n\t\t\t\t'-'+text\n\t\t\twhen :other\n\t\t\t\t' '+text\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "3c7783574546d40897b8e06b65bb8070", "score": "0.5977453", "text": "def to_s\n @text\n end", "title": "" }, { "docid": "a634b54b68bbf4d2b792e4900d2e8e53", "score": "0.5975872", "text": "def to_s\n text\n end", "title": "" }, { "docid": "23c75f8e6f45619c309a19c471cb8d71", "score": "0.5961188", "text": "def to_s\n \"#{text}\"\n end", "title": "" }, { "docid": "23c75f8e6f45619c309a19c471cb8d71", "score": "0.5961188", "text": "def to_s\n \"#{text}\"\n end", "title": "" }, { "docid": "1dd2ac36168039281f79645ea9732358", "score": "0.59439033", "text": "def to_s\n @text\n end", "title": "" }, { "docid": "1dd2ac36168039281f79645ea9732358", "score": "0.59439033", "text": "def to_s\n @text\n end", "title": "" }, { "docid": "e582d41995911f68b6474f4df7b6606e", "score": "0.5942896", "text": "def formatted_text\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn \"Discussion added, \\'#{self.reference.subject}\\'\"\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn \"Comment added to \\'#{self.reference.discussion.subject}\\'\"\n\t\tend\n\tend", "title": "" }, { "docid": "653c41b77d2a7a672b48bbe471b5d6d4", "score": "0.5931146", "text": "def to_s\n text\n end", "title": "" }, { "docid": "041d60cb2af3c41c1f69998a30f3afa3", "score": "0.59179825", "text": "def to_s\n return @text\n end", "title": "" }, { "docid": "d65bf27d7c696ef0315ca339cecb43c4", "score": "0.59111917", "text": "def to_s\n @text\n end", "title": "" }, { "docid": "d65bf27d7c696ef0315ca339cecb43c4", "score": "0.59111917", "text": "def to_s\n @text\n end", "title": "" }, { "docid": "4d6ae09e8114779a61f23c870fe5a3f6", "score": "0.58995855", "text": "def text\n param(-1)\n end", "title": "" }, { "docid": "ac14cf7dc389bc76ae8fca4eaed6f894", "score": "0.5879744", "text": "def to_s\n @segments.collect { |s| s if s.to_s.length > 0 }.join( \"\\n\" ).encode(encoding)\n end", "title": "" }, { "docid": "84d293c5a03697410ec2f00acac5f040", "score": "0.5868701", "text": "def string() end", "title": "" }, { "docid": "13e8bbdb0f817ca7172e0a4ccc4d48e7", "score": "0.5857171", "text": "def text\n @parts.join\n end", "title": "" }, { "docid": "34a4fbac48aa1a4efa3356d652bb07ed", "score": "0.58370113", "text": "def text *params\n raise_without_self \"Parameters are not specified!\", HOWT if params.empty?\n params = params[0]\n\n # reduce short form to full\n params = {@text_default => params} if single_term? params\n\n # parse full form\n opt = OpenStruct.new(:control_text => nil)\n parse_metric params, opt\n\n return @adapter.text(opt)\n end", "title": "" }, { "docid": "4b2318b94d79a013ca55980ddd989b85", "score": "0.58081335", "text": "def to_s\n text_value\n end", "title": "" }, { "docid": "2d5cad06e8bb855ca24f7b250dced437", "score": "0.5803481", "text": "def as_text\n raise Error::UnsupportedOperation, \"Method Geometry#as_text not defined.\"\n end", "title": "" }, { "docid": "af4d57923a349d920f1c95ac052f5f2c", "score": "0.5775735", "text": "def to_s\n format(:default)\n end", "title": "" }, { "docid": "e0e490ea2a1094507937c1f206827a48", "score": "0.5773396", "text": "def text\n options.fetch(:text, nil)\n end", "title": "" }, { "docid": "bca526799e74b1225826cfc3eb0b1289", "score": "0.57674456", "text": "def text(path = T.unsafe(nil)); end", "title": "" }, { "docid": "02d19c58814566b59f8bdac20305b263", "score": "0.575465", "text": "def to_s\n text = \"#{keyword} #{self.text}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "title": "" }, { "docid": "7ed37ef754d55c432ff403f6be7d4190", "score": "0.5754243", "text": "def to_s\n Alf::Renderer.text(self).execute(\"\")\n end", "title": "" }, { "docid": "01334d5883e964628ab573d03ab2703a", "score": "0.5750447", "text": "def to_text(pad)\n if @tagstr.length == 0\n ''\n else\n pad + @tagstr + \"\\n\"\n end\n end", "title": "" }, { "docid": "8738cb77446c7ced526a5a44a798cffa", "score": "0.57494557", "text": "def as_text\n @fragment.as_text\n end", "title": "" }, { "docid": "b56d8f6121adce4a89741eea2122f0f3", "score": "0.57474685", "text": "def to_s\n return \"[#{@text}:#{@type}]\"\n end", "title": "" }, { "docid": "f33d05e1ee98de658723f81622da5af6", "score": "0.57470423", "text": "def string\n @fragments.join(\" \")\n end", "title": "" }, { "docid": "77a6fc63066cc5e5b60e391c812e4759", "score": "0.57469654", "text": "def create_sample_text\n Text.new(0, viewport, 0, 0, 0, 0, ' ')\n end", "title": "" }, { "docid": "5abf8b7b8337732972affb08cb6c3421", "score": "0.574418", "text": "def to_s\n \"\"\n end", "title": "" }, { "docid": "f4677e1a1734c3971aa11ba90232a98a", "score": "0.5739722", "text": "def as_text\n @text\n end", "title": "" }, { "docid": "affeade8acdcd743bdebebf3f16a3b25", "score": "0.573894", "text": "def text\n @text\n end", "title": "" }, { "docid": "00ddd63aace3b539d3fd332b92ba0e43", "score": "0.57340753", "text": "def to_s\n if self.is_blank_interval\n #is blank interval --> <% 17>\n stimulusText='<% '+self.duration.to_s+'>'\n else\n #is not blank interval\n stimulusText='\"'+self.text+'\"'\n if self.stimulus_type==\"wav\"\n #is sound\n if self.synchronise_with_next==true\n stimulusText='<svp start> '+stimulusText\n end\n stimulusText='<'+self.stimulus_type+'> '+stimulusText\n \n else \n if self.stimulus_type==\"bmp\"||self.stimulus_type==\"jpg\"\n #is image\n stimulusText=' <'+self.stimulus_type+' '+self.top_possition.to_s+', '+self.left_possition.to_s+'> '+stimulusText \n else\n #is text\n #add line\n stimulusText=\"<Line \"+self.present_in_line.to_s+\"> \"+stimulusText\n end\n #add the duration of the stimulus (NOT FOR AUDIO STIMULUS?????)\n stimulusText=stimulusText+' <% '+self.duration.to_s+'>'\n end\n if self.not_erase_previous\n stimulusText=\"!\"+stimulusText\n end\n \n \n #add symbol \"/\" at the end of the stimulus or not\n if self.clear_screen\n stimulusText=stimulusText+\" /\"\n else\n stimulusText=stimulusText+\",\"\n end\n end\n stimulusText\n end", "title": "" }, { "docid": "5745830ebb8f49cadaebcefd814b0b19", "score": "0.5733548", "text": "def to_s\n nil? ? '' : super\n end", "title": "" }, { "docid": "d656ed9d0eeea76566f6409bee0b2a71", "score": "0.571928", "text": "def to_s\n \"in segment #{@whitelist}\"\n end", "title": "" }, { "docid": "95573d7ef176c2aecdf3ff2070de6992", "score": "0.57112086", "text": "def to_s\n return super + \": '#{token.lexeme}'\"\n end", "title": "" }, { "docid": "5c35c1c26123b12371af78cfeec97049", "score": "0.570794", "text": "def text\n @text\n end", "title": "" }, { "docid": "3362902a770c37706fd78367e206a11d", "score": "0.56973505", "text": "def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end", "title": "" }, { "docid": "5baea62d1dfc85d00ac19bab3c118185", "score": "0.5688108", "text": "def text_default metric;\n @text_default = metric\n end", "title": "" }, { "docid": "25946ff8cebb7cc75fce4f2de3a9ee51", "score": "0.56860954", "text": "def text\n add_spaces(@text, @chars_per_group)\n end", "title": "" }, { "docid": "ada6d9e2266908f7fa42fcab2ec5a9e6", "score": "0.56788784", "text": "def text_name\n summary.to_s\n end", "title": "" }, { "docid": "acb0080adaf7a3a72d9edd35ba1a6cd7", "score": "0.5677177", "text": "def text_representation(allow_z=true,allow_m=true) #:nodoc:\r\n tex_rep = \"#{@x} #{@y}\"\r\n tex_rep += \" #{@z}\" if @with_z and allow_z\r\n tex_rep += \" #{@m}\" if @with_m and allow_m\r\n tex_rep\r\n end", "title": "" }, { "docid": "98bb0fa3a2d7f5866365fe7d1b391b77", "score": "0.5672335", "text": "def text=(_arg0); end", "title": "" }, { "docid": "a14c6582bbe8d2938365cf4e7a124ca1", "score": "0.5669043", "text": "def text_representation(allow_z = true, allow_m = true) #:nodoc:\n tex_rep = \"#{@x} #{@y}\"\n tex_rep += \" #{@z}\" if @with_z && allow_z\n tex_rep += \" #{@m}\" if @with_m && allow_m\n tex_rep\n end", "title": "" }, { "docid": "d60cf2b6e7351769992e57c9a4e28b8f", "score": "0.56662387", "text": "def to_s\n TEXT_SYMBOLS[self.entry_type] + \n \"] \" +\n body\n end", "title": "" }, { "docid": "79b9f50c56918a8fbc61c79162744461", "score": "0.5666003", "text": "def string_content\n CMark.node_get_string_content(@pointer)\n end", "title": "" }, { "docid": "d888aedf79827395748425aaaf8b189a", "score": "0.5660176", "text": "def description; @text; end", "title": "" }, { "docid": "d516950dda2300e815b022549f1319dd", "score": "0.5659991", "text": "def text(data, sectname='__text', segname='__TEXT')\n real_segname = nil\n unless @current_segment\n real_segname = segname_based_on_filetype(segname)\n segment(real_segname) do |seg|\n seg[:maxprot] = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE\n seg[:initprot] = VM_PROT_READ | VM_PROT_EXECUTE\n end\n end\n\n section(sectname, segname, data) do |sect|\n # reloff and nreloc are calculated later (in calculate_offsets)\n sect[:flags] = 0x400 # S_ATTR_SOME_INSTRUCTIONS\n end\n\n # Remember where section and data are so we can update them later.\n @text_segname = real_segname || segname\n @text_sect_index = @sections[@text_segname].length-1\n @text_data_index = @data.length-1\n\n return self\n end", "title": "" }, { "docid": "d3b7c83c908193a032466ef56e6227d2", "score": "0.56518453", "text": "def String(p0) end", "title": "" }, { "docid": "4e259dddf5466dd08df64666d404788b", "score": "0.5646837", "text": "def to_s\n \"\"\n end", "title": "" }, { "docid": "4e259dddf5466dd08df64666d404788b", "score": "0.5646837", "text": "def to_s\n \"\"\n end", "title": "" }, { "docid": "508d9ce3de27a3b0ce53b6c1a57807f1", "score": "0.5646098", "text": "def text\n @value[:text].to_s\n end", "title": "" }, { "docid": "723e47fec85403eaccfd52bcc09e0e5f", "score": "0.56356263", "text": "def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "title": "" }, { "docid": "679ade0c023b009cd20c2561148151ff", "score": "0.5620104", "text": "def text\n @attributes.fetch('text', nil)\n end", "title": "" }, { "docid": "63a041f25f946c54041a15c0cd5f16a0", "score": "0.5619806", "text": "def stringOutput\n\t\tend", "title": "" }, { "docid": "63a041f25f946c54041a15c0cd5f16a0", "score": "0.5619806", "text": "def stringOutput\n\t\tend", "title": "" }, { "docid": "bb5ccfa412a2a726e7d4ce5cc504f499", "score": "0.56181777", "text": "def text\n attributes.fetch(:text)\n end", "title": "" }, { "docid": "bb5ccfa412a2a726e7d4ce5cc504f499", "score": "0.56181777", "text": "def text\n attributes.fetch(:text)\n end", "title": "" }, { "docid": "bb5ccfa412a2a726e7d4ce5cc504f499", "score": "0.56181777", "text": "def text\n attributes.fetch(:text)\n end", "title": "" }, { "docid": "2153cf56cfea8921a60e8330fed669ff", "score": "0.56152695", "text": "def default\n ''\n end", "title": "" }, { "docid": "86129319a2a6447f6fe874d37b39c363", "score": "0.5605132", "text": "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "title": "" }, { "docid": "f45dc3fc5eebdcc8325a5f98389dea5e", "score": "0.56048423", "text": "def get_text\n raise NotImplementedError\n end", "title": "" }, { "docid": "027149c8dfd58c1ee2cd231d8b2c2509", "score": "0.560111", "text": "def text\n [email protected]\n v == \"\" ? nil : v\n end", "title": "" }, { "docid": "027149c8dfd58c1ee2cd231d8b2c2509", "score": "0.560111", "text": "def text\n [email protected]\n v == \"\" ? nil : v\n end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" }, { "docid": "c5102d7f884ed2a4f4e594b4c5e48d46", "score": "0.5584482", "text": "def string; end", "title": "" } ]
1c61b2d26b80ebd8075be9ef9681f620
Validate check scheduling. Validates: publish, interval, standalone, subscribers
[ { "docid": "69ae12dcabc183686cae362a4ed4791b", "score": "0.83801675", "text": "def validate_check_scheduling(check)\n must_be_boolean_if_set(check[:publish]) ||\n invalid(check, \"check publish must be boolean\")\n unless check[:publish] == false\n if check[:cron]\n validate_check_cron(check)\n else\n (must_be_an_integer(check[:interval]) && check[:interval] > 0) ||\n invalid(check, \"check interval must be an integer greater than 0\")\n end\n end\n must_be_boolean_if_set(check[:standalone]) ||\n invalid(check, \"check standalone must be boolean\")\n unless check[:standalone]\n if is_an_array?(check[:subscribers])\n items_must_be_strings(check[:subscribers]) ||\n invalid(check, \"check subscribers must each be a string\")\n else\n invalid(check, \"check subscribers must be an array\")\n end\n end\n end", "title": "" } ]
[ { "docid": "f4e5d860674b116bd8586112e19fb35d", "score": "0.6534519", "text": "def check_schedule()\n create_daily_tests()\n create_weekly_tests()\n end", "title": "" }, { "docid": "b95d7d2844c76882fb8ddb87fcbc6361", "score": "0.64340407", "text": "def run_interval_check\n if self.attributes.keys.include?('run_start_minute')\n if !run_start_minute.present? && !run_interval.present?\n errors.add(:run_interval, \"or run_start_minute must be nil\")\n errors.add(:run_start_minute, \"or run_interval must be nil\")\n end\n else\n if !run_interval.present?\n errors.add(:run_interval, \"must be present\")\n end\n end\n end", "title": "" }, { "docid": "6d4336672f70bd3886671291b735b183", "score": "0.64090925", "text": "def validate_check_subdue(check)\n validate_time_windows(check, \"check\", :subdue)\n end", "title": "" }, { "docid": "7c99ed186b6659d1130edc0d12b50a71", "score": "0.6378439", "text": "def check_schedule(range_of_days)\n\tif 1 > range_of_days.to_i\n\t\traise \"The schedule of the diary must last for at least one day.\"\n\telsif 40 < range_of_days.to_i\n\t\traise \"Save paper! Don't generate schedule for >40 days.\"\n\tend\n\t\n\t# Set the duration of the food diary\n\t$duration = range_of_days.to_i\nend", "title": "" }, { "docid": "59a34e3a9e30f46312b7e32d74eff49f", "score": "0.6332806", "text": "def validate_payment_schedule_types(payment_schedule)\n schedule = %w[weekly biweekly monthly]\n unless schedule.include? payment_schedule\n \"payment schedule can only be: #{schedule.join(', ')}\"\n end\n end", "title": "" }, { "docid": "b7e9857540384921e1df5c036ef6e878", "score": "0.6332361", "text": "def initialize(schedule)\n @result, @min, @hour, @day, @month, @wday = *schedule.match(CRON_REGEXP)\n validate\n end", "title": "" }, { "docid": "cc0f6919c05134a4eef6843b06c1cbe3", "score": "0.63084763", "text": "def validate_time_to_market\n # lead time based on priority!\n today = Date.today\n days = (self.start_date - today).to_i\n if days < LEAD_TIME[self.priority]\n add_validation 'Start date must be at least ' + LEAD_TIME[self.priority].to_s + ' days in advance for ' +\n EngagementRequest::PRIORITIES[self.priority] + ' priority'\n end\n\n # 30 day minimum!\n length = (self.end_date - self.start_date).to_i\n if length < 30\n add_validation 'Projects with a length of less than 30 days will not be considered'\n end\n\n # must start on a Monday and end on a Friday\n if self.start_date.wday != 1\n add_validation 'Start Date must be a Monday'\n end\n if self.end_date.wday != 5\n add_validation 'End Date must be a Friday'\n end\n\n # cost reduction projects!\n cost_reduction = ['Operations Streamlining', 'Manufacturing Efficiency'].include? self.program.name\n if cost_reduction && self.projected_revenue != 0\n add_validation self.program.name + ' is not expected to generate revenue'\n end\n if cost_reduction && ! self.low_risk?\n add_validation self.program.name + ' projects must be low risk'\n end\n\n # potential profit!\n profit = self.projected_revenue - self.budget_allocated\n if ! cost_reduction && profit < RISK_REWARD[self.risk_rating]\n add_validation EngagementRequest::RISK_RATINGS[self.risk_rating] +\n ' risk projects should be expected to produce at least ' +\n number_to_currency(RISK_REWARD[self.risk_rating]) + ' profit'\n end\n\n # risks should be defined! 5 sentences!\n validate_sentences_length 'Risks', self.risks, 100, 500, 5\n end", "title": "" }, { "docid": "abe3f8e346b46e7f7581e4a1ac21072c", "score": "0.62386304", "text": "def validate_check_cron(check)\n must_be_a_string(check[:cron]) ||\n invalid(check, \"check cron must be a string\")\n begin\n cron_parser = CronParser.new(check[:cron])\n cron_parser.next(Time.now)\n rescue ArgumentError\n invalid(check, \"check cron string must use the cron syntax\")\n end\n end", "title": "" }, { "docid": "c75356e6eb9a531e6294f05f56a28d30", "score": "0.6194792", "text": "def validate\n @errors = []\n validate_termination\n validate_freq\n validate_interval\n validate_int_by_list(:bysecond, (0..59))\n validate_int_by_list(:byminute, (0..59))\n validate_int_by_list(:byhour, (0..23))\n validate_int_by_list(:bymonth, (1..12))\n validate_bysetpos\n validate_byday_list\n validate_bymonthday_list\n validate_byyearday_list\n validate_byweekno_list\n validate_wkst\n end", "title": "" }, { "docid": "2f98c641c37177d7f6f25d8bb06f3edc", "score": "0.6184896", "text": "def validate!\n unless @pattern.kind_of? String\n raise InvalidCronPatternError.new(\"cron pattern must be a string\".squish)\n end\n fix_common_typos! # how nasty!\n # do you know that cron has some pretty good fields, huh?\n # go and,\n validate_fields!\n end", "title": "" }, { "docid": "3cec7e6a781a7fd7099e5aecbc8cf10f", "score": "0.6163582", "text": "def exclusive_schedule\n if Schedule.where('init >= ? AND init <= ?', init, finish).any?\n errors.add(:base, \"Já existe uma reserva para esse horário\")\n end\n end", "title": "" }, { "docid": "34d67df5323197716ee81137c0110293", "score": "0.6150335", "text": "def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend", "title": "" }, { "docid": "71457e256401dad2a06bea97059e7220", "score": "0.6131413", "text": "def validate\n\t\tif not isEmpty(self.time)\n\t\t\terrors.add(:time, \"is already occupied.\")\n\t\tend\n\t\tif not Schedule.isValidTimeSlot(self.schedule, self.time)\n\t\t\terrors.add(:time, \"is not a valid timeslot.\")\n\t\tend\n\tend", "title": "" }, { "docid": "b714be480afbab39c59fa4aba6d5424f", "score": "0.6070334", "text": "def valid?\n id && cron_schedule && worker\n end", "title": "" }, { "docid": "02881afbe90e7ecd9d70790b9d30c92e", "score": "0.60267746", "text": "def validate_check(check)\n validate_check_name(check)\n validate_check_execution(check)\n validate_check_source(check) if check[:source]\n validate_check_scheduling(check)\n validate_check_proxy_requests(check) if check[:proxy_requests]\n validate_check_handling(check)\n validate_check_ttl(check) if check[:ttl]\n validate_check_aggregate(check)\n validate_check_flap_detection(check)\n validate_check_hooks(check) if check[:hooks]\n validate_check_truncate_output(check)\n validate_check_subdue(check) if check[:subdue]\n end", "title": "" }, { "docid": "5bdde4b6dd3b9f46fd2d84d370916f94", "score": "0.59952974", "text": "def can_schedule?\n conditions.any?\n end", "title": "" }, { "docid": "4d766de5735abf2594a9172bc01f2ddc", "score": "0.598387", "text": "def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend", "title": "" }, { "docid": "e8a331f6a416caf7a68ff17b4e903557", "score": "0.5967665", "text": "def validate_wpm_parameters(wpm_type)\n errors = validate_common_parameters\n\n # Work\n @check_guid = get_field('check_guid', '')\n @from_date = get_field('from_date')\n @to_date = get_field('to_date')\n @detail_level = get_int_field('detail_level', 1)\n @scope = get_field('scope')\n @count = get_int_field('count')\n\n # The rules:\n # ALL require \"check_guid\"\n # :last_value ignores rest\n # :aggregated requires: \"from_date\", \"to_date\", \"detail_level\", \"scope\"\n # :most_recent requires: \"from_date\", \"to_date\", \"detail_level\", OR\n # \"count\", \"detail_level\"\n\n errors << 'No Check GUID specified' if @check_guid.empty?\n # Could probably validate guid a little better than that...\n\n if wpm_type == WPM_LAST_VALUE\n # No additional checks required\n end\n\n if wpm_type == WPM_MOST_RECENT\n # Check count (optional)\n errors << \"'Count #{@count}' out of range. Must be between 1 and <tbd>\" if @count < 1\n end\n\n if wpm_type == WPM_AGGREGATED || wpm_type == WPM_MOST_RECENT\n # Check detail level\n errors << \"'Detail Level #{@detail_level}' out of range. Must be between 1 and 3\" if @detail_level < 1 || @detail_level > 3\n\n if wpm_type == WPM_AGGREGATED || @count == 0\n # Check scope\n @scope = @scope.downcase if @scope\n errors << \"'Scope #{@scope}' out of range. Must be either 'd' (day), or 'h' (hour)\" if @scope != 'd' && @scope != 'h'\n\n # Check dates\n end\n end\n\n if !errors.empty?\n raise ConfigError, \"Configuration errors: #{errors.join(', ')}\"\n end\n end", "title": "" }, { "docid": "accf96a7408a75652fdd0a7ea458ed88", "score": "0.5921723", "text": "def valid_schedule?(time_blocks)\n time_blocks = quicksort_timeblocks(time_blocks)\n return !exists_overlap?(time_blocks)\n end", "title": "" }, { "docid": "22e8c6a1cf55974e05bfda0638e9aed6", "score": "0.5885618", "text": "def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end", "title": "" }, { "docid": "69b457ba60571650b62176fd18f41772", "score": "0.58793795", "text": "def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end", "title": "" }, { "docid": "b2a2289f6ca9a59fd21ff98558b45db7", "score": "0.58717036", "text": "def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end", "title": "" }, { "docid": "f9eda11e76ccf6f4309754df0e74d083", "score": "0.5858288", "text": "def validate!\n ensure_valid_tick\n end", "title": "" }, { "docid": "dd8bd4bf11485ca5b91b3b2ba99f9be6", "score": "0.5857756", "text": "def valid?\n return false if !@monitor_priority.nil? && @monitor_priority > 5\n return false if !@monitor_priority.nil? && @monitor_priority < 1\n return false if !@tick_every.nil? && @tick_every > 604800\n return false if !@tick_every.nil? && @tick_every < 30\n true\n end", "title": "" }, { "docid": "3d2ebd5ad88a2da10eac586745046dd5", "score": "0.5849148", "text": "def time_valid\n if self.valid_from and self.valid_to then\n errors.add(:valid_from,\n \"must be before the valid to date. #{self.valid_from} >= #{self.valid_to}\") unless self.valid_from < self.valid_to\n else\n if self.valid_from or self.valid_to then\n errors.add(:valid_from,\n \" must be set when valid_to is set.\") unless self.valid_from\n errors.add(:valid_to,\n \" must be set when valid_from is set.\") unless self.valid_to\n end\n end\n end", "title": "" }, { "docid": "63a1e3cfe27ebb4fc2888b9532364c8c", "score": "0.5840436", "text": "def validate_with_shift_times # see alias_method_chain above\n #s_time = (start_time.hour * 2) + (start_time.min/30)\n #e_time = (params[:issue][:end_time].hour * 2) + (params[:issue][:end_time].min/30)\n\n #if (e_time<=s_time) && (e_time == 0 || e_time == 1)\n # #errors.add :due_date, :greater_than_start_date\n # end_time = Issue.time_list[e_time+48] #assuming user knows what he's doing, automatically adjusts the time to next day\n #end\n\n if self.end_time and self.start_time and self.end_time <= self.start_time\n errors.add :due_date, :greater_than_start_date\n end\n\n end", "title": "" }, { "docid": "e0bd73b037338414aa70684e2474e21f", "score": "0.57958376", "text": "def valid?\n return false if @name.nil?\n return false if @schedule.nil?\n true\n end", "title": "" }, { "docid": "3e89f82e445e9bec508c4a68246663a1", "score": "0.57945323", "text": "def validate\n\n # no need to validate if disabled\n return if disabled?\n\n # validate that we've filled in all the days\n if rateType == 'Day'\n\n if dayValue == 0\n\n if requireFullWeek == true\n\n # must fill in whole week, and datValue is 0\n errors.add(:dayValue, \"You must supply a day value for all shifts, including weekends\")\n\n else\n\n # requireFullWeek is false\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry is not filled in for mon to fri\n errors.add(:dayValue, \"You must supply a day value for each shift, Mon - Fri\")\n \n end\n \n end\n\n end\n\n # return as there is no need to validate anything else\n return\n \n end\n\n # now validating hourly rate entry\n if hours.blank?\n \n # can we allow blank hours?\n if is_bank_hol == false\n \n if requireFullWeek == true\n \n # its not a bank holiday and we need the whole week\n msg = \"Hours must be supplied for all days\"\n\n else\n\n # its not a bank hol and we dont need the whole week\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry for mon-fri isnt supplied\n msg = \"Hours must be supplied for Monday - Friday\"\n \n end\n\n end\n \n end\n\n if !msg.blank?\n\n errors.add(:hours, msg)\n\n end\n\n end\n\n # validate start, end and break times\n if !startTime.blank? && !finishTime.blank? && !hours.blank? && requireTimes\n\n time_difference = Time.parse(finishTime) - Time.parse(startTime)\n break_seconds = Time.parse(breakHours) - Time.parse(\"00:00\") unless breakHours.blank?\n time_difference -= break_seconds unless break_seconds.nil?\n specified_hours = Time.parse(hours) - Time.parse(\"00:00\")\n \n if (time_difference <=> specified_hours) != 0\n \n # the time entered in hours doesnt match the calculation\n errors.add(:hours, \"Make sure the hours supplied correctly relates to the time periods\")\n \n end\n\n end\n\n # check times are valid\n if (startTime.blank? || finishTime.blank?)\n \n #logger.info(\"date: #{dateValue}, manual: #{manual}, disabled: #{disabled}, rateType: #{rateType}, rate category: #{rate.category}\")\n \n if requireTimes == true\n\n # if we dont require full week and this is a w/e then dont bother carrying on\n if requireFullWeek == false && (dateValue.wday == 6 || dateValue.wday == 0)\n return\n end\n\n # if we get here then there's a prob so display error\n errors.add(:startTime, \"You must supply start times\") if startTime.blank? && rate.category != 'Unpaid'\n errors.add(:finishTime, \"You must supply finish times\") if finishTime.blank? && rate.category != 'Unpaid'\n\n end\n\n end\n \n end", "title": "" }, { "docid": "9edabd54008ca8f4939be15b9eb7393e", "score": "0.5772104", "text": "def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end", "title": "" }, { "docid": "7ca8b2917868ea77033b5cd41af5e23c", "score": "0.57693726", "text": "def test_arrival_time_validation\n batch = Batch.new(:id => 80,\n :batchid => 8,\n :date => \"#{Time.now}\",\n :eob => 30,\n :facility_id => 1,\n :arrival_time => \"#{Time.now.yesterday}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\")\n batch.valid?\n assert_equal \"must be within 6 hours window period from current time\", batch.errors.on(\"arrival_time\")\n \n batch = Batch.new(:id => 80,\n :batchid => 8,\n :date => \"#{Time.now}\",\n :eob => 30,\n :facility_id => 1,\n :arrival_time => \"#{Time.now.tomorrow}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\")\n batch.valid?\n assert_equal \"must be within 6 hours window period from current time\", batch.errors.on(\"arrival_time\")\n end", "title": "" }, { "docid": "932c42337974a67e525edc86854ec4da", "score": "0.5733744", "text": "def validate!\n validate_redis\n validate_workers\n validate_options\n end", "title": "" }, { "docid": "336468a35776d688bd922ce6ad08922a", "score": "0.5728648", "text": "def valid_timing\n errors.add(:review, \"Invalid timing for review\") unless !reservation.nil? && reservation.status == \"accepted\" && reservation.checkout < Time.current\n end", "title": "" }, { "docid": "d76b8f7f53c334f511618d1299cb60ea", "score": "0.57082", "text": "def scheduled?(schedulable, starts, ends)\n puts \"This #{schedulable.class} is not scheduled between #{starts} and #{ends}\"\n end", "title": "" }, { "docid": "ba2afd1352ba3d1d3bfa294da6ea95a9", "score": "0.56987417", "text": "def validate_check_in_time\n validate_time(params[:check_in][:check_in_time])\n end", "title": "" }, { "docid": "6cca3b5c7da77551c2eabab8fab69545", "score": "0.56948525", "text": "def time_is_within_scheduled_days\n \tif start_time\n \t\tschedule = Schedule.find_by(id: Piece.find_by(id: piece_id).schedule_id)\n\t update_day = nil\n\t schedule.days.each do |day|\n\t \t\tupdate_day = day if start_time >= day.start_time and start_time <= day.end_time\n\t \t\tbreak if !update_day.nil?\n\t end\n\t update_day.nil? ? errors.add(:start_time, \"must be during one of the scheduled times\") : update_attribute(:day, update_day)\n\t else\n\t \tupdate_attribute(:day, nil)\n\t end\n end", "title": "" }, { "docid": "11925babe16c1cd46cc3cf4b6cfdc51f", "score": "0.56852543", "text": "def check_deadline\n true\n end", "title": "" }, { "docid": "061bd943a0a02e7fa4242355f8fde977", "score": "0.5665616", "text": "def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend", "title": "" }, { "docid": "9213ae0f2aa6ac7150b0287b63934e77", "score": "0.5662568", "text": "def valid\n if @counter > Settings.max_recurrences &&\n Settings.max_recurrences != -1\n fail MaxInstancesExceededException, \"Recurring events are only allowed to generate #{Settings.max_recurrences}\"\n end\n\n !@current_date.nil?\n end", "title": "" }, { "docid": "d03d731552d57073a883d00a77cbf589", "score": "0.56606394", "text": "def check_DR_sched(dr_hrly, model, runner)\n # Check for invalid DR flags\n if (dr_hrly.to_a - (-1..1).to_a).any?\n runner.registerError('The DR schedule must have values of -1, 0, or 1.')\n return false\n end\n\n return true\n end", "title": "" }, { "docid": "24d2e7b6c630531fd437b8770bbbc1f4", "score": "0.5654969", "text": "def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end", "title": "" }, { "docid": "fbc9c2e463515ca44dc6c60fc3fae111", "score": "0.5650526", "text": "def validate_task(task, instance, options)\n if instance.try(:ext_management_system)&.zone&.maintenance?\n task.error(\"#{instance.ext_management_system.name} is paused\")\n return false\n end\n\n return true unless options[:task] == \"retire_now\" && instance.retired?\n task.error(\"#{instance.name} is already retired\")\n false\n end", "title": "" }, { "docid": "e41bd8cb06e1a10c1464d56f7dc0ac6f", "score": "0.56229734", "text": "def validate!\n raise \"Missing period\" if throttle_period.nil?\n end", "title": "" }, { "docid": "154169f794b9562ee277cd5ed28e5e8f", "score": "0.561308", "text": "def schedule_next_check time_to_check\n # TODO if time to check is not between 6:55 AM and 9:00 AM on a weekday, \n # TODO then schedule for 6:55 AM on the next weekday\n puts \"Is weekday? #{time_to_check.wday.between?(1,6)}\"\n puts \"Is after 9:00 AM on weekday? #{time_to_check.hour.between?(6,9)}\"\n puts \"Will check for bus at #{time_to_check}\"\n @sched.at time_to_check do\n check_for_bus\n end\n @sched.join\n end", "title": "" }, { "docid": "5c6fac736f4239bd22d29e9c9f600045", "score": "0.5601578", "text": "def evaulate_schedule\n true\n end", "title": "" }, { "docid": "014ef86cb7ee9b123dc84d66712e3e57", "score": "0.5574479", "text": "def validate_for_another_reservation\n if start_at && end_at && BUSY_STATUSES.include?(self.status)\n errors.add(:start_at, 'Another reservation already exists for these dates.') if exists_other_reservations_in_same_period?\n end\n end", "title": "" }, { "docid": "0e70b3c778901623255a392846e457a8", "score": "0.556171", "text": "def validate_start_and_stop_time\n if active_time\n if active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_time, \"start time or end time not set\")\n end\n end\n end", "title": "" }, { "docid": "f66c6cd31805ee3814a56c3b238fdda0", "score": "0.5561539", "text": "def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end", "title": "" }, { "docid": "ca355f4e7806519ba303317f0338c17d", "score": "0.55441105", "text": "def check_invariants\n validEvent = true\n\n # This block checks if the start and end times are empty\n if :start_time_date.empty? or :end_time_date.empty?\n errors.add :start_time, \"should be added.\"\n validEvent = false\n end\n \n # This block checks if the number of categories is > 2\n if !categories.nil? and categories.split(',').size > 2\n errors.add :categories, \"section should only have one or two categories selected.\"\n validEvent = false\n end\n\n # This block checks if the start time is greater than the end time\n# #if (Time.strptime(self.start_time, \"%Y-%d-%m %H:%M\") > Time.strptime(self.end_time, \"%Y-%d-%m %H:%M\")) \n# if (self.start_time > self.end_time)\n# errors.add :start_time, \"should be before the end time.\"\n# validEvent = false\n# end\n\n # This block checks if the name field exists\n if (self.name.nil?)\n errors.add :name, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the description field exists\n if (self.description.nil?)\n errors.add :description, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the location field exists\n if (self.location.nil?)\n errors.add :location, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the approval_rating field exists\n if (self.approval_rating.nil?)\n errors.add :approval_rating, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_start field exists\n if (self.event_start.nil?)\n errors.add :event_start, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_end field exists\n if (self.event_end.nil?)\n errors.add :event_end, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if there are any duplicate events when submitting a new event\n if(self.id == nil) \n if (Event.exists?(:location => self.location, :start_time => self.start_time, :end_time => self.end_time))\n errors.add :location, \"invalid: Cannot be a duplicate event.\"\n validEvent = false\n end\n else\n if (Event.where(\"location = ? AND start_time = ? AND end_time = ? AND NOT id = ?\", self.location, self.start_time, self.end_time, self.id).length >= 1)\n errors.add :location, \"invalid: Created a duplicate event via editing\"\n end\n end\n\n # This block checks to make sure that the organization\n # matches the specified user\n if !can_modify?(self.user)\n errors.add :organization, \"should be one that you are a member of\"\n validEvent = false\n end\n\n return validEvent\n end", "title": "" }, { "docid": "cdf69addbfef00ea1fcd6b2606eb1b65", "score": "0.55410373", "text": "def is_valid_service\n if (self.status == \"active\" and (self.is_schedulelater == true or (self.is_schedulelater == false and self.end_date >= Date.today)))\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "64a11dce309db03307e211e88ddbbbf9", "score": "0.55278903", "text": "def new_schedule(*args)\n if !args.all? { |e| e.is_a?(Integer) && e >= 0 && e <= 6 }\n return \"Please enter a number from 0-6 where each number represents a day of the week. 0 represents Sunday, 1 represents Monday, etc.\"\n end\n schedule1 = Schedule.new(self.first_event, duration: self.duration_mins.minutes )\n schedule1.add_recurrence_rule Rule.weekly.day(args)\n self.schedule = schedule1\n self.save!\n end", "title": "" }, { "docid": "f711d1b4a6b7202031a958269e4e87fe", "score": "0.5521914", "text": "def validate\n validate_amount\n validate_game\n validate_period\n end", "title": "" }, { "docid": "9817a7474b81a2bdda0e185508dbf422", "score": "0.55207664", "text": "def valid_appointments(base_time)\n transform_blocks_to_appointments(valid_blocks(base_time))\n end", "title": "" }, { "docid": "a37b29c3706d8feec707905c763b44bf", "score": "0.5515568", "text": "def validate\n unless TrueClass === @obsolete or FalseClass === @obsolete then\n raise RuntimeError.new( 'task validation failed: obsolete must be true or false ')\n end\n unless @id.is_a? Integer then\n raise RuntimeError.new( 'task validation failed: id must be an Integer' )\n end\n unless @role_id.is_a? Integer or @role_id.nil? then\n raise RuntimeError.new( 'task validation failed: role_id must be nil or an Integer' )\n end\n unless @label.is_a? String then\n raise RuntimeError.new( 'task validation failed: label must be a String' )\n end\n unless @inflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: incoming flows must be an Array' )\n else\n @inflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an incoming flow is not a WorkFlowFlow' )\n end\n end\n end\n unless @outflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: outgoing flows must be an Array' )\n else\n @outflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an outgoing flow is not a WorkFlowFlow' )\n end\n end\n end\n end", "title": "" }, { "docid": "59a2681d0feee790106cbdd5996ced62", "score": "0.55076706", "text": "def validate_time_entry\n errors.add :amount, :invalid if amount && (amount < 0 || amount >= 100000)\n errors.add :project_id, :invalid if project.nil?\n errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)\n end", "title": "" }, { "docid": "89924a8d29a96c7c9aea0bc9e681050e", "score": "0.54965436", "text": "def validate_temporal_sanity\n errors.add(:end_time, \"Must be after Start Time.\") unless self.start_time < self.end_time\n end", "title": "" }, { "docid": "7a741c1970c8175c3a29e1df6a711b82", "score": "0.5496023", "text": "def validate_timings\n p start_time, end_time\n if (start_time > end_time)\n errors[:base] << \"Start Time must be less than End Time\"\n end\n end", "title": "" }, { "docid": "16534ed7a889869ed6569f8d7621e09b", "score": "0.5480256", "text": "def validate_can_start\n if aasm_states_to_check\n cannot_start! if requests_have_notices?\n end\n end", "title": "" }, { "docid": "29bbe2d12c3cfbf1430b3a9c34bedf86", "score": "0.5478115", "text": "def validate_choice\n return if errors.present?\n\n return if %i[not_required all_day].include? service_choice.to_sym\n\n validate_numbers\n validate_number_ranges\n return if errors.present?\n\n validate_time_sequence\n end", "title": "" }, { "docid": "17d7e70b087cba1445dc0e11d3807650", "score": "0.54750186", "text": "def scheduled?(starting, ending)\n schedule.scheduled?(self, starting, ending)\n end", "title": "" }, { "docid": "c21066d662b1aa03a610dd94dd1ff5a9", "score": "0.54747164", "text": "def validate_day_lock(time, schedule)\n days_in_month = TimeUtil.days_in_month(time)\n date = Date.new(time.year, time.month, time.day)\n\n if value && value < 0\n start = TimeUtil.day_of_month(value, date)\n month_overflow = days_in_month - TimeUtil.days_in_next_month(time)\n elsif value && value > 0\n start = value\n month_overflow = 0\n else\n start = TimeUtil.day_of_month(schedule.start_time.day, date)\n month_overflow = 0\n end\n\n sleeps = start - date.day\n\n if value && value > 0\n until_next_month = days_in_month + sleeps\n else\n until_next_month = TimeUtil.days_to_next_month(date) + sleeps\n until_next_month -= month_overflow\n end\n\n sleeps >= 0 ? sleeps : until_next_month\n end", "title": "" }, { "docid": "f2eef12938ba42e74f884f403d1ca660", "score": "0.5454141", "text": "def test_valid_with_attributes\r\n fee_schedule = FeeSchedule.new\r\n fee_schedule.start_date = fee_schedules(:fee_schedule_00001).start_date\r\n fee_schedule.end_date = fee_schedules(:fee_schedule_00001).end_date\r\n assert fee_schedule.valid?, fee_schedule.errors.full_messages \r\n end", "title": "" }, { "docid": "bc0090c65409942a049086d70cd00eef", "score": "0.5447325", "text": "def check_validity!\n keys = CHECKS.keys\n options.slice(*keys).each do |option, value|\n next if is_time?(value) || value.is_a?(Proc) || value.is_a?(Symbol) || (defined?(ActiveSupport::TimeWithZone) and value.is_a? ActiveSupport::TimeWithZone)\n raise ArgumentError, \":#{option} must be a time, a date, a time_with_zone, a symbol or a proc\"\n end\n end", "title": "" }, { "docid": "32034fda2d5a575422e9aa22d9ccae60", "score": "0.5437144", "text": "def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end", "title": "" }, { "docid": "16856e2aff5f66ccd8a4e65eaa311e8b", "score": "0.5429702", "text": "def rule_date_range_validation\n if self and self.from_date > self.to_date\n return [false,\"from_date should be less than to_date\"]\n else\n return true\n end\n end", "title": "" }, { "docid": "c9ad383f5b90bf936ed807cb35783af9", "score": "0.542966", "text": "def schedule(guest)\n currentday = Time.now.strftime(\"%A\")\n currenttime = Time.now.strftime(\"%H:%M:%S\")\n\n goodtogo = false\n\n guest.schedules.each do |schentry|\n if schentry.day == currentday && schentry.start_time.strftime(\"%H:%M:%S\") < currenttime && schentry.stop_time.strftime(\"%H:%M:%S\") > currenttime\n goodtogo = true\n end\n end\n\n return goodtogo\n end", "title": "" }, { "docid": "aceadff4ec00807ecec3b8b3e060fa24", "score": "0.5427023", "text": "def validate_routes\n return unless time_segment\n self.time_segment.delete_routing_set_errors\n self.time_segment.check_routing_set_percent_is_100\n end", "title": "" }, { "docid": "696abebdb85db580858e5a4fe00f9c73", "score": "0.542491", "text": "def validity_period\n super\n end", "title": "" }, { "docid": "170cbe4ad8e6c76d240210276f5e3484", "score": "0.54241097", "text": "def check_calendar_event_data_validity(event_data)\n schema =\n {\n 'type' => 'object',\n 'required' => %w(Title Description StartDateTime EndDateTime StartDay\n EndDay GroupId RecurrenceInfo HasVisibilityRestrictions\n VisibilityRestrictions CalendarEventViewUrl),\n 'properties' =>\n {\n 'Title' => { 'type' => 'integer' },\n \"Description\" => { 'type' => 'integer' },\n \"StartDateTime\" => { 'type' => %w(string nil) }, # UTCDateTime || nil\n \"EndDateTime\" => { 'type' => %w(string nil) }, # UTCDateTime || nil\n \"StartDay\" => { 'type' => %w(string nil) }, # LocalDateTime || nil\n \"EndDay\" => { 'type' => %w(string nil) }, # LocalDateTime || nil\n \"GroupId\" => { 'type' => %w(integer nil) }, # D2LID || nil\n \"RecurrenceInfo\" =>\n {\n 'type' => 'object',\n 'required' => %w(RepeatType RepeatEvery RepeatOnInfo RepeatUntilDate),\n 'properties' =>\n {\n \"RepeatType\" => { 'type' => 'integer' }, # number -- repeat type\n \"RepeatEvery\" => { 'type' => 'integer' }, # number\n \"RepeatOnInfo\" => # Calendar.RepeatOnInfo\n {\n 'type' => 'object',\n 'required' => %w(Monday Tuesday Wednesday Thursday Friday\n Saturday Sunday),\n 'properties' =>\n {\n \"Monday\" => { 'type' => 'boolean' }, # boolean\n \"Tuesday\" => { 'type' => 'boolean' }, # boolean\n \"Wednesday\" => { 'type' => 'boolean' }, # boolean\n \"Thursday\" => { 'type' => 'boolean' }, # boolean\n \"Friday\" => { 'type' => 'boolean' }, # boolean\n \"Saturday\" => { 'type' => 'boolean' }, # boolean\n \"Sunday\" => { 'type' => 'boolean' }, # boolean\n }\n },\n \"RepeatUntilDate\" => { 'type' => 'string' } # UTCDATETIME\n }\n }, # Calendar.RecurrenceInfo\n \"HasVisibilityRestrictions\" => { 'type' => 'boolean' },\n \"VisibilityRestrictions\" =>\n {\n 'type' => 'object',\n 'required' => %w(Type Range HiddenRangeUnitType StartDate EndDate),\n 'properties' =>\n {\n \"Type\" => { 'type' => 'integer' }, # <number:VISIBILITY_T>,\n \"Range\" => { 'type' => %w(integer nil) }, # <number>|null,\n \"HiddenRangeUnitType\" => { 'type' => %w(integer nil) }, # <number:HIDDENUNIT_T>|null,\n \"StartDate\" => { 'type' => %w(string nil) }, # <string:UTCDateTime>|null,\n \"EndDate\" => { 'type' => %w(string nil) } # <string:UTCDateTime>|null,\n }\n }, # Calendar.VisibilityInfo\n \"CalendarEventViewUrl\" => { 'type' => 'string' } # url\n }\n }\n JSON::Validator.validate!(schema, event_data, validate_schema: true)\nend", "title": "" }, { "docid": "7b558ae9aa1ea5dc503e5f0e9fbadfaf", "score": "0.5422774", "text": "def validate_nonoverlapping\n end", "title": "" }, { "docid": "7433a49af2169904bfef66a3bbc4325f", "score": "0.54178005", "text": "def confirmation_period_valid?; end", "title": "" }, { "docid": "569a3e72e5acb7e6a61e3654861e2288", "score": "0.5416243", "text": "def on_schedule\n return to_enum(:on_schedule) unless block_given?\n start = context.order.created_at\n finish = start + context.order.gateway.orders_expiration_period.seconds\n period = finish - start\n often = {\n base_interval: ENVied.ORDER_CHECK_BASE_INTERVAL.seconds,\n max_interval: ENVied.ORDER_CHECK_MAX_INTERVAL.seconds,\n rand_factor: ENVied.ORDER_CHECK_RAND_FACTOR,\n multiplier: ENVied.ORDER_CHECK_BACKOFF_MULT,\n max_period: period,\n }\n now = start\n with_intervals often do |interval|\n now += interval\n now = now.round(2)\n yield now, false\n end\n yield finish, true\n end", "title": "" }, { "docid": "4808734482c9d6372a2054d00228acd2", "score": "0.5411479", "text": "def is_valid_batch_event_settings(batch_events)\n logger = VWO::Logger.get_instance\n events_per_request = batch_events[:events_per_request]\n request_time_interval = batch_events[:request_time_interval]\n\n unless events_per_request || request_time_interval\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::EVENT_BATCHING_INSUFFICIENT,\n file: VWO::FileNameEnum::ValidateUtil\n )\n )\n return false\n end\n\n if (request_time_interval && !valid_number?(request_time_interval))\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::REQUEST_TIME_INTERVAL_INVALID,\n file: VWO::FileNameEnum::ValidateUtil\n )\n )\n return false\n end\n\n if (events_per_request && !valid_number?(events_per_request))\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::EVENTS_PER_REQUEST_INVALID,\n file: VWO::FileNameEnum::ValidateUtil\n )\n )\n return false\n end\n\n if events_per_request && (events_per_request < VWO::MIN_EVENTS_PER_REQUEST || events_per_request > VWO::MAX_EVENTS_PER_REQUEST)\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::EVENTS_PER_REQUEST_OUT_OF_BOUNDS,\n file: VWO::FileNameEnum::ValidateUtil,\n min_value: VWO::MIN_EVENTS_PER_REQUEST,\n max_value: VWO::MAX_EVENTS_PER_REQUEST\n )\n )\n return false\n end\n\n if request_time_interval && request_time_interval < VWO::MIN_REQUEST_TIME_INTERVAL\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::REQUEST_TIME_INTERVAL_OUT_OF_BOUNDS,\n file: VWO::FileNameEnum::ValidateUtil,\n min_value: VWO::MIN_REQUEST_TIME_INTERVAL\n )\n )\n return false\n end\n\n if batch_events.key?(:flushCallback) && !batch_events[:flushCallback].is_a?(Method)\n logger.log(\n VWO::LogLevelEnum::ERROR,\n format(\n VWO::LogMessageEnum::ErrorMessages::FLUSH_CALLBACK_INVALID,\n file: VWO::FileNameEnum::ValidateUtil\n )\n )\n return false\n end\n true\n end", "title": "" }, { "docid": "131d600fc97fb0656c4fe29100fc5a1c", "score": "0.5402709", "text": "def validate_broadcast!\n\n # we can't check it each time when user open transmission page\n # it generates too many api calls\n\n broadcast_status = Rails.cache.fetch(\"broadcast_status_#{id}\", expires_in: 3.hours) do\n broadcast_service.status\n end\n\n if broadcast_status == 'complete'\n complete!\n end\n\n end", "title": "" }, { "docid": "c3376be55ce3a2e887f0add941682840", "score": "0.5402488", "text": "def valid_intervals\n VALID[:interval]\n end", "title": "" }, { "docid": "7a7ee53ec67d6b4ad023564a9ff0b0cd", "score": "0.539543", "text": "def task_available\n return unless task\n\n validate_task_has_no_pending\n validate_task_has_no_approved\n end", "title": "" }, { "docid": "98ba74fd85f9f979258b91cd63befa29", "score": "0.53951573", "text": "def validate_check_execution(check)\n must_be_a_string_if_set(check[:command]) ||\n invalid(check, \"check command must be a string\")\n must_be_a_string_if_set(check[:extension]) ||\n invalid(check, \"check extension must be a string\")\n (!check[:command].nil? ^ !check[:extension].nil?) ||\n invalid(check, \"either check command or extension must be set\")\n must_be_a_numeric_if_set(check[:timeout]) ||\n invalid(check, \"check timeout must be numeric\")\n must_be_boolean_if_set(check[:stdin]) ||\n invalid(check, \"check stdin must be boolean\")\n end", "title": "" }, { "docid": "5ff22b18cb7c969c0b838f3121426fea", "score": "0.5394551", "text": "def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end", "title": "" }, { "docid": "0404b3189ae2c620aa949bc21707dd89", "score": "0.5393798", "text": "def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end", "title": "" }, { "docid": "5d6554c0e86fa6b60ce3693222101333", "score": "0.5389813", "text": "def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end", "title": "" }, { "docid": "9f551686ab2278637364b29ac8d04ee1", "score": "0.5385184", "text": "def check_times\n if start_end_times.count > 0 && !start_end_times.nil?\n start_end_times.each do |t|\n return true if t.check_time_ranges\n end\n\n false\n else\n true\n end\n end", "title": "" }, { "docid": "19dd7a1e6dfbd029ac4219e30b38daf7", "score": "0.53704715", "text": "def check_full_schedule\n has_full_schedule = true\n schedules = self.schedules\n schedules.each_with_index do |schedule, index|\n if(index != 0 && index != schedules.length-1)\n #if(schedule[:plan].length == 0 || schedule[:hotel].length == 0)\n if(schedule[:plan].strip.length == 0)\n has_full_schedule = false\n break\n end\n end\n end\n\n return has_full_schedule\n end", "title": "" }, { "docid": "09ed169378dc5b92bd1841d1be62df5f", "score": "0.5369649", "text": "def schedule_day_or_week_must_have_question\n errors.add(:base, \"Either day or week has to contain character ?\") if (schedule_day != \"?\") && (schedule_week != \"?\")\n end", "title": "" }, { "docid": "3c0933bf17db5107980e99a9776c5a9e", "score": "0.5368303", "text": "def validate!\n raise Errors::Worker, 'Queue threads must be an Integer.' unless @queue_threads.is_a?(Integer)\n raise Errors::Worker, 'Retry threads must be an Integer.' unless @retry_threads.is_a?(Integer)\n end", "title": "" }, { "docid": "450651da26c782074965afe7e4add36e", "score": "0.53657866", "text": "def check_dates\n # TODO the init_time must be less then the end_time\n true\n end", "title": "" }, { "docid": "756c079a284e75568321a0a944bd18c9", "score": "0.53656936", "text": "def validate_positive_times\n return true if (time_type == \"gift_given\" || time_type == \"penalty\") || start.nil? || finish.nil?\n if r = start >= finish\n errors.add(:start, \"must come before finish\")\n end\n r\n end", "title": "" }, { "docid": "62c48f90c3e6e0e084c43b334b787d9f", "score": "0.53655624", "text": "def validate(entries)\n first = last = nil\n errors = []\n entries.each do |entry|\n if entry[:end] < entry[:start]\n errors << \"#{entry[:raw]} has its end before its start.\"\n end\n first = entry[:start] if first.nil? || first > entry[:start]\n last = entry[:end] if last.nil? || last < entry[:end]\n end\n if last && first && last - first > 14*24*60*60 # 14 days\n errors << \"Time entries span more than two weeks! from #{first} to #{last}\"\n end\n errors\nend", "title": "" }, { "docid": "f89a7b64b36be5c0e5bb6794b7be7432", "score": "0.53544086", "text": "def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end", "title": "" }, { "docid": "fbd8bb02f584db423c99a7d143313d0f", "score": "0.53451777", "text": "def time_period_for_room_reservation\n time_period = (self.start_date.year * 12 + self.start_date.month) - (Date.today.year * 12 + Date.today.month)\n errors.add(:start_date, \"you can book your room before 6 months only\") if time_period > 6\n end", "title": "" }, { "docid": "e3afe79f5e1c0ed39d0d2219f649a51a", "score": "0.5340859", "text": "def validate_can_assign_auction_date\n if self.ready_for_auction? && \n (self.auction_datum.blank? || (self.auction_datum.present? && self.auction_datum.auction_date.blank? )) &&\n self.service_orders.joins(:service_order_details).where(\"service_order_details.status=? AND service_orders.priority=?\", ServiceOrder::SO_STATUS_APPROVED, ServiceOrder::SO_PRIORITY_HIGH).count > 0\n self.errors.add(:\"auction_datum.auction_date\", I18n.t(\"models.vehicle.errors.service_order_must_be_completed\"))\n end\n end", "title": "" }, { "docid": "a19e391aa0d9fdb3d0a2826403e38fcf", "score": "0.53405684", "text": "def should_validate\n validation_trigger\n end", "title": "" }, { "docid": "958429a951fe02d59a8ad866a95496f7", "score": "0.5333873", "text": "def parse_rrule recurrence\n rule = recurrence.find do |rec|\n /\\ARRULE/.match(rec)\n end\n\n return nil unless rule\n rule = rule.split(':')[1]\n params = {\n validations: {}\n }\n\n rule.split(';').each do |rule|\n (name, value) = rule.split('=')\n value.strip!\n case name\n when 'FREQ'\n params[:freq] = value.downcase\n when 'INTERVAL'\n params[:interval] = value.to_i\n when 'COUNT'\n params[:count] = value.to_i\n when 'UNTIL'\n params[:until] = Time.parse(value).utc\n when 'WKST'\n params[:wkst] = day_to_symbol(value)\n when 'BYSECOND'\n params[:validations][:second_of_minute] = value.split(',').collect(&:to_i)\n when 'BYMINUTE'\n params[:validations][:minute_of_hour] = value.split(',').collect(&:to_i)\n when 'BYHOUR'\n params[:validations][:hour_of_day] = value.split(',').collect(&:to_i)\n when 'BYDAY'\n dows = {}\n days = []\n value.split(',').each do |expr|\n day = day_to_symbol(expr.strip[-2..-1])\n # day with occurence\n if expr.strip.length > 2\n occ = expr[0..-3].to_i\n dows[day].nil? ? dows[day] = [occ] : dows[day].push(occ)\n days.delete(to_wday(day))\n else\n days.push to_wday(day) if dows[day].nil?\n end\n end\n params[:validations][:day_of_week] = dows unless dows.empty?\n unless days.empty?\n # days = days.sort_by do |day|\n # day\n # end\n params[:validations][:day] = days\n end\n when 'BYMONTHDAY'\n params[:validations][:day_of_month] = value.split(',').collect(&:to_i)\n when 'BYMONTH'\n params[:validations][:month_of_year] = value.split(',').collect(&:to_i)\n when 'BYYEARDAY'\n params[:validations][:day_of_year] = value.split(',').collect(&:to_i)\n when 'BYSETPOS'\n else\n raise \"Invalid or unsupported rrule command: #{name}\"\n end\n end\n\n params[:interval] ||= 1\n params.delete(:wkst) unless params[:freq] == 'weekly'\n params\n end", "title": "" }, { "docid": "3b4c384c13378d07ad155fa7673ed389", "score": "0.5331962", "text": "def check_overlapping_dates\n #compare this new reservation against existing reservations\n listing.reservations.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates are not available\")\n end\n end\n\n end", "title": "" }, { "docid": "feb93a674016f7c60a2e4be2be4e9add", "score": "0.5331375", "text": "def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end", "title": "" }, { "docid": "1948e8199ad31a882c4d521101894bc1", "score": "0.53284025", "text": "def valid?\n return false if [email protected]? && @period > 2147483647\n return false if !@until_occurrences.nil? && @until_occurrences > 2147483647\n true\n end", "title": "" }, { "docid": "f1f1a9bfd8db6cc14c4d186c54b2a95d", "score": "0.53215957", "text": "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "title": "" }, { "docid": "f1f1a9bfd8db6cc14c4d186c54b2a95d", "score": "0.53215957", "text": "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "title": "" }, { "docid": "f1f1a9bfd8db6cc14c4d186c54b2a95d", "score": "0.53215957", "text": "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "title": "" }, { "docid": "495a1116549c4c6b3ddd0dfc997593d2", "score": "0.5307491", "text": "def check_lesson_plan\n current_schedule = \n submitted_lesson_plan = LessonPlan.find(:all, :conditions => ['is_submitted=?', true]).map(&:schedule)\n if submitted_lesson_plan.include?(self.id)\n #lesson plan created, schedule editable? #issue arise during training : lesson plan first created by lecturer, schedule used to be last minute produce by Coordinator\n #errors.add_to_base \"tak bole la\"\n # raise I18n.t(\"weeklytimetable_detail.removal_not_allowed\")\n return false\n end\n end", "title": "" }, { "docid": "3e16990b8a53ad4e8b0e68e7c639a4b3", "score": "0.5305445", "text": "def validate_tasks\n validated = false\n if tasks_completed?\n validated = tasks_completed!\n end\n\n validated\n end", "title": "" }, { "docid": "ff89d7d0eeffbbd164920ad6c76caae4", "score": "0.53049755", "text": "def has_schedule?\n self.schedule != nil\n end", "title": "" } ]
c7af5331468b1a7d0e5fa79c2cadfd8a
A helper for using the native NOW() SQL function in a default
[ { "docid": "e99f5fccb59b67901b03bbaf25a07fd0", "score": "0.7945138", "text": "def now\n SqlExpr.new('NOW()')\n end", "title": "" } ]
[ { "docid": "56dfbcce3673ca839ff24b7f1867f945", "score": "0.72920644", "text": "def db_time_now; end", "title": "" }, { "docid": "8d75b571b35e3e3ec46190aa34fec133", "score": "0.700678", "text": "def default_to_now\n { additionally: lambda { Time.zone.now.utc } }\n end", "title": "" }, { "docid": "47151a6029214de62a23bb253eed50b7", "score": "0.6990789", "text": "def now\n @now ||= Time.now.utc.strftime(\"%Y%m%d%H%M.%S\")\nend", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "eabe3efd0793e4af283269301f752a3d", "score": "0.6821951", "text": "def now; end", "title": "" }, { "docid": "075990ac6b44bcbaf94efe3c85abb1c7", "score": "0.6808545", "text": "def constant_sql_append(sql, constant)\n case constant\n when :CURRENT_DATE\n sql << 'today()'\n when :CURRENT_TIMESTAMP, :CURRENT_TIME\n sql << 'now()'\n else\n super\n end\n end", "title": "" }, { "docid": "33cb0971f3082bbd914493d121e2f380", "score": "0.67327446", "text": "def current_datetime\n Sequel.datetime_class.now\n end", "title": "" }, { "docid": "86ede96d46bdaae4a316991bab170698", "score": "0.67185026", "text": "def now\n @now ||= Time.current\n end", "title": "" }, { "docid": "8e9d5e47f09ad8db238e75c3c5598a5b", "score": "0.6712357", "text": "def db_time_now\n Time.now.utc\n end", "title": "" }, { "docid": "65092cf9cd8f90eddbd5b33ba62ffc1d", "score": "0.66729647", "text": "def constant_sql_append(sql, constant)\n if constant == :CURRENT_TIMESTAMP && supports_timestamp_usecs?\n sql << 'CURRENT_TIMESTAMP(6)'\n else\n super\n end\n end", "title": "" }, { "docid": "08332780829a20baa0bb6dada740c9f2", "score": "0.6648277", "text": "def now(opts)\n if opts.key? \"now\"\n DateTime.parse(opts[\"now\"])\n else\n DateTime.now\n end\n end", "title": "" }, { "docid": "7888454622874ba5b22a6b88b6b66a97", "score": "0.66422427", "text": "def now()\n @fixed_time || Time.now\n end", "title": "" }, { "docid": "0a085cf4d66b9e054e59e840303927b4", "score": "0.66416264", "text": "def from_now(time = T.unsafe(nil)); end", "title": "" }, { "docid": "0a085cf4d66b9e054e59e840303927b4", "score": "0.66416264", "text": "def from_now(time = T.unsafe(nil)); end", "title": "" }, { "docid": "a694bebc8e6fa372e12764dfb27f15ae", "score": "0.6568889", "text": "def constant_sql_append(sql, c)\n if c == :CURRENT_TIME\n super(sql, :CURRENT_TIMESTAMP)\n else\n super\n end\n end", "title": "" }, { "docid": "45094dc254ffca7c0a306c6b6c6ceafc", "score": "0.6497746", "text": "def time_now\n @now.call\n end", "title": "" }, { "docid": "ca897357efc98daf01f64ee98c6174d2", "score": "0.64759797", "text": "def now\n @now ||= Time.now\n end", "title": "" }, { "docid": "13eb95e95cd8a10d013c0e7f5f0e0960", "score": "0.6395857", "text": "def now\n convert(Time.now)\n end", "title": "" }, { "docid": "8c878231b06c82b16705a41836c50255", "score": "0.6379584", "text": "def constant_sql_append(sql, constant)\n case constant\n when :CURRENT_DATE\n sql << 'Date()'\n when :CURRENT_TIMESTAMP\n sql << 'Now()'\n when :CURRENT_TIME\n sql << 'Time()'\n else\n super\n end\n end", "title": "" }, { "docid": "5047ce0ab56070a9df7e476d07bcd896", "score": "0.6371722", "text": "def now_iso\n iso { now }\n end", "title": "" }, { "docid": "3e94fb4363c44bb61b67fd1c4d7314e8", "score": "0.6364274", "text": "def evaluate_default_value(options = {})\n if default_value == 'current_date' then\n Time.now\n else\n nil\n end\n end", "title": "" }, { "docid": "4c8eab87806680527f14aa92ad5ce03b", "score": "0.6361054", "text": "def now\n @now || Time.now\n end", "title": "" }, { "docid": "36e081b16ed2deec666c9c5ed0455a23", "score": "0.6341804", "text": "def last_time(now = T.unsafe(nil)); end", "title": "" }, { "docid": "d4fedbed354086e032b3bab9fd5b6ae3", "score": "0.63404894", "text": "def qnow\n qval now\n end", "title": "" }, { "docid": "dd9f616ca3e13eefdb896be5539dd621", "score": "0.63325334", "text": "def current\r\n ::Time.zone_default ? ::Time.zone.today : ::Date.today\r\n end", "title": "" }, { "docid": "97615b06c36475588b841655b7e0d546", "score": "0.6315696", "text": "def now\n Time.now_without_mock_time\n end", "title": "" }, { "docid": "3799d76b30a180df1d83a168ba7c565d", "score": "0.6294221", "text": "def convert_default_value(v)\n case v\n when Sequel::CURRENT_DATE\n lambda{Date.today}\n when Sequel::CURRENT_TIMESTAMP\n lambda{dataset.current_datetime}\n else\n v\n end\n end", "title": "" }, { "docid": "a99aca5e518c85e9537374dd37872400", "score": "0.62865525", "text": "def current_time\n @current_time ||= Time.now.to_s(:db)\n end", "title": "" }, { "docid": "e247131595a9a9fd8f475e781ff37b3d", "score": "0.6283799", "text": "def now = Time.now.localtime(self)", "title": "" }, { "docid": "76ecbe28d5e9469b26b4ea3cb508c07a", "score": "0.6282847", "text": "def now_without_mock_time\n Time.now_without_mock_time.send :to_datetime\n end", "title": "" }, { "docid": "6711b8c1b69e08e2cf1bf7c63eada006", "score": "0.62776154", "text": "def default_date\n Date.today\n end", "title": "" }, { "docid": "429a66020d9cfae4a4e79f1317f92f69", "score": "0.62715816", "text": "def today\n proc_for_datetime(DateTime.now)\n end", "title": "" }, { "docid": "2f7b55f8af03fc1b0ffa210fe1535fd9", "score": "0.62514746", "text": "def now\n\t@now = 'hola x 2 !!! '\n\tend", "title": "" }, { "docid": "987bcab0bfa4a953ab2f677a905b8a0a", "score": "0.62414193", "text": "def current\n ::Time.zone ? ::Time.zone.today : ::Date.today\n end", "title": "" }, { "docid": "987bcab0bfa4a953ab2f677a905b8a0a", "score": "0.62414193", "text": "def current\n ::Time.zone ? ::Time.zone.today : ::Date.today\n end", "title": "" }, { "docid": "2930cbf8c6801b26963a31e4b4264df7", "score": "0.62315995", "text": "def right_now \n Time.now.getutc \n end", "title": "" }, { "docid": "a3be43f57efe2edd52e005ea46d3ccdf", "score": "0.6206027", "text": "def now\n Time.now()\n end", "title": "" }, { "docid": "df65fe1d40df79aeddf7eee8d8902c84", "score": "0.61927736", "text": "def now\n Time.now\n end", "title": "" }, { "docid": "7182017e7f9d30490c71801449684746", "score": "0.6153908", "text": "def now\n Time.now.utc\nend", "title": "" }, { "docid": "f4d26ccdfb1f5b4a689be2d72bc1ea26", "score": "0.61479497", "text": "def perform_now; end", "title": "" }, { "docid": "bf5312ba5410de004962906fe877d9d0", "score": "0.6128708", "text": "def time_now\n ::Time.now\n end", "title": "" }, { "docid": "057884e533547ff85003f6963ef15ee4", "score": "0.6127382", "text": "def time_now\n now = Time.new\n Time.new(now.year, now.month, now.day, now.hour, now.min, now.sec)\nend", "title": "" }, { "docid": "5a21d66b3f0a5d1ff2487ab98dd85b2b", "score": "0.61206746", "text": "def now_provider=(block)\n define_singleton_method(:now, &block)\n end", "title": "" }, { "docid": "80a6afabe15fc18270182a006e2f6c5b", "score": "0.61045647", "text": "def current\n ::Time.zone_default ? ::Time.zone.now : ::Time.now\n end", "title": "" }, { "docid": "f7753ec960ae27f3a3f94a8e7e4175bf", "score": "0.6085081", "text": "def default_time\n Time.now.utc\n end", "title": "" }, { "docid": "bdb0f0accd11c7791a0f4e47a16ee135", "score": "0.6084978", "text": "def immediate_column(value, column = nil)\n if ((column.name == 'created_at') && value.nil?) || (column.name == 'updated_at')\n value = Time.zone.now\n end\n ActiveRecord::Base.connection.quote(value, column)\n end", "title": "" }, { "docid": "0e0e3e6af1f07c1b35bf346f1cb4b2af", "score": "0.6067057", "text": "def now_f\n now.to_f\n end", "title": "" }, { "docid": "e1094a9dbb5eb534f20b8a1e0a75e1a8", "score": "0.6059017", "text": "def now\n Time.now\nend", "title": "" }, { "docid": "3b319fe42398e8e3a0939572dc5adcd1", "score": "0.6042185", "text": "def today?; end", "title": "" }, { "docid": "3b319fe42398e8e3a0939572dc5adcd1", "score": "0.6042185", "text": "def today?; end", "title": "" }, { "docid": "3b319fe42398e8e3a0939572dc5adcd1", "score": "0.6042185", "text": "def today?; end", "title": "" }, { "docid": "3b319fe42398e8e3a0939572dc5adcd1", "score": "0.6042185", "text": "def today?; end", "title": "" }, { "docid": "b557607aa7e1c8d2adbc4d7752f1cfee", "score": "0.60223377", "text": "def today\n Time.zone.now.to_date\n end", "title": "" }, { "docid": "b557607aa7e1c8d2adbc4d7752f1cfee", "score": "0.60223377", "text": "def today\n Time.zone.now.to_date\n end", "title": "" }, { "docid": "b557607aa7e1c8d2adbc4d7752f1cfee", "score": "0.60223377", "text": "def today\n Time.zone.now.to_date\n end", "title": "" }, { "docid": "107875b40a0c872389ae9c5e42be5a20", "score": "0.6020062", "text": "def current_time\n @current_time ||= Time.now.to_s(:db)\n end", "title": "" }, { "docid": "66481d0bb33b1070e71e463cea37572f", "score": "0.60108185", "text": "def now\n Time.now\n end", "title": "" }, { "docid": "4eadb312889e7aa18a01f39896dc80fe", "score": "0.599824", "text": "def now\n if Time.respond_to?(:now_without_mock_time) # Timecop\n Time.now_without_mock_time\n else\n Time.now\n end\n end", "title": "" }, { "docid": "0c3b613084c81bc30f91023a050955be", "score": "0.5997176", "text": "def now\n ::DateTime.now.strftime('%Q').to_i\n end", "title": "" }, { "docid": "b1bc5f30ee69d17dfc7ef09664a7812a", "score": "0.5990068", "text": "def from_now\n after(Time.now)\n end", "title": "" }, { "docid": "6db3ccc66f23b0e5221129960190e19a", "score": "0.5987383", "text": "def now\n Time.now.utc\n end", "title": "" }, { "docid": "eaf32418f0c534acf292fb110b7bf1b0", "score": "0.5986535", "text": "def time_now\r\n Time.now.utc.iso8601(3)\r\nend", "title": "" }, { "docid": "cdba912913e5c0622884081bf569b20a", "score": "0.5984694", "text": "def literal_datetime_append(sql, v)\n v.is_a?(DateTime) ? literal_append(sql, Sequel::CURRENT_TIMESTAMP) : super\n end", "title": "" }, { "docid": "3c8da54f5163fdbc7b59acd0d2db3d78", "score": "0.59735", "text": "def get_date\n return Time.now\n end", "title": "" }, { "docid": "d857c76efbc8e8c72884c0fff4272b2e", "score": "0.59656733", "text": "def created_at\n @right_now ||= Time.now.utc\nend", "title": "" }, { "docid": "dec1dd1a0ca253d86cf7b8808401c173", "score": "0.59595436", "text": "def today\n if time_zone.nil?\n Date.today\n else\n Time.now.in_time_zone(time_zone).to_date\n end\n end", "title": "" }, { "docid": "ca82b7c3b23a0833bd085a4219c75be3", "score": "0.59420216", "text": "def time_now\n Time.now.utc.iso8601(3)\nend", "title": "" }, { "docid": "8de6a1517774a62041614c7f37b775d4", "score": "0.59279186", "text": "def get_now\n t = Time.now\n @tt = Time.new(t.year, t.month, t.day, t.hour, t.min, t.sec)\n rescue => e\n raise\n end", "title": "" }, { "docid": "ff082ca7891aff1e3d511808b6ee5f11", "score": "0.59246415", "text": "def immediate_column(value, column)\n value = Time.zone.now if ((column.name == 'created_at') && value.nil?) || (column.name == 'updated_at')\n ActiveRecord::Base.connection.quote(value, column)\n end", "title": "" }, { "docid": "302634716e92a14720c987afca585bb2", "score": "0.5909767", "text": "def now\n return @now unless @now.nil?\n @now = (value & 1) != 0\n @now\n end", "title": "" }, { "docid": "302634716e92a14720c987afca585bb2", "score": "0.5909767", "text": "def now\n return @now unless @now.nil?\n @now = (value & 1) != 0\n @now\n end", "title": "" }, { "docid": "ce51285e324cc760943d4af82e378384", "score": "0.5900578", "text": "def default_date\n @default_date ||= DateTime.new(Time.now.year, Time.now.mon, Time.now.mday, Time.now.hour, 0)\n end", "title": "" }, { "docid": "9fa36dd83d05728a7f4697f48194ac6a", "score": "0.5867228", "text": "def today\n Time.now.strftime(DATE_FORMAT)\n end", "title": "" }, { "docid": "d3d32792e8db2d060b12430be512da38", "score": "0.5865345", "text": "def today\n tzinfo.now.to_date\n end", "title": "" }, { "docid": "803c2a446cfa898fe79a3b2b972c1c3b", "score": "0.586341", "text": "def current\n ::Time.zone ? ::Time.zone.now : ::Time.now\n end", "title": "" }, { "docid": "b6a356e8c0cf91554eb326699bc9b7e9", "score": "0.5858749", "text": "def time_now\n Time.now.utc\n end", "title": "" }, { "docid": "a12b00f83e335101d2567e99e22ab8d9", "score": "0.58577037", "text": "def now\n Morrow.update_start_time\n end", "title": "" }, { "docid": "d55b81aed0a1ffc998bbc9a0bd880f81", "score": "0.58570635", "text": "def today_date\n in_time_zone(Time.now).to_date\n end", "title": "" }, { "docid": "4cd0dce58fed9401eb51d521064cede8", "score": "0.5852213", "text": "def now\n Time.now.strftime('%Y-%m-%d %H:%M:%S')\n end", "title": "" }, { "docid": "4cd0dce58fed9401eb51d521064cede8", "score": "0.5852213", "text": "def now\n Time.now.strftime('%Y-%m-%d %H:%M:%S')\n end", "title": "" }, { "docid": "580f80870a22c240d88d62e024c5d8f9", "score": "0.58360356", "text": "def now\n Time.now.to_i\n end", "title": "" }, { "docid": "808a1391de0d062b72b0f0e1b16e23a1", "score": "0.5835152", "text": "def current_date\n format_date(Date.today)\n end", "title": "" }, { "docid": "afebd3128bc09b4875cbcda6439fafa3", "score": "0.5833111", "text": "def today\n Date.today\n end", "title": "" }, { "docid": "493d7f3656e086cbeeee161984bb3ea9", "score": "0.5826447", "text": "def test_quoted_datetime_local\n before = ActiveRecord::Base.default_timezone\n ActiveRecord::Base.default_timezone = :local\n t = DateTime.now\n assert_equal t.to_s(:db), @quoter.quoted_date(t)\n ensure\n ActiveRecord::Base.default_timezone = before\n end", "title": "" }, { "docid": "991d7bb7335680b4263d97878b78e423", "score": "0.582451", "text": "def apply_default_begin_time\n self.begin_time = start_of_day(Date.today) if begin_time.nil?\n end", "title": "" }, { "docid": "015226460752b8da87a0c7ab9918777a", "score": "0.5823937", "text": "def time_now_or_param(params_time_now)\n if params_time_now.present?\n Time.at(params_time_now.to_i)\n else\n Time.now\n end\n end", "title": "" }, { "docid": "015226460752b8da87a0c7ab9918777a", "score": "0.5823937", "text": "def time_now_or_param(params_time_now)\n if params_time_now.present?\n Time.at(params_time_now.to_i)\n else\n Time.now\n end\n end", "title": "" }, { "docid": "015226460752b8da87a0c7ab9918777a", "score": "0.5823937", "text": "def time_now_or_param(params_time_now)\n if params_time_now.present?\n Time.at(params_time_now.to_i)\n else\n Time.now\n end\n end", "title": "" }, { "docid": "e4e9e0f3326fbdb54dcdfd9d9ba6b769", "score": "0.58206433", "text": "def time_now\n Time.now\n end", "title": "" }, { "docid": "e4e9e0f3326fbdb54dcdfd9d9ba6b769", "score": "0.58206433", "text": "def time_now\n Time.now\n end", "title": "" }, { "docid": "7e2b7e63ff099a40b76beae537bb17fd", "score": "0.58112365", "text": "def now\n time_now.utc.in_time_zone(self)\n end", "title": "" } ]
e7b89396fc25241c908a2d5533cef1ee
DELETE /questionares/1 DELETE /questionares/1.json
[ { "docid": "143238e3815e8e07c3f8da5a81d3b8a6", "score": "0.7473714", "text": "def destroy\n @questionare = Questionare.find(params[:id])\n @questionare.destroy\n\n respond_to do |format|\n format.html { redirect_to questionares_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "002f0e620d952c742bb3ab0e5bccc559", "score": "0.762618", "text": "def destroy\n @v1_question = V1::Question.find(params[:id])\n @v1_question.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "e030cbcfdf71c561a228839806401f6e", "score": "0.7584445", "text": "def destroy\n render json: question.destroy!, status: :ok\n end", "title": "" }, { "docid": "e52c3fef08554163ae84321c5a65d258", "score": "0.75695926", "text": "def destroy\n @questionaire = Questionaire.find(params[:id])\n @questionaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionaires_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "527bb34b1310d12893735ef6b76a5952", "score": "0.7512676", "text": "def destroy\n question = Question.find(params[:question_id])\n question.destroy\n \n render json: {success: true}\n \n end", "title": "" }, { "docid": "d2dd506504ae81488d07d7ceb562903a", "score": "0.74705136", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n fotmat.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6967d0797ddebd55f57e0de41b339d8e", "score": "0.7466598", "text": "def destroy\n @questionaire.destroy\n respond_to do |format|\n format.html { redirect_to questionaires_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c030fd877841d54a2d621a7e7d9c0f5", "score": "0.74644345", "text": "def destroy\n @question = Question.find_by(id: params[:id])\n @question.destroy\n render json: {question: \"\"}\n end", "title": "" }, { "docid": "dc8526ba857447476a954d143bce6580", "score": "0.7423493", "text": "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc8526ba857447476a954d143bce6580", "score": "0.7423493", "text": "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b78835a5d10c23b49163b22f9c5dd6f3", "score": "0.742117", "text": "def destroy\n @question_set1 = QuestionSet1.find(params[:id])\n @question_set1.destroy\n\n respond_to do |format|\n format.html { redirect_to question_set1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f207b0cf11476302b95372ebe2ce276b", "score": "0.74201", "text": "def destroy\n @exam_question = ExamQuestion.find(params[:id])\n @exam_question.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc0d6076708ca6371518aa0aaba2556b", "score": "0.73844165", "text": "def destroy\n current_question.destroy!\n render json: current_question, status: :ok\n end", "title": "" }, { "docid": "01fa659c0467e4cfd2992631ebea95ef", "score": "0.736585", "text": "def destroy\n @aquestion = Aquestion.find(params[:id])\n @aquestion.destroy\n\n respond_to do |format|\n format.html { redirect_to aquestions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "01fa659c0467e4cfd2992631ebea95ef", "score": "0.736585", "text": "def destroy\n @aquestion = Aquestion.find(params[:id])\n @aquestion.destroy\n\n respond_to do |format|\n format.html { redirect_to aquestions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a5f52d10eea7128c84afca89bfcd34f2", "score": "0.7364301", "text": "def destroy\n @admin_interview_question.destroy\n respond_to do |format|\n format.html { redirect_to admin_interview_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "695731595504dbb164a68a59b290fb14", "score": "0.73496747", "text": "def destroy\n @my_question.destroy\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8732abdd28ba38547ecad9784e4dfc50", "score": "0.73454595", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dec70daf44119643321d36963c33e3bc", "score": "0.73433584", "text": "def destroy\n @quiz1 = Quiz1.find(params[:id])\n @quiz1.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad29fcaf6b8b7e4e55f02e340676b0f7", "score": "0.73327017", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f79e5bc7786292d7a4ca887902610a1", "score": "0.7326013", "text": "def destroy\n @question.destroy\n respond_destroy questions_url, \"La pregunta\"\n end", "title": "" }, { "docid": "9201c1e2c2e9bc7e6df271677e06f509", "score": "0.73259336", "text": "def destroy\n @survey1 = Survey1.find(params[:id])\n @survey1.destroy\n\n respond_to do |format|\n format.html { redirect_to survey1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b87f455892983e01eaedd64f34edc77", "score": "0.73176223", "text": "def destroy\n render json: answer.destroy!, status: :ok\n end", "title": "" }, { "docid": "e7e14511cf33e0872118db7adaf33f02", "score": "0.7317419", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c678873d920aee23f10400cc59ebf98", "score": "0.73063695", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "888e803224a819e1f0d1bc22101cbb24", "score": "0.73055136", "text": "def destroy\n @askquestion.destroy\n respond_to do |format|\n format.html { redirect_to askquestions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "25b33ecbffc31a34feb8687db21db0f7", "score": "0.7302322", "text": "def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e127b4309253e12466525c03ea6fd89b", "score": "0.7299203", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format| \n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "28bf34b9a08f2ffb8775d4c6959a913d", "score": "0.7298096", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to '/main/quiz' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b5dedb55e5fcc8cf92e2e26f3c6396ca", "score": "0.72978026", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Questão foi apagada com sucesso!' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a919a26087e80e5b68cbb5f1f9cd0ed9", "score": "0.7289319", "text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questaos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "912c7537300509867ef2cd1e5e5400b0", "score": "0.72864383", "text": "def destroy\n @my_question = My_question.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ae0e291d21a3be36e2cdd135cbb69c0c", "score": "0.7267029", "text": "def destroy\n @question = @exam.questions.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to teacher_course_exam_questions_url(@course, @exam) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17d9cc94f64f4b2be794544fb219a37a", "score": "0.72612876", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to @section }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08102797b8d40415b06aaaa617aa6fb6", "score": "0.7247266", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Questão deletada com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f7dad95b9346fb82c2f30f3333861a7", "score": "0.72469115", "text": "def destroy\n @survey_question.destroy\n render json: get_survey_questions\n end", "title": "" }, { "docid": "387800b54c297728ea1a84e16fce8936", "score": "0.7239532", "text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questoes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fca2075f12a5dbbab4a08b18657cff19", "score": "0.7239452", "text": "def destroy\n #@answer = Answer.find(params[:id])\n @answer = @question.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url(@question) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e3dd6161022fff107fa77d286adafe6", "score": "0.7237874", "text": "def destroy\n @survey_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_questions_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "431a12a085e7a2a924bc50359e512947", "score": "0.7237735", "text": "def destroy\n @api_v1_answer.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "72d4cc63ee0a37ac5f665412d05a1ab4", "score": "0.72289246", "text": "def destroy\n @qa.destroy\n respond_to do |format|\n format.html { redirect_to qas_url, notice: 'Question was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd7dea17bfba4eff03f4189120be20b0", "score": "0.722686", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "64e90a70234894631b4e4218b0834f62", "score": "0.7226662", "text": "def destroy\n @enq_question = EnqQuestion.find(params[:id])\n @enq_question.destroy\n\n respond_to do |format|\n format.html { redirect_to enq_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a7effec0ce4012b7144cb59c7fdd2671", "score": "0.72246385", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @answer.question, notice: 'La respuesta fue eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "74d2016c24c7eb760bcf451d5893cc0e", "score": "0.72233987", "text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questoes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4c3c22118a1002d6c146273d62cafb50", "score": "0.72174215", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Survey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75f7570be40d679f3c263d316bce0775", "score": "0.7217325", "text": "def destroy\r\n @admin_question.destroy\r\n respond_to do |format|\r\n format.html { redirect_to admin_heuristic_questions_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "9647a0d62b981a32f17db04de24fa55e", "score": "0.72171324", "text": "def destroy\n @question = Quiz::Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_questions_path_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "title": "" }, { "docid": "0eab50125e3cd590f25a72bdc89fff9e", "score": "0.72129506", "text": "def destroy\n @ttest_question.destroy\n respond_to do |format|\n format.html { redirect_to ttest_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f28e3e1c39ea6fc1c16886b39305e579", "score": "0.72108066", "text": "def destroy\n @survey_answer = SurveyAnswer.find(params[:id])\n @survey_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d24db5ee2df2497861f782418f6b07cf", "score": "0.7207827", "text": "def destroy\n @response_question = ResponseQuestion.find(params[:id])\n @response_question.destroy\n\n respond_to do |format|\n format.html { redirect_to response_questions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4f4f0251dfe85d8f4f5de22c0178f38f", "score": "0.7204271", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to @question.survey, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "25182e9adb665d15cc1c512e234c69c6", "score": "0.7203626", "text": "def destroy\n @question_answer = QuestionAnswer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e7a2f8545a1bcb02adab4c8e6ab892c5", "score": "0.7203201", "text": "def destroy\n @m_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6690c5b026186da6250458af5cd5e6c", "score": "0.7198438", "text": "def destroy\n @question.answers.find_by(id: params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2c17cad049e007def03e77803cec32c5", "score": "0.71968555", "text": "def destroy\n @question = Question.find(params[:question_id])\n @responce = @question.responces.find(params[:id])\n @responce.destroy\n\n respond_to do |format|\n format.html { redirect_to project_question_path(@question.project_id, @question) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "29c31dae972fc84df676fe3a95a17f0d", "score": "0.719364", "text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_questions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "c85191a4f51604bdf9a800ea1b18f896", "score": "0.71916825", "text": "def delete\n supprimer = QuestionChoixService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7190074", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7190074", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7190074", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7190074", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7190074", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d79eb685022038067edf664edbb8e575", "score": "0.71879494", "text": "def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ee1865aa3f73a4bcc23ac7858d01f18", "score": "0.7187906", "text": "def destroy\n @rutas_survey.destroy\n respond_to do |format|\n format.html { redirect_to rutas_surveys_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f95977dccfb41c2e31e5a46b8fd41bb2", "score": "0.7185502", "text": "def destroy\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url(@answer.question) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad86927f1fcde37e80086f508ce163d0", "score": "0.71786517", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.delete\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c690f68f7be3e5c41f96392377288424", "score": "0.71772075", "text": "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Pregunta fue eliminada' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "36c3ef000e19c772e296e724b0ab3af3", "score": "0.7175539", "text": "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c5d57ecff684624fd825567f6ec335b5", "score": "0.717478", "text": "def destroy\n\n quoraa=Quora.where(question_id: @quora.id)\n quoraa.destroy_all\n @quora.destroy\n respond_to do |format|\n format.html { redirect_to '/quoras', notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
5a92488ff95f145b53a5149b745653c3
Baseline implementation for the delete_product REST call
[ { "docid": "a808ba054108370853410f235a0dcff0", "score": "0.70892525", "text": "def delete_product 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_delete_product_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::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" } ]
[ { "docid": "e0ad6e463189323c8bd24b9d5ab62176", "score": "0.78334576", "text": "def destroy\n Api.delete(\"#{BASE_PATH}/#{product_id}\")\n true\n end", "title": "" }, { "docid": "8e0ae8527df25788b7dde9dddbce8edf", "score": "0.76267856", "text": "def destroy\n if @product.destroy\n render body: '', status: 204\n else\n # :nocov:\n render_error 400, @product.errors.full_messages\n # :nocov:\n end\n end", "title": "" }, { "docid": "38f69a6fe310678df7a54185505e6aa6", "score": "0.753231", "text": "def destroy\n if @product.destroy\n render json: { status: 200, result: :ok }\n else\n render json: { status: 500, result: :error }\n end\n end", "title": "" }, { "docid": "e72a91041431f336b4c4d0d5e27cd4c1", "score": "0.7531909", "text": "def destroy\n respond_with Product.destroy(params[:id])\n end", "title": "" }, { "docid": "2d3bb0ceb522b19c1190889d02e5f863", "score": "0.7490489", "text": "def destroy\n respond Products::Delete, location: nil\n end", "title": "" }, { "docid": "7db887ae294bff3b1c9bb5609d722b2d", "score": "0.7420353", "text": "def do_destroy\n delete :destroy, id: @product.id\n end", "title": "" }, { "docid": "7735b64572d2ac384bae7b31a011f445", "score": "0.735732", "text": "def destroy\n @product_basis = ProductBase.find(params[:id])\n @product_basis.destroy\n\n respond_to do |format|\n format.html { redirect_to product_bases_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d41c3df6afd5e3df8670d41d0cebeb1", "score": "0.73570585", "text": "def destroy\n if @product == Product.find(params[:id])\n @product.destroy!\n render json: {\n status: 'OK', results: 'Delete success', error: nil\n }, status: :ok\n else\n not_process\n end\n end", "title": "" }, { "docid": "f1e49f0b2b926f983ac5457ee4642a6e", "score": "0.7337774", "text": "def destroy\n if @product.destroy\n render_success 'Deleted successfully'\n else\n render_error({delete: 'Failed to delete'})\n end\n end", "title": "" }, { "docid": "f6e413aa6075ccc35ccdd922998cc8f3", "score": "0.73239076", "text": "def destroy\n @product.destroy\n \n respond_to do |format|\n format.xml { head :no_content }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6595000a0a4fe1a31ed9d19871a4101d", "score": "0.7320459", "text": "def destroy\n @product = Product.find(params[:id])\n \n if @product.destroy\n render json: @product, :status => :ok\n else\n render json: @product, :status => '500'\n end\n end", "title": "" }, { "docid": "7783bf34e3d3a8a806aa0fc7e251775c", "score": "0.7256406", "text": "def destroy\n uri = \"#{API_BASE_URL}/users/#{params[:id]}\"\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n begin\n rest_resource.delete\n flash[:notice] = \"Product Deleted successfully\"\n rescue Exception => e\n flash[:error] = \"Product Failed to Delete\"\n end\n redirect_to products_path\n end", "title": "" }, { "docid": "60030cd54a23fc4bec0583d4d62991c4", "score": "0.7242392", "text": "def destroy\n #Finds selected product\n @product = Product.find(params[:id])\n #destroy product\n @product.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f4a31a9a8d373a29c6787b8d25e4a17b", "score": "0.72374815", "text": "def destroy\n\tid = params[:id]\n\tputs id\n\td_destroy = Product.find(id)\n\td_destroy.destroy\n\trender json: d_destroy\n end", "title": "" }, { "docid": "29549615d903a5cb2ec4e1f262c76e1a", "score": "0.72341615", "text": "def destroy\n @product.destroy\n respond_with(@product)\n end", "title": "" }, { "docid": "2dbd14d61a8f8c2afa236437137b483e", "score": "0.7229499", "text": "def delete\n authorize!(:delete,current_user) unless current_user.role?:livia_admin\n begin\n ProductSubproduct.delete_all(\"product_id=#{params[:id]}\")\n ProductDependent.delete_all(\"product_id=#{params[:id]}\")\n ProductDependent.delete_all(\"parent_id=#{params[:id]}\")\n Product.find(params[:id]).delete\n flash[:notice] = \"#{t(:text_product)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n redirect_to :action=> 'index'\n rescue => ex\n redirect_to :action=> 'index'\n end\n end", "title": "" }, { "docid": "8052f3e2bee2f439cad2a07771da047a", "score": "0.72187734", "text": "def destroy\r\n @product = Product.find(params[:id])\r\n @product.destroy\r\n render json: { status: \"success\", data: @product}\r\n end", "title": "" }, { "docid": "4db1452a4beb4c236acf0dcda2048354", "score": "0.72182554", "text": "def destroy\n @product.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "4db1452a4beb4c236acf0dcda2048354", "score": "0.72182554", "text": "def destroy\n @product.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "0b44cb6dfea1aec374e8db6d78a5b9ab", "score": "0.7215602", "text": "def destroy\r\n product = Product.find(params[:id])\r\n product.destroy\r\n removeFromShoppingCart = ShoppingCart.where(product_num: params[:id])\r\n removeFromShoppingCart.all.each do |x|\r\n x.destroy\r\n end\r\n render json: {\r\n status: 'SUCCESS',\r\n message: 'Removed specific product',\r\n data: product\r\n }, status: :ok\r\n end", "title": "" }, { "docid": "b153ae0706c23fcfe79a8401848a2608", "score": "0.72074103", "text": "def destroy\n if @product.try_destroy\n message = '产品删除成功'\n else\n message = '产品资源已回收'\n end\n respond_to do |format|\n format.html { redirect_to products_url, notice: message }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eb2861e640a2341af3c3d1a5fab9ea57", "score": "0.719698", "text": "def destroy\n if @product.is_product_referenced_by_line_items\n flash[:error] = \"Product is in use!\"\n\n respond_to do |format|\n format.html { redirect_to products_url}\n format.json { head :no_content }\n end\n \n return\n else \n @product.update(is_deleted: true)\n create_log(@product, \"delete\") \n\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "f19c67e591e3ba0e79ce65a1d4d18749", "score": "0.7194688", "text": "def destroy\n @home_cart_indices_product = Home::Cart::Indices::Product.find(params[:id])\n @home_cart_indices_product.destroy\n\n respond_to do |format|\n format.html { redirect_to home_cart_indices_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a1023840b7938dfad9767ac28ef36024", "score": "0.719386", "text": "def destroy\n product = Product.find(params[:id])\n\n if product.destroy\n response = formatted_response(true, nil, t('api.message.catalog.products.destroy.success'))\n else\n response = formatted_response(false, nil, t('api.message.catalog.products.destroy.failure'))\n end\n\n render :json => response\n end", "title": "" }, { "docid": "a7decc36cbf95150961d75f3cd537188", "score": "0.7183201", "text": "def destroy\n @product.destroy\n\n render json: @product\n end", "title": "" }, { "docid": "c8fe28b7edd04e10b88cb2cffb9b57f8", "score": "0.71779203", "text": "def destroy\n # identify and retrieve the product you want to delete\n product_id = params[:id]\n @product1 = Product.find_by(id: product_id)\n #the action of removing the product from the db\n @product1.destroy\n render json: {message: \"You have deleted the product\"}\n end", "title": "" }, { "docid": "c7eb552e1977764cbc4cacab20aaa25a", "score": "0.716123", "text": "def destroy\n begin\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : User click the products delete\"\n @product.destroy\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} products_controller destroy method\" }\n end\n\n end", "title": "" }, { "docid": "63794606609d06ef05fc5f6dc605d1b1", "score": "0.7159086", "text": "def destroy\n find_product.destroy\nend", "title": "" }, { "docid": "900cb06470995ef43134182dad802386", "score": "0.7151284", "text": "def destroy\n @service_product.destroy\n respond_to do |format|\n format.html { redirect_to backend_service_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd28f5c317c6cd0d2f8f0cae121878fa", "score": "0.7143152", "text": "def destroy\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.destroy\n format.html { redirect_to products_url,\n notice: (crud_notice('destroyed', @product) + \"#{undo_link(@product)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to products_url, alert: \"#{@product.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e17cedc958cf8a3b0132b7407a7ea7fc", "score": "0.71422607", "text": "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to client_products_path(client_id: @product.client.id) }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "2249bddc503398d68d5ae3b6a3c1f8a4", "score": "0.71415067", "text": "def destroy\n @product.status = Product::STATUS_DELETED\n @product.save\n respond_to do |format|\n format.html { redirect_to admin_products_url, notice: t('.notice') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "081a880495d46153af1be6c1f38a3c59", "score": "0.7137173", "text": "def destroy\n @id = @product.id\n @product.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_products_path, notice: 'Product was successfully destroyed.' }\n\n msg = { :status => 200, :message => \"ok\", result: { id: @id } }\n format.json { render :json => msg }\n\n #format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6768b03baeecaccb43ed39c6d6e8f99e", "score": "0.71355325", "text": "def destroy\n @product_operation = ProductOperation.find(params[:id])\n @product_operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_operations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "cc08b7701a6b30086f6160b60a2713d4", "score": "0.71318895", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to backend_products_url, notice: 'Producto eliminado.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "12737c992f2a5447f985e77d1c2ba80f", "score": "0.7128241", "text": "def destroy\n @product = Product.find(params[:id])\n #TODO: should check product id here.\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "371fed571c5c07a1b88f5800749aedd6", "score": "0.7124596", "text": "def destroy\n if @product.cant_be_deleted\n return redirect_to products_url, notice: 'No se puede eliminar un producto con reservas activas'\n end\n\n @product.update deleted: true\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Producto Eliminado' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2168bd1c43c7e4dcbd48ceaf8a880f2a", "score": "0.71207076", "text": "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n respond_with(@product)\n end", "title": "" }, { "docid": "70c22d40c97171e0be1ca01078d98c46", "score": "0.7118675", "text": "def destroy\n product = Product.find(params[:id])\n product.destroy\n render json: {status: 'SUCCESS', message: 'Deleted coffee product', data: product}, status: :ok \n end", "title": "" }, { "docid": "7945532fefabe331ea95119af9ad6212", "score": "0.7116653", "text": "def destroy\n authorize!(@product)\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "04c0cc3f5c694fbf84647952c4bab4b1", "score": "0.71141857", "text": "def destroy \n if not params[:id]\n render json: ' { \"message\": \"Field productId is missing\" } '\n else \n product = Product.find(params[:id])\n if product.destroy \n render json: ' { \"message\": \"Product successfully deleted\"}'\n else \n render json: '{ \"message\": \"There was a problem with your request\" }'\n end \n end \n end", "title": "" }, { "docid": "737aefcffa505a847efc19acc84ceb9c", "score": "0.7112833", "text": "def destroy\n product = @user.products.find(params[:id])\n if !product.destroy\n return render json: { error: @product.errors }, status: 422\n else\n return render json: { deleted: true }, status: 200\n end\n end", "title": "" }, { "docid": "e75dfff65449e3c092c06cbaffa2ad9a", "score": "0.7104413", "text": "def destroy\n @product.destroy\n render_success_format('Entrada eliminada',@product,true)\n rescue Exception => e\n render_default_error e, 401\n end", "title": "" }, { "docid": "83ab1474e47cfb3c2a54c0d6059bbbc3", "score": "0.70930946", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to edit_fabrication_order_path(params[:fabrication_order_id]), notice: 'Product was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7af4501bc6dee0a91fba3be493c0754a", "score": "0.7092053", "text": "def destroy\n @home_indices_product = Home::Indices::Product.find(params[:id])\n @home_indices_product.destroy\n\n respond_to do |format|\n format.html { redirect_to home_indices_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a1d95267e62a3125d25ba78449cb0de", "score": "0.70915776", "text": "def destroy\n @object=Spree::Product.find_by_id(params[:id])\n if [email protected]?\n @object.destroy\n if @object.destroy\n error=error_response_method($e4)\n render:json=>error \n end\n else\n error=error_response_method($e2)\n render:json=>error\n end\n end", "title": "" }, { "docid": "41b99b2c9ae5eb676c85fd3cf87a8af9", "score": "0.70874566", "text": "def destroy\n @product_rec = ProductRec.find(params[:id])\n @product_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to product_recs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7cb76d101d5ca7dc271bcdfa1b5a774a", "score": "0.7083869", "text": "def destroy\n @product = Product.find(params[:id])\n @product.triggered_destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4407cb41cf8dbc6fb4da756cb9d61c41", "score": "0.70768726", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4407cb41cf8dbc6fb4da756cb9d61c41", "score": "0.70768726", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "11c372121d067455b0a99534f8b63b40", "score": "0.7070755", "text": "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n recalculate_top_price\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33c39d4d2d3c779a9cb8f7653a86c434", "score": "0.7068274", "text": "def destroy\n CartItem.where(product_id: @product.id).delete_all\n if @product.destroy\n render json: {\n status: :deleted\n }\n else\n render json: {\n status: 500\n }\n end\n end", "title": "" }, { "docid": "ad0c9afb38ed1aec06fc8c057765c179", "score": "0.70681065", "text": "def destroy\n delete(\"/products/#{self.sku}/delete\")\n end", "title": "" }, { "docid": "a1de9bfd17350fcd096f6afb5adfe721", "score": "0.7061033", "text": "def destroy\n @raw_product = RawProduct.find(params[:id])\n @raw_product.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "566923bb809eb97908d1cdec0345845b", "score": "0.7054944", "text": "def delete!\n opts = {:product_id => self.product_id}\n Twocheckout::API.request(:post, 'products/delete_product', opts)\n end", "title": "" }, { "docid": "c0cc2269d4b6a2e83f5fa41994b60282", "score": "0.7054458", "text": "def destroy\n # delete product itself\n respond_to do |format|\n if @product.destroy\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to products_url, notice: 'Product failed to destroy.' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42bf3175515c95b46e532d1a345bf86b", "score": "0.7053724", "text": "def destroy\n product = Product.find(params[:id])\n if product.destroy\n render status: :ok , json: {message: 'Producto eliminado'}\n end\n end", "title": "" }, { "docid": "74c25445401336c81da782056654d0b3", "score": "0.70524204", "text": "def destroy\n @store_indices_product = Store::Indices::Product.find(params[:id])\n @store_indices_product.destroy\n\n respond_to do |format|\n format.html { redirect_to store_indices_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2c5956b2f5c7000ac708704ada3ab869", "score": "0.7046615", "text": "def destroy\n @client_product.destroy\n respond_to do |format|\n format.html { redirect_to @client, notice: 'Custom price was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "14f8da967f2cf2807897f0f9ea693dbe", "score": "0.70436674", "text": "def destroy\n @product = Product.find(@total_product.product_id)\n @total_product.destroy\n authorize @total_product\n respond_to do |format|\n format.html { redirect_to new_total_product_of_path(@product), notice: 'Total product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17023d638c95718a597ba9d136fcacb3", "score": "0.7041995", "text": "def destroy\n @api_wmall_product = Wmall::Product.find(params[:id])\n @api_wmall_product.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dfe21fa0ebfb8834be5cfb6498dcca04", "score": "0.7041134", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: '删除产品数据完成' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5f2afc1d15cc37fa34bd0414681e9654", "score": "0.703167", "text": "def destroy\n authorize! :delete_product, @product\n @product.destroy\n respond_to do |format|\n #format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6a302a7054ea07e1172435d556017041", "score": "0.7028894", "text": "def delete\n Connector.new(product, auth: true, client: client)\n .delete(access_token: access_token)\n\n freeze\n end", "title": "" }, { "docid": "b98e40709d8d5486edc04dd60e6c6159", "score": "0.70261216", "text": "def destroy\n @product = Product.find(params[:id])\n Redis.current.del @product.redis_key\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a604e4d463204631b96236631b8c5370", "score": "0.70249796", "text": "def destroy\r\n @product_product = ProductProduct.find(params[:id])\r\n @product_product.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to product_products_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "4c390940d7003f6e90273463a4a77a80", "score": "0.7020616", "text": "def destroy\n Product.find(params[:id]).destroy\n respond_to do |format|\n flash[:success] = 'Product was successfully deleted !!!' \n format.html { redirect_to products_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9fe535baf812d92b810273f433197cce", "score": "0.7019188", "text": "def destroy\n @instantiated_product = InstantiatedProduct.find(params[:id])\n @instantiated_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(instantiated_products_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "80f25c90a052eebd80f675eb1fd699fe", "score": "0.70165586", "text": "def delete_product(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"products/#{id}\", params)\n end", "title": "" }, { "docid": "7ba8196935ca04aa9b4a965284284df5", "score": "0.7015778", "text": "def destroy\n @product.update(is_deleted: true)\n @store = store_path(current_user.id)\n respond_to do |format|\n format.html { redirect_to @store, notice: 'Product was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f0e1d8044b5550632d1c35a05ab1cdf7", "score": "0.70088995", "text": "def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c5f417cb950cd3ad1774a0e697920ec", "score": "0.700853", "text": "def destroy\r\n @product.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to products_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.7007306", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee79dd61309c3a35b8d07072ff397e59", "score": "0.70067567", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e054c5ab840957befd4ee08991e03e61", "score": "0.7005744", "text": "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to '/admin/' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07926a6af25911a8ea1c5a38f2e92023", "score": "0.7003856", "text": "def destroy\n @product.destroy\n end", "title": "" }, { "docid": "07926a6af25911a8ea1c5a38f2e92023", "score": "0.7003856", "text": "def destroy\n @product.destroy\n end", "title": "" }, { "docid": "07926a6af25911a8ea1c5a38f2e92023", "score": "0.7003856", "text": "def destroy\n @product.destroy\n end", "title": "" }, { "docid": "07926a6af25911a8ea1c5a38f2e92023", "score": "0.7003856", "text": "def destroy\n @product.destroy\n end", "title": "" } ]
2bf078791506d149c9cb00bebc487a89
Generate the quote node with all its containing text elements
[ { "docid": "f660de031c230a56cbec8aa49dc3166c", "score": "0.5386052", "text": "def export\n create_element(quote_tag, node_opts) do |div|\n @element.content.each do |child_element|\n div.add_child(base_class.new(child_element).export)\n end\n if @element.caption&.any?\n div.add_child(caption_node(caption_tag))\n end\n end\n end", "title": "" } ]
[ { "docid": "b884d9710d87b2336807ee593cc8581d", "score": "0.67603695", "text": "def quote(node)\n cite_value = node.attr(\"citetitle\")\n cite_value = nil unless cite_value.to_s =~ URI::DEFAULT_PARSER.make_regexp\n\n blockquote_attributes = {\n anchor: node.id,\n quotedFrom: node.attr(\"attribution\"),\n cite: cite_value,\n }\n\n noko do |xml|\n xml.blockquote **attr_code(blockquote_attributes) do |xml_blockquote|\n xml_blockquote << node.content\n end\n end\n end", "title": "" }, { "docid": "277b3da7f2777bcb558f9635c096db86", "score": "0.6563688", "text": "def quote_text\n extract_text(@element.content).tap do |text|\n if @element.caption&.any?\n text << \" --#{extract_text(@element.caption)}\\n\"\n end\n end\n end", "title": "" }, { "docid": "42f06eaa6e96760d6748f661ae650e3a", "score": "0.6364098", "text": "def text_node(element, parent)\n if element.name.to_sym.eql?(:code) and parent.eql?(:pre)\n element.text.gsub(\"\\n\",\"\\n \") << \"\\n\"\n elsif parent.eql?(:blockquote)\n element.text.gsub!(\"\\n \",\"\\n>\")\n return element.text\n else\n element.text\n end\n end", "title": "" }, { "docid": "e24e7873bd22d35d0076ea4ebfff9c7c", "score": "0.5875934", "text": "def text(node); end", "title": "" }, { "docid": "e24e7873bd22d35d0076ea4ebfff9c7c", "score": "0.5875934", "text": "def text(node); end", "title": "" }, { "docid": "7ed5a72f657816184575a147135ba175", "score": "0.575701", "text": "def generate_concat_for_xpath_text(text)\n $browser.generate_concat_for_xpath_text text\n end", "title": "" }, { "docid": "f61ae684a0f5be09a3f6fcd3058c0b6d", "score": "0.5745246", "text": "def accept_block_quote block_quote\n tt_sections block_quote.text\n end", "title": "" }, { "docid": "14e7dcba1e7f2b871bcbd506376a1dc7", "score": "0.5710536", "text": "def initial_quotes(text)\n # $1 is the initial part of the string, $2 is the quote or entitity, and $3 is the double quote\n exclude_sensitive_tags(text) do |t|\n t.gsub(/((?:<(?:h[1-6]|p|li|dt|dd)[^>]*>|^)\\s*(?:<(?:a|em|strong|span)[^>]*>)?)('|&#8216;|&lsquo;|(\"|&#8220;|&ldquo;))/) {$1 + \"<span class=\\\"#{'d' if $3}quo\\\">#{$2}</span>\"}\n end\n end", "title": "" }, { "docid": "72162247e69da47019dbc1df1b5b615d", "score": "0.56770384", "text": "def quotes; end", "title": "" }, { "docid": "e3aa3f7ebf8bf0d2f134d369d355b40c", "score": "0.5647442", "text": "def convert_smart_quote(el)\r\n t = case el.value\r\n when :lsquo\r\n \"\\u2018\"\r\n when :rsquo\r\n \"\\u2019\"\r\n when :ldquo\r\n \"\\u201C\"\r\n when :rdquo\r\n \"\\u201D\"\r\n end\r\n #puts \"smartquote sub #{t}\"\r\n %{para(\"#{t}\", :margin_left => 0, :margin_right => 0)}\r\n end", "title": "" }, { "docid": "95df54b4949c417a078f78427df9f45d", "score": "0.5622238", "text": "def quote\n _passthru \"<blockquote>\"\n _passthru _body\n _passthru \"</blockquote>\"\n _optional_blank_line\nend", "title": "" }, { "docid": "6cc89faa39fbacb5f6562945e91435c6", "score": "0.56202805", "text": "def parse_text\r\n @text_nodes.map(&:content).join('')\r\n end", "title": "" }, { "docid": "6cc89faa39fbacb5f6562945e91435c6", "score": "0.56202805", "text": "def parse_text\r\n @text_nodes.map(&:content).join('')\r\n end", "title": "" }, { "docid": "4ac3260998d45d0d80a17cbdacaacaa1", "score": "0.5620257", "text": "def text_node(content)\n return node(\"text\", content)\n end", "title": "" }, { "docid": "d8ed4103bd73af7190f90714ba34ce68", "score": "0.5617069", "text": "def node_text(node)\n node.content.gsub('<', '&lt;').gsub('>', '&gt;')\n end", "title": "" }, { "docid": "5783af06c13965212a6330f22b3bf544", "score": "0.5613881", "text": "def initial_quotes(text)\n return Typogruby.initial_quotes(text.to_s)\n end", "title": "" }, { "docid": "09549b3ad36408fd5f617212cfbab1c5", "score": "0.56008697", "text": "def smart_quote_entity(el); end", "title": "" }, { "docid": "048909e9f8a69695de5593864ad687ec", "score": "0.5584752", "text": "def text_content\n @_node.getTextContent\n end", "title": "" }, { "docid": "2c8206be921da0a9e1a0f94b2aec7076", "score": "0.5584031", "text": "def table_row_by_words node\n newchildren = []\n children = node.children.to_a\n children.each_index do |child_index|\n child = children[child_index]\n sibling = (child_index+1 == children.length) ? nil : children[child_index+1]\n if not child\n next\n end\n if child.text?\n words = child.text.gsub('--',\"\\u00A0\").split( %r{\\s+} )\n words.each_index do |word_index|\n word = words[word_index]\n unless word =~ %r{^\\s*$}\n td = Nokogiri::XML::Node.new( 'td', $document )\n td.content = word\n if word_index == words.length-1 && word[-1] == \"-\" && sibling && !(sibling.text?) && sibling.element? && sibling.name == 'quote'\n td << sibling.dup\n children[child_index+1] = nil\n end\n newchildren << td\n end\n end\n elsif child.element?\n td = Nokogiri::XML::Node.new( 'td', $document )\n td.children = child.clone\n newchildren << td\n end\n end\n tr = Nokogiri::XML::Node.new( 'tr', $document )\n tr.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n tr[:class] = node.name\n\n newnode = node.replace tr\n return newnode\nend", "title": "" }, { "docid": "10bb007c2bd8cf9d4eb8c9f6702bb0e1", "score": "0.5567004", "text": "def test_text\n root = CommandNode.new(nil, nil)\n\n root << 'A block of text.'\n assert(root.size == 1)\n assert(root[0].class == TextNode)\n assert(root[0].text == 'A block of text.')\n\n root << \" More text.\"\n assert(root.size == 1)\n assert(root[0].class == TextNode)\n assert(root[0].text == 'A block of text. More text.')\n\n root.paragraph\n root << \"A new node.\"\n assert(root.size == 3)\n assert(root[0].class == TextNode)\n assert(root[-1].class == TextNode)\n assert(root[0].text == 'A block of text. More text.')\n assert(root[-1].text == 'A new node.')\n end", "title": "" }, { "docid": "11d052b43c25a4f7e7ae4c5bef2716d9", "score": "0.5566734", "text": "def text\n @node.inner_text.strip\n end", "title": "" }, { "docid": "c573921410dbeb81b7b9c1af9e5d8936", "score": "0.5540814", "text": "def tex_quote\n to_s.tex_quote\n end", "title": "" }, { "docid": "3feaa814e7c5b14857dab42c1f6195ed", "score": "0.5532693", "text": "def each_escape(node); end", "title": "" }, { "docid": "097f03f0fb3980ec8cfe2ad2c6b22ee4", "score": "0.5529267", "text": "def quote(text)\n \"#{quotes[0]}#{text}#{quotes[1]}\"\n end", "title": "" }, { "docid": "c74d94758f4e0c989d7a8befa8fb7a82", "score": "0.5500177", "text": "def content\n @node.children\n .map { |child| child.name == 'br' ? \"\\n\" : child.inner_text }\n .join('')\n .gsub(/\\s*\\n\\s*/, \"\\n\") # Only keep a single consecutive linebreak\n end", "title": "" }, { "docid": "75dc62fc8b2a495f0c0d91956c417b29", "score": "0.5443039", "text": "def accept_block_quote block_quote\n @res << \"\\n<blockquote>\"\n\n block_quote.parts.each do |part|\n part.accept self\n end\n\n @res << \"</blockquote>\\n\"\n end", "title": "" }, { "docid": "ddd27e9e42d740deda48b6b23516928d", "score": "0.54228437", "text": "def convert_node_to_plain_text(parent, out = '', options = {})\n if PARAGRAPH_TAGS.include?(parent.name)\n append_paragraph_breaks(out)\n elsif BLOCK_TAGS.include?(parent.name)\n append_block_breaks(out)\n end\n\n format_list_item(out, options) if parent.name == LI\n out << \"| \" if parent.name == TR && data_table?(parent.parent)\n\n parent.children.each do |node|\n if node.text? || node.cdata?\n text = node.text\n unless options[:pre]\n text = node.text.gsub(LINE_BREAK_PATTERN, SPACE).squeeze(SPACE)\n text.lstrip! if WHITESPACE.include?(out[-1, 1])\n end\n out << text\n elsif node.name == PLAINTEXT\n out << node.text\n elsif node.element? && !IGNORE_TAGS.include?(node.name)\n convert_node_to_plain_text(node, out, child_options(node, options))\n\n if node.name == BR\n out.sub!(TRAILING_WHITESPACE, EMPTY)\n out << NEWLINE\n elsif node.name == HR\n out.sub!(TRAILING_WHITESPACE, EMPTY)\n out << NEWLINE unless out.end_with?(NEWLINE)\n out << \"-------------------------------\\n\"\n elsif node.name == TD || node.name == TH\n out << (data_table?(parent.parent) ? TABLE_SEPARATOR : SPACE)\n elsif node.name == A\n href = node[HREF]\n if href &&\n href =~ ABSOLUTE_URL_PATTERN &&\n node.text =~ NOT_WHITESPACE_PATTERN &&\n node.text != href &&\n node.text != href[NON_PROTOCOL_PATTERN, 1] # use only text for <a href=\"mailto:[email protected]\">[email protected]</a>\n out << \" (#{href}) \"\n end\n elsif PARAGRAPH_TAGS.include?(node.name)\n append_paragraph_breaks(out)\n elsif BLOCK_TAGS.include?(node.name)\n append_block_breaks(out)\n end\n end\n end\n out\n end", "title": "" }, { "docid": "8a17314603fce87d8d470eee09e2cd64", "score": "0.5415609", "text": "def quotes\n end", "title": "" }, { "docid": "562a196988fd4a0b3b8e82ad52b307ad", "score": "0.5402373", "text": "def verse(node)\n quote(node)\n end", "title": "" }, { "docid": "b05ce2b8c2ebbb3377a2d7e37b843a58", "score": "0.53914607", "text": "def parse_quote(quote)\n update_action_log(:spans, !quote.spans.to_a.empty?)\n\n quote_author = quote.spans[1].small\n update_action_log(:small, !quote_author.nil? && quote_author.present?)\n\n tags = quote.div.links.map(&:text) # a.k.a { |tag| tag.text }\n update_action_log(:div, !quote.div.nil? && quote.div.present?)\n update_action_log(:links, !(quote.div.links.nil? || quote.div.links.to_a.empty?))\n update_action_log('element#text', !tags.empty?)\n {\n text: quote.spans[0].text,\n author: quote_author.text,\n tags: tags\n }\n end", "title": "" }, { "docid": "ae0cc4dfbf8c2e4821c216727dd5a6cc", "score": "0.5381576", "text": "def quote\n fetch('final_space.quotes')\n end", "title": "" }, { "docid": "b7adb613b9aa63c02e86de617a6dcef7", "score": "0.53765965", "text": "def text_repr\n result_children = children.map(&:to_str)\n \"(?:#{result_children.join('|')})\"\n end", "title": "" }, { "docid": "2708b9f2c4553934cacee89636ba4618", "score": "0.5362148", "text": "def literal(node)\n artwork_attributes = {\n anchor: node.id,\n align: node.attr(\"align\"),\n type: \"ascii-art\",\n name: node.title,\n alt: node.attr(\"alt\"),\n }\n\n # NOTE: html escaping is performed by Nokogiri\n artwork_content = \"\\n\" + node.lines.join(\"\\n\") + \"\\n\"\n\n noko do |xml|\n if node.parent.context != :example\n xml.figure do |xml_figure|\n # xml_figure.artwork artwork_content, **attr_code(artwork_attributes)\n xml_figure.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n else\n # xml.artwork artwork_content, **attr_code(artwork_attributes)\n xml.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n end\n end", "title": "" }, { "docid": "e046ed553215c2a42ba1bc306a9235b7", "score": "0.53427994", "text": "def create_text_node(string, &block); end", "title": "" }, { "docid": "e046ed553215c2a42ba1bc306a9235b7", "score": "0.53427994", "text": "def create_text_node(string, &block); end", "title": "" }, { "docid": "7362771fd73f800f93cb970915a123c4", "score": "0.53426254", "text": "def fetch_text_content (workitem, escape=false)\n\n text = (children || raw_children).inject('') do |r, child|\n\n r << child.to_s\n end\n\n return nil if text == ''\n\n escape ? text : OpenWFE::dosub(text, self, workitem)\n end", "title": "" }, { "docid": "65eec474594831c032f5783ce08ccf6e", "score": "0.5338096", "text": "def text(el)\n return el.value if el.type == :text\n\n xs = el.children.map do |x|\n text(x)\n end\n\n xs.join(\" \").gsub(\"\\n\", '')\n end", "title": "" }, { "docid": "8336c3f3d3246397baadf32d9a35a9b9", "score": "0.5331431", "text": "def simple_format_with_quote(text)\n text = '' if text.nil?\n text = text.dup\n start_tag = \"<p>\"\n text = text.to_str\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text.concat(\"</p>\")\n end", "title": "" }, { "docid": "0a65c32a6e2ee4127547914798c0aae8", "score": "0.5323314", "text": "def text_repr\n result_children = children.inject(+'') do |sub_result, child|\n if child.kind_of?(Regex::Character) && Metachars.include?(child.codepoint)\n sub_result << '\\\\' # Escape meta-character...\n end\n sub_result << child.to_str\n end\n \"[#{negated ? '^' : ''}#{result_children}]\"\n end", "title": "" }, { "docid": "edc2c7fac219cd84dc6e1ddfb25c4f2d", "score": "0.5322866", "text": "def node_text(node)\n return node.text.gsub('<', '&lt;').gsub('>', '&gt;') if node.text?\n\n return node.to_s if node.name =~ /code/\n\n node.children.map { |child| node_text(child) }.join('').strip\n end", "title": "" }, { "docid": "673287a8e0be5a271313e72bc67d4693", "score": "0.53075445", "text": "def get_quote_list(html)\n quote_list = Array.new\n\n html.css('div.item-listing').css('div.item').each do |item|\n quote = Quote.new\n quote.id = item[\"class\"].gsub(/[^\\d]/, '')\n quote.link = BASE_QUOTE_LINK.gsub(\"id\", quote.id)\n\n quote_item = item.children()[0].children()[0]\n\n quote_item.children().each do |i|\n if i[\"class\"] == \"decoration\"\n i.content = \"|newline|\" + i.content + \"|decorationclass|\"\n end\n end\n\n while quote_item\n str = HTMLEntities.new.decode quote_item.content.gsub(/\\|newline\\|/, \"\\n\")\n\n str.each_line do |line|\n unless line =~ /^[[:space:]]+$/\n first, second = line.split(/\\|decorationclass\\|/)\n quote.quote << [first.strip(), second ? second.strip() : second]\n end\n end\n\n quote_list << quote\n if (quote_item != nil)\n quote_item = quote_item.next()\n end\n end\n\n end\n\n quote_list\n end", "title": "" }, { "docid": "069d3ee63684b02cd6cef796e51bedf2", "score": "0.5286077", "text": "def build_quote_array(page_array)\n all_quotes = []\n page_array.map do |page|\n page_quotes = page.search('div.quoteText').map do |x|\n x.text.gsub(/\\n/, '').gsub(/Dorothy.*/, '').gsub(/”.*|^.*“/, '')\n end\n all_quotes += page_quotes\n end\n all_quotes\nend", "title": "" }, { "docid": "63da1e2d5719f9cf7b00f649bb7e1dca", "score": "0.52648276", "text": "def literal(node)\n artwork_attributes = {\n align: node.attr(\"align\"),\n type: node.attr(\"type\"),\n name: node.title,\n alt: node.attr(\"alt\"),\n }\n\n # NOTE: html escaping is performed by Nokogiri\n artwork_content = \"\\n\" + node.lines.join(\"\\n\") + \"\\n\"\n\n ret = noko do |xml|\n if node.parent.context != :example\n figure_attributes = {\n anchor: node.id,\n }\n xml.figure **attr_code(figure_attributes) do |xml_figure|\n # xml_figure.artwork artwork_content, **attr_code(artwork_attributes)\n xml_figure.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n else\n # xml.artwork artwork_content, **attr_code(artwork_attributes)\n xml.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n end\n ret\n end", "title": "" }, { "docid": "35c31984c54aaf562b1f86e151db056f", "score": "0.525491", "text": "def html_markup_org(text); end", "title": "" }, { "docid": "a184ca8139bb591d7f16d8d863da76ed", "score": "0.5236654", "text": "def text\n res = \"\"\n @contents.each{|c|\n if c.is_a? XML\n res << c.text\n elsif c.is_a? String\n res << c\n end # Ignore XML_PI/XML_Comment\n }\n res\n end", "title": "" }, { "docid": "1ca4dde55f160b17017f4ce5c42ce010", "score": "0.52288544", "text": "def marvin_quote; end", "title": "" }, { "docid": "208b670b483253671c7af55a46edd42d", "score": "0.52265084", "text": "def read_text( element )\n result = \"\"\n\n element.each_child do |child|\n if child.text?\n result << child.to_s\n elsif child.elem?\n case child.name\n when 'span'\n child.classes.each do |c|\n case c\n when 'red'\n result << \"\\\\textcolor{red}{\" << read_text( child ) << \"}\"\n when 'spoken'\n result << \"\\\\textsl{\" << read_text( child ) << \"}\"\n else\n result << \"{\" << read_text( child ) << \"}\"\n end\n end\n when 'em'\n result << \"\\\\emph{\" << read_text( child ) << \"}\"\n when 'strong'\n result << \"\\\\textbf{\" << read_text( child ) << \"}\"\n end\n else\n # write out\n end\n end\n\n result\n end", "title": "" }, { "docid": "7cbae937c5efc342107bf1d246655259", "score": "0.52205086", "text": "def node_text( value, block = nil )\n @seq_map = false\n\t\t\tvalx = value.dup\n unless block\n block =\n if options(:UseBlock)\n '|'\n elsif not options(:UseFold) and valx =~ /\\n[ \\t]/ and not valx =~ /#{YAML::ESCAPE_CHAR}/\n '|'\n else\n '>'\n end \n\n indt = $&.to_i if block =~ /\\d+/\n if valx =~ /(\\A\\n*[ \\t#]|^---\\s+)/\n indt = options(:Indent) unless indt.to_i > 0\n block += indt.to_s\n end\n\n block +=\n if valx =~ /\\n\\Z\\n/\n \"+\"\n elsif valx =~ /\\Z\\n/\n \"\"\n else\n \"-\"\n end\n end\n block += \"\\n\"\n if block[0] == ?\"\n esc_skip = ( \"\\t\\n\" unless valx =~ /^[ \\t]/ ) || \"\"\n valx = fold( YAML::escape( valx, esc_skip ) + \"\\\"\" ).chomp\n self << '\"' + indent_text( valx, indt, false )\n else\n if block[0] == ?> \n valx = fold( valx ) \n end\n #p [block, indt]\n self << block + indent_text( valx, indt )\n end\n\t\tend", "title": "" }, { "docid": "a63d4b8b19e03565b5d77f1e0014bdeb", "score": "0.52156425", "text": "def build_node\n \"\"\n end", "title": "" }, { "docid": "df2b7d670bb81235a93cac5c3c01a5ba", "score": "0.52068293", "text": "def update_raw_text(item)\n raw_text = +''\n\n append_text = lambda do |child|\n case child.type\n when :text, :codespan, :math\n raw_text << child.value\n when :entity\n raw_text << child.value.char\n when :smart_quote\n raw_text << ::Kramdown::Utils::Entities.entity(child.value.to_s).char\n when :typographic_sym\n raw_text << case child.value\n when :laquo_space\n \"« \"\n when :raquo_space\n \" »\"\n else\n ::Kramdown::Utils::Entities.entity(child.value.to_s).char\n end\n else\n child.children.each { |c| append_text.call(c) }\n end\n end\n\n append_text.call(item)\n item.options[:raw_text] = raw_text\n end", "title": "" }, { "docid": "e121286f01a6562880303304cab58199", "score": "0.5202371", "text": "def get_inside_text( text )\n \"<hello>#{ text }</hello>\"\n end", "title": "" }, { "docid": "60e7a894c84295542aa9671c2df7a1ef", "score": "0.5196235", "text": "def king_richard_iii_quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" }, { "docid": "2858941c804209e2a4602e0fed183acf", "score": "0.519461", "text": "def quote; end", "title": "" } ]
a3229acfbf843fbe367988ab2a76e3f2
Check to see if the current user is subscribed to a thread. = Examples github = Github.new oauth_token: 'token' github.activity.notifications.subscribed? 'threadid'
[ { "docid": "14fd2e881c2f18a65ecc660a71fcdd29", "score": "0.7717471", "text": "def subscribed?(thread_id, params={})\n assert_presence_of thread_id\n normalize! params\n get_request(\"/notifications/threads/#{thread_id}/subscription\", params)\n end", "title": "" } ]
[ { "docid": "a24ff481d08da0c39e9d074e5d3d1c72", "score": "0.8167685", "text": "def subscribed?(*args)\n arguments(args, required: [:thread_id])\n\n get_request(\"/notifications/threads/#{arguments.thread_id}/subscription\", arguments.params)\n end", "title": "" }, { "docid": "ce3274a215c0911987dc164337edebb3", "score": "0.68273854", "text": "def subscribed?(profile)\n subscriber_feed_subscriptions.where(profile_id: profile.id).first ?\n true : false\n end", "title": "" }, { "docid": "ce3274a215c0911987dc164337edebb3", "score": "0.6826967", "text": "def subscribed?(profile)\n subscriber_feed_subscriptions.where(profile_id: profile.id).first ?\n true : false\n end", "title": "" }, { "docid": "37a003f478e568cafd2e911798aa4d35", "score": "0.6820202", "text": "def subscribed?(subreddit)\n subscribed_subreddits.include?(subreddit)\n end", "title": "" }, { "docid": "dc3f6296bf1c5f612bf097bc1db86b2c", "score": "0.6737341", "text": "def is_subscribed?(post)\n subscriptions.where(:post => post).count > 0\n end", "title": "" }, { "docid": "d001efcecb4f1230382f76a93671a53e", "score": "0.6668367", "text": "def subscribing?(subscribed_user)\n subscribing.include?(subscribed_user)\n end", "title": "" }, { "docid": "10decf74fe496631054082438739c6e8", "score": "0.66609156", "text": "def subscribed_by?(user)\n Subscription.exists?(feed_id: self.id, user_id: user.id)\n end", "title": "" }, { "docid": "4aa7243b2cdd47882fdc9413d630e234", "score": "0.65446913", "text": "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "title": "" }, { "docid": "4aa7243b2cdd47882fdc9413d630e234", "score": "0.65446913", "text": "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "title": "" }, { "docid": "44a4b8725004621a765a4d413e4837ad", "score": "0.63763624", "text": "def subscribed?(sub)\n subscriptions.include?(sub)\n end", "title": "" }, { "docid": "44483cda6f9f2e944b1d684ec6a0f832", "score": "0.63643533", "text": "def subscribed?(*args)\n arguments(args, required: [:user, :repo])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/subscription\", arguments.params)\n true\n rescue Github::Error::NotFound\n false\n end", "title": "" }, { "docid": "3a1068013b9c03341cc828353e5a2e72", "score": "0.63010186", "text": "def is_subscribed?(podcastID)\n has_id = Subscription.where(\"user_id = ? AND podcast_id = ?\", current_user.id, podcastID)\n has_id.any?\n end", "title": "" }, { "docid": "fbb581fa54708ffaf82954062c308de1", "score": "0.62866056", "text": "def is_recipient_subscribed?\n recipient.is_newsletter_subscribed?\n end", "title": "" }, { "docid": "627b243c232c8e58f4d34ecabef2bcba", "score": "0.62677157", "text": "def already_replied? client, user\n client.user_timeline(\"crustasianwill\").any?{|my_tweet|\n my_tweet.in_reply_to_user_id == user.id\n }\nend", "title": "" }, { "docid": "965dd895938959660acabccce82c8745", "score": "0.6241666", "text": "def has_subscribed?(question)\n self.subscriptions.where(question: question).exists?\n end", "title": "" }, { "docid": "08bac26505deb9083227f309d496c267", "score": "0.62368286", "text": "def subscribed?\n subscribed == true\n end", "title": "" }, { "docid": "62d1aa97be9a79acea8f837e14f39dac", "score": "0.62199146", "text": "def subscribed_by?(user)\n !subscriptions.where(user: user).empty?\n end", "title": "" }, { "docid": "ce1dd10bb5ced56cef7ca3be184e2c16", "score": "0.6188231", "text": "def subscribed_to?(article)\n subscriptions.where(article_id: article.id, user_id: self.id).count > 0\n end", "title": "" }, { "docid": "ec5d3212191af699c299d0d6b8957789", "score": "0.61844456", "text": "def subscribed?(sub)\n subscribed_subs.include?(sub)\n end", "title": "" }, { "docid": "668a3ec805168ec3d2cbb39fa442689a", "score": "0.6172305", "text": "def subscribed?(example_subscription)\n if user_subs.find_by(subscription_id: example_subscription.id)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "5369707ea74b489573e16bc2d02b38e5", "score": "0.61710113", "text": "def has_subscription_for?(user)\n users.exists?(id: user.id)\n end", "title": "" }, { "docid": "8ea8782aea025dc21cd0b8eea331c847", "score": "0.6148007", "text": "def subscribed_to?(*)\n true\n end", "title": "" }, { "docid": "32848581eb55701674bc3d4e855b3541", "score": "0.6138458", "text": "def can_post_to_thread(message_text, message_channel, message_thread)\n is_main = message_thread == message_channel.main_thread\n isnt_adding_another_channel = (detect_mentioned_channels(message_text, current_user) - [message_channel]).empty?\n (not is_main) or (is_main and isnt_adding_another_channel)\n end", "title": "" }, { "docid": "f8b744cfa3336b3c598e4db8aaca510a", "score": "0.6135069", "text": "def subscribed_to?\n %w[to both].include?(@subscription)\n end", "title": "" }, { "docid": "f8b744cfa3336b3c598e4db8aaca510a", "score": "0.6135069", "text": "def subscribed_to?\n %w[to both].include?(@subscription)\n end", "title": "" }, { "docid": "f3a7e76d2d2d0fdeef45444cdd5c435d", "score": "0.61298895", "text": "def subscribed?\n self.active_subscription.present?\n end", "title": "" }, { "docid": "fb6c3df1895804f248fb4989ada14a1f", "score": "0.6104609", "text": "def subscribing?(other_user)\n self.subscribing.include?(other_user)\n end", "title": "" }, { "docid": "fb6c3df1895804f248fb4989ada14a1f", "score": "0.6104609", "text": "def subscribing?(other_user)\n self.subscribing.include?(other_user)\n end", "title": "" }, { "docid": "0f5dec86ffd300a3fda7b264dd6691c3", "score": "0.6088485", "text": "def subscribed?(question)\n subscriptions.where(question: question).exists?\n end", "title": "" }, { "docid": "086ce607973d05c56d9871436ee7446b", "score": "0.60853916", "text": "def subscribed?\n if @subscriber.nil?\n false\n else\n ![@subscriber.channels, @subscriber.groups, @subscriber.wildcard_channels].flatten.empty?\n end\n end", "title": "" }, { "docid": "3302fea75deb904b11a49b38eb669611", "score": "0.6072335", "text": "def subscribe_request?\n subject.downcase == \"subscribe\"\n end", "title": "" }, { "docid": "0541709c9c7a71d647abff44750c5a9f", "score": "0.6071503", "text": "def subscribed?(course)\n\t\tsubscribed_courses.include?(course)\n\tend", "title": "" }, { "docid": "ccee8063eeb1255b63953267d0bf3f31", "score": "0.60646933", "text": "def subscribed?(list_id, user_id)\n !unsubscribed?(list_id, user_id)\n end", "title": "" }, { "docid": "9c99cacd924d197cb82c3423e1a96e83", "score": "0.60350055", "text": "def can_subcribe_channel? channel_name\n\n if self.id == channel_name\n true\n else\n false\n end\n\n end", "title": "" }, { "docid": "df25c722bf3c122b4c32fb5b4d769478", "score": "0.6034904", "text": "def subscribing?(other)\n self.subscriptions.find_by_subscribed_id(other.id)\n end", "title": "" }, { "docid": "7edda0bd9f340287ff8aa207ac930d74", "score": "0.60151756", "text": "def user_exists_in_thread(message_id)\n it = Message.find(message_id)\n\n begin\n return true if it.to_user_id == current_user.id\n it = it.previous_message\n end while !it.previous_message.nil?\n\n false\n rescue\n # No message found, new thread, allow reply (new message in this case)\n true\n end", "title": "" }, { "docid": "1ef2c72123ae64484f41589e078638ce", "score": "0.59895635", "text": "def subscribed_to?(jid)\n follower = follower(jid)\n follower && follower.subscribed_to?\n end", "title": "" }, { "docid": "03bc09534a551254541ba3adaf0998d4", "score": "0.59887165", "text": "def can_subscribe?\n @ask == 'subscribe' && %w[none from].include?(@subscription)\n end", "title": "" }, { "docid": "03bc09534a551254541ba3adaf0998d4", "score": "0.59887165", "text": "def can_subscribe?\n @ask == 'subscribe' && %w[none from].include?(@subscription)\n end", "title": "" }, { "docid": "7a6ea8865fa84117ef0b8fa86e164440", "score": "0.59756196", "text": "def subscribed?(user)\n subscribed_emails.include?(user.email)\n end", "title": "" }, { "docid": "e171681aa5529803d89a3325ba104ed1", "score": "0.59701234", "text": "def subscribers?(topic)\n !subscribers_for(topic).empty?\n end", "title": "" }, { "docid": "b63da05f301cfb980096df970208218b", "score": "0.595927", "text": "def thread?\n\t\tthread_id == comment_id\n\tend", "title": "" }, { "docid": "65a19be537e131884cf88197abc91623", "score": "0.595243", "text": "def subscribed_to?(channel_name)\n @subscribed_channels.include? channel_name\n end", "title": "" }, { "docid": "9d709a0f49547ce47ffc11de0b4d2fdc", "score": "0.5940238", "text": "def own_tweet?(user)\n self.user_id == user.id\n end", "title": "" }, { "docid": "243280393c03eec6083be6f3df1a63a8", "score": "0.5932334", "text": "def subscribed?(course_id)\n begin\n self.courses.find(course_id)\n return true\n rescue ActiveRecord::RecordNotFound\n return false\n end\n end", "title": "" }, { "docid": "fac279f314639503638113afeaf78f61", "score": "0.5922118", "text": "def subscribers?(topic)\n !subscribers_for(topic).empty?\n end", "title": "" }, { "docid": "79c65960722f487a0ed7814de555cc87", "score": "0.5920534", "text": "def has_thread? id\n @threads.has_key? id\n end", "title": "" }, { "docid": "72a77fa1080114669a90802a84753bc5", "score": "0.59064174", "text": "def subscribed_to?(jid)\n c = contact(jid)\n c && c.subscribed_to?\n end", "title": "" }, { "docid": "891d649aae4d8ce56f89bf20e891d461", "score": "0.5906281", "text": "def in_channel?(channel)\n Juggernaut.client_in_channel?(current_user.id, channel)\n end", "title": "" }, { "docid": "7f35f8c960a611efbe393acb23e5b8db", "score": "0.5889455", "text": "def thread_unread?(user)\n return false if user.nil?\n\n self.unread?(user) || self.descendants.reduce(false) { |so_far, post| so_far || post.unread?(user) }\n end", "title": "" }, { "docid": "3206bdbee1bd4ca509aa077ea4aa8e50", "score": "0.58873814", "text": "def is_subscribed(channel)\n\t\t\treturn false unless is_channel_valid channel\n\t\t\tch = @channels[channel]\n\t\t\treturn false if ch == nil\n\t\t\treturn ch.is_subscribed\n\t\tend", "title": "" }, { "docid": "881b94177c673d90c5eaadaaeb676995", "score": "0.5873089", "text": "def subscribed_to_emails?\n self.subscribed_to_emails\n end", "title": "" }, { "docid": "35de7df23dffa5da2badcdded9f2a112", "score": "0.5869068", "text": "def subscribed_without_subscriptions?(user, project)\n false\n end", "title": "" }, { "docid": "dd64db0fd1dd1c0cec7ce0e028eb608c", "score": "0.58647394", "text": "def subscribing_allowed?(*channels)\n is_allowed? :subscribe, *channels\n end", "title": "" }, { "docid": "36db200683f3b82cff3ac06c7f4ac2ec", "score": "0.5859422", "text": "def active?\n subscriptions.any?(&:running?)\n end", "title": "" }, { "docid": "3354ee7ab4651a1b973792f5fc139379", "score": "0.5859079", "text": "def subscribed_to?(jid)\n contact = contact(jid)\n contact && contact.subscribed_to?\n end", "title": "" }, { "docid": "beb4d1044af1dc327fbfd4b21852a532", "score": "0.58523506", "text": "def subscribed?\n target.subscribes_to_notification?(key)\n end", "title": "" }, { "docid": "b5efa6eca2524b9d9433ac2e11e570a6", "score": "0.58522844", "text": "def has_weekender?\n self.subscriptions.any? do |sub|\n sub.publication.name == 'Crikey Weekender'\n end\n end", "title": "" }, { "docid": "705e2009ec6bf3a64562cada0a1ab020", "score": "0.58521724", "text": "def subscribed?\n not unsubscribed?\n end", "title": "" }, { "docid": "3fd088e59ac4d40f98a60bd206c5ca60", "score": "0.5846449", "text": "def check_conversation_state uid\n puts 'Ran check_conversation_state uid'\n puts 'Ran check_conversation_state uid: ' + uid.to_s\n # Check for existing thread\n threads = Textthread.where(user_id: uid)\n\n if threads.count > 0\n thread = threads.last\n thread_id = thread.id\n else\n thread_id = create_thread(uid)\n end\n\n identify_next_message(thread_id)\n end", "title": "" }, { "docid": "fae6c2704c921c1fbf6eb29c39591f75", "score": "0.58392197", "text": "def watching?(*args)\n arguments(args, required: [:user, :repo])\n\n get_request(\"/user/subscriptions/#{arguments.user}/#{arguments.repo}\", arguments.params)\n true\n rescue Github::Error::NotFound\n false\n end", "title": "" }, { "docid": "ec3f2f9593df7076819abe0dae857d0e", "score": "0.5834418", "text": "def has_active_subscriptions?\n subscriptions.any?(&:active?)\n end", "title": "" }, { "docid": "19e47c73e4dead541e38e1701bca3aec", "score": "0.5813026", "text": "def already_tweeted?(user_timeline, show_info)\n user_timeline.detect { |tweet| tweet.reply? && tweet.full_text.include?(show_info) }\nend", "title": "" }, { "docid": "3b83295309c1cf2d976aabca6525d443", "score": "0.58103514", "text": "def is_subscribed?(list_id)\n Subscriber.is_subscribed?(@emailAddress, list_id, :apiKey=> @apiKey)\n end", "title": "" }, { "docid": "de4b3e47606a4ba70baaea09779e7b95", "score": "0.58080196", "text": "def has_link_to_subscribe?(options = {}) # TODO: which channel\n # TODO: might take as an option WHICH channel to subscribe to\n # in order to check if it's my own channel\n links.any?{|link| link.kind == :subscription}\n end", "title": "" }, { "docid": "974cba84b47564b9d32b115a1ae65688", "score": "0.5804179", "text": "def subscribed_from?\n %w[from both].include?(@subscription)\n end", "title": "" }, { "docid": "974cba84b47564b9d32b115a1ae65688", "score": "0.5804179", "text": "def subscribed_from?\n %w[from both].include?(@subscription)\n end", "title": "" }, { "docid": "243acddcaba3f87e08b0cd0e884b20a3", "score": "0.579444", "text": "def email_subscribed?(email)\n subscriber = subscriber_info(email)\n\n subscriber.present? && subscriber[:status] == 'subscribed'\n end", "title": "" }, { "docid": "4dea90184c02f3434ab3bf32d5b40942", "score": "0.57922345", "text": "def subscribes_to? subscribable\n subscriptions.any? do |subscription|\n subscription.subscribable == subscribable\n end\n end", "title": "" }, { "docid": "d68832a7a3855dbd3c47ac1ce6d7df6c", "score": "0.5789214", "text": "def has_subscriptions?\n subscriptions.any?\n end", "title": "" }, { "docid": "7c7d55984302e80ba47d3130e60e4d98", "score": "0.5786733", "text": "def subscribed_from?(jid)\n follower = follower(jid)\n follower && follower.subscribed_from?\n end", "title": "" }, { "docid": "b24a3d31082dbfac5d32162da414ee2c", "score": "0.57867265", "text": "def subscribed?\n !ended? && !unsubscribed?\n end", "title": "" }, { "docid": "17332661226ffca0f80aff2cded4bbb5", "score": "0.578429", "text": "def subscribed?\n subscription.nil? || active_trial? ? false : true\n end", "title": "" }, { "docid": "93092241d24a841cef5490110db2822f", "score": "0.57713425", "text": "def channelHasUser?(nick, channel)\n return @channels[channel].has_key?(nick)\n end", "title": "" }, { "docid": "4a115cf826c6f758ba4810b1405f6933", "score": "0.5769176", "text": "def channel?\n self.channel_referent_id > 0\n end", "title": "" }, { "docid": "249015d7224897076cbe4631a07d40f1", "score": "0.57500255", "text": "def subscriber_can_get_notification?(subscription, event)\n subscription.user.active? &&\n no_notification_on_event?(event, subscription.user) &&\n check_event_for_brave(subscription, event) &&\n (user_not_actor?(subscription.user, event) || user_subscribed_on_own_changes?(event))\n #&& check_event_summary_subscriptions(subscription)\n #has_access(event, subscription.user)\n end", "title": "" }, { "docid": "292902edf02aad0fc377854ba86610f3", "score": "0.57378143", "text": "def active_subscribed?\n subscription.nil? ? false : true\n end", "title": "" }, { "docid": "fee9aa5817a555c1ef7dbc2a1187b8be", "score": "0.5730162", "text": "def subscribed?\n url = 'config'\n options = {query: {dv: 0}}\n\n subscribed = make_get_request(url, options)['data']['entries'].find do |item|\n item['key'] == 'isNautilusUser' && item['value'] == 'true'\n end\n\n !subscribed.nil?\n end", "title": "" }, { "docid": "811c5b385c25bc3f688d233a7b13646e", "score": "0.57198226", "text": "def subscribed_from?(jid)\n c = contact(jid)\n c && c.subscribed_from?\n end", "title": "" }, { "docid": "1577fbfcb604ea981d9ebbee9131d914", "score": "0.57096934", "text": "def has_subscriber?(consumer)\n subscriptions.collect(&:consumer_id).include?(consumer.id)\n end", "title": "" }, { "docid": "348edbbdc2bf5bff57a21ab4fe319326", "score": "0.5709673", "text": "def activated?\n subscribed? && active\n end", "title": "" }, { "docid": "56a0c626f562ffe0b5ba9cc05b3e504d", "score": "0.5689671", "text": "def watched?\n raise SecurityError, \"Couldn't check watch status. Not logged in.\" unless User.current_user\n self.code_notifications.where(:email => User.current_user.email).first\n end", "title": "" }, { "docid": "120f97b24980f293c4aaa9f4c8c4ad8e", "score": "0.5679289", "text": "def subscribed_from?(jid)\n contact = contact(jid)\n contact && contact.subscribed_from?\n end", "title": "" }, { "docid": "d14aed05584a60a446922bb32d2e3f70", "score": "0.56765836", "text": "def folder_is_subscribed?(path)\n folders_contain?(lsub(\"\", \"*\"), path)\n end", "title": "" }, { "docid": "390508473bb346a3a3ac4d1295010ad4", "score": "0.5668851", "text": "def is_read?\n self.user_notifications.present?\n end", "title": "" }, { "docid": "5569ccd990e2a5e95933bc168093c7fb", "score": "0.5665238", "text": "def subscribing?(course)\n courses.include?(course)\n end", "title": "" }, { "docid": "4b1b0d82a85272be2be949f9c7b1e35b", "score": "0.56603456", "text": "def subscribed?\n stripe_subscription_id?\n end", "title": "" }, { "docid": "88629cfcbcf2d973e2829703163c9ebc", "score": "0.5660274", "text": "def subscription?\n subscription_node\n end", "title": "" }, { "docid": "3675fd760c15fcfd761899f3f1a622af", "score": "0.5648387", "text": "def subscriber?\n return subscriber_flag == true\n end", "title": "" }, { "docid": "55dc27c1a9aa59044f1ed0ecddfbef48", "score": "0.5638196", "text": "def subscribed?\n !!@on_msg\n end", "title": "" }, { "docid": "e52a8daebd24eec12033936a12531676", "score": "0.56164795", "text": "def delete_thread_subscription(thread_id, options = {})\n boolean_from_response :delete, \"notifications/threads/#{thread_id}/subscription\", options\n end", "title": "" }, { "docid": "3b39f16e470fe825181fca9ed162fd1f", "score": "0.5613359", "text": "def tweets?\n twitter?\n end", "title": "" }, { "docid": "1393facc56af1a2a96645a2442fd4bf9", "score": "0.5602986", "text": "def faq\n if session[:user_id]\n @check = Channel.where(user: session[:user_id])\n end\n end", "title": "" }, { "docid": "51eae33580e3aaa914e18157ed5c629e", "score": "0.55987155", "text": "def slack_permission?\n return true if DevelopersTopic.dtl?\n\n ChatClient.message('levelbuilder', MESSAGE_DTL_SKIPPED_TOPIC, color: 'yellow')\n\n false\nend", "title": "" }, { "docid": "de634142f1bc29621c258d20a4b3da6f", "score": "0.55910164", "text": "def in_thread thread_id, options={}, headers={}\n @connection.get \"messages/in_thread/#{thread_id}.json\", options, headers\n end", "title": "" }, { "docid": "6c70f5afe06ad69d3e0f591cb3716a8f", "score": "0.5588777", "text": "def has_active_user?(user)\r\n conversation_members.where(\r\n :user_id => user.id,\r\n :parted => true\r\n ).any?\r\n end", "title": "" }, { "docid": "1dae964c638e8f98c5d6f5ed9930c8cc", "score": "0.5570534", "text": "def subscribed_to_mailing_list?(list_name)\n\t\tleid(list_name).present?\n\tend", "title": "" }, { "docid": "fabda68dfb4ad728fd1184c530080591", "score": "0.5570417", "text": "def subscribed?(event)\n\t\tsubscribed_events.include?(event)\n\tend", "title": "" }, { "docid": "b694322e928e7d1f72235d7bd6189593", "score": "0.5569012", "text": "def subscription_successful?\n order_placed_online? && user_intakes.first.order.subscription_successful?\n end", "title": "" }, { "docid": "b4370896ae32bc39093fe23019d3ab2c", "score": "0.5566563", "text": "def subscribed(jid)\n rosterUsers = find(jid)\n rosterUsers.each do |m|\n # For now just assume that if they are in our buddy list then we are subscribed\n return true\n end\n return false\n end", "title": "" } ]
2eaa68b11e97ed9466086ee23f7f88e5
Return an hstore with only the keys in the given array: hstore_op.slice(:a) slice(hstore, a)
[ { "docid": "3f7bb043fb7c48ad5a50304325cb4c4d", "score": "0.7690572", "text": "def slice(keys)\n HStoreOp.new(function(:slice, wrap_input_array(keys)))\n end", "title": "" } ]
[ { "docid": "578f7e0ec1856e4c84c820d543f35a73", "score": "0.6606377", "text": "def slice!(*keys); end", "title": "" }, { "docid": "a8704bfae5de6e39fbd2557415964d98", "score": "0.64387524", "text": "def slice *keys\n dup.slice! *keys\n end", "title": "" }, { "docid": "d26712764a587c673e7c5ca478c13274", "score": "0.63881916", "text": "def slice(*args)\n s = super(*args)\n s.keys = @keys.slice(*args)\n s\n end", "title": "" }, { "docid": "187bce1f7a56ba5351ad905ddd4fa1bd", "score": "0.63495225", "text": "def slice (*args)\n\tcase args.size\n\twhen 1\n\t if args[0].is_a? Range\n\t\trange = args[0]\n\t\tnew_similar(:hash => pairs_at(*keys(:ary).select do |key|\n\t\t range.include? key\n\t\t end))\n\t else fetch args[0], nil\n\t end\n\twhen 2\n\t in_range = []\n\t catch :index_error do\n\t\tstart = _adjust_key args[0]\n\t\tin_range = keys(:ary).select { |key| key >= start }\n\t end\n\t new_similar(:hash => pairs_at(*in_range.slice(0, args[1])))\n\telse nil\n\tend\n end", "title": "" }, { "docid": "a578435d31ceb6aa5214e57d326c59f3", "score": "0.6268172", "text": "def slice(*keys)\n dup.slice!(*keys)\n end", "title": "" }, { "docid": "5611e44efbe992ec5c3aa2bd13c2b6d9", "score": "0.62650084", "text": "def slice! *keys\n keys.inject({}) {|acc,key|\n acc[key] = self.delete(key) if self.has_key?(key)\n acc\n }\n end", "title": "" }, { "docid": "69a1cf7c086633665db2379188afce15", "score": "0.61123806", "text": "def slice_hash(*args)\n slice0(args, Hash)\n end", "title": "" }, { "docid": "08dacba6cbf89b32670fdf485ddfccb0", "score": "0.6105169", "text": "def slice!(*keys)\n keys = Set.new keys\n delete_if { |k,v| not keys.include? k }\n self\n end", "title": "" }, { "docid": "aa563cd38950f8403d2b5da56fd7ea59", "score": "0.60616255", "text": "def slice(*keys)\n keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)\n hash = self.class.new\n keys.each { |k| hash[k] = self[k] if has_key?(k) }\n hash\n end", "title": "" }, { "docid": "d81afd104465e3c9bfccdd2792d518ee", "score": "0.6047656", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "d81afd104465e3c9bfccdd2792d518ee", "score": "0.6047656", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "d81afd104465e3c9bfccdd2792d518ee", "score": "0.6047656", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "1edb90dd3b8569d75c23eb8d2f79fc80", "score": "0.6046269", "text": "def slice(*keys)\n\t\tres = []\n\t\tkeys.each{ |key| res << self[key] if has_key?(key) }\n\t\tres\n\tend", "title": "" }, { "docid": "e7e852bdca4c98284cbe3b180d332a77", "score": "0.59777254", "text": "def slice(*keys)\n keys.each_with_object({}) {|key, h| h[key] = self[key]}\n end", "title": "" }, { "docid": "12c8b89e804e11b987bba3ed7b32501a", "score": "0.59773266", "text": "def get_slice(key, start=nil, stop=nil)\n return [] if @store[key].nil?\n arr = @store[key].sort\n start_index = get_start_index(arr, start)\n stop_index = get_stop_index(arr, start_index, stop)\n arr[start_index..stop_index]\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "373da76352b0f71cc698f9584525adc5", "score": "0.59642047", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "bb7eb62de376e0e8f17d0f7634eecd00", "score": "0.5927515", "text": "def slice(*keys)\n keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)\n keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if has_key?(k) }\n end", "title": "" }, { "docid": "32f4eb8fcbbfe8ada0c973a7620e1d53", "score": "0.5900606", "text": "def slice *keys\n keys.inject({}) do |hsh, key|\n hsh[key] = send(key) if respond_to?(key)\n hsh\n end\n end", "title": "" }, { "docid": "5587635a4de13c5f1ab8af1d0769e14c", "score": "0.5900166", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "5587635a4de13c5f1ab8af1d0769e14c", "score": "0.5900166", "text": "def slice!(*keys)\n replace(slice(*keys))\n end", "title": "" }, { "docid": "43c38ceded2f48918b7893c0f5be6f62", "score": "0.587802", "text": "def slice(hash, *keys)\n Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]\n end", "title": "" }, { "docid": "51e0d8d639b6f3a2cacd7e3505a9e913", "score": "0.57957417", "text": "def sliced(delim, *keys)\n return [] if keys.empty?\n key = keys.detect { |k| key? k }\n val = to_h[key]\n return [] if val.nil? || val.blank?\n return val if val.is_a? Array\n return [val] unless val.include? delim\n slice key, delim\n end", "title": "" }, { "docid": "2d7f301a7993ce25185672f5d6739004", "score": "0.56889164", "text": "def slice(key, delim)\n return [] unless to_h.key? key\n trim to_h[key].split(delim)\n end", "title": "" }, { "docid": "e4d1e16521d21b25c2781ff31b035fe7", "score": "0.5535449", "text": "def slice(*args)\n send(\"[]\",*args)\n end", "title": "" }, { "docid": "3beab7e95c944eaf446ace9ccb390dad", "score": "0.5446191", "text": "def slice!(*args)\n orphaned = super\n\n orphan_resources(orphaned) unless orphaned.nil?\n\n # Workaround for Ruby <= 1.8.6\n compact! if RUBY_VERSION <= '1.8.6'\n\n unless orphaned.kind_of?(Enumerable)\n return orphaned\n end\n\n offset, limit = extract_slice_arguments(*args)\n\n query = sliced_query(offset, limit)\n\n new_collection(query, orphaned)\n end", "title": "" }, { "docid": "8161a726657820c1ca75098b9795b304", "score": "0.54267853", "text": "def slice!(options, *keys)\n keys.each_with_object({}) do |key, sliced|\n sliced[key] = options.delete(key) if options.key?(key)\n end\n end", "title": "" }, { "docid": "e52856bfcf0fd850b6ef796076fe5b1f", "score": "0.5423214", "text": "def slice!\n end", "title": "" }, { "docid": "3f8a2fdf7e49e620f4bec0a5daf0784e", "score": "0.53701544", "text": "def slice_hash!(index)\n entry(index, Hash, true)\n end", "title": "" }, { "docid": "4a210afed4fc146e6497f64bc5d8aa54", "score": "0.5361868", "text": "def slice(criterion = nil)\n option(criterion) do |options|\n options.__union__(\n fields: criterion.inject({}) do |option, (field, val)|\n option.tap { |opt| opt.store(field, { \"$slice\" => val }) }\n end\n )\n end\n end", "title": "" }, { "docid": "b6f8d1702e003777515181399b51d538", "score": "0.53580093", "text": "def slice!\n end", "title": "" }, { "docid": "ca94e42379f4c06210a20c74f83c1b2f", "score": "0.53308046", "text": "def slice\n end", "title": "" }, { "docid": "5ee7b6674dbd1d57bd2110fdb58b2f3e", "score": "0.5315335", "text": "def slice_hash\n return {} if items.empty?\n return singlar_hash if items.size == 1\n\n @value.select { |key, _value| items.include?(key) }.to_h\n end", "title": "" }, { "docid": "eacf009e3548bdaef004bcf0b650a006", "score": "0.5313943", "text": "def slice!(*args); end", "title": "" }, { "docid": "eacf009e3548bdaef004bcf0b650a006", "score": "0.5313943", "text": "def slice!(*args); end", "title": "" }, { "docid": "c140ff87d18e7fa53a8d699f2c8c1651", "score": "0.5308266", "text": "def slice!(*args)\n removed_slice = @order.slice!(*args)\n reindex\n removed_slice\n end", "title": "" }, { "docid": "c28e22bf1fa19c7d252c92bae3e60556", "score": "0.5286956", "text": "def slice(*args)\n # TODO: check indices\n super\n end", "title": "" }, { "docid": "99ad9c7795be3bfe48ec5d566fb06c07", "score": "0.5277313", "text": "def slice!(index)\n entry(index, Array, true)\n end", "title": "" }, { "docid": "0f99b3c126a1eaccfc8517cd604b6afa", "score": "0.52522445", "text": "def slice(*several_variants)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "d09f1abb2286562895adcea27ce93fe5", "score": "0.5226242", "text": "def slice(start: 0, length: -1)\n length = length.to_i\n end_index = length.positive? ? start + length - 1 : length\n\n return self.connection.lrange(@key, start.to_i, end_index)\n end", "title": "" }, { "docid": "ac1cf9557a9b7ad1886f5beafdc01e45", "score": "0.52021146", "text": "def [] (*args)\n\tif args.count == 1 || (respond_to?(:slice) && args.count == 2 &&\n\t args[0].is_a?(Integer) && args[1].is_a?(Integer))\n\t # [key] or array[start, length]\n\t super *args\n\telse\n\t def_opts = { :else => nil } # Default options\n\t if args[-1].is_a? Hash\n\t\toptions, last = def_opts.merge(args[-1]), -2\n\t else options, last = def_opts, -1\n\t end\n\t xfetch *args[0..last], options\n\tend\n end", "title": "" }, { "docid": "20207ee9e5130ed1cf66ad696de2073e", "score": "0.51951426", "text": "def slice_hash(src, *keys)\n hash = src.class.new\n Array(keys).flatten.each { |k| hash[k] = src[k] if src.has_key?(k) }\n hash\n end", "title": "" }, { "docid": "7e659b285f2a56b6bd9f3c9a38417051", "score": "0.5177868", "text": "def array_only_keys\n super + %w{ array my_array }\n end", "title": "" }, { "docid": "4696eeac61d20c3173dbf8722726f0f2", "score": "0.51647747", "text": "def slice(*args)\n evaluate_delayed_arguments.slice(*args)\n end", "title": "" }, { "docid": "4696eeac61d20c3173dbf8722726f0f2", "score": "0.51647747", "text": "def slice(*args)\n evaluate_delayed_arguments.slice(*args)\n end", "title": "" }, { "docid": "ac3ab462ae3cac19e4f1acea6fc7d913", "score": "0.5159485", "text": "def slice(input, start, size, name: nil)\n _op(:slice, input, start, size: size, name: name)\n end", "title": "" }, { "docid": "967d8f26f6f678ee055232b8973f8b3f", "score": "0.515536", "text": "def reverse_slice(*keys)\n keys.flatten!\n dup.delete_if { |k,_| keys.include?(k) }\n end", "title": "" }, { "docid": "967d8f26f6f678ee055232b8973f8b3f", "score": "0.515536", "text": "def reverse_slice(*keys)\n keys.flatten!\n dup.delete_if { |k,_| keys.include?(k) }\n end", "title": "" }, { "docid": "587834bf732ef7d861ee8ed5580fe7c4", "score": "0.51501834", "text": "def slice slice = nil\n @slice = slice if slice\n @slice\n end", "title": "" }, { "docid": "16d232dc494daadba949f8f0613d8977", "score": "0.5149432", "text": "def slice(arg0, arg1, *rest)\n end", "title": "" }, { "docid": "16d232dc494daadba949f8f0613d8977", "score": "0.5149432", "text": "def slice(arg0, arg1, *rest)\n end", "title": "" }, { "docid": "5151f530e63b0f7b796ae0c60d010185", "score": "0.512469", "text": "def access_Array(o, scope, keys)\n keys.flatten!\n case keys.size\n when 0\n fail(Issues::BAD_ARRAY_SLICE_ARITY, @semantic.left_expr, {:actual => keys.size})\n when 1\n key = coerce_numeric(keys[0], @semantic.keys[0], scope)\n unless key.is_a?(Integer)\n bad_access_key_type(o, 0, key, Integer)\n end\n o[key]\n when 2\n # A slice [from, to] with support for -1 to mean start, or end respectively.\n k1 = coerce_numeric(keys[0], @semantic.keys[0], scope)\n k2 = coerce_numeric(keys[1], @semantic.keys[1], scope)\n\n [k1, k2].each_with_index { |k,i| bad_access_key_type(o, i, k, Integer) unless k.is_a?(Integer) }\n\n # Help confused Ruby do the right thing (it truncates to the right, but negative index + length can never overlap\n # the available range.\n k1 = k1 < 0 ? o.length + k1 : k1 # abs pos (negative is count from end)\n k2 = k2 < 0 ? o.length - k1 + k2 + 1 : k2 # abs length (negative k2 is length from pos to end count)\n # if k1 is outside, adjust to first position, and adjust length\n if k1 < 0\n k2 = k2 + k1\n k1 = 0\n end\n # Help ruby always return empty array when asking for a sub array\n result = o[ k1, k2 ]\n result.nil? ? [] : result\n else\n fail(Issues::BAD_ARRAY_SLICE_ARITY, @semantic.left_expr, {:actual => keys.size})\n end\n end", "title": "" }, { "docid": "d37568dec24c43f16d024116e815c494", "score": "0.5096591", "text": "def reverse_slice(*keys)\n keys.flatten!\n dup.delete_if { |k, _| keys.include?(k) }\n end", "title": "" }, { "docid": "3fcc9e7f7b5ce3cbfb2ac2f276c6f675", "score": "0.5094724", "text": "def slice(s, *keys)\n h = {}\n keys.each { |k| h[k] = s[k] }\n h\n end", "title": "" }, { "docid": "079b7d504a6cd4bd26a66c00c8c5ca22", "score": "0.5081281", "text": "def extended_slice(*args)\n @index_range = normalize_indexes(*args)\n case @index_range[:result]\n when :nil\n return nil\n when :empty\n klass = self.index_array_class || self.class\n return klass.new([])\n end\n res = (@index_range[:start]..@index_range[:end]).map {|i| at(i) }\n @index_range[:class] = self.class.name\n if @index_range[:result] == :scalar\n res = res.first \n else\n klass = self.index_array_class || self.class\n @index_range[:array_class] = klass.name\n res = klass.new(res)\n end\n log if $indexable_basic_log\n res\n end", "title": "" }, { "docid": "cee183e46242ba83b1d87c455b2cc0e2", "score": "0.5070474", "text": "def filter *a\n a.reduce({}) {|h,k| h[k] = self[k] if key? k; h }\n end", "title": "" }, { "docid": "4a3011ba0fd4b5cc8295acd744f732d5", "score": "0.50658864", "text": "def get_keys(arr)\n @provider.get_specified_values(arr)\n end", "title": "" }, { "docid": "be00e35e6f15caf1bb3a5a5238a323bd", "score": "0.50497013", "text": "def slice(*wanted)\n trie = Trie.new(0)\n wanted.each { |key| trie.put!(key, get(key)) if key?(key) }\n self.class.alloc(trie, @default)\n end", "title": "" }, { "docid": "5af0e75f271083d926c7ae05884ac1a8", "score": "0.50453466", "text": "def slice_cache\n Feed.find cache.slice(safe_partition.window.min, safe_partition.windowsize)\n end", "title": "" }, { "docid": "d5343b8ce4a72697a7541f5afe348ca8", "score": "0.50415283", "text": "def slices(chunks, ary)\n if (\n !(chunks.is_a?(Integer)) || (chunks > ary.size) ||\n chunks.negative? || chunks.zero? || !(ary.is_a? Array)\n ) then\n STDERR.puts 'ERROR: my_slices - bad args'; return nil end\n width = ary.size / chunks\n remainder = ary.size % chunks\n results = []; i = 0\n ary_orig = ary.dup; ary_tmp = ary.dup\n 0..chunks.times do results << ary_tmp.slice!(0,width) end\n if remainder > 0 then\n i = 0;\n ary_orig.last(remainder).each do |entry|\n results[i] << entry\n if i < results.size then i += 1 else i = 0 end\n end\n end\n results\nend", "title": "" }, { "docid": "8c9ac93c552174d4bea8fd8c32a39918", "score": "0.503991", "text": "def slice(*args)\n Vector[*to_a.slice(*args)]\n end", "title": "" }, { "docid": "1416d4c113c738a74017b9e02f761fc1", "score": "0.50379765", "text": "def slice\n unless @slice\n raise SliceLoadError, \"a slice must be given to #{self} via `.with_slice(slice)`\"\n end\n\n @slice\n end", "title": "" }, { "docid": "689ecfcd2469fb25873c95c3f32de391", "score": "0.50344616", "text": "def slice(*args)\n return handler.slice(@string, *args)\n end", "title": "" }, { "docid": "b27340ae5dc894dc2b1e76af8520746d", "score": "0.5033907", "text": "def to_set\n return slice.to_set\n end", "title": "" }, { "docid": "f531fda493000f6a76290bc1e547c2f9", "score": "0.5030929", "text": "def retrieve(array, drop_this_many, print_this_many)\n new_array = array.drop(drop_this_many)\n\n final_array = new_array.first(print_this_many)\n\n final_array\nend", "title": "" }, { "docid": "6a7f813a0e2883f4dd69f6a167b31108", "score": "0.49697348", "text": "def slice(options, *keys)\n keys.inject({}) do |hash, key|\n hash[key] = options[key] if options[key]\n hash\n end\n end", "title": "" }, { "docid": "6a7f813a0e2883f4dd69f6a167b31108", "score": "0.49697348", "text": "def slice(options, *keys)\n keys.inject({}) do |hash, key|\n hash[key] = options[key] if options[key]\n hash\n end\n end", "title": "" }, { "docid": "305c172273d0e06727c887a2d60f5a1e", "score": "0.49662754", "text": "def slice(**options)\n defaults = {\n lower: nil,\n upper: nil,\n exclusive: false,\n lex: @lex\n }\n\n self.class::Slice.new(self, **defaults.merge(options))\n end", "title": "" }, { "docid": "f67f3fa0dcb925552d3d83e33353b0a9", "score": "0.49637705", "text": "def hcsv_hkeys(db, table, hstore)\n sql = %{\n SELECT DISTINCT k\n FROM (\n SELECT skeys(#{hstore}) AS k\n FROM #{table}\n ) AS keys\n ORDER BY k\n }.gsub(/\\s+/, ' ')\n psql(db, sql).split(\"\\n\")\n end", "title": "" }, { "docid": "a7fa0cc9e03620890f8163177cce1813", "score": "0.49562436", "text": "def subset( *keys, &select_block )\n subset_params =\n if block_given?\n filter_parameters.select &select_block\n else\n filter_parameters.slice( *keys )\n end\n subset = self.class.new( subset_params )\n subset.predicates = predicates.clone\n subset\n end", "title": "" }, { "docid": "8f849042d5e3ebff7cef5cdc8ccd760d", "score": "0.4933769", "text": "def slice!(arg0, arg1, *rest)\n end", "title": "" }, { "docid": "90e7e56f8ff3faae2e143308f30a1938", "score": "0.49256006", "text": "def slice(array, length)\n return nil if length <= 0\n\n sliced = []\n array.each_slice(length) { |slice| sliced << slice }\n sliced\nend", "title": "" }, { "docid": "644a1565698394e946461579f929e347", "score": "0.49145415", "text": "def slices\n []\n end", "title": "" }, { "docid": "0347cd9cfffe650e0cd86842deb3f85a", "score": "0.49109632", "text": "def sub(input)\n hash = input.dup\n @db.keys.each do |k|\n self[k] = hash[k] ? hash.delete(k) : false\n end\n hash\n end", "title": "" }, { "docid": "8edd3d1976062ce292b95c23885e0b9b", "score": "0.49095812", "text": "def slice_hash(hash, *keys)\n return {} if keys.empty?\n\n new_hash = {}\n hash.each do |key, value|\n new_hash[key] = value if keys.include? key\n end\n new_hash\n end", "title": "" }, { "docid": "8edd3d1976062ce292b95c23885e0b9b", "score": "0.49095812", "text": "def slice_hash(hash, *keys)\n return {} if keys.empty?\n\n new_hash = {}\n hash.each do |key, value|\n new_hash[key] = value if keys.include? key\n end\n new_hash\n end", "title": "" }, { "docid": "abc6594a1833a122013c747241bc4d51", "score": "0.4895353", "text": "def slice!(index, length=nil)\n if length.nil?\n catalog = @data.slice!(index)\n else\n catalog = @data.slice!(index, length)\n end\n return Catalog.new(catalog)\n end", "title": "" }, { "docid": "3d8c2ed75706c61e9593ee17675bd7cf", "score": "0.48795167", "text": "def partition(hash, &predicate)\n hash.partition(&predicate).map(&:to_h)\nend", "title": "" }, { "docid": "1a9095def28f148174837c0bf09972be", "score": "0.48662066", "text": "def slice(table)\n header = table.header\n rows_size = table.rows_size\n\n head = header ? header : (0..rows_size).map { |n| (n + 1).to_s }\n\n (0...rows_size).reduce([]) do |array, index|\n array + head.zip(table.rows[index]).map { |row| table.to_row(row) }\n end\n end", "title": "" }, { "docid": "5c996fcb5a3f8a773e51cfc4bd6ba911", "score": "0.4855168", "text": "def take (arr, start_position=1)\n arr.slice(start_position, arr.length)\nend", "title": "" }, { "docid": "08438f856190f091ab07eb29c72efb54", "score": "0.485428", "text": "def keys(options = { })\n if options.include? :range\n warn \"range supersedes prefix\" if options[:prefix]\n range = options[:range]\n unless range.respond_to?(:first) and range.respond_to?(:last)\n fail ArgumentError, \"Range or two element Array expected\"\n end\n start = cast_key_in(range.first)\n include_start = !options.fetch(:exclude_start, false)\n finish = cast_key_in(range.last)\n include_finish = !( range.respond_to?(:exclude_end?) ?\n range.exclude_end? :\n options.fetch(:exclude_end, false) )\n else\n fail ArgumentError, \"prefix not supported\" if options[:prefix]\n start = cast_key_in(:min)\n include_start = true\n finish = cast_key_in(:max)\n include_finish = true\n end\n limit = options.fetch(:limit, -1)\n Utilities.temp_int do |count|\n begin\n list = lib.range(@db, start, finish, limit, count)\n array = list.get_array_of_uint64(0, count.get_int(0))\n array.shift if array.first == start and not include_start\n array.pop if array.last == finish and not include_finish\n array # cast not needed: already Integer\n ensure\n Utilities.free(list) if list\n end\n end\n end", "title": "" }, { "docid": "85fa6a3739322e57f5092a1b9c24be01", "score": "0.4853027", "text": "def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", keys: keys.flatten)\n end", "title": "" }, { "docid": "c48b8aebfd74b15e559e05ee7f7914ed", "score": "0.48471323", "text": "def slice from, to\n from, to = from.to_i, to.to_i\n ret = self.class.new self.select { |k,v| k.to_i.between?(from,to) }\n end", "title": "" }, { "docid": "3b4fefec2351d79e124c55d5bc0faec9", "score": "0.48443693", "text": "def slice!#(*args)\n raise NotImplementedError\n end", "title": "" }, { "docid": "db1933c8750bd63186b28c8376d31728", "score": "0.48442575", "text": "def slice!(*args)\n out = self[*args]\n if !(Range === args[0])\n # make sure that negative values are not passed through to the\n # []= assignment\n args[0] = Type.coerce_to args[0], Integer, :to_int\n args[0] = args[0] + self.length if args[0] < 0\n # This is to match the MRI behaviour of not extending the array\n # with nil when specifying an index greater than the length\n # of the array.\n if args.size == 1\n return out unless args[0] >= 0 && args[0] < self.length\n args << 1\n end\n end\n self[*args] = []\n out\n end", "title": "" }, { "docid": "ce5549f0daaab138b66b7750cff3bbf9", "score": "0.48441827", "text": "def deleted_elements(my_array)\n\tmy_array.drop(2)\nend", "title": "" }, { "docid": "60a5c21b94720e84abc1a92e1cf9bd16", "score": "0.48432472", "text": "def to_group(*keys)\n Record.new(slice(*keys))\n end", "title": "" }, { "docid": "f4e792108fb6f49b15d9aa31ce4eeb55", "score": "0.48242432", "text": "def all_elements_except_first_3 array\n\tarray.slice(3,array.length)\nend", "title": "" }, { "docid": "70a7024c8bf1353f2195642a9a4f37f5", "score": "0.48194474", "text": "def extract_key!(array, key)\n map_array!(array, -> v { v[key] })\n end", "title": "" }, { "docid": "51543793969e74ecae2ae921d5910d72", "score": "0.4805539", "text": "def keys\n keys = []\n underlying_array.each { |arr| keys << arr.first }\n keys\n end", "title": "" }, { "docid": "72ce4c051a8e85078e43c2017eceab37", "score": "0.4795156", "text": "def to_a\n return slice.to_a\n end", "title": "" }, { "docid": "53d31043b6e373dc0d6b4a4e97c30757", "score": "0.4794388", "text": "def extract!( *keys, &select_block )\n rv = subset( *keys, &select_block )\n rv.to_h.keys.each do |key|\n filter_parameters.delete( key )\n end\n rv\n end", "title": "" }, { "docid": "cb7504769f64ef65d9f5753bbd2e8340", "score": "0.47932595", "text": "def -(ary)\n `for(var i=0,l=ary.length,result=[],seen=[];i<l;++i){var a=ary[i],k=a.m$hash();if(!seen[k]){seen[k]=true;};};`\n `for(var i=0,l=this.length;i<l;++i){var a=this[i],k=a.m$hash();if(!seen[k]){result.push(a);};}`\n return `result`\n end", "title": "" }, { "docid": "9589e312305b3faebc1b783920060970", "score": "0.47923014", "text": "def test_slice\n slice = @set.slice\n assert_equal @set.key, slice.key, 'should have the same object key'\n assert_equal @set.factory, slice.factory, 'should have the same initial factory'\n assert_equal '-inf', slice.lower, 'should have infinity as lower bound'\n assert_equal '+inf', slice.upper, 'should have infinity as upper bound'\n refute slice.exclusive, 'should not be exclusive by default'\n\n slice = @set.slice(lower: 1, upper: 3, exclusive: true)\n assert_equal '(1.0', slice.lower, 'should have exclusive 1.0 as lower bound'\n assert_equal '(3.0', slice.upper, 'should have exclusive 3.0 as upper bound'\n\n slice = @set.slice(lower: 1, upper: 3, exclusive: false)\n assert_equal 1.0, slice.lower, 'should have inclusive 1.0 as lower bound'\n assert_equal 3.0, slice.upper, 'should have inclusive 3.0 as upper bound'\n end", "title": "" }, { "docid": "ef672ac7b296fe94e7fbfd76cf9a4bc6", "score": "0.4790144", "text": "def test_slice_before_noneMatch\n assert_equal [[3, 2, 9]], @triple.slice_before(10).to_a\n end", "title": "" } ]
3f5af2d1bb47da622956e2d687284f21
5) when the Book has a complex multiple level hierarchy
[ { "docid": "35538e33f92b7f3869d16bb4c8b37929", "score": "0.52033067", "text": "def test_associations_5\n simulate('Book')\n simulate('Page')\n simulate('Line')\n simulate('Word')\n simulate('Letter')\n\n Book.class_eval do\n has_many :pages\n has_many :lines\n has_many :words\n has_many :letters\n end\n\n Page.class_eval do\n has_many :lines\n has_many :words\n has_many :letters\n end\n\n Line.class_eval do\n has_many :words\n has_many :letters\n end\n\n Word.class_eval do\n has_many :letters\n end\n\n letters = :letters\n words = { words: [letters] }\n lines = { lines: [words, letters] }\n pages = { pages: [lines, words, letters] }\n associations = [pages, lines, words, letters]\n\n assert_equal(Hierarchy.associations(Book), associations)\n end", "title": "" } ]
[ { "docid": "359a96f13786f958e05761f0adc6cd4c", "score": "0.6446331", "text": "def test_book_part(book_part)\n expect(book_part).to be_persisted\n expect(book_part.title).not_to be_blank\n\n book_part.child_book_parts.each do |cbp|\n next if cbp == book_part\n test_book_part(cbp)\n end\n\n book_part.pages.each do |page|\n expect(page).to be_persisted\n expect(page.title).not_to be_blank\n end\n end", "title": "" }, { "docid": "822c5a726e9b3d0d3a0dc9bc16cce0a9", "score": "0.6025141", "text": "def structurize!\n # Assuming doc is a Nokogiri::HTML::Document\n if body = doc.css('book').first then\n stack = []\n \n body.children.each do |node|\n # non-matching nodes will get level of 0\n level = node.name[ /h([1-6])/i, 1 ].to_i\n level = 99 if level == 0\n \n stack.pop while (top=stack.last) && top[:level]>=level\n stack.last[:div].add_child( node ) if stack.last\n if level<99\n if node.name == \"h1\"\n div = Nokogiri::XML::Node.new(\"chapter\",doc)\n else\n div = Nokogiri::XML::Node.new(\"sect#{level -1}\",doc)\n end\n if node.attr(\"i\")\n div.set_attribute(\"xml:id\", node.attr(\"id\").to_s) \n node.remove_attribute(\"id\")\n end\n node.add_next_sibling(div)\n node.name=\"title\"\n div.add_child(node)\n node.delete(node)\n stack << { :div=>div, :level=>level }\n end\n end\n \n\n end\n end", "title": "" }, { "docid": "188547fea69d3cd37585c286ad5e5c23", "score": "0.59573793", "text": "def get_children(params)\n if params[:id].nil? || params[:id] == 'root' \n super # Let the data_class handle the root collection\n else params[:id] =~ /Author-(\\d+)/\n Book.where(:author_id => $1)\n end\n end", "title": "" }, { "docid": "88f6d090c5f0fb8afb2320b6dc11d630", "score": "0.591081", "text": "def has_book\n end", "title": "" }, { "docid": "b4e0bb2af91af5e03ce616ecc56166eb", "score": "0.58302367", "text": "def child_ancestry; end", "title": "" }, { "docid": "0298b4692080daa3b72169c188766bff", "score": "0.5788513", "text": "def test_ancestors\n assert_equal([Book, Printable, Document, Object, Kernel, BasicObject], Book.ancestors)\n end", "title": "" }, { "docid": "48678d2dc4e6b4bf1b56750c6c98bb1c", "score": "0.5785986", "text": "def books\n books = []\n self.location.each do |location|\n books << location.book\n end\n books\n end", "title": "" }, { "docid": "51119bf821d091ee4c98f221032c9b9b", "score": "0.57146436", "text": "def test_book_info\n library = Library.new( books:[\n {\n title: \"lord_of_the_rings\",\n rental_details: {\n student_name: \"Jeff\",\n date: \"01/12/16\"\n }\n },\n\n {\n title: \"The_Wind_in_the_Willows\",\n rental_details: {\n student_name: \"Susan\",\n date: \"11/03/17\"\n }\n },\n\n {\n title: \"The Circle\",\n rental_details: {\n student_name: \"Mae\",\n date: \"05/03/17\"\n }\n }\n ])\n\n expected = {\n title: \"The Circle\",\n rental_details: {\n student_name: \"Mae\",\n date: \"05/03/17\"\n }\n }\n actual = library.book_info( \"The Circle\" )\n assert_equal( expected, actual )\nend", "title": "" }, { "docid": "5719fcb45b43f9595990c1241f44d360", "score": "0.57013524", "text": "def getbook\n \n end", "title": "" }, { "docid": "38f4c5a37bc8bfc37ca9848829177ed6", "score": "0.56872326", "text": "def books\n # @books\n # Look over the Books class\n # try to find books that have\n # the same author as this one you're looking for\n Book.all.select do |book| # Book instance\n book.author == self\n end\n end", "title": "" }, { "docid": "4cf766313743b6163ae016d7775074fb", "score": "0.56864804", "text": "def collection_with_parent_collection; end", "title": "" }, { "docid": "4cf766313743b6163ae016d7775074fb", "score": "0.56864804", "text": "def collection_with_parent_collection; end", "title": "" }, { "docid": "f6e48cdcbea195a6ea57e0b9d1a7af3b", "score": "0.56716436", "text": "def books\n # has many\n Book.all.select do |book|\n book.author == self\n end\n end", "title": "" }, { "docid": "4299d61f8aaad0103e97f6b0c807f9f7", "score": "0.561435", "text": "def lays_down_book\n end", "title": "" }, { "docid": "c4577d8fa7375e227ca617aeb2b5e155", "score": "0.5541069", "text": "def set_book\n @book = Book.includes(:chapters).find(params[:id])\n end", "title": "" }, { "docid": "151c8b8865113b295a9117afd370446d", "score": "0.5510459", "text": "def my_books\n #Need all them books doe\n # author is me?\n Book.all.select do |book_obj|\n book_obj.author == self\n end\n\n end", "title": "" }, { "docid": "81dbe8c1a693f7155ea92e98a42abdcf", "score": "0.54952717", "text": "def test_associations_4\n simulate('Book')\n simulate('Page')\n simulate('Line')\n simulate('Word')\n simulate('Letter')\n Book.class_eval { has_many :pages }\n Page.class_eval { has_many :lines }\n Line.class_eval { has_many :words }\n Word.class_eval { has_many :letters }\n\n assert_equal(Hierarchy.associations(Book), [{ pages: [{ lines: [{ words: [:letters] }] }] }])\n end", "title": "" }, { "docid": "67a1823450bcc806619970c1bbc001a9", "score": "0.549481", "text": "def get_records(params)\n if params[:id].nil? || params[:id] == 'root'\n Category.where(:parent_id => nil)\n else params[:id] =~ /Category-(\\d+)/\n cat = Category.find $1\n cat.lft == cat.rgt-1 ? Book.where(:category_id => cat.id)\n : Category.where(:parent_id => cat.id)\n end\n end", "title": "" }, { "docid": "4e60f9a1750914951a0c89cf8a4d310e", "score": "0.54922634", "text": "def autogenerateBetterBook()\n context = self.data['_context']\n if context.nil?\n msg = 'self.data[\\'_context\\'] is nil in (' + relative_path + ')'\n raise Exception.new(\"Unable to generate better book: \" + msg);\n return\n end\n\n currentLevel = 0;\n rootSection = nil;\n otherSections = []\n topLevelEntries = []\n\n # Pick out this pages rootSection and split out other sections\n site.data['_context']['subdirectories'].each { |subdirectory|\n if subdirectory['index'].nil?\n next\n end\n\n # We force generation here since if you in a top level section\n # we want the nav to be generated for that page, regardless of whether\n # it's normally displayed or not\n force = false\n isSelected = false\n if subdirectory['id'] == @directories[currentLevel]\n isSelected = true\n if @directories.count > 0\n force = true\n end\n end\n entry = getBetterBookEntry(subdirectory, currentLevel, force, isSelected)\n if entry.nil?\n next\n end\n\n topLevelEntries << entry\n }\n\n self.data['contentnav'] = { \"toc\" => topLevelEntries }\n\n #if @directories[currentLevel] == 'updates'\n # puts \"HERE\"\n # puts self.data['contentnav']\n #end\n end", "title": "" }, { "docid": "0f87cfeda0d6497b79e4a1b496fbad5a", "score": "0.54769677", "text": "def test_add_book\n lib = Library.new(\n [\n {title: \"lord_of_the_rings\",\n rental_details:\n {\n student_name: \"Fari\",\n date: \"01/12/18\"\n }\n },\n {title: \"fire_and_ice\",\n rental_details:\n {\n student_name: \"Debi\",\n date: \"12/09/18\"\n }\n }\n ]\n )\n lib.add_book(\"Beauty_and_the_beast\")\n assert_equal(3, lib.books.count)\n assert_equal(\"\", lib.books[2][:rental_details][:student_name])\n assert_equal(\"\", lib.books[2][:rental_details][:date])\n end", "title": "" }, { "docid": "92982df7a35fcc4f6c3d1d9453e96cc6", "score": "0.547302", "text": "def new\n @book = Book.new\n @author = @book.authors.new\n end", "title": "" }, { "docid": "60624232bf814986f274142e6cf333ef", "score": "0.5450426", "text": "def add(book)\n node = @root\n \n for i in 1...book.size\n new_point = book[i]\n \n if node.child.nil? # new book\n node.child = Node.new\n node = node.child\n node.point.y = new_point.y\n node.point.x = new_point.x\n else # search brother node\n node = node.child\n while true\n # find node in database\n break if node.point.equals(new_point)\n \n if node.sibling.nil? # new node\n node.sibling = Node.new\n node = node.sibling\n node.point.y = new_point.y\n node.point.x = new_point.x\n break\n end\n \n node = node.sibling\n end\n end\n end\n end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "056660d10c5f8b234f613b378d94ac98", "score": "0.5443642", "text": "def nesting; end", "title": "" }, { "docid": "28ac66a82fe38728eea4a9837e3bd6ac", "score": "0.54349554", "text": "def child_objects; end", "title": "" }, { "docid": "c7134124406ef53cd2756628f54cfd72", "score": "0.54261863", "text": "def index\n \t@chapters = @book.chapters\n \t@chapter = @book.chapters.build()\n end", "title": "" }, { "docid": "d26e53ee7dd3e52a6f056b24a3d08b0b", "score": "0.5413631", "text": "def test_abebooks_book_object\n\t\tresp = Abebooks4r::Abe.search(:author => 'Brad Ediger', :title => 'Advanced Rails')\t\t\n\t\tassert(resp.books.first.get('title') == 'Advanced Rails')\n\t\tassert(resp.books.first.get('author') == 'Ediger, Brad')\n\tend", "title": "" }, { "docid": "9bae6f4c78ff6aa0ffe5618a23903263", "score": "0.53908956", "text": "def split_into_chapters(xml)\n chapter_number = 0\n current_chapter = manifest.chapters.first\n reference_cache = {}\n if Softcover::Utils.article?\n # Include all the material before the first section.\n xml.css('#book').children.each do |node|\n next if node['id'] == 'title_page'\n break if node['class'] == 'section'\n current_chapter.nodes.push node\n node.remove\n end\n end\n xml.css('#book>div').each do |node|\n # Include the title page info.\n if node['id'] == 'title_page'\n current_chapter.nodes.unshift node\n else\n klass = node.attributes['class'].to_s\n id = node.attributes['id'].to_s\n if klass == 'chapter' || id == 'frontmatter'\n current_chapter = manifest.chapters[chapter_number]\n node['data-chapter'] = current_chapter.slug\n chapter_number += 1\n end\n\n reference_cache[node['data-tralics-id']] = current_chapter\n node.xpath('.//*[@data-tralics-id]').each do |labeled_node|\n reference_cache[labeled_node['data-tralics-id']] = current_chapter\n end\n\n current_chapter.nodes.push node\n end\n end\n reference_cache\n end", "title": "" }, { "docid": "3bf4c3816b57588aaf28cea0d651700c", "score": "0.5379621", "text": "def map_collection(hash, cnx_book_hash, chapter_number = 0)\n contents = hash['contents']\n\n if contents.any?{ |entry| entry['id'] == 'subcol' } # Book/Unit (internal node)\n contents.each do |entry|\n next if entry['id'] != 'subcol' # Skip anything not in a chapter (preface/appendix)\n\n chapter_number = map_collection(entry, cnx_book_hash, chapter_number)\n end\n else # Chapter (leaf)\n chapter_number += 1\n if contents.empty?\n puts \"WARNING: Chapter #{chapter_number} is empty!\"\n return chapter_number\n end\n\n section_number = contents.first['title'].start_with?('Introduction') ? 0 : 1\n\n contents.each do |entry|\n cnx_book_hash[chapter_number][section_number] = entry\n section_number += 1\n end\n end\n\n return chapter_number\nend", "title": "" }, { "docid": "3c0763840a8765e8913b4d7764582243", "score": "0.53713965", "text": "def current_book\n book = self.books.where('level > 0 and visible = true and active = true').order(\"level DESC\").first \n return book\n end", "title": "" }, { "docid": "cc6305a07fdd528d37a8230f2e4d6878", "score": "0.5343803", "text": "def test_spec\n root = branch(Tags::Or)\n assert Tags::Or===root\n assert_equal [], root.children\n assert_equal([], root.child_keys)\n \n x = leaf(Tags::Prop, \"x\")\n assert Tags::Prop===x\n assert_equal [], x.children\n assert_equal([], x.child_keys)\n \n root << [:left, x]\n assert_equal [x], root.children\n assert_equal [:left], root.child_keys\n assert_equal :left, x.key_in_parent\n assert_equal x, root.select(:left)\n assert_equal root, x.parent\n \n y = leaf(Tags::Prop, \"y\")\n assert Tags::Prop===y\n assert_equal [], y.children\n assert_equal([], y.child_keys)\n\n root << [:right, y]\n assert_equal [x,y], root.children\n assert_equal [:left,:right], root.child_keys\n assert_equal :left, x.key_in_parent\n assert_equal :right, y.key_in_parent\n assert_equal x, root.select(:left)\n assert_equal y, root.select(:right)\n assert_equal [x,y], root.select(:left, :right)\n assert_equal [x,y], root.select(Tags::Prop)\n end", "title": "" }, { "docid": "aa15a4240c53e20adbab37966aa60200", "score": "0.5343149", "text": "def other_books_by_author\n # This method returns an array of hashes. Each hash contains two kv pairs: the book id and the name of each title by the same author. We then uniq it to avoid cluttering up the AI with duplicated cover images.\n @bookcontact = self.contacts.first.books if self.contacts.first\n @array = []\n # First get the contributor id via the HABTM bookcontact relationship.\n @bookcontact.try(:each) do |bookcontact|\n # Get the books by the contributor\n Book.where(\"publishing_status = ? AND books.id = ?\", \"04\", bookcontact.id).joins(:work => :contract).where('contracts.signed_date is not null').each do |book|\n # Omit the current title and fill the array with hashes of id => x, titlename =>y\n @array << {:id => book.id, :name => book.title} unless book.id == self.id\n end\n end\n get_unique_titlenames(@array)\n #Then in the view, we can iterate through this array of ids.\n return @author_books\n end", "title": "" }, { "docid": "128b8058ea35e2eb517dbaacc967d871", "score": "0.5330914", "text": "def get_chapter\n @book_series = BookSeries.find(params[:book_series_id])\n @book_series_1 = BookSeries.first\n @collection = @book_series.collections.find(params[:collection_id])\n @book = @collection.books.find(params[:book_id])\n @chapter = @book.chapters.find(params[:chapter_id])\n end", "title": "" }, { "docid": "27feb34705fa307c30a7b5bd995d324a", "score": "0.53308856", "text": "def add_book(book) #look at Book_scraper line 27\n @books << book unless @books.include?(book)\n book.genre = self if book.genre != self # checking that book is not duplicated\n end", "title": "" }, { "docid": "1b84c0e2a7dc387683013ca51db69eca", "score": "0.5316798", "text": "def books\n Book.all.select do |book_instance|\n book_instance.author == self\n end\n end", "title": "" }, { "docid": "3ea0fd313ad733be23f996e60edfaf67", "score": "0.5299201", "text": "def get_hierarchical_from\n self.course\n end", "title": "" }, { "docid": "5e71c05e4e3e892b76a037ae7fbc8a47", "score": "0.52969104", "text": "def books_involved_with\n Book.for_user(self)\n end", "title": "" }, { "docid": "7dc11784236fc7127266ace995049f3a", "score": "0.52949256", "text": "def test_associations_3\n simulate('Book')\n simulate('Page')\n Book.class_eval { has_many :pages }\n\n assert_equal(Hierarchy.associations(Book), [:pages])\n end", "title": "" }, { "docid": "f38c68dba0131beb5a8025cea419130a", "score": "0.5292795", "text": "def test_associations_2\n simulate('Book')\n simulate('Page')\n Book.class_eval { has_one :page }\n\n assert_equal(Hierarchy.associations(Book), [:page])\n end", "title": "" }, { "docid": "af418330ffe86f4d76a6602e206d8ba5", "score": "0.52871317", "text": "def test_has_many_array_accessors\n \n # Reader#books (similar to Book.find :all, :conditions => \"reader_id = #{id}\")\n # Reader#books.size (similar to Book.count \"reader_id = #{id}\")\n # Reader#books.empty? (similar to @reader.books.size == 0)\n # Reader#books<<\n # Reader#books.include?\n # Reader#books.find (similar to Book.find(id, :conditions => \"reader_id = #{id}\"))\n assert @nolan.books.empty?\n assert_add_to_collection @nolan, :books, @catch22\n assert_equal @catch22.id, @nolan.books.find(@catch22.id).id\n \n # Magazine#readers.size (similar to Reader.count \"book_id = #{id}\")\n # Magazine#readers (similar to Readers.find :all, :conditions => \"book_id = #{id}\")\n # Magazine#readers.empty? (similar to @book.readers.size == 0)\n # Magazine#readers<<\n # Magazine#readers.include?\n # Magazine#readers.find (similar to Reader.find(id, :conditions => \"magazine_id = #{id}\"))\n \n assert @make.readers.empty?\n assert_add_to_collection @make, :readers, @nolan\n assert_equal @nolan.id, @make.readers.find(@nolan.id).id\n end", "title": "" }, { "docid": "301b05bb94fae1e856a7b74008340986", "score": "0.5284009", "text": "def ancestors?; end", "title": "" }, { "docid": "40c67e14d1bda4dd44833310247a535f", "score": "0.5281663", "text": "def book\n @library_location = 3\n super\n end", "title": "" }, { "docid": "869b858ebd7d13cce6e9aea405b08e28", "score": "0.52809495", "text": "def visit_book node\n process_doc node\n end", "title": "" }, { "docid": "92256b3e26786ebd333c3c8a3780d295", "score": "0.52778816", "text": "def parents; end", "title": "" }, { "docid": "92256b3e26786ebd333c3c8a3780d295", "score": "0.52778816", "text": "def parents; end", "title": "" }, { "docid": "92256b3e26786ebd333c3c8a3780d295", "score": "0.52778816", "text": "def parents; end", "title": "" }, { "docid": "19459bb3bd5b32ff43c6f6bc65fbb01f", "score": "0.5275254", "text": "def book\n\n end", "title": "" }, { "docid": "74138784e4a5ec15e7eff9334ef15e37", "score": "0.5273298", "text": "def genre\r\n @genre = Genre.find(params[:genre_id])\r\n @genres = Genre.all\r\n @books = @genre.books #<-- THIS IS IMPORTANT\r\n end", "title": "" }, { "docid": "2445383f2a5e51f941197a5fb2ad5179", "score": "0.5266331", "text": "def test_build\n # Reader#books.build (similar to Book.new(\"reader_id\" => id))\n assert @nolan.books.build({:title => 'foo'}).valid?\n # Book#readers.build (similar to Reader.new(\"book_id\" => id))\n assert @make.readers.build({:name => 'foo'}).valid?\n end", "title": "" }, { "docid": "8eba0a8afb63ab423afbe321a8919b44", "score": "0.52651054", "text": "def nesting_level; end", "title": "" }, { "docid": "8eba0a8afb63ab423afbe321a8919b44", "score": "0.52651054", "text": "def nesting_level; end", "title": "" }, { "docid": "336d4a2dce7e42b02c626391e0fb793c", "score": "0.52599114", "text": "def book\n @library_location = 6\n super\n end", "title": "" }, { "docid": "10d81dcf4e5ee2dfaa7c6865ca1746ad", "score": "0.5253131", "text": "def book\n @library_location = 7\n super\n end", "title": "" }, { "docid": "50fc7e355192b9f42d19528bfa175e35", "score": "0.5246297", "text": "def books\n Book.all.select do |book|\n book.author == self\n end\n end", "title": "" }, { "docid": "4030d4cdf4edd76546ae54b687160324", "score": "0.5243652", "text": "def ancestry_exclude_self; end", "title": "" }, { "docid": "470323252505fb7aa98a32deb3cc5cf8", "score": "0.5243384", "text": "def breadcrumb\n add_breadcrumb \"Users\", persons_path if @pa.book\n add_breadcrumb \"Master book\", master_pas_path if @pa.is_master?\n\n add_breadcrumb @pa.book.person.first_name, person_path(@pa.book.person) if @pa.book\n add_breadcrumb @pa.book.number, person_book_path(@pa.book.person, @pa.book) if @pa.book\n if @pa.is_master?\n add_breadcrumb @pa.book.number, master_book_path(@pa.book) \n else\n add_breadcrumb @pa.book.number, book_pa_path(@pa.book, @pa)\n end\n add_breadcrumb @pa.name, book_pa_path(@pa.book, @pa) if @pa\n end", "title": "" }, { "docid": "09951beb5074bf0d1db011a9949469b8", "score": "0.5238898", "text": "def books\n @books = Medium.where(category: \"Book\")\n end", "title": "" }, { "docid": "591270af26bcf9fb271a8fbc29bd1997", "score": "0.52383584", "text": "def books\n result = []\n BookAuthor.all.each do | join_object |\n if join_object.author == self \n result.push(join_object.book)\n end\n end\n return result\n end", "title": "" }, { "docid": "c9691d44b71ed57654155e0cbacfff07", "score": "0.52334464", "text": "def book\r\n @book = Book.find(params[:id])\r\n @genre = @book.genre_id\r\n @genres = Genre.all\r\n end", "title": "" }, { "docid": "196b92d5d3b700385c73d6b24d531ac4", "score": "0.5204271", "text": "def set_nested\n end", "title": "" }, { "docid": "d7187411364d20759f027eef8aac61dd", "score": "0.5203017", "text": "def test_one_to_many_to_many\n expected_contributors = [\"David Thomas\",\"Andrew Hunt\",\"Chad Fowler\", \"David Heinemeier Hansson\"]\n expected_books = [\"Programming Ruby - 2nd Edition\", \"Agile Web Development with Rails\"]\n library = Library.from_xml(fixture(:library))\n assert_equal(\"Ruby library\", library.name)\n assert !library.books.empty?\n library.books.each do |book|\n assert expected_books.include?(book.title)\n book.contributions.each do |contributor|\n assert(expected_contributors.include?(contributor.name))\n end\n end\n end", "title": "" }, { "docid": "625bae7c0ae35579b10b3a4b4b7d35a5", "score": "0.5197192", "text": "def nested?; end", "title": "" }, { "docid": "f2ef4f22957fc08a477e68b50999d459", "score": "0.5187154", "text": "def set_book\n @book = Book.includes([:users => [:books => [:users]]]).find(params[:id])\n end", "title": "" }, { "docid": "bf4c9589f160e07340f2d945e32d23ee", "score": "0.51786387", "text": "def create\n @book = Book.new(book_params)\n # @author_books = @book.author_books.\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "345f3f75298cdd4148b2c3c5f990a24e", "score": "0.51762575", "text": "def test_one_to_many_to_many\n expected_contributors = [\"David Thomas\",\"Andrew Hunt\",\"Chad Fowler\", \"David Heinemeier Hansson\"]\n expected_books = [\"Programming Ruby - 2nd Edition\", \"Agile Web Development with Rails\"]\n library = Library.parse(fixture(:library))\n assert_equal(\"Ruby library\", library.name)\n library.books.each do |book|\n assert expected_books.include?(book.title)\n book.contributions.each do |contributor|\n assert(expected_contributors.include?(contributor.name))\n end\n end\n end", "title": "" }, { "docid": "c85604f2775d315a5a7a8045dd1ec901", "score": "0.5164068", "text": "def process_rels; end", "title": "" }, { "docid": "4a8f609feb5bc2d38aab6387c91a2a3e", "score": "0.516246", "text": "def book_info\n \t BookInfo.new(items: @items)\n end", "title": "" }, { "docid": "685b7079c28145b709654455ccc8482d", "score": "0.51587605", "text": "def other_books\n author.books.where.not(id: self)\n end", "title": "" }, { "docid": "05313ca96f7ea363a4cd18e889e98d73", "score": "0.51586777", "text": "def parent_list; end", "title": "" }, { "docid": "f5c7f002e52673908f8851c736c0a9c2", "score": "0.5145256", "text": "def for_parents\n @news = News.active.for_parents\n @junior_clubs = Club.active.junior\n end", "title": "" }, { "docid": "d14fa4eae427f784183a3029b422d59c", "score": "0.5142629", "text": "def bible_books_helper\n res = {}\n req = Net::HTTP.get_response(URI.parse('https://getbible.net/index.php?option=com_getbible&task=bible.books&format=json&v=kjv'))\n JSON.parse(req.body[1...-2]).map{|book|\n req2 = Net::HTTP.get_response(URI.parse(\"https://getbible.net/index.php?option=com_getbible&task=bible.chapter&format=json&v=asv&nr=#{book['book_nr']}\"))\n book['chapters'] = JSON.parse(req2.body[1...-2]).count\n res[book['ref']] = book\n }\n res\n end", "title": "" }, { "docid": "1ec6bc58978a9abd4d91d1d912631562", "score": "0.5135972", "text": "def tree; end", "title": "" }, { "docid": "1ec6bc58978a9abd4d91d1d912631562", "score": "0.5135972", "text": "def tree; end", "title": "" }, { "docid": "7f4b346f96aceefc3ffa13f2a6617660", "score": "0.51317483", "text": "def test_one_to_many_with_container\n expected_authors = [\"David Thomas\",\"Andrew Hunt\",\"Chad Fowler\"]\n book = BookWithContributions.from_xml(fixture(:book_with_contributions))\n assert_equal(\"Programming Ruby - 2nd Edition\", book.title)\n book.contributions.each do |contributor|\n assert expected_authors.include?(contributor.name)\n end\n end", "title": "" }, { "docid": "1e468e85e3a8988c1db9cdf138b7ae9e", "score": "0.51302356", "text": "def has_ancestry(options = {})\n @ancestry_by_property = nil\n def self.ancestry_by_property\n @ancestry_by_property\n end\n options = {order_by: :position}.merge(options)\n order_by = case options[:order_by]\n when Symbol then \"doc['#{options[:order_by]}']\"\n when Array then \"[#{options[:order_by].map{|o| \"doc['#{o}']\"}.join(', ')}]\"\n else \"doc['position']\"\n end\n property :path_ids, type: Array, default: []\n property :position, type: Integer, default: 0\n if options[:by_property].present?\n property options[:by_property] unless property_names.include?(options[:by_property])\n @ancestry_by_property = options[:by_property]\n by_property_view_prefix = options[:by_property].present? ? \"doc['#{options[:by_property]}'], \" : ''\n end\n\n view :subtree_view, type: :custom, include_docs: true, map_function: %|function(doc){\n if(doc['ruby_class'] == '#{name}' && doc.path_ids){\n for(var i = 0; i < doc.path_ids.length - 1; i++){\n emit([#{by_property_view_prefix}doc.path_ids[i], #{order_by}], 1);\n }\n }\n }|, reduce_function: \"_sum\"\n\n view :children_view, type: :custom, include_docs: true, map_function: %|function(doc){\n if(doc['ruby_class'] == '#{name}' && doc.path_ids){\n emit([#{by_property_view_prefix}doc.path_ids.slice(-2,-1)[0], #{order_by}], 1);\n }\n }|, reduce_function: \"_sum\"\n view :roots_view, conditions: \"doc.path_ids && doc.path_ids.length == 1\", key: [options[:by_property].presence, options[:order_by]].compact\n include SimplyStored::Couch::Ancestry::InstanceMethods\n extend SimplyStored::Couch::Ancestry::ClassMethods\n before_update :update_tree_path\n after_create :create_tree_path\n end", "title": "" }, { "docid": "4272ecac35946d20d2d95606bb82c4a8", "score": "0.51293474", "text": "def import_collection(parent_book, hash, options = {})\n book = ::Book.create(parent_book: parent_book,\n title: hash['title'] || '')\n\n parent_book.child_books << book unless parent_book.nil?\n\n hash['contents'].each do |item|\n if item['id'] == 'subcol'\n import_collection(book, item, options)\n else\n run(:page_import, item['id'], book, \n options.merge(title: item['title']))\n end\n end\n\n book\n end", "title": "" }, { "docid": "35e109036ab59fb77e14f8c1dbdc7d27", "score": "0.51260954", "text": "def children\n # return students\n return offerings\n end", "title": "" }, { "docid": "7c78c28fa863d99f2384c405bda78ad0", "score": "0.5123313", "text": "def books\n Book.all.select do |book|\n # Does the book's author match me?\n book.author == self\n end\n end", "title": "" }, { "docid": "61b6ce5e0ee7f5e7203396173d17e433", "score": "0.5120257", "text": "def test_one_to_many_with_container\n expected_authors = [\"David Thomas\",\"Andrew Hunt\",\"Chad Fowler\"]\n book = BookWithContributions.parse(fixture(:book_with_contributions))\n assert_equal(\"Programming Ruby - 2nd Edition\", book.title)\n book.contributions.each do |contributor|\n assert expected_authors.include?(contributor.name)\n end\n end", "title": "" }, { "docid": "a41de5a0009706d951a15757c2c240a9", "score": "0.5090755", "text": "def book\n #@book = Book.find(params[:book_id])\n #@version = Version.find(params[:version_id])\n #@paragraphs = @book.paragraphs.where(:version_id => @version.id).all\n respond_to do |format|\n format.html {redirect_to admin_version_book_paragraphs_url(params[:version_id],params[:book_id])}\n end\n end", "title": "" }, { "docid": "b98d075513ec2580351c4ffb3b599a06", "score": "0.50902206", "text": "def new\n @book = Book.new\n @book.page_count = 0\n @title = 'ახალი წიგნი'\n \n if params[:copy_id]\n copy = Book.find(params[:copy_id])\n @book.name = copy.name\n @book.order_by = copy.order_by\n @book.nomenclature = copy.nomenclature\n @book.start_date = copy.start_date\n @book.end_date = copy.end_date\n @book.page_count = copy.page_count\n @book.book_presenter = copy.book_presenter\n end\n \n session[:parent_id] = request[:parent_id]\n if session[:parent_id]\n @parent = Place.find(session[:parent_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "title": "" }, { "docid": "d91c8664255629b4858f79443fa78ae9", "score": "0.50857234", "text": "def add_category_to_authors_books(category_title, author_name)\n author = Author.find_by(name: author_name)\n category = Category.find_or_create_by(title: category_title)\n author.books.each do |book|\n book.categories << category unless book.categories.include?(category)\n end\nend", "title": "" }, { "docid": "ddf001d0071f633bee9a71e5e0466a2c", "score": "0.50776434", "text": "def initialize\n @book = nil # not loaded until needed\n end", "title": "" }, { "docid": "b5f52384ae5862c6c985f7e057e3a20a", "score": "0.50768095", "text": "def has_parent?; end", "title": "" }, { "docid": "5fb39c46bede9a80118ea81e5770a502", "score": "0.50717354", "text": "def genres\n # 1. Find all the books this author has written\n # implicit self - calls the method \"books\", when there isn't a variable by that name\n # books\n # explicit self - I'm explicitly calling a method\n self.books.map do |book|\n book.genre\n end\n\n\n # 2. Through all books, ask their genre\n end", "title": "" }, { "docid": "cf4df8c7ae18e2fd74393caf1d554efa", "score": "0.5062383", "text": "def superbalanced_tree\n\nend", "title": "" }, { "docid": "e2e8a861ea3fcca1a46fc189bf110429", "score": "0.5060346", "text": "def get_book_name()\n return @books\nend", "title": "" }, { "docid": "bbbe6960798a4e09ce81e631b9445c69", "score": "0.50589", "text": "def get_books()\n return @book_collection\n end", "title": "" } ]
bde7ae66ff4b47a628ebe05e9fad81aa
Split options into request options and params
[ { "docid": "3398784cc6244534b46231b1609d487f", "score": "0.7447643", "text": "def split_options(options = {})\n defaults = {\n method: :get,\n content_type: :json,\n accept: :json,\n append_json: true\n }\n options = defaults.merge(options)\n request_options = [:body, :method, :append_json]\n [options.only(*request_options), options.except(*request_options)]\n end", "title": "" } ]
[ { "docid": "db1289b02e0bc0b9bf66954096d22c09", "score": "0.7073885", "text": "def options\n params.slice(*OPTIONS_KEYS).symbolize_keys\n end", "title": "" }, { "docid": "febfd616dc5d4f810c89ca4aedf09e6c", "score": "0.68689644", "text": "def parse_options options = {}, request = ''\n options.each do |opt, value|\n case opt\n when :timeout, :paging, :mode\n request += \"&#{opt}=#{value}\"\n when :callback, :stats\n request += \"&#{opt}\"\n when :fields\n request += \"&#{opt}=\" + value.join(',') if value.is_a?(Array)\n end\n end\n request\n end", "title": "" }, { "docid": "32fcf9f68215f322efe626d4d18b3ca3", "score": "0.67914283", "text": "def split_options(options = {})\n prefix_options, query_options = {}, {}\n\n (options || {}).each do |key, value|\n next if key.blank?\n (prefix_parameters.include?(key.to_s.to_sym) ? prefix_options : query_options)[key.to_s.to_sym] = value\n end\n\n [ prefix_options, query_options ]\n end", "title": "" }, { "docid": "7a15d0122abcdfb466f5ed27d45fd079", "score": "0.67884856", "text": "def split_options(options = {})\n prefix_options, query_options = {}, {}\n (options || {}).each do |key, value|\n next if key.blank?\n (prefix_parameters.include?(key.to_sym) ? prefix_options : query_options)[key.to_sym] = value\n end\n\n [ prefix_options, query_options ]\n end", "title": "" }, { "docid": "d75863e7a6d3c7d524ba428d51272a50", "score": "0.67706484", "text": "def split_options(options = {})\n prefix_options, query_options = {}, {}\n\n (options || {}).each do |key, value|\n next if key.blank? || !key.respond_to?(:to_sym)\n query_options[key.to_sym] = value\n end\n\n [ prefix_options, query_options ]\n end", "title": "" }, { "docid": "4fd85fea6d6ff3a661b6f0c01b1e9388", "score": "0.67181695", "text": "def prepare_request_params(options)\n params = detect_request_input options.delete(:input)\n\n options.inject(params) do |params, kv|\n key, value = kv\n params.merge!(\"#{key.to_s.downcase.gsub(/_+/, '')}\" => value)\n end\n end", "title": "" }, { "docid": "0c66aec56c2fe7108291a2791b21aaa4", "score": "0.6543237", "text": "def split_options(options = {})\n prefix_options, query_options = {}, {}\n\n (options || {}).each do |key, value|\n next if key.blank?\n (key =~ /\\w*_id$/ ? prefix_options : query_options)[key.to_sym] = value\n end\n\n [prefix_options, query_options]\n end", "title": "" }, { "docid": "dbe918181a07c7a5c654d6b379df323f", "score": "0.65195763", "text": "def parse_options(options, params={})\n params = params ? params.dup : {}\n # parse_list_options!(args, options, params)\n # merge in options set with -Q max=3, --query max=3&sort=id\n params.deep_merge!(options[:query_filters]) if options[:query_filters]\n # query parameters are stored in :params\n # preserve anything already set in :params by the OptionParser or command specific logic..\n options[:params] ||= {}\n options[:params].deep_merge!(params)\n # (JSON) body parameters (JSON) are stored in :payload\n # if options[:payload]\n # end\n # ok now call execute_request(@api_client.whoami, :get, nil, options)\n return options\n end", "title": "" }, { "docid": "fa0f8910171be9506b9567e170eb3510", "score": "0.6481377", "text": "def params\n OPTIONS.inject({}) do |params, param|\n option = send(param)\n params.merge!(param => option) if param != :resource && !option.nil?\n params\n end\n end", "title": "" }, { "docid": "ec0a3762a985991c1e2f2d2dccb56a78", "score": "0.6471756", "text": "def token_params\n super.tap do |params|\n options[:token_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n end\n end", "title": "" }, { "docid": "6804ee3aba796d55d36ab390ae4233e8", "score": "0.64678216", "text": "def prepare_params(options)\n droute = GrapeRouteHelpers::DecoratedRoute.new(route)\n rq = droute.required_helper_segments\n helper_params = params.select { |k,v| rq.include? k }\n query_params = params.reject do |k,v|\n rq.include?(k) || !route.params.key?(k) || v == route.params[k][:default]\n end\n helper_params.merge({ params: query_params }.deep_merge(options))\n end", "title": "" }, { "docid": "6c8732e57eaddf27abec10f092ebc029", "score": "0.63866395", "text": "def construct_params_from_options(options={})\n url = \"\"\n options.keys.each_with_index do |key, index|\n index == 0 ? url = \"?\" : url += '&'\n url+=\"#{key}=#{options[key]}\"\n end\n url\n end", "title": "" }, { "docid": "ea8d81c02df0fc5ec6804d723b24cd09", "score": "0.6380755", "text": "def parse_params(options)\n params = {}\n params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n params[:includeArchived] = options[:include_archived] if options[:include_archived]\n params[:order] = options[:order] if options[:order]\n params[:createdByMyApp] = options[:createdByMyApp] if options[:createdByMyApp]\n\n params[:IDs] = filterize(options[:IDs]) if options[:IDs]\n params[:InvoiceNumbers] = filterize(options[:InvoiceNumbers]) if options[:InvoiceNumbers]\n params[:ContactIDs] = filterize(options[:ContactIDs]) if options[:ContactIDs]\n params[:Statuses] = filterize(options[:Statuses]) if options[:Statuses]\n\n if options[:where]\n params[:where] = case options[:where]\n when String then options[:where]\n when Hash then parse_where_hash(options[:where])\n end\n end\n params[:offset] = options[:offset] if options[:offset]\n params[:Status] = options[:status] if options[:status]\n params[:DateFrom] = options[:date_from] if options[:date_from]\n params[:DateTo] = options[:date_to] if options[:date_to]\n params[:page] = options[:page] if options[:page]\n params\n end", "title": "" }, { "docid": "47f9ab1e975318c1622e0d6d5979c2f1", "score": "0.6367972", "text": "def extract_params!(request); end", "title": "" }, { "docid": "6369053519f1f08288d84a30f9fd1e17", "score": "0.636706", "text": "def parse_options(options)\n headers = nil\n query_params = []\n url_prefix = nil\n consistency = []\n\n # Parse options used as header\n headers = { 'X-Consul-Token' => configuration.acl_token } if configuration.acl_token\n headers = { 'X-Consul-Token' => options[:token] } if options[:token]\n\n # Parse consistency options used as query params\n consistency = 'stale' if options[:stale]\n consistency = 'leader' if options[:leader]\n consistency = 'consistent' if options[:consistent]\n query_params << consistency\n\n query_params << 'cached' if options[:cached]\n\n # Parse url host\n url_prefix = options[:http_addr] if options[:http_addr]\n { query_params: query_params, headers: headers, url_prefix: url_prefix }\n end", "title": "" }, { "docid": "4ed3748c1d593c974ca81061adad5ab7", "score": "0.62908304", "text": "def params_options(method, params)\n return {} if params.empty?\n\n { query: params } if %i[get delete].includes? method\n end", "title": "" }, { "docid": "cf21e85dae40a454a218b82ef0c32208", "score": "0.6285196", "text": "def parse_static_options\n option_parser.parse!(@params)\n @params.pop\n end", "title": "" }, { "docid": "f03a8fe1934648e0c09902252571cdf9", "score": "0.628287", "text": "def split_options\n options[:split]\n end", "title": "" }, { "docid": "33971b1395c05c10842e6cad9fe94ec8", "score": "0.62419796", "text": "def prepare_options(options)\n opts = {}\n opts[:query] = options.fetch(:query, {})\n opts[:headers] = options.fetch(:headers, {})\n opts\n end", "title": "" }, { "docid": "817243ae3928340d8e6f181e955ed494", "score": "0.62016195", "text": "def params_options(method, params)\n return {} if params.empty?\n\n if %i[get delete].include?(method)\n { query: params }\n else\n {\n body: params.to_json,\n headers: { 'Content-Type' => 'application/json' }\n }\n end\n end", "title": "" }, { "docid": "64387b49ac4941dcaaa52168e56a52e5", "score": "0.61941004", "text": "def _process_options(options); end", "title": "" }, { "docid": "64387b49ac4941dcaaa52168e56a52e5", "score": "0.61941004", "text": "def _process_options(options); end", "title": "" }, { "docid": "64387b49ac4941dcaaa52168e56a52e5", "score": "0.61941004", "text": "def _process_options(options); end", "title": "" }, { "docid": "d9859d3b9099117b545f5cf0946aaa3e", "score": "0.619302", "text": "def prepare_options(options)\n # combine the incoming params with the app default options\n params_hash = params_to_hash(options)\n opts = @app_options.clone.merge(params_hash) { |key, app, req|\n if key == \"f\"\n # Remove app filter if request contains the same filter.\n # Otherwise multiples of a filter are AND-ed in the API query\n # and will likely return no results. To preserve any app filters,\n # they must be sent along with the request filters.\n\n req_f_fields = req.map { |r| r.split(\"|\").first }\n app_filtered = app.reject do |a|\n req_f_fields.include?(a.split(\"|\").first)\n end\n app_filtered + req\n else\n # Default is to override app option with request option\n req\n end\n }\n # remove rails internal parameters and reassign \"rows\" to \"num\"\n Orchid::RAILS_INTERNAL_PARAMS.each { |p| opts.delete(p) }\n opts = remove_rows(opts)\n # remove page and replace with start\n opts = calc_start(opts)\n # remove .year from the middle of date filters for api's sake which\n # automatically adds Jan 1 and Dec 31 to incoming date strings of years\n opts[\"f\"].map { |f| f.slice!(\".year\") } if opts.has_key?(\"f\")\n opts\n end", "title": "" }, { "docid": "079f9751daf21e5ba8862eb717f17cd4", "score": "0.61818284", "text": "def parse_get_options!(args, options, params)\n params.merge!(parse_query_options(options))\n end", "title": "" }, { "docid": "3aa0b7225c1e022a05b23307522b2745", "score": "0.61746526", "text": "def prepare_request params\n Hash[ params.map{ |p| [p, config.send(p)] } ]\n end", "title": "" }, { "docid": "3dfbe113095da5f6869d7a4e336452cb", "score": "0.6167105", "text": "def params_separation\n\n options= self.map { |element|\n if element.class == ::Hash\n element\n end\n }.uniq - [ nil ]\n #options.each{|e| self.delete(e) }\n arguments= self.dup - options\n options= ::Hash[*options]\n\n return [options,arguments]\n\n end", "title": "" }, { "docid": "8da08983ec2879ba3af1e00676050ba3", "score": "0.6160201", "text": "def options_hash\n @options ||= {\n :request => request,\n :format => check_format(params[:format]),\n :include => param_list_to_symbols(:include),\n :exclude => param_list_to_symbols(:exclude),\n :delete => param_list_to_symbols(:delete),\n :pretty => params[:pretty],\n }\n end", "title": "" }, { "docid": "35660ea5ac6e8f50567e85b104aa0726", "score": "0.61501765", "text": "def parsed_options\n params.reject { |k| !settings.allowed_actions.include?(k.to_sym) }\n end", "title": "" }, { "docid": "88d59bfc3d9ae15549f75a9c9635b34b", "score": "0.6149291", "text": "def split_options(options = T.unsafe(nil)); end", "title": "" }, { "docid": "92ec99233308a53b83ab77a57704829b", "score": "0.61380106", "text": "def request_params(options={})\n pagination = options.fetch(:pagination, nil)\n filters = options.fetch(:filters, nil)\n params = options.fetch(:params, {})\n\n if pagination\n params[:page] = pagination.fetch(:page, 1)\n params[:per_page] = pagination.fetch(:per_page, 25)\n end\n\n if filters\n if filters.is_a?(Hash)\n filter_index = 0\n filters.each do |key, value|\n params[\"filter[#{filter_index}][field]\"] = key\n params[\"filter[#{filter_index}][eq]\"] = value\n filter_index += 1\n end\n end\n end\n\n params\n end", "title": "" }, { "docid": "bfb7c68d1733161d988cd96bb75e4191", "score": "0.61364627", "text": "def request_params(keywords, options)\n {\n Operation: self.name.split('::').last,\n Keywords: keywords,\n ResponseGroup: 'Small',\n Availability: 'Available',\n SearchIndex: 'All',\n ItemPage: '1'\n }.merge(options)\n end", "title": "" }, { "docid": "e6bae7f787062351973fe010b925e835", "score": "0.61310184", "text": "def get_search_args_from_params(params)\n options = {}\n %w(metrics sort fields zip distance page per_page debug).each do |opt|\n options[opt.to_sym] = params.delete(\"_#{opt}\")\n # TODO: remove next line to end support for un-prefixed option parameters\n options[opt.to_sym] ||= params.delete(opt)\n end\n options[:endpoint] = params.delete(\"endpoint\") # these two params are\n options[:format] = params.delete(\"format\") # supplied by Padrino\n options[:fields] = (options[:fields] || \"\").split(',')\n options[:command] = params.delete(\"command\")\n\n options[:metrics] = options[:metrics].split(/\\s*,\\s*/) if options[:metrics]\n options\nend", "title": "" }, { "docid": "27ae5640e75b09bfd765ba6a99bf1341", "score": "0.6130108", "text": "def full_options(params)\n {\n v: API_VERSION,\n method: params[:method],\n app_key: config['app_key'],\n access_token: config['access_token'],\n '360buy_param_json' => params[:fields].symbolize_keys.sort.to_h.to_json,\n timestamp: Time.now.strftime('%F %T')\n }\n end", "title": "" }, { "docid": "1ca7652f49d06b60e7e6238b41a5daab", "score": "0.61295825", "text": "def url_options_from_params\n {:page => if !params[:page].blank? then params[:page] else nil end,\n :sort => if !params[:sort].blank? then params[:sort] else nil end,\n :direction => if !params[:direction].blank? then params[:direction] else nil end}\n end", "title": "" }, { "docid": "1ca7652f49d06b60e7e6238b41a5daab", "score": "0.61295825", "text": "def url_options_from_params\n {:page => if !params[:page].blank? then params[:page] else nil end,\n :sort => if !params[:sort].blank? then params[:sort] else nil end,\n :direction => if !params[:direction].blank? then params[:direction] else nil end}\n end", "title": "" }, { "docid": "a76d2843bac7fc21705ee1476abf8065", "score": "0.6120917", "text": "def collect_options(params, api_names = @request_info[:inputs].keys)\n options = {}\n api_names.each do |api_name|\n cli_name = map_parameter_key(api_name)\n first_value = first_value_for(params, cli_name, api_name)\n value = transform_value(api_name, first_value, params)\n options[api_name] = value if value\n end\n options\n end", "title": "" }, { "docid": "ee054c8395a3cdf5e43cd7d350b110db", "score": "0.60943", "text": "def options\n return @options if @options\n\n @options = {}\n @options[:include] = include_params if include_params\n @options[:fields] = field_params if field_params\n @options\n end", "title": "" }, { "docid": "49ed6207414bf2c27f23cb36d654d34f", "score": "0.606345", "text": "def params_for(options)\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n \"?#{params.join(\"&\")}\"\n end", "title": "" }, { "docid": "49ed6207414bf2c27f23cb36d654d34f", "score": "0.606345", "text": "def params_for(options)\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n \"?#{params.join(\"&\")}\"\n end", "title": "" }, { "docid": "28516ab6ebb23367257c7cbf970f8477", "score": "0.60427237", "text": "def split options\n @filters = if options.last.kind_of?(Hash)\n [*(options.pop[:filter_through])].reverse\n else\n []\n end\n @attributes = options\n end", "title": "" }, { "docid": "28516ab6ebb23367257c7cbf970f8477", "score": "0.60427237", "text": "def split options\n @filters = if options.last.kind_of?(Hash)\n [*(options.pop[:filter_through])].reverse\n else\n []\n end\n @attributes = options\n end", "title": "" }, { "docid": "0f22aa020c9c5cb5c84d71f2d5bd4a39", "score": "0.60368747", "text": "def parse_params_for params\n options.merge! URLParser.parse_params_for(params, self.name)\n end", "title": "" }, { "docid": "42c6c3d67331e6b8181e2fa1e9db5fe2", "score": "0.6016066", "text": "def prepare_options(options)\n end", "title": "" }, { "docid": "467eb150d9c120cf1ff046cb1c75f0c9", "score": "0.60159063", "text": "def process_options\n end", "title": "" }, { "docid": "467eb150d9c120cf1ff046cb1c75f0c9", "score": "0.60159063", "text": "def process_options\n end", "title": "" }, { "docid": "7b252f6d0d39e7e80273942da3de0754", "score": "0.6011456", "text": "def make_options(method, params={})\n options = base_options\n options[:body][:params].merge! params\n options[:body].merge!({ method: method })\n options[:body] = options[:body].to_json\n options\n end", "title": "" }, { "docid": "fdc41be4763873992a7254b9dab39e09", "score": "0.6005694", "text": "def get_request_options(options) # :nodoc:\n options = @options.merge(options)\n\n options[:output] = SOAP_OUTPUT_PARAM\n\n unless options[:uri] or options[:uploaded_file] or options[:fragment]\n raise ArgumentError, \"an uri, uploaded file or fragment is required.\"\n end\n\n # URI should be a string. If it is a URI object, .to_s will\n # be seamless; if it is not an exception will be raised.\n if options[:uri] and not options[:uri].kind_of?(String)\n options[:uri] = options[:uri].to_s\n end\n\n # Convert booleans to integers\n [:fbc, :fbd, :verbose, :debug, :ss, :outline].each do |k|\n if options.has_key?(k) and not options[k].kind_of?(Integer)\n options[k] = options[k] ? 1 : 0\n end\n end\n\n options\n end", "title": "" }, { "docid": "20a8d7235259382a6ec5cbc5c23665a2", "score": "0.6001729", "text": "def to_params\n ret = Array.new\n @options.each {|k,v| ret << \"#{k}=#{v}\" unless HEROKU_IGNORE.include?(k)}\n _ra = @options[:REQUIRE_AUTH].join(',')\n ret << \"REQUIRE_AUTH=#{_ra}\"\n ret.join(\" \")\n end", "title": "" }, { "docid": "b5ce49b5a2c9556839d13856f49711d3", "score": "0.59918183", "text": "def parse_options(options); end", "title": "" }, { "docid": "d21232ed935ec5ea41648d7f198cbf4d", "score": "0.59888995", "text": "def process_path_options(options)\n options = options.symbolize_keys\n options.update(options[:params].symbolize_keys) if options[:params]\n\n if (overwrite = options.delete(:overwrite_params))\n options.update(@parameters.symbolize_keys)\n options.update(overwrite.symbolize_keys)\n end\n\n options\n end", "title": "" }, { "docid": "cc88bf23487237927cec697eaef36200", "score": "0.5962955", "text": "def request_options options\n options[:debug_output] = $stdout # For debug\n options[:headers] = request_headers(options[:headers])\n\n options\n end", "title": "" }, { "docid": "08d765ec189b0135d25f7ed82d1b2255", "score": "0.59536284", "text": "def request_parameters\n Hash[(Tumblr::Client::POST_OPTIONS | [:id, :type]).map {|key|\n [key.to_s, send(key)] if respond_to?(key) && send(key)\n }]\n end", "title": "" }, { "docid": "1f22a33988bd267e58e7703280a9e225", "score": "0.59450114", "text": "def options(options = {})\n request :options, options\n end", "title": "" }, { "docid": "2b3af5928874c7adf108dc676df8c5e6", "score": "0.59402406", "text": "def request_arguments_for *args\n [].tap do |arr|\n # remove the handler arg - the first, if it is a string OR set default\n arr << (args.first.is_a?(String) ? args.shift : nil)\n # remove the params - the first, if it is a Hash OR set default\n arr << (args.first.kind_of?(Hash) ? args.shift : {})\n # everything that isn't params is opts\n arr << (args.first.kind_of?(Hash) ? args.shift : {})\n end\n end", "title": "" }, { "docid": "77cce6cfa4402d54cbb1030f3418ade4", "score": "0.5927633", "text": "def split_options(options)\n # merge in default values to fill in any missing options with default values\n options = default_options.merge(options)\n # then extract the various configuration options used when connecting to the Cassandra\n # cluster (hosts, username, password, port, timeout, keyspace, repl_strategy, and repl_factor)\n hosts = options['hosts']\n username = options['username']\n password = options['password']\n port = options['port']\n timeout = options['timeout']\n keyspace = options['keyspace']\n repl_strategy = options['repl_strategy']\n repl_factor = options['repl_factor']\n [hosts, username, password, port, timeout, keyspace, repl_strategy, repl_factor]\n end", "title": "" }, { "docid": "ce5683495771ad091c7167c560900013", "score": "0.5926478", "text": "def options_from_params(params)\n options = {}\n pcount = params.count\n if pcount > 0 && params[pcount - 1].is_a?(Hash)\n options = params[pcount - 1]\n params.delete_at(pcount - 1)\n end\n\n options\n end", "title": "" }, { "docid": "b4a885d568b67b125e5d50de8ee1e48f", "score": "0.59227645", "text": "def options *args\n make_request :options, *args\n end", "title": "" }, { "docid": "5ec060edb50734f3fe951ccb653b9c7c", "score": "0.59214175", "text": "def splitting_params\n params[:splitting]\n end", "title": "" }, { "docid": "8bec6e5bf88cfd37fc3ea2de30cfc2d5", "score": "0.58956236", "text": "def process_options\n\n end", "title": "" }, { "docid": "8bec6e5bf88cfd37fc3ea2de30cfc2d5", "score": "0.58956236", "text": "def process_options\n\n end", "title": "" }, { "docid": "7e2dfb03f1b2d15e0f3fa983f4965c69", "score": "0.5890686", "text": "def request_method_options\n %w(GET POST PUT DELETE OPTIONS HEAD PATCH)\n end", "title": "" }, { "docid": "9efb9880592b4159ffe21a94c6e8e30d", "score": "0.58882225", "text": "def params(options = {})\n options.each_pair do |key, value|\n @http_request_parameters[key] = value\n end\n self\n end", "title": "" }, { "docid": "41ad6f1a6a71614f051a79f9a538dc2c", "score": "0.5879923", "text": "def split_options(options)\n # merge in default values to fill in any missing options with default values\n options = default_options.merge(options)\n # then extract the various configuration options used when connecting to the Cassandra\n # cluster (host, username, password, port, timeout)\n host = options['host']\n username = options['username']\n password = options['password']\n port = options['port']\n timeout = options['timeout']\n dbname = options['dbname']\n [host, username, password, port, timeout, dbname]\n end", "title": "" }, { "docid": "229a87e7cc6934ef96d1bd2a361fc09c", "score": "0.58701086", "text": "def params_values(opt, *keys)\n prm = url_parameters(opt.presence)\n prm.values_at(*keys).compact_blank.first.to_s.downcase.split(/\\s*,\\s*/)\n end", "title": "" }, { "docid": "e1cadce78c5f79eea79d598b827a6fda", "score": "0.5846818", "text": "def protoc_options\n @protoc_options ||= begin\n parameters = request.parameter.split(\",\").map do |parameter|\n key, value = parameter.split \"=\"\n value = value.first if value.size == 1\n value = nil if value.empty? # String or Array\n [key.to_sym, value]\n end\n Hash[parameters]\n end\n end", "title": "" }, { "docid": "6152825ea32f27d1daafd27c40dd7b3e", "score": "0.5837232", "text": "def prepare_params_for(action, options = {})\n options.stringify_keys!\n params = deep_copy(RubyProvisioningApi.configuration.send(\"#{self.name.demodulize.underscore}_actions\")[action])\n options.each_pair do |k, v|\n params[:url].gsub!(k, v)\n end\n params\n end", "title": "" }, { "docid": "3b42afbf0d7108c1b51dc93dbe50d445", "score": "0.58349717", "text": "def parse_options\n#--{{{\n @op = OptionParser.new\n @options = {}\n OPTSPEC.each do |spec|\n k = spec.first.gsub(%r/(?:--)|(?:=.*$)|(?:\\s+)/o,'')\n @op.def_option(*spec){|v| v = v.to_s; @options[k] = v.empty? ? nil : v}\n #@op.def_option(*spec){|v| @options[k] = v}\n end\n\n if((env_opts = (ENV['RQ_OPTS'] || ENV['RQ_OPTIONS'])))\n require 'shellwords'\n @op.parse! Shellwords.shellwords(env_opts)\n end\n\n @op.parse! @argv \n\n @options\n#--}}}\n end", "title": "" }, { "docid": "ca1666b9308edaa9c0bb05dc53cfa59b", "score": "0.5833161", "text": "def parse_params params\n @resource_name = ''\n @query = ''\n @options = {}\n end", "title": "" }, { "docid": "ca8355f07b39ad7b8c2e1bcdaef329ec", "score": "0.5831945", "text": "def replicate_options_and_data(request)\n replicated_options ||= {}\n %w(\n accept_encoding\n body\n request_method\n content_charset\n media_type\n media_type_params\n params\n referer\n request_method\n user_agent\n url\n ).map(&:to_sym).each do |m|\n value = request.send(m)\n replicated_options[m] = value unless value.nil?\n end\n\n if replicated_options[:params][\"authenticity_token\"]\n replicated_options[:params][\"authenticity_token\"] = csrf_token(request)\n end\n\n replicated_options\n end", "title": "" }, { "docid": "8c039951dc389c6afc40fd16dbbcba28", "score": "0.5823247", "text": "def options\n Hash[*VALID_PARAMS.map { |key| [key, send(key)] }.flatten]\n end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.5814116", "text": "def request_params; end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.5814116", "text": "def request_params; end", "title": "" }, { "docid": "0c721e76bef86f82cebc6c5cbb3cebc8", "score": "0.58140045", "text": "def params; @params ||= destructure(request.params); end", "title": "" }, { "docid": "0c721e76bef86f82cebc6c5cbb3cebc8", "score": "0.58140045", "text": "def params; @params ||= destructure(request.params); end", "title": "" }, { "docid": "02ce5abbff0e37302bdc239837780376", "score": "0.58046526", "text": "def options(*a) route 'OPTIONS', *a end", "title": "" }, { "docid": "4194daa3fad9fb2a568ccd0152e343cc", "score": "0.57850164", "text": "def _parse_options(options)\n\n return [] unless options\n\n options_list = options.split(@delim).map do |option|\n { :name => option.split(\"=\").first, :value => option.split(\"=\").last }\n end\n options_list\n end", "title": "" }, { "docid": "2a64962ee064e5ac693684d7176f5a51", "score": "0.57825595", "text": "def request_options\n {}\n end", "title": "" }, { "docid": "93c2529b8a53549c3eddc582c1d76053", "score": "0.57784384", "text": "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end", "title": "" }, { "docid": "144c52fcee3639b6b7f0f76beca04a0e", "score": "0.5770052", "text": "def params\n @options.map do |k, v|\n v.nil? && raise(Client::RuntimeError, \"Missing option [:#{k}]\")\n end\n \"//#{@options[:host]}/#{@options[:share]} #{@options[:password]} \\\n-U #{@options[:user]} -W #{@options[:workgroup]} -m SMB#{@options[:version]}\"\n end", "title": "" }, { "docid": "7bbb9936b8f91008d9d3e035d91e3024", "score": "0.57673806", "text": "def split_options(*utils_option_names, **options)\n utils_options, pattern_options = {}, {}\n utils_option_names += %i[force noop verbose]\n\n options.each do |key, value|\n list = utils_option_names.include?(key) ? utils_options : pattern_options\n list[key] = value\n end\n\n [utils_options, pattern_options]\n end", "title": "" }, { "docid": "3327a1e0867a85c99e68297016482e03", "score": "0.57666016", "text": "def generate_params\n result = {}\n\n passed_options.each do |opt|\n result[opt] = self.send(opt)\n end\n\n # Setting up test option\n self.test ? result[:test] = 1 : result.delete(:test)\n\n result\n end", "title": "" }, { "docid": "3327a1e0867a85c99e68297016482e03", "score": "0.57666016", "text": "def generate_params\n result = {}\n\n passed_options.each do |opt|\n result[opt] = self.send(opt)\n end\n\n # Setting up test option\n self.test ? result[:test] = 1 : result.delete(:test)\n\n result\n end", "title": "" }, { "docid": "833749427588a95ed503ffbe12cdbde5", "score": "0.57573336", "text": "def setup_options(params={}, credentials=nil)\n options = {}\n prepare_request_body(params, options)\n setup_authentication(options, credentials)\n options[:no_follow] = true if !follows?\n options[:headers] = @headers if [email protected]?\n options\n end", "title": "" }, { "docid": "a62662062ff7801d25949b3c5bc21b26", "score": "0.57560474", "text": "def request_options\n request_options = {}\n case options\n in { stream_identifier: { regex: String } } | { stream_identifier: { prefix: Array } } |\n { event_type: { regex: String } } | { event_type: { prefix: Array } }\n request_options[:filter] = options\n add_window_options(request_options)\n else\n request_options[:no_filter] = EventStore::Client::Empty.new\n end\n request_options\n end", "title": "" }, { "docid": "999fc5961ed95b055d927e459df4cd80", "score": "0.57467896", "text": "def parameters\n if options[:clobber_request]\n options[:parameters]\n else\n all_parameters\n end\n end", "title": "" }, { "docid": "b3672b02b2e7eaf8dfafc575b2ed847e", "score": "0.5738753", "text": "def option_params\n # params.fetch(:option, {})\n if params[:option].key? 'values'\n params[:option][:values] = params[:option][:values].split(\",\")\n end\n params.require(:option).permit(:name, values: [])\n end", "title": "" }, { "docid": "7fc38e96ab6818102253e23dd4592bbf", "score": "0.5733956", "text": "def cleanup_params(*options)\n options = options.first\n missing = keep_missing(options)\n \n unless missing.blank?\n [:source, [:reverse, :auto, :reflection, :source_relation], :name].each do |expected|\n if expected.is_a?(Array)\n validate_one_is_present(expected, options)\n else\n validate_option(options, expected)\n end\n end\n options = split_source(options)\n options = find_reflection_name(options)\n end\n #puts \"Options cleaned: #{options.inspect}\"\n options\n end", "title": "" }, { "docid": "831a4c6111e891c92152224a233bdbca", "score": "0.57338804", "text": "def options(request)\n RTSP::Server.log \"Received OPTIONS request from #{request.remote_host}\"\n response = []\n response << \"Public: #{OPTIONS_LIST.join ','}\"\n response << \"\\r\\n\"\n\n [response]\n end", "title": "" }, { "docid": "51383bcfe7e292f0a851b19c245c3aad", "score": "0.57263035", "text": "def process_options\n \n end", "title": "" }, { "docid": "64b6775e1eb080914f52f13c86293e5c", "score": "0.57157004", "text": "def prepare_request_body(params, options={})\n if (@via == :post || @via == :put)\n options[:body] = params unless params.blank?\n else\n options[:query] = params unless params.blank?\n end\n options\n end", "title": "" }, { "docid": "79e84530108cbba71b2a21e0131e71a7", "score": "0.5709024", "text": "def process_options\n \n end", "title": "" }, { "docid": "8af0f718c4add45ec62a431dd1a7e85b", "score": "0.57084745", "text": "def extract_options!(options)\n options.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "title": "" }, { "docid": "f66d6ea30fd5768c2a03e85d29418e2c", "score": "0.5705551", "text": "def query_parameters_filtered(options = {})\n query_params = (request.query_parameters | request.request_parameters)\n if options[:only]\n query_params = query_params & options[:only]\n else\n query_params = query_params - [:render, :render_options, :\"_\", :page_path, :authenticity_token]\n if form_field_path\n query_params = query_params - [form_field_path[0]]\n end\n end\n query_params = query_params - options[:skip] if options[:skip]\n query_params\n end", "title": "" }, { "docid": "35613064c5c5f18895e58cc203db6a04", "score": "0.5701199", "text": "def em_request_options(data = {})\n data = data.is_a?(Hash) ? data.with_indifferent_access : {}\n {\n redirects: 5, # follow 3XX redirects up to depth 5\n keepalive: true, # enable keep-alive (don't send Connection:close header)\n head: (data[:head] || {}).merge(\n 'ACCEPT' => '*/*',\n 'Connection' => 'keep-alive'\n ).remove_blank_values!,\n body: (params[:body] || {})\n }\n end", "title": "" }, { "docid": "b73006ed746e086c19804a0be8a84aa2", "score": "0.5694951", "text": "def external_params\n included_keys = @other_options[:with]\n if @other_options && @other_options[:with]\n included_keys = @other_options[:with]\n included_strings = @other_options[:with].map(&:to_s)\n included_params = params.select{|key, val| \n included_keys.include?(key) || included_strings.include?(key) \n }\n retVal = {}\n included_params.each do |e1, e2|\n retVal[e1] = e2\n end\n retVal\n else\n {}\n end\n end", "title": "" }, { "docid": "e12a834d0fe963b741f2890f1f708e42", "score": "0.56925696", "text": "def parse_list_options!(args, options, params)\n if args.count > 0\n options[:phrase] = args.join(\" \")\n # params['phrase'] = = args.join(\" \")\n end\n params.merge!(parse_list_options(options))\n # query parameters are stored in :params\n # preserve anything already set in :params by the OptionParser or command specific logic..\n options[:params] ||= {}\n options[:params].deep_merge!(params)\n return options\n end", "title": "" }, { "docid": "ecefcc444fcf38cbebd76ce43cc74469", "score": "0.5690375", "text": "def extract_options!(params, list)\n output = Hash[list.map do |opt|\n [opt, params.delete(opt)]\n end].keep_if {|k,v| !is_empty?(v)}\n end", "title": "" }, { "docid": "9961c50096a0fe51605bddaafe28e055", "score": "0.56855917", "text": "def url_for_params(options = {})\n new_params = params.clone\n if without = options.delete(:without)\n without = [without] unless without.is_a?(Array)\n without.map!(&:to_s)\n new_params.reject! {|k,v| without.include?(k) }\n end\n \n new_params.merge!(options) unless options.empty?\n \n new_params\n end", "title": "" }, { "docid": "b2d5d91e86e06f7b19ec513613c72f43", "score": "0.5677451", "text": "def clean_params\n @template.params.delete_if { |k, v|\n ['Filename', 'Upload', 'Filedata', 'authenticity_token', Rails.configuration.session_options[:key]].include?(k)\n }\n if @template.params[:options].is_a?(String)\n @template.params[:options] = Rack::Utils.parse_query(@template.params[:options])\n end\n @template.params\n end", "title": "" } ]
80e43c8dc441ca91cca601908f8f7588
Whether this is visible to the given user based on the moderation state.
[ { "docid": "eb717e0dd59659fe6908d190ce3c60e7", "score": "0.8850114", "text": "def moderation_state_visible_to_user?(user)\n moderation_state_visible_to_all? || (!user.thredded_anonymous? && user_id == user.id)\n end", "title": "" } ]
[ { "docid": "05555fd1a68661aa0f31272e1645cd42", "score": "0.7851482", "text": "def viewable?(user=:false)\n (user != :false && is_visible_to_id <= user.user_level.position) || (user == :false && is_visible_to == UserLevel.find_by_name(\"Anonymous\"))\n end", "title": "" }, { "docid": "d69aa534a89e9613329f40f0f8931123", "score": "0.78330076", "text": "def viewable_by?(user)\n Sugar.public_browsing? || user ? true : false\n end", "title": "" }, { "docid": "f6be8f53a403eadee0696e82255d412c", "score": "0.78152126", "text": "def visible_to?(user)\n return self.user==user || !self.visible_to || self.visible_to.include?(user._id)\n end", "title": "" }, { "docid": "3353f04c39aa862d61a6ae8af257b7fb", "score": "0.77901644", "text": "def visible?(user=User.current)\n true\n end", "title": "" }, { "docid": "f2907ddadaa6039ac25f63d2ebedbd6b", "score": "0.7788938", "text": "def viewable?(user)\n !deleted && !hidden?\n end", "title": "" }, { "docid": "a0b70fc40d834944f17c32d758afc7a1", "score": "0.7538139", "text": "def visible?(user)\n\n return true if self.for_all?\n\n return false if user.nil?\n\n return true if (user.admin?(User::AUTH_ADDRESSBOOK) or self.owner_id == user.id)\n\n groups = self.get_groups_a\n teams = self.get_teams_a\n\n user.get_groups_a(true).each do |group_id|\n return true if groups.include?(group_id)\n end\n\n user.get_teams_a.each do |team_id|\n return true if teams.include?(team_id)\n end\n\n return false\n end", "title": "" }, { "docid": "99b617be50a5931221b3ff2de85e87a4", "score": "0.750143", "text": "def visible?(user=nil)\n return true if author == user and not deleted?\n return false unless category.allow_viewing? user\n return false unless available?\n true\n end", "title": "" }, { "docid": "6cb07bdd86d102fded27b18e74ae6260", "score": "0.74880904", "text": "def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end", "title": "" }, { "docid": "c05da9a3b99c6f24de888384d641ae5f", "score": "0.7393662", "text": "def moderation_state_visible_to_all?\n if Thredded.content_visible_while_pending_moderation\n !blocked?\n else\n approved?\n end\n end", "title": "" }, { "docid": "9cc833a97bc55ea0346afa270240a76e", "score": "0.7391705", "text": "def accessible_by?(user)\n return false unless user&.logged_in?\n\n accessible_by_user?(user)\n end", "title": "" }, { "docid": "7fefc5096e799840d3e36a35c4b16d5d", "score": "0.7360542", "text": "def visible?(user=User.current)\n (project.nil? || user.allowed_to?(:view_contacts, project)) && (self.is_public? || self.user_id == user.id)\n end", "title": "" }, { "docid": "7540cbe255c737632005794e4e70de23", "score": "0.7359455", "text": "def can_be_accessed_by?(user)\n if visibility == 'public'\n return true\n elsif visibility == 'buddies' && organization.battle_buddy_list.include?(user.organization_id)\n return true\n elsif visibility == 'shared' && buddy_list.split(',').include?(user.organization_id.to_s)\n return true\n elsif visibility == 'executive' && user.is_executive? && organization.users.include?(user)\n return true\n elsif ['private','buddies','shared'].include?(visibility) && organization.users.include?(user)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "a930dd8256d4a859b1e11fb0d18acf67", "score": "0.735119", "text": "def editable_by?(user)\n if self.status == :private\n self.user == user || self.featurings.map(&:user).include?(user)\n elsif status == :temporary\n true # XXX FIXME SECURITY HOLE RIGHT HERE: ANY USER CAN MODIFY TEMP SONGS FIXME\n elsif status == :public\n false\n end\n end", "title": "" }, { "docid": "fe091150f376da0d1b6a8ca7407eb73c", "score": "0.73238665", "text": "def visible(current_user=User.current_user)\n if current_user.is_a?(Admin) || (current_user.is_a?(User) && current_user.is_author_of?(self))\n return self\n elsif current_user == :false || !current_user\n return self unless self.restricted || self.hidden_by_admin\n elsif (!self.hidden_by_admin && !self.posted_works.empty?)\n return self\n end\n end", "title": "" }, { "docid": "8f555f8f455bd046df046db74ace906a", "score": "0.7317049", "text": "def visible?(user=User.current)\n user.allowed_to?(:view_issues, self.project)\n end", "title": "" }, { "docid": "7ebe40bc9a28828c02abee360e36b394", "score": "0.7311569", "text": "def is_user_moderator?(user)\n result = false\n if(user)\n if user.has_system_role('moderator')\n result = true\n end\n\n\n if(created_by==user.id)\n result = true\n end\n\n self.publishers.each do |organism|\n if organism.is_user_moderator?(user)\n result = true\n end\n end\n end\n return result\n\t\n end", "title": "" }, { "docid": "703aaae96393d4130630fed4ba87182d", "score": "0.7302737", "text": "def may_view_user?(user=nil)\n#\t\t\tself.is_user?(user) || self.may_administrate?\n\t\t\tself.is_user?(user) || self.may_administrate?\n\t\tend", "title": "" }, { "docid": "d67eea3ffb97bc87083c84ae8ab9edd2", "score": "0.7284524", "text": "def is_user_moderator?(user)\n if user\n if id==user.id\n return true\n end\n end\n return false\n end", "title": "" }, { "docid": "e7bf340796ce6e7f1d88500e6b7f6b65", "score": "0.72653115", "text": "def visible?(user=User.current)\n user.allowed_to?(:view_pulls, self.project)\n end", "title": "" }, { "docid": "bfa1e556e72301e57c3143b4756c7439", "score": "0.72521967", "text": "def can_be_viewed_by?(user)\n # you can always view your own tlog\n return true if user && user.id == self.id\n\n # skip if current user is blacklisted\n return false if user && self.is_blacklisted_for?(user)\n\n case self.tlog_settings.privacy\n when 'open'\n true\n\n # registration required\n when 'rr'\n user ? true : false\n\n # friend-mode\n when 'fr'\n user && self.all_friend_ids.include?(user.id)\n\n # only me\n when 'me'\n user && user.id == self.id\n end\n end", "title": "" }, { "docid": "45ab51bb4d1d176b464b32c0b3786661", "score": "0.7234539", "text": "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "title": "" }, { "docid": "9885733144f196d1fdfe875717bdae9a", "score": "0.72183114", "text": "def owned_by? a_user\n a_user == program.moderator\n end", "title": "" }, { "docid": "64b3d93f5e70264ce16fa61823b981fa", "score": "0.7189467", "text": "def visible?(usr=nil)\n (usr || User.current).allowed_to?(:view_cm_ncs, self.project)\n end", "title": "" }, { "docid": "77038617fae4a07e25273d3a9546cb33", "score": "0.7175838", "text": "def visible?(usr=nil)\n (usr || User.current).allowed_to?(:view_cm_qrs, self.project)\n end", "title": "" }, { "docid": "f5217dac6bb0a9c0b6ade35675a9fa32", "score": "0.71589327", "text": "def moderator?\n self.moderator\n end", "title": "" }, { "docid": "96baedd9962992ba854877e780a0bc57", "score": "0.71567595", "text": "def authorize?(user)\n user && user.moderator?\n end", "title": "" }, { "docid": "8e58d7a205c6d7e97386a41ff935b03b", "score": "0.71540266", "text": "def visible_to?(resource)\n if self.visible || self.user_id == resource.id #|| assuming they have an ID\n true\n else\n false\n end\n end", "title": "" }, { "docid": "b2db0cbe2ca37d1022fff7a076768304", "score": "0.7152686", "text": "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "title": "" }, { "docid": "5a0b740af564754eb49ec60f018e971e", "score": "0.70935076", "text": "def visible_to? a_user\n a_user.participating_programs.include? program\n end", "title": "" }, { "docid": "a6c4406b83520a78809f390271a1a084", "score": "0.7054188", "text": "def editable_by_user?\n %w(new paid).include?(self.state)\n end", "title": "" }, { "docid": "3e96162ced38cc232e4b2e60c9f6dcbd", "score": "0.70252156", "text": "def accessible_by_user?(user)\n user_membership = space_memberships.active.find_by(user: user)\n\n user_membership.present? && (unactivated? || active? || locked? && user_membership.host?)\n end", "title": "" }, { "docid": "8c93eced96a04a3705b8ba8c008ea02e", "score": "0.70055425", "text": "def editable_by?(user)\n \tuser && user == owner\n\tend", "title": "" }, { "docid": "0d0d95b2419f8931014ee33a2decf4b1", "score": "0.6998039", "text": "def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end", "title": "" }, { "docid": "07d4efcccf0d7f3044968916bebe2f6c", "score": "0.6997128", "text": "def current_user_is_moderator?(board)\n signed_in? && current_user.moderating?(board)\n end", "title": "" }, { "docid": "637d4a88cf0fe5881dbb06e91ff76d46", "score": "0.6987183", "text": "def viewer?\n user_role_id == UserRole::VIEWER\n end", "title": "" }, { "docid": "6d5b807c124bcaac2d72135cd50be3c4", "score": "0.69770104", "text": "def show?\n user_is_owner_or_admin? || user_is_professional?\n end", "title": "" }, { "docid": "87956d04de2a54967b25b3a0a8311b00", "score": "0.6956762", "text": "def can_user_access?(user)\n if user.is_account_holder_or_administrator? || self.is_user_tagged_to_team?(user)\n true\n else\n false\n end\n end", "title": "" }, { "docid": "e42d24fe68fc25593eee0808b04f8361", "score": "0.69431245", "text": "def displayable_to_user?(user, cat=catalog)\n at_least_editor = user.catalog_role_at_least?(cat, 'editor')\n at_least_editor || !restricted?\n end", "title": "" }, { "docid": "f6e969eb2daa59656f688ca722579dcf", "score": "0.6941196", "text": "def viewable_by?(actor)\n return true if public? || owner?(actor) || has_member?(actor) || has_invite?(actor)\n return false\n end", "title": "" }, { "docid": "21574d06c345e787e5ec45dc55bb828a", "score": "0.6926474", "text": "def is_visible\n !!(@training && @training.id && (@is_admin_logged_in || @current_user))\n end", "title": "" }, { "docid": "f6ccf4b2ae9986b04817e33b65998f58", "score": "0.6919472", "text": "def editable_by?(user)\n\t\tuser && user == author\n\tend", "title": "" }, { "docid": "ce68ced7a24a178990631b4dfb30e354", "score": "0.69118816", "text": "def is_editable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n [email protected]_user.find_any_friendship_with(another_user).nil?\n )\n end", "title": "" }, { "docid": "065f34273711a04eab8b34f689197be8", "score": "0.6910799", "text": "def editable_by_user?(user)\n begin\n (user && (user.id == 1)) or # by root\n (allow_editing == 99) or # it's public editable\n (allow_editing == 0 and author and author.user == user) or # it's the author\n (allow_editing == 1 and user ) or # it's editable by any registered user\n (allow_editing == 2 and user.functions.include?(restricted_to_function_id)) # user is member of function\n rescue\n false\n end\n end", "title": "" }, { "docid": "0e5b98d3922c4755004b48849767545f", "score": "0.6906415", "text": "def is_moderator?\n self.current_user && self.current_user.has_system_role('moderator')\n\tend", "title": "" }, { "docid": "57400d4145eb81eb58f533e22bb24ff7", "score": "0.68958414", "text": "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "title": "" }, { "docid": "f45f8ada9bc0d1d66e894aea43f01ff9", "score": "0.68952143", "text": "def can_edit?(user)\n if user.nil?\n false\n else\n if self.admins.map(&:downcase).include?(user.email.downcase)\n return true\n else\n self.user_in_group_share?(user, 'Edit')\n end\n end\n end", "title": "" }, { "docid": "c3009e3684eb6f928b1b2ab2019d983b", "score": "0.68876696", "text": "def preview_only?(user)\n !listed && !author?(user)\n end", "title": "" }, { "docid": "1c282c9e7f84098dc6d11a614b674709", "score": "0.6885903", "text": "def user_can_view?(_check_user)\n true # everyone can view these\n end", "title": "" }, { "docid": "bedc88487d43d4f874d1312dc71743b0", "score": "0.688586", "text": "def visible_to?(identity)\n return true if !restricted && !deleted && published\n return false if nobody?(identity)\n return true if identity.god and identity.realm == self.realm\n identity.id == created_by\n end", "title": "" }, { "docid": "1f8576fdbfdc3bbca45ba376a1a29b91", "score": "0.68712133", "text": "def visible_to?(user)\n if method = Garage.configuration.docs.docs_authorization_method\n method.call(document: self, user: user)\n else\n true\n end\n end", "title": "" }, { "docid": "e738e6be2c29c1fdecc29b9935b19275", "score": "0.6868615", "text": "def readable_by?(user)\n !resource.archived? || (user.is_admin? || is_mill?(user))\n end", "title": "" }, { "docid": "d8b3adff6cf218bcba4ea3c0b4a56103", "score": "0.68669206", "text": "def visible?\n @visible\n end", "title": "" }, { "docid": "d8b3adff6cf218bcba4ea3c0b4a56103", "score": "0.68669206", "text": "def visible?\n @visible\n end", "title": "" }, { "docid": "86fd6624cd363a185103e2150fcd9c76", "score": "0.6864971", "text": "def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end", "title": "" }, { "docid": "f6ad302348dfe36c4219711af5001f69", "score": "0.6862067", "text": "def show?\n @user.has_role?(:admin) || @record.course.user_id == @user.id || @record.course.bought(@user) == false\n end", "title": "" }, { "docid": "bb69dd63977a79756cfae92a47be199a", "score": "0.6859974", "text": "def is_view_permitted?(given_user = nil)\r\n return false unless self.active?\r\n \r\n given_user ||= self.current_user\r\n \r\n # If item is public, no need for further permission checks\r\n return true if self.public? && self.user && self.user.public? \r\n \r\n # Base case of identity, no need to check relationships\r\n return true if given_user && ((given_user.id == self.author_id) || (given_user.id == self.foruser_id) || given_user.is_self_or_owner?(self.user))\r\n\r\n # Special case -- allow recipient and owners to see private messages\r\n if self.is_a?(Pvtmessage)\r\n return true if given_user.is_self_or_owner?(self.foruser) || given_user.is_self_or_owner?(self.user)\r\n return false\r\n end\r\n\r\n return true if given_user.admin?\r\n \r\n # Otherwise no can do if only my owner can see it (if you got to here, you aren't my owner)\r\n return false if self.restriction_level == Relationshiptype.nobody\r\n\r\n # Content of private or blocked projects cannot be seen\r\n return false if self.user && !self.user.is_view_permitted?\r\n\r\n # Fine, we'll actually run some DB queries...\r\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\r\n end", "title": "" }, { "docid": "2cdd2d61283bbf3f85a08fe611e55449", "score": "0.6854371", "text": "def editable_by?(user)\n\t \t# user && user == owner\n\t user == user\n \tend", "title": "" }, { "docid": "00211188b2eb87e934d2ccd27a99801b", "score": "0.68491954", "text": "def is_visible?\n visibility && ( visibility > 0 )\n end", "title": "" }, { "docid": "233a9387d9be5397d260db4654a0488a", "score": "0.6845945", "text": "def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end", "title": "" }, { "docid": "1467cf71c0f6e293e4b3f592e9e0e885", "score": "0.684268", "text": "def viewable_by?(actor)\n actor.is_a?(User)\n end", "title": "" }, { "docid": "be1b0e7ab1b2f10e0e49a6754653a653", "score": "0.6838112", "text": "def readable_by? user\n true\n end", "title": "" }, { "docid": "0406d741204c02151d99df3e7de6f900", "score": "0.68369514", "text": "def user_accessible?\n is_admin\n end", "title": "" }, { "docid": "053eba91733a851ad850a0463852b131", "score": "0.68358", "text": "def editable_by?(user)\n user && self.user_id == user.id\n end", "title": "" }, { "docid": "053eba91733a851ad850a0463852b131", "score": "0.68358", "text": "def editable_by?(user)\n user && self.user_id == user.id\n end", "title": "" }, { "docid": "5237108b88444f44d1ec6e81ec1d489b", "score": "0.6825496", "text": "def editable_by?(usr)\n if wiki.project &&\n wiki.project.module_enabled?('wiki') &&\n wiki.project.module_enabled?('redmine_advanced_wiki_permissions')\n !protected? || usr.wiki_allowed_to?(self, :protect_wiki_pages)\n else\n !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project)\n end\n end", "title": "" }, { "docid": "54fc5fe5010acac28f3103b2d4f28775", "score": "0.6824835", "text": "def approve?\n user && user.able_to?(:moderate_any_forum, record.forum)\n end", "title": "" }, { "docid": "41d97f7c3c97a6068f0dfed4ed369c62", "score": "0.68242306", "text": "def show?\n user.id == record.id || user.administrator?\n end", "title": "" }, { "docid": "5fa68466e2bf07fe2d79a37a6eac9268", "score": "0.6823628", "text": "def visible?\n\t\t\t@visible\n\t\tend", "title": "" }, { "docid": "cccf9ed10f61f38f2ccec34dc032debe", "score": "0.6822769", "text": "def is_view_permitted?(given_user = nil)\n given_user ||= self.current_actor\n\n # Guests can't see circles unless they log in\n return false if given_user.guest?\n \n # Oh look, it's me\n return true if given_user.is_self_or_owner?(self.user)\n \n # Fine, let's check the db\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\n end", "title": "" }, { "docid": "2ec14223cf290c6061dd638770c080bd", "score": "0.6819094", "text": "def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end", "title": "" }, { "docid": "e3401ba759b55434902942bcc8f8bd00", "score": "0.68167406", "text": "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "title": "" }, { "docid": "71c1f014ef5fc3a74a654a37b81e2f16", "score": "0.6807394", "text": "def visible_exercise? exercise\n !exercise.read_task(:visible_to_admin_only) || current_user.mentor?\n end", "title": "" }, { "docid": "6efea516143c5e79ea29b33f18ab0e6e", "score": "0.6806205", "text": "def show?\n @current_user.admin?\n end", "title": "" }, { "docid": "aeaae8b65bc0715a305d98818a0149c4", "score": "0.680566", "text": "def publishable?(user)\n user.present? && !public?\n end", "title": "" }, { "docid": "b4c267d6d3d1e923fb6a5e110ccf2241", "score": "0.68017596", "text": "def is_approved?\n moderation_flag ? true : false\n end", "title": "" }, { "docid": "b4c267d6d3d1e923fb6a5e110ccf2241", "score": "0.68017596", "text": "def is_approved?\n moderation_flag ? true : false\n end", "title": "" }, { "docid": "3bc8d29eb8f601ef606eb4a9f94e3e12", "score": "0.68012565", "text": "def has_access?(user)\n return false if user.nil?\n self.user == user || user.is_admin?\n end", "title": "" }, { "docid": "a6f19d2deec098129d258641ffdb4afc", "score": "0.6799539", "text": "def can_view?(user)\n if user.nil?\n false\n else\n # use if/elsif with explicit returns to ensure skipping downstream calls\n if self.study_shares.can_view.map do |email_address|\n remove_gmail_periods(email_address)\n end.include?(remove_gmail_periods(user.email))\n return true\n elsif self.can_edit?(user)\n return true\n else\n return self.user_in_group_share?(user, 'View', 'Reviewer')\n end\n end\n false\n end", "title": "" }, { "docid": "2d2711fea11794b5d13076c210feba9b", "score": "0.6791134", "text": "def speaker_on_visibles_for_user( user )\n return self.speaker_on.visible if self != user\n return self.speaker_on if self == user || user.admin?\n end", "title": "" }, { "docid": "6ecb7a751becd33fcac403c2a74add5a", "score": "0.67902035", "text": "def can_view?(user)\n user.nil? ? false : (self.can_edit?(user) || self.user_annotation_shares.can_view.include?(user.email))\n end", "title": "" }, { "docid": "c9facbca1ae6ca1989f6d0f64a3887e1", "score": "0.678916", "text": "def show?\n @user && (can_update_seminar? || @record.holder_id == @user.id || @user.authorization.can_read?(@record.seminar.organization_id))\n end", "title": "" }, { "docid": "5af56bf552224242361c5aad6f6b86a5", "score": "0.6788852", "text": "def show?\n GuidanceGroup.can_view?(@user, @record)\n end", "title": "" }, { "docid": "aee60383dc570471a7ab42a46b073c82", "score": "0.67878926", "text": "def visible?\n model.respond_to?(:visibility) && model.visibility.include?(Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)\n end", "title": "" }, { "docid": "a0a743ba25d43369e2073146110de413", "score": "0.67800575", "text": "def show?\n user.admin? || user.po? || record.user == user\n end", "title": "" }, { "docid": "116a1013f28eb930772de910b271433b", "score": "0.67711985", "text": "def readable_by?(user)\n user.in_session?(resource) || user.admin_for?(resource.course)\n end", "title": "" }, { "docid": "36693953ad8bda7c800b2820f25eea4e", "score": "0.67705166", "text": "def moderator?\n permissions == 'moderator'\n end", "title": "" }, { "docid": "f5b5f0d81dd3525435bac602a759cfaa", "score": "0.67664355", "text": "def user?\n get_mode == :user\n end", "title": "" }, { "docid": "16c126095b3196b73e67a423080ef8e6", "score": "0.676587", "text": "def privacy_check(user_check)\n can_view = nil\n\n if self.public == false\n user = User.find_by_id(self.user_id)\n if user.company_id != user_check.company_id\n can_view = false\n else\n can_view = true\n end\n else\n can_view = true\n end\n\n return can_view\n\n end", "title": "" }, { "docid": "b09cf77e00cb0d93e8096335e89a1a78", "score": "0.6757539", "text": "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "title": "" }, { "docid": "b09cf77e00cb0d93e8096335e89a1a78", "score": "0.6757539", "text": "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "title": "" }, { "docid": "b09cf77e00cb0d93e8096335e89a1a78", "score": "0.6757539", "text": "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "title": "" }, { "docid": "a000089c3ab2f0b9919f048c1f5e4e95", "score": "0.67556345", "text": "def check_visibility\n raise Helpedia::ItemNotVisible unless @user.visible_for?(current_user)\n end", "title": "" }, { "docid": "a1b4ba65800a57fde5e717004a630d3e", "score": "0.67545515", "text": "def visible?(project, current_user)\n call_name = self.name.downcase.gsub(/ /, '_') + '_is_visible?'\n if respond_to? call_name.to_sym\n send(call_name.to_sym, project, current_user)\n else\n true\n end\n end", "title": "" }, { "docid": "33aed54aea7dcf026d2d15f858ec3136", "score": "0.67522603", "text": "def editable? usr\r\n (seller?(usr) || pixter?(usr) || usr.has_role?(:admin)) || usr.has_role?(:support)\r\n end", "title": "" }, { "docid": "f96fcabe9a10e9b1750b2693381fd1c4", "score": "0.6752075", "text": "def can_edit?(user)\n (self.user == user) || !!(user && user.admin?)\n end", "title": "" }, { "docid": "8c778c9e4a474911a32fd760ac6a9a54", "score": "0.6744297", "text": "def check_visibility\n if not @organisation.active?\n hidden = false\n if not current_user == @organisation\n hidden = true\n end\n\n current_user.is_a?(User) and current_user.has_role?(:admin) ? hidden = false : nil\n if hidden\n raise Helpedia::ItemNotVisible\n end\n end\n end", "title": "" }, { "docid": "39b6d7235c2bb9ac768cc2c4400e63c9", "score": "0.67387635", "text": "def show_edit_link?\n @user && @user.admin\n end", "title": "" }, { "docid": "58c673e4dfd30bc08e050c805e2263b2", "score": "0.67325956", "text": "def show?\n user_record? || user.accessible_registrants.include?(record) || event_planner? || super_admin?\n end", "title": "" }, { "docid": "0ccee0d261721d1d75b4258862b906fc", "score": "0.672771", "text": "def has_permission_with?(user)\r\n\t\t\treturn user.has_permission?(privacy_owner, self.class.privacy_rule_name, privacy_object_id)\r\n\t\tend", "title": "" }, { "docid": "b860163d0a711d248e317e1c2939aa35", "score": "0.67255414", "text": "def collaborate?\n record.private? && (record.user_id == user.id || user.admin?)\n end", "title": "" } ]
3d9fcfd52af9d17b6c4d651371d36897
this is the url that we'll put in the email with results
[ { "docid": "adcc8f981c9c682b8b2ecd9a2f43e323", "score": "0.0", "text": "def show\n render 'orders/show'\n end", "title": "" } ]
[ { "docid": "08dcc5cc6c7b7c1ba3998e248644bff8", "score": "0.6918927", "text": "def url\n\t\t\t@msg\n\t\tend", "title": "" }, { "docid": "6c7f0173801433f566e2ad0fec82069f", "score": "0.6557944", "text": "def fetch_squirrelmail(base_url)\nend", "title": "" }, { "docid": "e07db17a93afb2cbf0e888d5917f7c73", "score": "0.651559", "text": "def report_url\n report_url = \"mailto:\\\"#{translate 'admin.report_issue.name'}\\\"<#{translate 'admin.report_issue.email'}>\"\n report_url += \"?subject=#{CGI.escape translate('admin.report_issue.subject')}\"\n report_url += \"&body=#{CGI.escape translate('admin.report_issue.body')}\"\n report_url\n end", "title": "" }, { "docid": "0484e568e2ff5dbbe01fd5a46e4e8434", "score": "0.6465579", "text": "def get_url(result)\n if result.item_links.item_link[0]\n url = result.item_links.item_link[0].url\n else\n url = \"n/a\"\n end\n return url\n end", "title": "" }, { "docid": "f44edf9a744e2f72f7979943a8d91ae1", "score": "0.63117087", "text": "def email_message_action_url\n view_context.work_url(work)\n end", "title": "" }, { "docid": "f44edf9a744e2f72f7979943a8d91ae1", "score": "0.63117087", "text": "def email_message_action_url\n view_context.work_url(work)\n end", "title": "" }, { "docid": "f44edf9a744e2f72f7979943a8d91ae1", "score": "0.63117087", "text": "def email_message_action_url\n view_context.work_url(work)\n end", "title": "" }, { "docid": "84348856bc27515c3fff0d3e09672b49", "score": "0.62946796", "text": "def send\n generate_url\n end", "title": "" }, { "docid": "84348856bc27515c3fff0d3e09672b49", "score": "0.62946796", "text": "def send\n generate_url\n end", "title": "" }, { "docid": "7bca6bd347cf605267f1b052b8ed128d", "score": "0.6276783", "text": "def to_url; end", "title": "" }, { "docid": "1f387261a899bbc6ccf16489813d49f9", "score": "0.62558514", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}/corporate_groupings/#{CGI.escape(result['name'].to_s)}\"\n if query['api_token'].any?\n url += \"?api_token=#{CGI.escape(query['api_token'][0].to_s)}\"\n end\n url\n end", "title": "" }, { "docid": "9b2cece5d58977c3bbb62d01936a2682", "score": "0.6237253", "text": "def invite_report(saved_search)\n default_url_options[:host] = \"www.meetingwave.com\" \n \n setup_email( get_emails(saved_search.member) ) \n @body['saved_search'] = saved_search\n # Email header info\n # @subject = \"MeetingWave: #{saved_search.name} Invites since #{saved_search.last_send_time.strftime(\"%A, %B %d, %Y\")} \"\n \n @subject = \"Your Upcoming Meetings from MeetingWave.com\"\n # Email body substitutions\n @body['invitations'] = saved_search.invitations_to_send[0..10]\n @body['recurring_invitations'] = saved_search.recurring_to_send[0..10]\n \n end", "title": "" }, { "docid": "003fcb3e394fbac91f387214203ee973", "score": "0.623469", "text": "def final_url; end", "title": "" }, { "docid": "5ac5ea95423e7cce34bd14b7676fad7a", "score": "0.62283665", "text": "def results_url\n @attributes[:results_url]\n end", "title": "" }, { "docid": "5ac5ea95423e7cce34bd14b7676fad7a", "score": "0.62283665", "text": "def results_url\n @attributes[:results_url]\n end", "title": "" }, { "docid": "450b9ce400d8a8a2bfe22cf23ae5fc29", "score": "0.62010956", "text": "def result_url\n '/results/' + id.to_s\n end", "title": "" }, { "docid": "2407a02652d6100bb9523ff1b017ffea", "score": "0.61846435", "text": "def get_hyperlink(result)\n result['url']\n end", "title": "" }, { "docid": "23bc842b053de63621dd37a8144f3d8a", "score": "0.6140993", "text": "def index\n DefaultUrlOptionsForMailersMailer.deliver_mail_with_url\n head :ok\n end", "title": "" }, { "docid": "d746da410f4d66f88d64e1d1863e7844", "score": "0.61371773", "text": "def url\n end", "title": "" }, { "docid": "d00ea3898db2fd89b83d239273a9595f", "score": "0.6134867", "text": "def email_link\n params[:to].split(',')[0..4].each do |to|\n begin\n Notifier.email_link(params[:from], to.strip, params[:subject], params[:body]).deliver\n rescue => e\n Rails.logger.error \"Email could not be sent: #{e.message}\\n#{e.backtrace.inspect}\"\n end\n end\n render :nothing => true\n end", "title": "" }, { "docid": "a0f58d77fd93cd79ef9cf401bd4c6809", "score": "0.61173373", "text": "def welcome_email(user)\n @user = user \n @url = 'http://jamarks.herokuapp.com' #what url do i need here?\n mail(to: @user.email, subject: 'Welcome to Jamarks!')\n end", "title": "" }, { "docid": "1a9d821e9d21528f0267fdef3574c032", "score": "0.6106026", "text": "def url\n link\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "821abf38524fcc9014f39a79eec3d6d2", "score": "0.60976875", "text": "def url\n return @url\n end", "title": "" }, { "docid": "0c02fd2f38d64c0ce55731ca1c572f56", "score": "0.6087719", "text": "def getEmail(url)\n html = ScraperWiki::scrape(url)\n doc = Nokogiri::HTML html\n\n emaildata = {\n subject: getEmailSubject(doc),\n id: getEmailID(doc),\n date: getEmailDate(doc),\n body: getEmailContent(doc)\n }\n ScraperWiki::save_sqlite(['id'], emaildata)\nend", "title": "" }, { "docid": "db828fde1e6b01faf618b31928e315b0", "score": "0.6084732", "text": "def result_url(result)\n if result.respond_to? :url\n refinery.url_for result.url\n else\n refinery.url_for refinery.send(Refinery.route_for_model(result.class, admin: false), result)\n end\n end", "title": "" }, { "docid": "5e4d9c46868c19961c5e8d369ad11cd2", "score": "0.60807586", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}/companies/#{result['jurisdiction_code']}/#{result['identifiers'][0]['identifier']}\"\n if query['api_token'].any?\n url += \"?api_token=#{CGI.escape(query['api_token'][0].to_s)}\"\n end\n url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.60668266", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066436", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066436", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066436", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066436", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066436", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066334", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066334", "text": "def url\n @url\n end", "title": "" }, { "docid": "31221e129e6ce934a53954456223749b", "score": "0.6066334", "text": "def url\n @url\n end", "title": "" }, { "docid": "787a87b103a8201dd7110aafc522f602", "score": "0.60629255", "text": "def url\n @url \n end", "title": "" }, { "docid": "76e4142c74d97b76be0e6aaa1c624927", "score": "0.60561234", "text": "def url\n @response[\"url\"]\n end", "title": "" }, { "docid": "ae645bf8b191c13ad3fc1d955b86f0f2", "score": "0.60502476", "text": "def http_email(input_url)\n uri = URI input_url\n response = Net::HTTP.get(uri)\n uri1 = Addressable::URI.parse input_url\n input_param_hash = uri1.query_values\n return response, input_param_hash\nend", "title": "" }, { "docid": "8723ad66e9e6f867bae89212efd51146", "score": "0.6048949", "text": "def generate_link\n logger.tagged('recognition') { logger.info \"sending email for recognition #{id}\" }\n generate_key(id)\n RecognitionMailer.email(Recognition.find(id)).deliver_now\n end", "title": "" }, { "docid": "d262704760ecf85be7b460eaa6785e08", "score": "0.60465163", "text": "def send_url(name)\n\n @name = name\n\n mail(\n to: @name,\n subject: \"Coffee-Cupを使ってみよう!\",\n ) do |format|\n format.html\n end\n\n end", "title": "" }, { "docid": "e6e643df44a07d10ddf581496430985f", "score": "0.604325", "text": "def url\n return @url\n end", "title": "" }, { "docid": "6de3a8c94096abb5efcb0e8601f8341d", "score": "0.6037067", "text": "def return_google_address\n puts @url\n end", "title": "" }, { "docid": "491cd5998e952c5330c41ab2b537dcc1", "score": "0.60370123", "text": "def constructEmail(metadata, email)\n \n # Declared Variables\n sender = '[email protected]'\n recipient = email\n subject = \"Pull Requests for Great Expectations Repository over last 7 days\"\n encoding = \"UTF-8\"\n \n \n # Create HTML Body\n htmlbody = \n '\n <html>\n <head>\n <style>\n #requests {\n font-family: Arial, Helvetica, sans-serif;\n border-collapse: collapse;\n width: 100%;\n }\n \n #requests td, #customers th {\n border: 1px solid #ddd;\n padding: 8px;\n }\n \n #requests tr:nth-child(even){background-color: #f2f2f2;}\n \n #requests tr:hover {background-color: #ddd;}\n \n #requests th {\n padding-top: 12px;\n padding-bottom: 12px;\n text-align: left;\n background-color: #0457aa;\n color: white;\n }\n </style>\n </head>\n <table id=\"requests\">\n <tr>\n <th>id</th>\n <th>title</th>\n <th>url</th>\n <th>user</th>\n </tr>'\n \n # iterate through the metadata, and append text to htmlbody\n metadata.each do |data|\n htmlbody << \"<tr>\n <td>#{data.id}</td>\n <td>#{data.title}</td>\n <td>#{data.url}</td>\n <td><a href=#{data.userUrl}>#{data.username}</a></td>\n </tr>\"\n end\n \n # finish the html body\n htmlbody << '</table> </html>'\n \n \n mail = Mail.deliver do\n to recipient\n from '[email protected]'\n subject 'Pull Request in last 7 days for Great-Expectations'\n \n html_part do\n content_type 'text/html; charset=UTF-8'\n body htmlbody\n end\n end\n \nend", "title": "" }, { "docid": "930240bf7d3b1dfa521ea098d2d2d32a", "score": "0.6033662", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n \"#{env.url.scheme}://#{env.url.host}/visualizacion/getEntityById?id=#{CGI.escape(result['identifiers'][0]['identifier'].to_s)}&entity=#{CGI.escape(query['entity'][0].to_s)}&user_key=#{CGI.escape(query['user_key'][0].to_s)}\"\n end", "title": "" }, { "docid": "6f7eb7bcb72061acaf2eaafaf966a770", "score": "0.6031822", "text": "def url\n @url\n end", "title": "" }, { "docid": "1213d3291192f0086c218a4da3818660", "score": "0.60314304", "text": "def result_url(result)\n if result.respond_to? :url\n refinery.url_for result.url\n else\n refinery.url_for send(Refinery.route_for_model(result.class, :admin => false), result, highlight: params[:query])\n end\n end", "title": "" }, { "docid": "5b577ffef45877de3a08ca3681af6c19", "score": "0.60256153", "text": "def send_metareview_metrics_email(response, map_id)\n response_id = self.response_id\n reviewer_id = ResponseMap.find_by_id(map_id).reviewer\n \n reviewer_email = User.find_by_id(Participants.fin_by_id(reviewer_id).user_id).email\n reviewed_url = @url\n \n body_text = \"The metareview metrics for review #{@url} are as follows: \" \n body_text = body_text + \" Relevance: \" + self.relevance\n body_text = body_text + \" Quantity: \" + self.plagiarism\n body_text = body_text + \" Plagiarised: \" + self.quantity\n body_text = body_text + \" Content Type: Summative content \" + self.content_summative.to_s + \n \" Problem content \"+self.content_problem.to_s + \" Advisory content \" + self.content_advisory\n body_text = body_text + \" Tone Type: Postive tone \" + self.tone_positive.to_s + \n \" Negative tone \"+self.tone_negative.to_s + \" Neutral tone \" + self.tone_neutral\n\n Mailer.deliver_message(\n {:recipients => reviewer_email,\n :subject => \"Your metareview metrics for review of Assignment\",\n :from => email_form[:from],\n :body => {\n :body_text => body_text\n }\n }\n )\n\n flash[:notice] = \"Your metareview metrics have been emailed.\"\n end", "title": "" }, { "docid": "254a14e4ca459ff28c450ff8631aa4d4", "score": "0.6025004", "text": "def url\n @url.to_s\n end", "title": "" }, { "docid": "fcd071b9d57c8cd384575d3a17444641", "score": "0.6012712", "text": "def get_url\n\t\tpage = Nokogiri::HTML(open(\"https://www.annuaire-des-mairies.com/manche.html\"))\n\t\turl = []\n\t\tpage.xpath('//a[@class=\"lientxt\"]').each do |name|\n\t\t\turl << name.text.capitalize\n\t\tend\n\t\tpush_sheet(url, 1)\n\t\tget_mail(url)\n\t\t\n\t\t\n\tend", "title": "" }, { "docid": "ffbd9d1fff85ff2808f9036bfcc133de", "score": "0.6012479", "text": "def perform()\n res = []\n get_all_the_url().each do |mairie_url|\n nom = mairie_url.text\n email = get_the_email_of_a_townhal_from_its_webpage(mairie_url[\"href\"])\n res << {:name =>nom , :email=>email }\n end\n res\nend", "title": "" }, { "docid": "68c0d652e9f1a9df09d0f6a416dd86a9", "score": "0.599805", "text": "def url\r\n @url = $brow.url\r\n end", "title": "" }, { "docid": "57050c247e43c1f555e518f28e0b1308", "score": "0.5990081", "text": "def generate_url\n api_key = WavecellSms.configuration.api_key\n sub_account = WavecellSms.configuration.sub_account\n details = [source, destination, text, encoding]\n parameters = {\n source: source,\n destination: destination,\n text: text,\n encoding: encoding\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/sms/v1/#{sub_account}/single\" + \"?#{query_string}\"\n HTTParty.post(url.to_str, \n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end", "title": "" }, { "docid": "b5e16fa676af49de588e6197bde5726d", "score": "0.5989537", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n \"#{env.url.scheme}://#{env.url.host}/list/#{result['identifiers'][0]['identifier']}.xml?_key=#{CGI.escape(query['_key'][0].to_s)}\"\n end", "title": "" }, { "docid": "f6fa669f3eb0881477eb8bfb5f2a656d", "score": "0.5982412", "text": "def result_url(result)\n if result.respond_to? :url\n refinery.url_for result.url\n else\n refinery.url_for send(Refinery.route_for_model(result.class, :admin => false), result)\n end\n end", "title": "" }, { "docid": "17523094604b0e228743030a5ff92a62", "score": "0.5981049", "text": "def return_email(to, title, review_url)\n @title = title\n @review_url = review_url\n mail(subject: \"SmartFlix received '#{title}'\",\n to: Rails.env == 'production' ? to : SmartFlix::Application::EMAIL_TO_DEVELOPER,\n from: SmartFlix::Application::EMAIL_FROM).deliver\n end", "title": "" }, { "docid": "7454461e2df1dce983825b3ddae6df79", "score": "0.59753513", "text": "def to(url); end", "title": "" }, { "docid": "159745800e9d946fd6f4048725ffcd7e", "score": "0.5969955", "text": "def email_results\n if config.notification\n to_email = config.notification\n\n opts = {}\n opts[:subject] = \"#{config.harvestdor.log_name.chomp('.log')} into Solr server #{config[:solr][:url]} is finished\"\n opts[:body] = email_report_body\n begin\n send_email(to_email, opts)\n rescue => e\n logger.error('Failed to send email notification!')\n logger.error(e)\n end\n end\n end", "title": "" }, { "docid": "92e788914e3f6bc1611221cdcdc5dbb2", "score": "0.59684175", "text": "def article_email(user, articles)\n @user = user\n @url = \"http://craftsmanship.sv.cmu.edu\"\n #@url = \"http://127.0.0.1:3000\"\n @articles = articles\n mail(:to => user.email, :subject => \"Article Feeds Notification\")\n end", "title": "" }, { "docid": "50794e42d1549fe3a10b711a80b72a6c", "score": "0.5959353", "text": "def return_url\n {}\n end", "title": "" }, { "docid": "50794e42d1549fe3a10b711a80b72a6c", "score": "0.5959353", "text": "def return_url\n {}\n end", "title": "" }, { "docid": "a1ceed79c7b1c4f880ca775f6458a1a5", "score": "0.5954619", "text": "def url\n URL_STARTS_WITH + @contact_row.css(\"td.name a\").attr(\"href\").value\n end", "title": "" }, { "docid": "6c2d9cc9a7eb95bf12243164e4494a35", "score": "0.5950822", "text": "def url()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "6c2d9cc9a7eb95bf12243164e4494a35", "score": "0.5950822", "text": "def url()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "eb9622eeaba8f3e19f9bcecc5cef1f17", "score": "0.59490234", "text": "def url\n response[\"url\"]\n end", "title": "" }, { "docid": "eb9622eeaba8f3e19f9bcecc5cef1f17", "score": "0.59490234", "text": "def url\n response[\"url\"]\n end", "title": "" }, { "docid": "82848c8c8d2b2d1e2d5d2041762c8f09", "score": "0.5942475", "text": "def fake_url\n return source.to_s + pub_date.to_s + headline.to_s\n end", "title": "" }, { "docid": "3587d004cec9bfebb091102c296b680a", "score": "0.59374744", "text": "def email_results ( results )\n results.each do |userdb|\n userdb.reload\n params = { 'name' => userdb.user.firstname, 'mail' => userdb.user.login, 'db' => userdb.name, 'date' => userdb.created_on.to_date.to_s(:long), 'job_id' => userdb.job_id, 'str_id' => userdb.str_id, 'probability' => userdb.probability, 'match_name' => userdb.params['match_name'] }\n PdbalertMailer.deliver_mail_result(params)\n end\nend", "title": "" }, { "docid": "21e4c77e9c4f0305515be9356be0ae30", "score": "0.59368616", "text": "def shortened(user, url)\n @url = url\n\n mail to: user.email\n end", "title": "" }, { "docid": "8e51a03669a9d34892e2e6e508cdd340", "score": "0.5935077", "text": "def notify_submit(user, answer, home_url)\n @answer = answer\n @user = user\n @homework = answer.homework\n @url = @answer.download_link\n @root_url = home_url.chomp('/')\n mail(to: user.email, subject: \"[資訊之芽作業繳交留存] #{@homework.title} - #{@answer.title}\")\n end", "title": "" }, { "docid": "cba652d10e0b9b1f47ff2e12ff35af91", "score": "0.59254366", "text": "def create_url (target,from)\n url = 'https://'+@subdomain+'.'+@domain+':'+@port+'/render?target=stats.'+target.to_s+'&from=-'+from.to_s+'minute&rawData=true'\n end", "title": "" }, { "docid": "adad908bcc0db6cab87e953a3049beb3", "score": "0.59246975", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n \"#{env.url.scheme}://#{env.url.host}/index.php/api/entity?id=#{CGI.escape(result['identifiers'][0]['identifier'].to_s)}&key=#{CGI.escape(query['key'][0].to_s)}\"\n end", "title": "" }, { "docid": "e0e42756a60859454de9344891e9ee38", "score": "0.5916229", "text": "def url\n return @url\n end", "title": "" }, { "docid": "e0e42756a60859454de9344891e9ee38", "score": "0.5916229", "text": "def url\n return @url\n end", "title": "" }, { "docid": "e0e42756a60859454de9344891e9ee38", "score": "0.5916229", "text": "def url\n return @url\n end", "title": "" }, { "docid": "710445a572c9f4dacc9c82937bf9ac6b", "score": "0.5913523", "text": "def perform\n x = []\n x = deputy_information_url\n deputy_name_and_email (x)\nend", "title": "" }, { "docid": "cc307080dc4b457fd7998b3b40284f51", "score": "0.59090203", "text": "def url_for_hold\n queryarray = { func: 'item-hold-request',\n doc_library: 'MIT50',\n adm_doc_number: @doc_number,\n item_sequence: @item_sequence }\n\n url = URI::HTTP.build(host: 'library.mit.edu',\n path: '/F',\n query: queryarray.to_query)\n url.to_s\n end", "title": "" }, { "docid": "555dc08870d101d10ac7910b164a1fd9", "score": "0.59080434", "text": "def url; TelerivetBridge.url_for_message_id(id); end", "title": "" }, { "docid": "87c9e21aa7d81e6d20858cc1f916c1f9", "score": "0.5904779", "text": "def generate_url\n values = {\n business: \"[email protected]\",\n cmd: '_xclick',\n return: @return_url,\n custom: @user.id,\n invoice: Time.now,\n currency_code: 'GBP',\n amount: @product.price_in_pounds,\n no_shipping: 1,\n item_name: self.purchase_name,\n item_number: @product.id\n }\n\n \"https://www.paypal.com/cgi-bin/websr?\" + values.to_query\n end", "title": "" }, { "docid": "59dd345887c56233cb0dddf42337f78c", "score": "0.590218", "text": "def email\n\t\tdoc = Nokogiri::HTML(open(\"http://www2.assemblee-nationale.fr/deputes/fiche/OMC_PA719740\"))\n\t\tdoc.xpath('/html/body/div[3]/div/div/div/section[1]/div/article/div[3]/div/dl/dd[4]/ul/li[1]/a').each do |link|\n\t \tputs mail = link['href']\n\t\tend\n\tend", "title": "" }, { "docid": "3fa81e9f1ced4c0eec1cf9f9518e90a4", "score": "0.5892604", "text": "def emails; end", "title": "" }, { "docid": "642eac8ef210b4cf6d5b49e7a78a022f", "score": "0.5888508", "text": "def url(id)\n return \"http://quincy.myshopify.com/apps/powerreviews/review.html?pr_page_id=#{id}&pr_source=email\"\nend", "title": "" }, { "docid": "8731b2ed93f02ad74479a6ae778cdf3d", "score": "0.58872163", "text": "def scraping logs\n @logs = logs\n mail(\n to: ENV['RECEIVER_ADDRESS'],\n subject: \"#{DateTime.now}のレビュー取得結果\"\n )\n end", "title": "" }, { "docid": "f15547ea88b9a7e4cd265bb978e694ef", "score": "0.5886836", "text": "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n \"#{env.url.scheme}://#{env.url.host}/concession/#{result['identifiers'][0]['identifier']}?apikey=#{CGI.escape(query['apikey'][0].to_s)}\"\n end", "title": "" }, { "docid": "74871bfd7de66a36741acb9a25b8d83a", "score": "0.5883529", "text": "def url\n location.href\n end", "title": "" }, { "docid": "9cafc248f37bc2fcfbec58fa6a85ed4f", "score": "0.58692026", "text": "def to_s\n return super + \" pointing to #{@url}\"\n end", "title": "" }, { "docid": "9cafc248f37bc2fcfbec58fa6a85ed4f", "score": "0.58692026", "text": "def to_s\n return super + \" pointing to #{@url}\"\n end", "title": "" }, { "docid": "a7d0138d7d5cf81dfd95bb005e39f657", "score": "0.5868032", "text": "def send_enquiries\n BusinessEnquiry.send_business_enquiry\n\t redirect_to business_urls_path, notice: \"Business enquiries sent to the urls where email address was present.\"\n\tend", "title": "" }, { "docid": "c55ec5b1735902ff07c93d4a699b69bd", "score": "0.58676946", "text": "def show #print single subject on url\n end", "title": "" }, { "docid": "cf503ecbf38286b381f2108a14e862c5", "score": "0.5867316", "text": "def enquiry_url\n \"http://epathway.wollongong.nsw.gov.au/ePathway/Production/Web/GeneralEnquiry/EnquiryLists.aspx\"\n end", "title": "" }, { "docid": "cf503ecbf38286b381f2108a14e862c5", "score": "0.5867316", "text": "def enquiry_url\n \"http://epathway.wollongong.nsw.gov.au/ePathway/Production/Web/GeneralEnquiry/EnquiryLists.aspx\"\n end", "title": "" }, { "docid": "8ffc8e9ccd18b5993ea58d048ca61e3d", "score": "0.58593065", "text": "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "title": "" }, { "docid": "8ffc8e9ccd18b5993ea58d048ca61e3d", "score": "0.58593065", "text": "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "title": "" }, { "docid": "8ffc8e9ccd18b5993ea58d048ca61e3d", "score": "0.58593065", "text": "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "title": "" }, { "docid": "8ffc8e9ccd18b5993ea58d048ca61e3d", "score": "0.58593065", "text": "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "title": "" }, { "docid": "aa61df2e17ccd00a37d3b16dc668526f", "score": "0.5856419", "text": "def reservation_email(user)\n @user = user\n @url =\"http://\"\n mail(to: @user.email, subject: 'Reservation Confirmation')\n end", "title": "" } ]
32ab5951676d4d2b6a8bb25290a8f696
Common MEDLINE tags PMID PubMed Unique Identifier Unique number assigned to each PubMed citation.
[ { "docid": "4b787d595ccf5a354e87ee7965a723f2", "score": "0.6209587", "text": "def pmid\n @pubmed['PMID'].strip\n end", "title": "" } ]
[ { "docid": "4511d8154924fb2530d2fb83a652731c", "score": "0.6157933", "text": "def get_pubmed_id\n pub = PrimaryPublication.where(:study_id=>self.id).select('pmid');\n if pub.empty?\n return \"\"\n else\n return pub.first.pmid\n end\n end", "title": "" }, { "docid": "84828de7e3a96a280d7e1ed1d5ff1a07", "score": "0.5844998", "text": "def add_any_pubmed_data_to_hash\n return if pmid.blank?\n\n pubmed_record = PubmedSourceRecord.for_pmid(pmid)\n return if pubmed_record.nil?\n\n pubmed_hash = pubmed_record.source_as_hash\n pub_hash[:mesh_headings] = pubmed_hash[:mesh_headings] if pubmed_hash[:mesh_headings].present?\n pub_hash[:abstract] = pubmed_hash[:abstract] if pubmed_hash[:abstract].present?\n pmc_id = pubmed_hash[:identifier].detect { |id| id[:type] == 'pmc' }\n pub_hash[:identifier] << pmc_id if pmc_id\n end", "title": "" }, { "docid": "cd3267fd6f33c9dffb327cfcd829710f", "score": "0.5578839", "text": "def citation_id\n Rantly {\n sized(8) {\n string(:alnum)\n }\n }\n end", "title": "" }, { "docid": "37da86ac47c8345f8aa637206b5ccefc", "score": "0.5573012", "text": "def pubmed_update\n pubmed_source_xml = PubmedClient.new.fetch_records_for_pmid_list pmid\n pub_doc = Nokogiri::XML(pubmed_source_xml).xpath('//PubmedArticle')[0]\n return false unless pub_doc\n attrs = {}\n attrs[:source_data] = pub_doc.to_xml\n attrs[:source_fingerprint] = Digest::SHA2.hexdigest(pub_doc)\n update_attributes! attrs\n end", "title": "" }, { "docid": "1e2aeae606c9cc60da4614fdd7b3f5dd", "score": "0.55627376", "text": "def citation\n str = name\n if institution_id == 530\n str += ' PRONI '\n m = source.match /(T|D\\.*\\ *\\d+\\/*\\d*)/\n str += m[1] unless m.nil?\n end\n \"#{str} CMSIED #{serial}\"\n end", "title": "" }, { "docid": "b7f5d4a4a320b6e1d72802bd07486478", "score": "0.5430604", "text": "def mh\n @pubmed['MH'].strip.split(/\\n/)\n end", "title": "" }, { "docid": "a34634baca5ec7a1b9c00f2f64cd205f", "score": "0.54211533", "text": "def get_key_to_pmid(entry_node)\n hash = {}\n entry_node.xpath('./evidence').each do |node| \n pubmed_id = \n if att = node['attribute']\n if md = att.match(/^PubMed=(.*)/)\n Integer(md[1])\n end\n end\n evidence_key = node['key']\n hash[evidence_key] = pubmed_id\n end\n hash\nend", "title": "" }, { "docid": "19eaf26f176df6679018281f6b7e6d25", "score": "0.53347796", "text": "def get_citation(alt_ids = [])\n retVal = \"\"\n arr = Study.get_key_question_output(self.id)\n study_pub_info = Study.get_primary_pub_info(self.id)\n\n # List the Pubmed ID\n retVal += \"<strong>PubMed ID:</strong> #{study_pub_info.pmid.nil? ? \"None\" : study_pub_info.pmid.empty? ? \"None\" : study_pub_info.pmid}\"\n\n # Include any alternate identifiers\n alt_ids.each do |aid|\n retVal += \" | <strong>#{aid.number_type == 'internal' ? 'Internal ID' : aid.number_type}:</strong> #{aid.number} \"\n end\n\n # Include the rest of the study citation, Title, Author, Year, etc.\n retVal += \"<br/>#{study_pub_info.author}. <strong>#{study_pub_info.title.nil? ? 'Untitled' : study_pub_info.title}.</strong>\n <em>#{study_pub_info.journal}</em> #{ study_pub_info.year }. <strong>Vol.</strong> #{ study_pub_info.volume }\n <strong>Issue</strong> #{ study_pub_info.issue }<br/><br/>\n <strong>Assigned User: </strong> #{self.get_study_creator }&nbsp;&nbsp;|&nbsp;&nbsp;\n <strong>Key Questions Answered:</strong> #{ arr.sort.to_sentence }&nbsp;&nbsp;|&nbsp;&nbsp;\n <strong>Created:</strong> #{self.created_at.strftime(\"%B %d, %Y\")}&nbsp;&nbsp;|&nbsp;&nbsp;\n <strong>Last Updated:</strong> #{self.updated_at.strftime('%B %d, %Y')}\"\n return retVal\n end", "title": "" }, { "docid": "734ab4da3f21d09855accba0c25554a9", "score": "0.5270885", "text": "def get_pubmed_data\n\t@pmid = params[\"pmid\"]\n\t@pub_information = SecondaryPublication.get_summary_info_by_pmid(@pmid);\n\t@pub_type = 'primary'\n\trender 'shared/form_completion.js.erb'\nend", "title": "" }, { "docid": "ea3e7f89ddee6aeb3036e5ddbb9f3ad3", "score": "0.5245386", "text": "def pubmed_update\n return false unless Settings.PUBMED.lookup_enabled\n\n pubmed_source_xml = Pubmed.client.fetch_records_for_pmid_list pmid\n pub_doc = Nokogiri::XML(pubmed_source_xml).xpath('//PubmedArticle')[0]\n return false unless pub_doc\n\n attrs = {}\n attrs[:source_data] = pub_doc.to_xml\n attrs[:source_fingerprint] = Digest::SHA2.hexdigest(pub_doc)\n update! attrs\n end", "title": "" }, { "docid": "9a3b0f01fd7f2ce0fda59258b4ca3447", "score": "0.52443683", "text": "def ProcessElements2(reader)\n\tmcid_page_map = Hash.new\n\telement = reader.Next\n\twhile !element.nil? do\t# Read page contents\n\t\t# In this sample we process only text, but the code can be extended\n\t\t# to handle paths, images, or other Element type.\n\t\tmcid = element.GetStructMCID\n\t\t\n\t\tif mcid>=0 and element.GetType == Element::E_text\n\t\t\tval = element.GetTextString\n\t\t\t\n\t\t\tif mcid_page_map.has_key?(mcid)\n\t\t\t\tmcid_page_map[mcid] = mcid_page_map[mcid].to_s + val\n\t\t\telse\n\t\t\t\tmcid_page_map[mcid] = val\n\t\t\tend\n\t\tend\n\t\telement = reader.Next\n\tend\n\treturn mcid_page_map\nend", "title": "" }, { "docid": "8cff8d90e7c28d45bd25067f532637eb", "score": "0.5239083", "text": "def extract_iso19139_metadata(doc)\n h = {}\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString', NS).tap do |node|\n h[:title] = [node.text.strip]\n end\n\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox', NS).tap do |node|\n w = node.at_xpath('gmd:westBoundLongitude/gco:Decimal', NS).text.to_f\n e = node.at_xpath('gmd:eastBoundLongitude/gco:Decimal', NS).text.to_f\n n = node.at_xpath('gmd:northBoundLatitude/gco:Decimal', NS).text.to_f\n s = node.at_xpath('gmd:southBoundLatitude/gco:Decimal', NS).text.to_f\n h[:coverage] = GeoConcerns::Coverage.new(n, e, s, w).to_s\n end\n\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString', NS).tap do |node|\n h[:description] = [node.text.strip]\n end\n\n doc.xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue=\\'originator\\']', NS).each do |node|\n h[:creator] = begin\n [node.at_xpath('ancestor-or-self::*/gmd:individualName', NS).text.strip]\n rescue\n [node.at_xpath('ancestor-or-self::*/gmd:organisationName', NS).text.strip]\n end\n end\n\n # TODO: Not sure if custodian is the same as source\n doc.xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue=\\'custodian\\']', NS).each do |node|\n h[:source] = begin\n [node.at_xpath('ancestor-or-self::*/gmd:individualName', NS).text.strip]\n rescue\n [node.at_xpath('ancestor-or-self::*/gmd:organisationName', NS).text.strip]\n end\n end\n\n h\n end", "title": "" }, { "docid": "b8900e58caab57db8134e29f472cc03c", "score": "0.5141993", "text": "def gen_mermaid(file)\n markdown = []\n mermaid_content = nil\n in_markers = false\n idx_mermaid = 0\n File.read(file).split(\"\\n\").each do |line|\n # Logic is simple: Mermaid code blocks should be encapsulated between comment markers that will also include the generated diagram and the details setion.\n # We always regenerate the content between existing comment markers.\n # If those comment markers are missing, we will find Mermaid code blocks to add them.\n # We always re-generate all diagrams.\n if line == MARKER_BEGIN\n in_markers = true\n elsif line == MARKER_END\n in_markers = false\n elsif line == '```mermaid'\n mermaid_content = []\n elsif line == '```'\n # End any block, including Mermaid block\n if mermaid_content.nil?\n markdown << line\n else\n # We have a diagram to generate\n gen_file = \"docs/gen/mermaid/#{file}-#{idx_mermaid}.png\"\n puts \"Generate #{file} / Diagram ##{idx_mermaid} => #{gen_file}...\"\n FileUtils.mkdir_p File.dirname(gen_file)\n Tempfile.create('mermaid') do |mermaid_file|\n mermaid_file.write(mermaid_content.join(\"\\n\"))\n mermaid_file.flush\n mmdc_cmd = \"./node_modules/.bin/mmdc -p #{@puppeteer_conf} -i #{mermaid_file.path} -o #{gen_file} -w 2048\"\n raise \"Error while running mmdc: #{mmdc_cmd}\" unless system mmdc_cmd\n end\n markdown.concat [\n MARKER_BEGIN,\n \"![Mermaid diagram](/#{gen_file})\",\n '<details>',\n '<summary><sub><sup>Diagram code</sup></sub></summary>',\n '',\n '```mermaid'\n ] + mermaid_content + [\n '```',\n '</details>',\n MARKER_END\n ]\n idx_mermaid += 1\n mermaid_content = nil\n end\n elsif !mermaid_content.nil?\n # We are in a Mermaid content\n mermaid_content << line\n elsif !in_markers\n markdown << line\n end\n end\n File.write(file, markdown.map { |line| \"#{line}\\n\" }.join) if idx_mermaid.positive?\nend", "title": "" }, { "docid": "427005fba528db3fa576a79896f90c28", "score": "0.5112112", "text": "def create_meditation(author_id)\n meditation = Meditation.new\n\n meditation.author_id = author_id\n\n meditation.submission_id = DateTime.now.strftime('%Q').to_s\n meditation.title = BetterLorem.w(3+rand(5),true,true)\n meditation.theme = BetterLorem.w(3+rand(5),true,true)\n meditation.long_reading = BetterLorem.w(1,true,true) + \" #{rand(45)}:#{rand(16)}-#{rand(45)+16}\"\n meditation.quoted_scripture = BetterLorem.w(13+rand(13),true,true)\n meditation.citation = BetterLorem.w(1,true,true) + \" #{rand(45)}:#{rand(16)}-#{rand(45)+16}\"\n\n body_text = BetterLorem.p(1+rand(4)).split(' ')\n s = rand(body_text.size-7)\n e = s + rand(3)+1\n body_text[s] = \"<i>\" + body_text[s]\n body_text[e] = body_text[e] + \"</i>\"\n\n meditation.body_text = body_text.join(' ')\n meditation.prayer = BetterLorem.p(1,true,false)\n meditation.thought_for_the_day = BetterLorem.w(3+rand(10),true,true)\n meditation.prayer_focus = BetterLorem.w(3+rand(6),true,true)\n\n return meditation\nend", "title": "" }, { "docid": "9ed09098a0b478de4cf88d90d4f5185e", "score": "0.5102556", "text": "def update_unique_ids(env, content)\n doc_xml = env.document.zip_contents[env.document.current_entry]\n dom_entry = env.document[env.document.current_entry]\n #\n # update all docPr tags created\n selector = \"//*[local-name() = 'docPr']\"\n init_id_val = dom_entry.max_attribute_value(doc_xml, selector, 'id')\n update_tag_attribute(content, 'docPr', 'id', init_id_val)\n #\n # update all cNvPr tags created\n selector = \"//*[local-name() = 'cNvPr']\"\n init_id_val = dom_entry.max_attribute_value(doc_xml, selector, 'id')\n update_tag_attribute(content, 'cNvPr', 'id', init_id_val)\n end", "title": "" }, { "docid": "42f98e7f3cc39b79ab6e365bad117d63", "score": "0.5082713", "text": "def get_prots_with_nglyc_motif(prots_id_array)\r\n prots_hash = {}\r\n motifs = {}\r\n prots_id_array.each do |id|\r\n prots_hash[id] = (read_online_fasta(\"http://www.uniprot.org/uniprot/#{id}.fasta\")).values[0]\r\n end\r\n prots_hash.each do |id, seq|\r\n pos = find_nglycosylation_motif(seq)\r\n if !(pos.empty?)\r\n motifs[id] = pos\r\n end\r\n end\r\n return motifs\r\nend", "title": "" }, { "docid": "42f98e7f3cc39b79ab6e365bad117d63", "score": "0.5082711", "text": "def get_prots_with_nglyc_motif(prots_id_array)\r\n prots_hash = {}\r\n motifs = {}\r\n prots_id_array.each do |id|\r\n prots_hash[id] = (read_online_fasta(\"http://www.uniprot.org/uniprot/#{id}.fasta\")).values[0]\r\n end\r\n prots_hash.each do |id, seq|\r\n pos = find_nglycosylation_motif(seq)\r\n if !(pos.empty?)\r\n motifs[id] = pos\r\n end\r\n end\r\n return motifs\r\nend", "title": "" }, { "docid": "78548a579e5be5e80ffe6de731d81ac5", "score": "0.50796044", "text": "def repeating\n dc_terms_is_part_of\n dc_contributor_author\n dc_identifier_orcid\n dc_contributor_advisor\n degree_fields\n dc_contributor_department\n rights_fields\n end", "title": "" }, { "docid": "e1bb07ae0a1c4fd2a7dfcd37925c035d", "score": "0.506865", "text": "def parse_pubmed_article(pubmed_article)\n Hash[:publication => {}, :journal => {}].tap do |pub_hash|\n medline_cite = pubmed_article['MedlineCitation']\n\n if medline_cite\n pub_hash[:publication].merge!(parse_medline_cite(medline_cite))\n pub_hash[:publication][:pmc_id] = pubmed_article['PubmedData']['ArticleIdList']['ArticleId'].detect { |e| e =~ /PMC/ }\n article = medline_cite['Article']\n end\n\n if article \n pub_hash[:publication].merge!(parse_article(article)) \n journal = article['Journal']\n end\n\n if journal\n pub_hash[:journal].merge!(parse_journal(journal))\n journal_issue = journal['JournalIssue']\n end\n\n if journal_issue\n pub_hash[:publication].merge!(parse_journal_issue(journal_issue))\n end\n end\n end", "title": "" }, { "docid": "641418a0fa82fabb1abf4b0e7e0939d4", "score": "0.50444597", "text": "def unique_tag\n \t\tabbr = self.author.split(\" \").collect do |sub_string|\n \t\t\tsub_string[0]\n \tend\n\n \tabbr.join + '#' + self.id.to_s\n end", "title": "" }, { "docid": "425ba6294424be96e11dae53afbe386c", "score": "0.5009749", "text": "def publisher_id\n 340\n end", "title": "" }, { "docid": "ce988f0fa371525f8947221c5e554d93", "score": "0.5007509", "text": "def pmc_link\n \"https://www.ncbi.nlm.nih.gov/pmc/articles/#{pmcid}\"\n end", "title": "" }, { "docid": "32db39870f553ca6f98ab34d699644b2", "score": "0.5005548", "text": "def bibliographic\n %Q(<mets:dmdSec ID=\"dmdSec1\" CREATED=\"#{mets_data[:created_at]}\">\n <mets:mdWrap MDTYPE=\"#{@source.xml_type}\">\n <mets:xmlData>\n #{@source.xml_data}\n </mets:xmlData>\n </mets:mdWrap>\n </mets:dmdSec>)\n end", "title": "" }, { "docid": "9f6d01ed0fbff84f27a00838c76db5f5", "score": "0.5005346", "text": "def process_pmid(author, pmid)\n pub = PubmedSourceRecord.get_pub_by_pmid(pmid)\n # Make sure author is assigned\n author.assign_pub(pub)\n end", "title": "" }, { "docid": "45464341d4481599d4141515bc208770", "score": "0.5003589", "text": "def highwire_press_meta_tags(document)\n highwire_press_meta_tags = [] \n\n # citation_title \n highwire_press_meta_tags << meta_tag(\"citation_title\", title(document, string_output: true))\n # citation_author\n authors = author(document)\n authors.each { |name| highwire_press_meta_tags << meta_tag(\"citation_author\", name) } unless authors.nil? \n # citation_date\n highwire_press_meta_tags << meta_tag(\"citation_publication_date\", meta_date(document))\n # citation_publisher\n highwire_press_meta_tags << meta_tag(\"citation_publisher\", publisher(document, string_output: true))\n # citation_journal_title\n highwire_press_meta_tags << meta_tag(\"citation_journal_title\", journal_title(document, string_output: true))\n # citation_volume\n highwire_press_meta_tags << meta_tag(\"citation_volume\", journal_volume(document, string_output: true))\n # citation_issue\n highwire_press_meta_tags << meta_tag(\"citation_issue\", journal_issue(document, string_output: true))\n # citation_firstpage\n highwire_press_meta_tags << meta_tag(\"citation_firstpage\", journal_start_page(document, string_output: true))\n # citation_lastpage\n highwire_press_meta_tags << meta_tag(\"citation_lastpage\", journal_end_page(document, string_output: true))\n # citation_doi\n highwire_press_meta_tags << meta_tag(\"citation_doi\", doi(document, string_output: true)) \n # citation_issn\n highwire_press_meta_tags << meta_tag(\"citation_issn\", print_issn(document, string_output: true))\n highwire_press_meta_tags << meta_tag(\"citation_issn\", electronic_issn(document, string_output: true))\n # citation_isbn\n highwire_press_meta_tags << meta_tag(\"citation_isbn\", isbn(document, string_output: true))\n # citation_keywords\n highwire_press_meta_tags << meta_tag(\"citation_keywords\", keywords(document, string_output: true))\n # citation_language\n highwire_press_meta_tags << meta_tag(\"citation_language\", language(document, string_output: true))\n # citation_pdf_url\n highwire_press_meta_tags << meta_tag(\"citation_pdf_url\", pdf_url(document))\n # citation_dissertation_institution \n highwire_press_meta_tags << meta_tag(\"citation_dissertation_institution\", dissertation_institution(document))\n # citation_technical_report_institution \n highwire_press_meta_tags << meta_tag(\"citation_technical_report_institution\", report_institution(document))\n # citation_abstract_html_url\n highwire_press_meta_tags << meta_tag(\"citation_abstract_html_url\", abstract_html_url(document))\n # citation_fulltext_html_url\n highwire_press_meta_tags << meta_tag(\"citation_fulltext_html_url\", fulltext_html_url(document))\n\n return highwire_press_meta_tags.compact\n end", "title": "" }, { "docid": "65818c4f71030b99a7bfcc736c3df2f6", "score": "0.50022054", "text": "def internal_id; Minuit.pout(@id)[5]; end", "title": "" }, { "docid": "2a2eec916e51fa498ee07ae46569c4e6", "score": "0.4998111", "text": "def _parse_multiverse_id doc\n src = doc.css('img#ctl00_ctl00_ctl00_MainContent_SubContent_SubContent_cardImage').first['src']\n src =~ /multiverseid=(.*?)&/\n $1\n end", "title": "" }, { "docid": "47f1b75dacc3e5b4445e7e25e085c4be", "score": "0.4993162", "text": "def group_id64; end", "title": "" }, { "docid": "9b5de0c0cce681f33c17001a3e78b1ff", "score": "0.49912506", "text": "def bib_id\n element = @mets.xpath(\"/mets:mets/mets:dmdSec/mets:mdRef/@xlink:href\")\n content = element.to_s\n content.gsub(/.*\\//, \"\")\n end", "title": "" }, { "docid": "01ae05a113a5dfcea420b16a9c14c3b9", "score": "0.4981133", "text": "def composite_med_proc_id\n qualifier = facility.sitecode =~ /^0*00S66$/ ? 'AD' : 'HC'\n elem = []\n proc_code = (service.service_procedure_code.blank? ? 'ZZ' + @delimiter.to_s +\n 'E01' : qualifier + @delimiter.to_s + service.service_procedure_code)\n proc_code = 'ZZ' + @delimiter.to_s + 'E01' if service.service_procedure_code.to_s == 'ZZE01'\n modifier_condition = (@facility_config.details['svc_segment'] && (@facility_config.details['svc_segment']['1'].to_s == '[CPT Code + Modifiers]'))\n elem = modifier_condition ? [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4] : [proc_code]\n elem = Output835.trim_segment(elem)\n elem.join(@delimiter)\n end", "title": "" }, { "docid": "c28292045077359139d7beb9ae889f96", "score": "0.49741042", "text": "def public_id; end", "title": "" }, { "docid": "c28292045077359139d7beb9ae889f96", "score": "0.49741042", "text": "def public_id; end", "title": "" }, { "docid": "05ae930b115baa2173e0b8fc245e6989", "score": "0.49617502", "text": "def InsertPublication(publication, update_if_pmc_exists=false)\n puts \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n raise \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n thePub = nil\n medline = Bio::MEDLINE.new(publication) # convert retrieved format into the medline format\n reference = medline.reference\n pubmed_central_id = medline.pubmed_central\n pubmed_central_id = nil if pubmed_central_id.blank?\n if reference.pubmed.blank?\n puts \"pubmed_id was blank for reference #{medline.inspect}\"\n return nil\n end\n publication_date = check_date(medline.publication_date, medline.electronic_publication_date, medline.deposited_date, reference.pubmed)\n thePub = Abstract.find_by_pubmed_include_deleted(reference.pubmed)\n begin \n if thePub.nil? || thePub.id < 1 then\n thePub = Abstract.create!(\n :endnote_citation => reference.endnote, \n :abstract => reference.abstract,\n :authors => reference.authors.join(\"\\n\"),\n :full_authors => medline.full_authors,\n :publication_date => publication_date,\n :electronic_publication_date => medline.electronic_publication_date,\n :deposited_date => medline.deposited_date,\n :status => medline.status,\n :publication_status => medline.publication_status,\n :title => reference.title,\n :publication_type => medline.publication_type[0],\n :journal => medline.full_journal[0..253],\n :journal_abbreviation => medline.ta, #journal Title Abbreviation\n :issn => medline.issn,\n :volume => reference.volume,\n :issue => reference.issue,\n :pages => reference.pages,\n :year => reference.year,\n :pubmed => reference.pubmed,\n :pubmedcentral => pubmed_central_id,\n :url => reference.url,\n :mesh => reference.mesh.is_a?(String) ? reference.mesh : reference.mesh.join(\";\\n\")\n )\n else\n if thePub.publication_date != publication_date || thePub.status != medline.status || thePub.publication_status != medline.publication_status || (thePub.pubmedcentral != pubmed_central_id) || thePub.issn != medline.issn then\n thePub.endnote_citation = reference.endnote\n thePub.publication_date = publication_date if ! publication_date.blank?\n thePub.electronic_publication_date = medline.electronic_publication_date if ! medline.electronic_publication_date.blank?\n thePub.deposited_date = medline.deposited_date\n thePub.publication_status = medline.publication_status\n thePub.status = medline.status\n thePub.issn = medline.issn if ! medline.issn.blank?\n thePub.volume = reference.volume\n thePub.issue = reference.issue\n thePub.pages = reference.pages\n thePub.year = reference.year\n thePub.pubmed = reference.pubmed\n thePub.pubmedcentral = pubmed_central_id\n thePub.url = reference.url\n thePub.mesh = reference.mesh.is_a?(String) ? reference.mesh : reference.mesh.join(\";\\n\")\n thePub.save!\n end\n # HandleMeshTerms(thePub.mesh, thePub.id)\n end\n rescue ActiveRecord::RecordInvalid => exc\n if thePub.nil? then # something bad happened\n puts \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}. error message: #{exc.message}\"\n raise \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}. error message: #{exc.message}\"\n end\n end \n thePub\nend", "title": "" }, { "docid": "0838ef52be1ef812940142a9bd0df606", "score": "0.49261463", "text": "def extract_pubmed_id(xml)\n doc = Nokogiri::XML(xml)\n doc.xpath('eSearchResult//IdList//Id').first&.text\n end", "title": "" }, { "docid": "f5b0b4394029cfb99ccaa606a6d6b6c4", "score": "0.49258918", "text": "def InsertPublication(publication, update_if_pmc_exists=false)\n puts \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n raise \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n thePub = nil\n medline = Bio::MEDLINE.new(publication) # convert retrieved format into the medline format\n reference = medline.reference\n pubmed_central_id = medline.pubmed_central\n pubmed_central_id = nil if pubmed_central_id.blank?\n thePub = Abstract.find_by_pubmed(reference.pubmed)\n begin \n if thePub.nil? || thePub.id < 1 then\n thePub = Abstract.create!(\n :endnote_citation => reference.endnote, \n :abstract => reference.abstract,\n :authors => reference.authors.join(\"\\n\"),\n :full_authors => medline.full_authors,\n :publication_date => medline.publication_date,\n :electronic_publication_date => medline.electronic_publication_date,\n :deposited_date => medline.deposited_date,\n :status => medline.status,\n :publication_status => medline.publication_status,\n :title => reference.title,\n :publication_type => medline.publication_type[0],\n :journal => medline.full_journal[0..253],\n :journal_abbreviation => medline.ta, #journal Title Abbreviation\n :volume => reference.volume,\n :issue => reference.issue,\n :pages => reference.pages,\n :year => reference.year,\n :pubmed => reference.pubmed,\n :pubmedcentral => pubmed_central_id,\n :url => reference.url,\n :mesh => reference.mesh.join(\";\\n\")\n )\n else\n if thePub.publication_date != medline.publication_date || thePub.status != medline.status || thePub.publication_status != medline.publication_status || (update_if_pmc_exists and ! pubmed_central_id.blank?) then\n thePub.endnote_citation = reference.endnote\n thePub.publication_date = medline.publication_date\n thePub.electronic_publication_date = medline.electronic_publication_date\n thePub.deposited_date = medline.deposited_date\n thePub.publication_status = medline.publication_status\n thePub.status = medline.status\n thePub.volume = reference.volume\n thePub.issue = reference.issue\n thePub.pages = reference.pages\n thePub.year = reference.year\n thePub.pubmed = reference.pubmed\n thePub.pubmedcentral = pubmed_central_id\n thePub.url = reference.url\n thePub.mesh = reference.mesh.join(\";\\n\")\n thePub.save!\n end\n # HandleMeshTerms(thePub.mesh, thePub.id)\n end\n rescue ActiveRecord::RecordInvalid\n if thePub.nil? then # something bad happened\n puts \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n raise \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n end\n end \n thePub\nend", "title": "" }, { "docid": "54b2f4e981e5c450c09a1df30ee83b18", "score": "0.49190536", "text": "def fetch_pubmed_ids\n rtn = []\n retstart = 0\n retmax = 500\n total_count = @count\n\n while retstart < total_count\n rtn += EUtilities.esearch(\n db: 'pubmed',\n retstart: retstart,\n retmax: retmax,\n query_key: @query_key,\n webenv: @webenv\n ).scan(/<Id>(\\d+)<\\/Id>/).flatten\n\n retstart += retmax\n retstart = total_count unless retstart < total_count\n end\n rtn\n end", "title": "" }, { "docid": "3a214eae29ff42e7019028f231b1e0ae", "score": "0.49167722", "text": "def canonical_id; end", "title": "" }, { "docid": "dd7f2d119a796b94cca1f0728595b86a", "score": "0.49043778", "text": "def to_ccr_immunizations(xml, patient)\n if patient.immunizations.present?\n xml.Immunizations do\n patient.immunizations.each_with_index do |immunization, index|\n xml.Immunization do\n xml.CCRDataObjectID(\"IM000#{index + 1}\")\n to_ccr_date(xml, immunization.as_point_in_time, \"Prescription Date\") \n xml.Type do\n xml.Text(\"Immunization\")\n end\n active_status_and_source(xml, patient)\n xml.Product do\n xml.ProductName do\n xml.Text(immunization.description)\n end\n xml.BrandName do\n xml.Text(immunization.description)\n code_section(xml, immunization.codes)\n end\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "7ad31eb5b979375254229cac45f53d0d", "score": "0.4901208", "text": "def publisher_code_and_title\n @code[(group_identifier.length + 3)..11].join\n end", "title": "" }, { "docid": "8ed1cfba7583ef074df4960c881199c8", "score": "0.48883992", "text": "def to_id # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity\n out = pubid[0].to_s\n if pubid.size > 1\n out += pubid[1].edition_to_s if pubid[0].edition.nil?\n out += pubid[1].draft_to_s if pubid[0].draft.nil?\n out += pubid[1].rev_to_s if pubid[0].rev.nil?\n out += pubid[1].corr_to_s if pubid[0].corr.nil?\n out += pubid[1].amd_to_s if pubid[0].amd.nil?\n out += pubid[1].year_to_s if pubid[0].year.nil?\n out += pubid[1].month_to_s if pubid[0].month.nil?\n out += pubid[1].redline_to_s unless pubid[0].redline\n end\n out\n end", "title": "" }, { "docid": "eead1888a34e88da42943a82f5525028", "score": "0.48873758", "text": "def set_pub_citation(record)\n pub_citation = []\n Traject::MarcExtractor.cached('260:264').collect_matching_lines(record) do |field, spec, extractor|\n a_pub_info = nil\n b_pub_info = nil\n pub_info = \"\"\n field.subfields.each do |s_field|\n a_pub_info = Traject::Macros::Marc21.trim_punctuation(s_field.value).strip if s_field.code == 'a'\n b_pub_info = Traject::Macros::Marc21.trim_punctuation(s_field.value).strip if s_field.code == 'b'\n end\n\n # Build publication info string and add to citation array.\n pub_info += a_pub_info unless a_pub_info.nil?\n pub_info += \": \" if !a_pub_info.nil? and !b_pub_info.nil?\n pub_info += b_pub_info unless b_pub_info.nil?\n pub_citation << pub_info if !pub_info.empty?\n end\n pub_citation\n end", "title": "" }, { "docid": "fc33327e95ea77cc974ee6eaf87e332b", "score": "0.4880991", "text": "def medications\n get_data_elements('medication')\n end", "title": "" }, { "docid": "d1edf7e00524bb521720c839144c0224", "score": "0.4868962", "text": "def get_citation line_array\n begin\n # re-using the code in secondary publication\n # the order is title,authors,country,year,journal_title,volume,issue\n puts \"----------STARTING ON CITATION...#{line_array}\"\n title = line_array[@@title].nil? ? \"\" : line_array[@@title].strip\n pmid = line_array[@@pmID].nil? ? \"\" : line_array[@@pmID].strip\n puts \"Title and PMID are: #{title}, #{pmid}\"\n citation_list = []\n if title.blank?\n unless pmid.blank?\n puts \"title was blank.\"\n citation_list = SecondaryPublication.get_summary_info_by_pmid(pmid)\n puts \"captured: #{citation_list.join(',')}\"\n else\n citation_list = [\"-- No Title Entered --\",\"\",\"\",\"\",\"\",\"\",\"\"]\n end\n else\n puts \"title was not blank.\"\n citation_list = [title,line_array[@@author],line_array[@@affiliation],\n line_array[@@year],line_array[@@journal],\n line_array[@@volume],line_array[@@issue]]\n end\n labels = [:title,:author,:country,:year,:journal,:volume,:issue]\n return Hash[labels.zip(citation_list)]\n rescue Exception => e\n puts \"ERROR WHILE FETCHING CITATION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n end", "title": "" }, { "docid": "8202c8277ec97190d9c22c6f5e6b7496", "score": "0.48602355", "text": "def buildIMD()\n\t\t#DDU = D, SCF = S, NDC = B, ASF = F, None = N\n\t\tfacilityTypes = {'D' => '1', 'S' => '2', 'B' => '3', 'F' => '4', 'N' => '5'} \n\t\tlines = []\n\t\tsampleCount = 0\n\t\tfacilityTypes.keys.each do |dri|\n\t\t\[email protected] do |d|\n\t\t\t\tif d['Destination Rate Indicator'] == dri\n\t\t\t\t\tpic = d['Tracking Number'].ljust(34, ' ')\n\t\t\t\t\tweight = imdWeight(d['Weight'])\n\t\t\t\t\tlength = imdSize(d['Length'])\n\t\t\t\t\theight = imdSize(d['Height'])\n\t\t\t\t\twidth = imdSize(d['Width'])\n\t\t\t\t\tgirth = imdSize(d['Dimensional Weight'])\n\t\t\t\t\tzip = d['Destination ZIP Code'] if @domClasses.include?(d['Mail Class'])\n\t\t\t\t\tzip = '00000' if @intClasses.include?(d['Mail Class'])\n\t\t\t\n\t\t\t\t\trateType = imdRate(d['Rate Indicator'])\n\t\t\t\t\tif d['Mail Class'] == 'IE'\n\t\t\t\t\t\tif d['Rate Indicator'] == 'E4'\n\t\t\t\t\t\t\tshape = 'F4'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'E6'\n\t\t\t\t\t\t\tshape = 'F6'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'E8'\n\t\t\t\t\t\t\tshape = 'F8'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'PA'\n\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\t\tsortation = 'PA'\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif rateType == 'shape'\n\t\t\t\t\t\t\t\tshape = d['Rate Indicator']\n\t\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\t\telsif rateType == 'sortation'\n\t\t\t\t\t\t\t\tsortation = d['Rate Indicator']\n\t\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif rateType == 'shape'\n\t\t\t\t\t\t\tshape = d['Rate Indicator']\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif rateType == 'sortation'\n\t\t\t\t\t\t\tsortation = d['Rate Indicator']\n\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\n\t\t\t\t\tcountryCode = ' ' if @domClasses.include?(d['Mail Class'])\n\t\t\t\t\tcountryCode = d['Destination Country Code'] if @intClasses.include?(d['Mail Class'])\n\t\t\t\n\t\t\t\t\tsampleLine = \" D#{pic}#{weight}#{length}#{height}#{width}#{girth}#{zip}YN#{shape}#{d['Processing Category']}NNNNNNNNNNNN0.0000000N#{d['Mail Class']}#{sortation}N NA NANNA#{' '.ljust(240, ' ')}#{countryCode} #{Time.now.strftime('%m%d%Y')}#{@time}NNNNNNNNNN\"\n\t\t\t\t\t#sampleLine = \" D#{pic}#{weight}#{length}#{height}#{width}#{girth}#{zip}YN#{shape}#{d['Processing Category']}NNNNNNNNNNNN0.0000000N#{d['Mail Class']}#{sortation}N NA NANNA#{' '.ljust(240, ' ')}#{countryCode} 01132013#{@time}NNNNNNNNNN\"\n\t\t\t\t\tlines << sampleLine\n\t\t\t\t\tsampleCount = sampleCount + 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif sampleCount > 0\n\t\t\t\tnumRecords = sampleCount.to_s.rjust(3, '0')\n\t\t\t\timdFileName = @fileName.gsub(/PTS-SBP-Extract-/, 'SBP_')\n\t\t\t\timdFile = File.open(\"#{imdFileName}_IMD_#{dri}.evs\", 'w')\n\t\t\t\timdHeader = (\"eVS1H#{@facilityZIP} #{facilityTypes[dri]}#{Time.now.strftime(\"%m%d%Y\")}THDSN0 N#{numRecords}#{@mid}3.0 NN030\").ljust(112, ' ')\n\t\t\t\t#imdHeader = (\"eVS1H#{@facilityZIP} #{facilityTypes[dri]}01132013THDSN0 N#{numRecords}#{@mid}3.0 NN030\").ljust(112, ' ') #Hard-coded date for date-sensitive testing.\n\t\t\t\timdFile.write(imdHeader)\n\t\t\t\tlines.each do |line|\n\t\t\t\t\timdFile.write(\"\\n\")\n\t\t\t\t\timdFile.write(line)\n\t\t\t\tend\n\t\t\t\timdFile.close()\n\t\t\t\timdSem = File.open(\"#{imdFileName}_IMD_#{dri}.sem\", 'w')\n\t\t\t\timdSem.close()\n\t\t\t\tlines.clear()\n\t\t\t\tsampleCount = 0\n\t\t\t\tputs \"Built SBP IMD sample (.evs/.sem) for STC #{@stc} and Facility Type #{dri}!\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "1fce293962a32b9745a5c4f22085fcf9", "score": "0.48593685", "text": "def to_ccr_medications(xml, patient)\n if patient.medications.present?\n xml.Medications do\n patient.medications.each_with_index do |medication, index|\n xml.Medication do\n xml.CCRDataObjectID(\"MD000#{index + 1}\")\n to_ccr_date(xml, medication.as_point_in_time, \"Prescription Date\") \n xml.Type do\n xml.Text(\"Medication\")\n end\n active_status_and_source(xml, patient)\n xml.Product do\n xml.ProductName do\n xml.Text(medication.description)\n end\n xml.BrandName do\n xml.Text(medication.description)\n code_section(xml, medication.codes)\n end\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "6f9f1c86bf8d604dda9fdd264de09770", "score": "0.48313802", "text": "def composite_med_proc_id\n elem = []\n if (cpt_code.blank? and revenue_code.blank?)\n proc_code = \"HC:XXXXX\"\n elsif ((!cpt_code.blank? and !revenue_code.blank?)|| revenue_code.blank?)\n proc_code = \"HC:#{cpt_code}\"\n else\n proc_code = \"NU:#{revenue_code}\"\n end\n\n # proc_code = ((!cpt_code.blank? and !revenue_code.blank?) || revenue_code.blank?) ? \"HC:#{cpt_code}\" : \"NU:#{revenue_code}\"\n elem = [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4]\n elem = Output835.trim_segment(elem)\n elem.join(':')\n end", "title": "" }, { "docid": "1b9bfe12e046b807d101e14bc0667e1b", "score": "0.48277754", "text": "def mnemo_id\n\n Rufus::Mnemo.from_i(h.subid[0, 9].to_i(16))\n end", "title": "" }, { "docid": "e7fdda2240f2113e1f3b27b896be3c87", "score": "0.4825579", "text": "def citation\n return nil unless owner.present? && dmp_id.is_a?(Identifier)\n\n # authors = owner_and_coowners.map { |author| author.name(false) }\n # .uniq\n # .sort { |a, b| a <=> b }\n # .join(\", \")\n # TODO: display all authors once we determine the appropriate way to handle on the ORCID side\n authors = owner.name(false)\n pub_year = updated_at.strftime('%Y')\n app_name = ApplicationService.application_name\n link = dmp_id.value\n \"#{authors}. (#{pub_year}). \\\"#{title}\\\" [Data Management Plan]. #{app_name}. #{link}\"\n end", "title": "" }, { "docid": "7a447fe53e2c88fc375a342cf7cc879b", "score": "0.48163193", "text": "def pudl_id\n elements = @mets.xpath(\"/mets:mets/mets:metsHdr/mets:metsDocumentID\")\n element = elements.first\n content = element.content\n content.gsub(/\\.mets/, \"\")\n end", "title": "" }, { "docid": "1850fc06c7c71b64965accc6079a3622", "score": "0.48064628", "text": "def doi\n @pubmed['AID'][/(\\S+) \\[doi\\]/, 1]\n end", "title": "" }, { "docid": "6d58c888a25ab6f41ebc6688dedd3720", "score": "0.4798828", "text": "def id_shared_record_set(rec)\n shared_set = nil\n Traject::MarcExtractor.cached('919| |a:773|0 |t', alternate_script: false).each_matching_line(rec) do |field, _spec, _extractor|\n value = field.value.downcase\n case value\n when 'dwsgpo'\n shared_set = 'dws'\n when 'troup'\n shared_set = 'oupp'\n when /^center for research libraries \\(crl\\) eresources \\(online collection\\)/\n shared_set = 'crl'\n end\n end\n shared_set\n end", "title": "" }, { "docid": "e35dd8044b748572c6c12055fe86686e", "score": "0.4792645", "text": "def buildIMD()\n\t\t#DDU = D, SCF = S, NDC = B, ASF = F, None = N\n\t\tfacilityTypes = {'D' => '1', 'S' => '2', 'B' => '3', 'F' => '4', 'N' => '5'} \n\t\tdetails = pullDetails()\n\t\tlines = []\n\t\tsampleCount = 0\n\t\tfacilityTypes.keys.each do |dri|\n\t\t\tdetails.each do |d|\n\t\t\t\tif d['Destination Rate Indicator'] == dri\n\t\t\t\t\tpic = d['Tracking Number'].ljust(34, ' ')\n\t\t\t\t\tweight = imdWeight(d['Weight'])\n\t\t\t\t\tlength = imdSize(d['Length'])\n\t\t\t\t\theight = imdSize(d['Height'])\n\t\t\t\t\twidth = imdSize(d['Width'])\n\t\t\t\t\tgirth = imdSize(d['Dimensional Weight'])\n\t\t\t\t\tzip = d['Destination ZIP Code'] if @domClasses.include?(d['Mail Class'])\n\t\t\t\t\tzip = '00000' if @intClasses.include?(d['Mail Class'])\n\t\t\t\n\t\t\t\t\trateType = imdRate(d['Rate Indicator'])\n\t\t\t\t\tif d['Mail Class'] == 'IE'\n\t\t\t\t\t\tif d['Rate Indicator'] == 'E4'\n\t\t\t\t\t\t\tshape = 'F4'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'E6'\n\t\t\t\t\t\t\tshape = 'F6'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'E8'\n\t\t\t\t\t\t\tshape = 'F8'\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif d['Rate Indicator'] == 'PA'\n\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\t\tsortation = 'PA'\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif rateType == 'shape'\n\t\t\t\t\t\t\t\tshape = d['Rate Indicator']\n\t\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\t\telsif rateType == 'sortation'\n\t\t\t\t\t\t\t\tsortation = d['Rate Indicator']\n\t\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif rateType == 'shape'\n\t\t\t\t\t\t\tshape = d['Rate Indicator']\n\t\t\t\t\t\t\tsortation = 'NA'\n\t\t\t\t\t\telsif rateType == 'sortation'\n\t\t\t\t\t\t\tsortation = d['Rate Indicator']\n\t\t\t\t\t\t\tshape = 'NA'\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\n\t\t\t\t\tcountryCode = ' ' if @domClasses.include?(d['Mail Class'])\n\t\t\t\t\tcountryCode = d['Destination Country Code'] if @intClasses.include?(d['Mail Class'])\n\t\t\t\n\t\t\t\t\tsampleLine = \" D#{pic}#{weight}#{length}#{height}#{width}#{girth}#{zip}YN#{shape}#{d['Processing Category']}NNNNNNNNNNNN0.0000000N#{d['Mail Class']}#{sortation}N NA NANNA#{' '.ljust(240, ' ')}#{countryCode} #{Time.now.strftime('%m%d%Y')}#{@time}NNNNNNNNNN\"\n\t\t\t\t\t#sampleLine = \" D#{pic}#{weight}#{length}#{height}#{width}#{girth}#{zip}YN#{shape}#{d['Processing Category']}NNNNNNNNNNNN0.0000000N#{d['Mail Class']}#{sortation}N NA NANNA#{' '.ljust(240, ' ')}#{countryCode} 01132013#{@time}NNNNNNNNNN\"\n\t\t\t\t\tlines << sampleLine\n\t\t\t\t\tsampleCount = sampleCount + 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif sampleCount > 0\n\t\t\t\tnumRecords = sampleCount.to_s.rjust(3, '0')\n\t\t\t\timdFile = File.open(\"#{@fileName}_IMD_#{dri}.evs\", 'w')\n\t\t\t\timdHeader = (\"eVS1H#{@facilityZIP} #{facilityTypes[dri]}#{Time.now.strftime(\"%m%d%Y\")}THDSN0 N#{numRecords}#{@mid}3.0 NN030\").ljust(112, ' ')\n\t\t\t\t#imdHeader = (\"eVS1H#{@facilityZIP} #{facilityTypes[dri]}01132013THDSN0 N#{numRecords}#{@mid}3.0 NN030\").ljust(112, ' ') #Hard-coded date for date-sensitive testing.\n\t\t\t\timdFile.write(imdHeader)\n\t\t\t\tlines.each do |line|\n\t\t\t\t\timdFile.write(\"\\n\")\n\t\t\t\t\timdFile.write(line)\n\t\t\t\tend\n\t\t\t\timdFile.close()\n\t\t\t\timdSem = File.open(\"#{@fileName}_IMD_#{dri}.sem\", 'w')\n\t\t\t\timdSem.close()\n\t\t\t\tlines.clear()\n\t\t\t\tsampleCount = 0\n\t\t\t\tputs \"Built IMD sample (.evs/.sem) for #{@mailClass} and Facility Type #{dri}!\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a6e620ba4df60a4e4ed5207a20574f2d", "score": "0.47880486", "text": "def meid\n return @meid\n end", "title": "" }, { "docid": "bfdf642170249b5c040d16f40fed5c19", "score": "0.47868055", "text": "def get_medications(patient_id)\n medications = Array.new()\n prescriptions = HTTParty.get(\"http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base/MedicationPrescription?patient._id=#{patient_id}\")\n prescriptions['entry'].each do |entry|\n resource = entry['resource']\n medication = resource['medication']\n reference = medication['reference']\n medications.push(get_medication_code(reference))\n end\n return medications\n end", "title": "" }, { "docid": "e6e618e09acccae5996bfd268b03c377", "score": "0.4782803", "text": "def initialize\n\t\t@meditations = []\n\tend", "title": "" }, { "docid": "08824950a6a65545a782e5546cb961d4", "score": "0.47812557", "text": "def metaphors\n self.authors.map{|a|a.metaphors}.flatten.uniq\n end", "title": "" }, { "docid": "931e8945bc53a365a94bb3b3aa8438c9", "score": "0.4759615", "text": "def bibitem(item = nil)\n item = \"PMID:#{@pubmed}\" unless item\n pages = @pages.sub('-', '--')\n return <<-\"END\".collect {|line| line.strip}.join(\"\\n\")\n \\\\bibitem{#{item}}\n #{@authors.join(', ')}\n #{@title},\n {\\\\em #{@journal}}, #{@volume}(#{@issue}):#{pages}, #{@year}.\n END\n end", "title": "" }, { "docid": "5153ecc7d2d5ac94906d867630ac9886", "score": "0.4756818", "text": "def member_id_and_qualifier\r\n member_id, qual = nil, nil\r\n unless subscriber_identification_code.blank?\r\n member_id = subscriber_identification_code\r\n qual = 'MI'\r\n end\r\n return member_id, qual\r\n end", "title": "" }, { "docid": "3ec83fb48cb4e3cbdc188d6fd078564e", "score": "0.47528693", "text": "def get_cid\n return '55505'\n end", "title": "" }, { "docid": "0395a42c9a31c6ffa62fb0433d1fa662", "score": "0.4751262", "text": "def subject\n return \"<http://bio2rdf.org/rgd:#{@primary_id}>\"\n end", "title": "" }, { "docid": "d65aaed68b2ce25445c077995ffa7d1e", "score": "0.47408015", "text": "def pubmed_addition(pub)\n raise(ArgumentError, 'pub must be Publication') unless pub.is_a? Publication\n return unless Settings.PUBMED.lookup_enabled\n\n pmid = parse_pmid(pub.pmid) # ensure the Publication has a valid PMID\n pubmed_record = PubmedSourceRecord.for_pmid(pmid)\n if pubmed_record.nil?\n pubmed_cleanup(pub, pmid)\n return\n end\n pubmed_hash = pubmed_record.source_as_hash\n pmc_id = pubmed_hash[:identifier].detect { |id| id[:type] == 'pmc' }\n pub.pub_hash.reverse_update(pubmed_hash)\n pub.pub_hash[:identifier] << pmc_id if pmc_id && pub.pub_hash[:identifier].exclude?(pmc_id)\n return unless pub.changed?\n\n pub.pubhash_needs_update!\n pub.save!\n rescue StandardError => e\n NotificationManager.error(e, \"pubmed_addition failed for args: #{pmid}, #{pub}\", self)\n end", "title": "" }, { "docid": "97368d8e917f7682a0c70b371a075027", "score": "0.47329047", "text": "def generate_mosaicid( h_pubkey , nonce )\n b_pubkey = Util.hex_to_bytes( h_pubkey )\n b_nonce = Util.long_to_bytes( nonce )\n b_digest = SHA3::Digest.digest( :sha256 , b_nonce + b_pubkey )\n first_8_bytes = b_digest[0,8]\n ll_first_8_bytes = Util.bytes_to_longlong( first_8_bytes )\n # Most significant bit of MosaicID is zero\n mask = 0xffffffffffffffff ^ (1<<63)\n mosaicid = ll_first_8_bytes & mask\n return Util.fixnum_to_hex( mosaicid )\nend", "title": "" }, { "docid": "cc8f9a4e94967b928d6906735ef6366b", "score": "0.47302908", "text": "def generate_ids\n (ids_for_author | ids_for_alternate_names) - author_pub_swids\n end", "title": "" }, { "docid": "62259891d72aa7be9c89da8ef06adcc6", "score": "0.47275668", "text": "def pg\n @pubmed['PG'].strip\n end", "title": "" }, { "docid": "f0a03338b8a537754895cbd59c2e9d1e", "score": "0.47260985", "text": "def citation_comment\n Rantly {\n freq(\n [5, :literal, ''],\n [1, :literal, sized(50) { string(:alnum) }]\n )\n }\n end", "title": "" }, { "docid": "37b80750e79e4f18deec59a158ff9406", "score": "0.47200423", "text": "def initialize(pmid=nil, identifier=nil)\n @quotes = []\n if pmid.is_a? Hash\n ########## THIS WHOLE MESS SHOULD BE ENCAPSULATED/INHERITED! but can't get\n #inheritance with authors= working for some reason\n @authors = []\n pmid.each do |k,v|\n if k == 'authors'\n v.each do |auth|\n if auth.is_a? String\n authors.push( Citation::Author.from_s(auth) )\n else\n authors.push( auth )\n end\n end\n else\n send(\"#{k}=\".to_sym, v)\n end\n end\n ############ <-- END MESS\n else\n @authors = []\n @pmid = pmid\n @bibtype = :article\n if pmid\n begin\n url = query_builder(pmid)\n xml_string = get_xml(url)\n extract_attrs_from_xml(xml_string)\n end\n end\n if identifier\n @ident = identifier\n else\n if pmid\n @ident = create_id\n end\n end\n end\n end", "title": "" }, { "docid": "2ec7ac82296cb4f9f60a5333d7635a16", "score": "0.46968156", "text": "def patient_id_and_qualifier\r\n pat_id, qual = nil, nil\r\n member_id = subscriber_identification_code unless subscriber_identification_code.blank?\r\n patient_id = patient_identification_code unless patient_identification_code_qualifier.to_s == '--'\r\n \r\n if pt_name_eql_sub_name? && member_id\r\n pat_id = member_id\r\n qual = 'MI'\r\n else\r\n pat_id = patient_id\r\n qual = identification_code_qual\r\n end\r\n return pat_id, qual\r\n end", "title": "" }, { "docid": "56b16e48e392fba1a6db526d076dac22", "score": "0.468948", "text": "def mamtce_in_common_event_id\n @map ? @map.note[/(?<=\\\\ENTER[_ ]CE\\[)\\s*\\d+\\s*(?=\\])/i].to_i : 0\n end", "title": "" }, { "docid": "bc8c46e0b0d685bfc26fab0dcf5ea241", "score": "0.4688066", "text": "def uniquify\n # make the CP and MRN unique; these values will ripple through the SCG, CPR, et al.\n # to make them unique as well\n @protocol.title = Jinx::StringUniquifier.uniquify(@protocol.title)\n @registration.participant.medical_identifiers.each { |mid| mid.medical_record_number = Jinx::UID.generate.to_s }\n # unset the SCG name and specimen label so the default is set to a new unique value\n @specimen_collection_group.name = @specimen.label = nil\n self\n end", "title": "" }, { "docid": "4983ef0c5b47b751feeece20a448fc99", "score": "0.4681167", "text": "def public_identity_metadata\n nodes = catalog_record_ids(SYMPHONY).map { |catkey| \" <otherId name=\\\"catkey\\\">#{catkey}</otherId>\" }\n catalog_record_ids(FOLIO).each { |folio_instance_hrid| nodes << \" <otherId name=\\\"folio_instance_hrid\\\">#{folio_instance_hrid}</otherId>\" }\n nodes << \" <sourceId source=\\\"sul\\\">#{public_cocina.identification.sourceId}</sourceId>\" if public_cocina.identification.sourceId.present?\n nodes << \" <otherId name=\\\"barcode\\\">#{public_cocina.identification.barcode}</otherId>\" if public_cocina.dro? && public_cocina.identification.barcode\n\n Nokogiri::XML(\n <<~XML\n <identityMetadata>\n <objectType>#{public_cocina.collection? ? 'collection' : 'item'}</objectType>\n <objectLabel>#{Cocina::Models::Builders::TitleBuilder.build(public_cocina.description.title)}</objectLabel>\n #{nodes.join(\"\\n\")}\n </identityMetadata>\n XML\n )\n end", "title": "" }, { "docid": "7dffa1f866be40c2f181685a1e57fad7", "score": "0.46734715", "text": "def spectrophotography_cimmerian()\n end", "title": "" }, { "docid": "5147ae27092e451c2e0921dc3f40f40f", "score": "0.46691132", "text": "def isbn13\n identifier(15).try(:id_value)\n end", "title": "" }, { "docid": "5b65d40c32a6ce9566ee385daf27f92f", "score": "0.4666141", "text": "def moscowmorph(w)\r\n feats = w['morphology'].split(//)\r\n cas = feats[6]\r\n num = feats[1]\r\n per = feats[0]\r\n mod = feats[3]\r\n tns = feats[2]\r\n inf = feats[9]\r\n gen = feats[5]\r\n \r\n if w['part-of-speech'] == 'V-'\r\n if mod == 'i'\r\n mtag = [MOOD[mod],TENSE[tns],NUMBER[num],PERSON[per]].join(',')\r\n elsif mod == 'm'\r\n mtag = [MOOD[mod],NUMBER[num],PERSON[per]].join(',')\r\n elsif mod == 'p'\r\n if tns == 's'\r\n STDERR.puts \"#{w['form']} is an l-participle\"\r\n mtag = [TENSE[tns],NUMBER[num],gen(gen)].join(',')\r\n else\r\n mtag = 'participle'\r\n end\r\n elsif mod == '-'\r\n mtag = 'noninfl'\r\n else\r\n mtag = MOOD[mod]\r\n end\r\n elsif ['Nb','Ne'].include?(w['part-of-speech'])\r\n mtag = [gen(gen),NUMBER[num],CASUS[cas]].join(',')\r\n elsif ['A-',\"Pd\", \"Pr\", \"Ps\", \"Pt\"].include?(w['part-of-speech'])\r\n mtag = [NUMBER[num],gen(gen),CASUS[cas]].join(',')\r\n elsif [\"Px\",\"Ma\",\"Mo\"].include?(w['part-of-speech'])\r\n mtag = [NUMBER[cas],CASUS[cas]].join(',')\r\n elsif ['Pk', 'Pp', 'Pi'].include?(w['part-of-speech'])\r\n mtag = CASUS[cas]\r\n elsif w['part-of-speech'] == \"Df\"\r\n mtag = 'noninfl'\r\n else\r\n if inf == 'n'\r\n mtag = 'noninfl'\r\n else\r\n STDERR.puts \"what to do with tag #{w['morphology']}?\"\r\n end\r\n end\r\n return mtag\r\nend", "title": "" }, { "docid": "82e91c577d169cb85b81bbc9ec5940e8", "score": "0.46596763", "text": "def generate_pubid\n self.pubid = SecureRandom.hex(4)\n end", "title": "" }, { "docid": "145ad680361097f41af30dcae1b122a1", "score": "0.46584272", "text": "def related_publications\n studies.collect(&:related_publications).flatten.uniq | publications\n end", "title": "" }, { "docid": "88fc55eaae101ae2f2dd170ace0c01f8", "score": "0.46580026", "text": "def bibliographic_id\n descMetadata.bibliographic_id.present? ? { source: descMetadata.bibliographic_id.source.first, id: descMetadata.bibliographic_id.first } : nil\n end", "title": "" }, { "docid": "804c57f01a0213f949e091d132d899b6", "score": "0.465782", "text": "def get_medal_tag\n case rank\n when 1\n 'medal_gold_3.png'\n when 2\n 'medal_silver_3.png'\n when 3\n 'medal_bronze_3.png'\n else\n ''\n end\n end", "title": "" }, { "docid": "5e52390cfc19ba5071f0e258a95c782d", "score": "0.46500078", "text": "def melting\n dinucleotide_lookup(@@MELTING)\n end", "title": "" }, { "docid": "60457f4542d8778dd1c49b18f27fa97a", "score": "0.46495652", "text": "def identify_primary(med_name)\n medicine = find_medicine_by_name(med_name)\n medicine = medicines.first if medicine.nil?\n rebuild_cabinet\n medicine\n end", "title": "" }, { "docid": "7412d754d19202a9d9e0ebf098b8d54d", "score": "0.46420544", "text": "def mtid\n @bam1[:core][:mtid]\n end", "title": "" }, { "docid": "267c11c88c98daab96161baf8c70ad30", "score": "0.46392658", "text": "def npid\n self.national_patient_identifier\n end", "title": "" }, { "docid": "147db548c607b60d793972af88ffe9f4", "score": "0.46324128", "text": "def meid=(value)\n @meid = value\n end", "title": "" }, { "docid": "47fee472c235f8214c52bc4ffc88b0e6", "score": "0.46151933", "text": "def memeid\n return nil if @data['meme'].nil?\n\n @data['meme']['memeid']\n end", "title": "" }, { "docid": "8d3de68f54e35b328cdad78d7fc85c66", "score": "0.46151662", "text": "def owms_permit_metadata_for(node)\n permit = node.content\n tags = []\n\n tags << meta_tag('DC.type', permit.product_type, 'OVERHEIDbm.bekendmakingtypeGemeente')\n #tags << meta_tag('DC.type', permit.product_type, 'OVERHEIDvg.Product')\n tags << meta_tag('OVERHEID.organisationType', 'gemeente')\n tags << meta_tag('DC.publisher', Settler[:site_name], 'OVERHEID.Gemeente')\n tags << meta_tag('DC.creator', Settler[:site_name], 'OVERHEID.Gemeente')\n tags << meta_tag('OVERHEIDbm.referentieNummer', permit.reference)\n # ==== parcels ====\n permit.parcels.each { |parcel| tags << [ meta_tag('DCTERMS.spatial', parcel.number, 'OVERHEIDvg.perceel'), meta_tag('OVERHEIDbm.sectie', parcel.section) ] }\n # ==== phases ====\n tags << meta_tag('OVERHEIDvg.phase', permit.phase, Permit::PERMIT_PHASES.include?(permit.phase) ? 'OVERHEIDvg.faseVergunning' : 'OVERHEIDvg.faseBezwaarBeroep') if permit.phase.present?\n # tags << meta_tag('OVERHEIDvg.status', (scheme OVERHEIDvg.status)\n tags << meta_tag('OVERHEIDbm.termijnsoort', permit.period_type)\n tags << meta_tag('OVERHEIDbm.startdatumTermijn', permit.period_start_date.utc.to_s(:w3cdtfutc), 'DCTERMS.W3CDTF') if permit.period_start_date\n tags << meta_tag('OVERHEIDbm.einddatumTermijn', permit.period_end_date.utc.to_s(:w3cdtfutc), 'DCTERMS.W3CDTF') if permit.period_end_date\n # ==== locations ====\n permit.addresses.each do |address|\n tags << meta_tag('DCTERMS.spatial', \"#{address.postal_code}#{address.house_number}\", 'OVERHEID.PostcodeHuisnummer')\n end\n # ==== coordinates ====\n permit.coordinates.each do |coord|\n tags << meta_tag('DCTERMS.spatial', coord.x, 'OVERHEIDbm.x-waarde')\n tags << meta_tag('DCTERMS.spatial', coord.y, 'OVERHEIDbm.y-waarde')\n end\n\n tags\n end", "title": "" }, { "docid": "97d0d0aa6125dfaf4713a2316f8c7ea5", "score": "0.4611535", "text": "def mediated_id\n mediated_instance.try(:id)\n end", "title": "" }, { "docid": "588da6b5164dea4e4c29c53ed5b33c5e", "score": "0.46089813", "text": "def unique_id\n [@contents_info.hash, @symlinks_info.hash]\n end", "title": "" }, { "docid": "af2b34a76bff60db610ae37234cbb5dd", "score": "0.460842", "text": "def micros\n self.questions.map{|q| q.topic_id}.uniq\n end", "title": "" }, { "docid": "a797d6feef275732b4451e1047a74612", "score": "0.46082684", "text": "def get_altmetric(pmid)\n url = ALTMETRIC_URL_BASE + pmid + ALTMETRIC_API_KEY\n altmetric_xml = Nokogiri::HTML(open(url))\n article = {}\n EPMC_ATTRIBUTES.each do\n |key,value| article[key] = remove_tag(altmetric_xml.xpath(value)[0].to_s)\n end\n return article\nend", "title": "" }, { "docid": "762e8a39ed84ec08db359dfc74944fcf", "score": "0.46078545", "text": "def get_id_data(rec)\n id_data = { '001' => '',\n '003' => '',\n '019' => [],\n '035' => [],\n '035z' => [],\n '035q' => []}\n \n Traject::MarcExtractor.cached('001:003:019:035a', alternate_script: false).each_matching_line(rec) do |field, spec, extractor|\n case field.tag\n when '001'\n id_data['001'] = field.value\n when '003'\n id_data['003'] = field.value\n when '019'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['019'] << sf.value\n end\n when '035'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['035'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'z' }.each do |sf|\n id_data['035z'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'q' }.each do |sf|\n id_data['035q'] << sf.value\n end\n end\n end\n \n return id_data\n end", "title": "" }, { "docid": "6ee8f6a2fa0bf85d12f27e414629a1f0", "score": "0.4603607", "text": "def FetchPublicationData(pubmed_ids)\n theCnt = 0\n theSize = 499\n theEnd = 0\n foundPubs=[]\n while theCnt < pubmed_ids.length do\n theEnd = theCnt+theSize\n theEnd = pubmed_ids.length-1 if theEnd > pubmed_ids.length-1 \n puts \"Slicing all_entries from #{theCnt} to #{theEnd}\" if LatticeGridHelper.debug?\n mySlice = pubmed_ids[theCnt..theEnd]\n puts \"looking up #{mySlice.length} pubs from #{theCnt} to #{theEnd}\" if LatticeGridHelper.debug?\n theCnt = theEnd+1\n printSlice(mySlice) if LatticeGridHelper.debug?\n pubs = Bio::PubMed.efetch(mySlice)\n inspectObject(pubs[0]) if LatticeGridHelper.debug?\n puts \"found #{pubs.length} pubs\" if LatticeGridHelper.debug?\n foundPubs = foundPubs + pubs\n end\n foundPubs\nend", "title": "" }, { "docid": "d3ec1d8d71f5b41ed1cddff09a650531", "score": "0.4599534", "text": "def public_id\n publicid = common_root_path + '/'\n \n if model.is_a?(SurveyResponse)\n details = model.survey_respondent_detail\n if details\n hasher = Hashids.new(SALT, 4)\n publicid += hasher.encode(details.id)\n publicid += \"_\"\n else\n publicid += 'response'\n end\n publicid += '_' + model.id.to_s\n else \n if ((defined? model.person) && model.person)\n hasher = Hashids.new(SALT, 4)\n publicid += hasher.encode(model.person.id)\n publicid += '_' + model.person.id.to_s\n else\n publicid += 'default_bio_image'\n publicid += '_' + model.id.to_s\n end\n end\n \n publicid.gsub(/[?!&\\s+]/, '')\n end", "title": "" }, { "docid": "ff1b6c09c386632d8206e467a5ae98b6", "score": "0.45982888", "text": "def bib_id\n nil\n end", "title": "" }, { "docid": "9884676e420eeb37f6200c81daa3898c", "score": "0.4597224", "text": "def phys_desc_field_hash smods_rec_obj, druid\n doc_hash = {}\n medium_vals = []\n phys_desc_nodeset = smods_rec_obj.physical_description if smods_rec_obj.physical_description\n unless phys_desc_nodeset.empty?\n phys_desc_nodeset.form.each { |form_node| \n if form_node.authority == 'gmd'\n doc_hash[:doc_type_ssi] = UnicodeUtils.nfkc(form_node.text.gsub(/\\s+/, ' ').strip.downcase)\n elsif form_node.authority == 'marcsmd' || form_node.type_at == 'material' || form_node.type_at == 'technique'\n medium_vals << UnicodeUtils.nfkc(form_node.text.gsub(/\\s+/, ' ').strip)\n end\n }\n if !doc_hash[:doc_type_ssi]\n logger.warn(\"#{druid} has no :doc_type_ssi; MODS missing <physicalDescription><form authority=\\\"gmd\\\">\")\n end\n if !medium_vals.empty?\n doc_hash[:medium_ssim] = medium_vals \n else\n logger.warn(\"#{druid} has no :medium_ssim; MODS missing <physicalDescription><form> that isn't authority=\\\"gmd\\\" or \\\"marccategory\\\"\")\n end\n end\n doc_hash\n end", "title": "" }, { "docid": "2411a73a6355a6dd485e8ca3ee294079", "score": "0.458614", "text": "def public_id\r\n nil\r\n end", "title": "" }, { "docid": "1359274447b9d92d503489398504267a", "score": "0.45836073", "text": "def initialize(mixed, id)\n @code = \"pe\"\n # load data\n if mixed.is_a? MarcNode\n # TODO, load data when the marc_node is passed as parameter\n # output directory will certainly have to be changed\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n # home dir\n @out_path = \"#{Rails.root}/public/incipits/#{id[12,14]}/\"\n\n\n if RISM::BASE == \"uk\" then\n @number = mixed.fetch_first_by_tag('a').content || \"na\"\n @number = @number + \"-\" + mixed.fetch_first_by_tag('b').content || \"nb\" rescue @number + \"-\" + \"nb\"\n @number = @number + \"-\" + mixed.fetch_first_by_tag('c').content || \"nc\" rescue @number + \"-\" + \"nc\"\n else\n @number = mixed.fetch_first_by_tag('a').content || \"no-number\"\n @number = @number + \".\" + mixed.fetch_first_by_tag('b').content || \"?\" rescue @number + \".\" + \"?\"\n @number = @number + \".\" + mixed.fetch_first_by_tag('c').content || \"?\" rescue @number + \".\" + \"?\"\n end\n \n @clef = mixed.fetch_first_by_tag('g').content || 'none' rescue @clef = 'none'\n @keysig = mixed.fetch_first_by_tag('n').content || 'none' rescue @keysig = 'none'\n @timesig = mixed.fetch_first_by_tag('o').content || 'none' rescue @timesig = 'none'\n @incipit = mixed.fetch_first_by_tag('p').content || 'none' rescue @incipit = 'none'\n @keymode = mixed.fetch_first_by_tag('r').content || ' ' rescue @keymode = ' ' ## 80390 out of 113435\n @file_name = id.to_s + \"-\" + @number\n elsif mixed.is_a? WorkIncipit\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n id_string = \"0\" + mixed.id.to_s\n @out_path = \"#{Rails.root}/public/incipits/#{id_string[0,2]}/\"\n #@number = mixed.movement || \"no-number\"\n #@number = @number + \".\" + mixed.excerpt || \"none\" rescue @number + \".\" + \"none\"\n #@number = @number + \".\" + mixed.heading || \"none\" rescue @number + \".\" + \"none\"\n @clef = mixed.clef || 'G-2' rescue @clef = 'G-2'\n @keysig = mixed.key_signature || '' rescue @keysig = ''\n @timesig = mixed.time_signature || '' rescue @timesig = ''\n @incipit = mixed.notation || '' rescue @incipit = ''\n # cleanup output directory\n @file_name = id_string #+ \"-\" + @number\n if mixed.code == \"da\"\n @code = \"darms\"\n end\n else\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n @out_path = \"#{Rails.root}/public/incipits/input/\"\n @file_name = rand.to_s\n @clef = mixed[:clef] || 'G-2' rescue @clef = 'G-2'\n @keysig = mixed[:keysig] || '' rescue @keysig = ''\n @timesig = mixed[:timesig] || '' rescue @timesig = ''\n @incipit = mixed[:incipit] || '' rescue @incipit = ''\n # cleanup output directory\n FileUtils.rm Dir.glob(\"#{@out_path}*\") \n end\n @results = \"\"\n end", "title": "" }, { "docid": "13a275ab26ef0da272361442b36ccf52", "score": "0.4577755", "text": "def section_physical_descriptions\n all_pds = []\n self.master_files.each do |master_file|\n all_pds += Array(master_file.physical_description) unless master_file.physical_description.nil?\n end\n all_pds.uniq\n end", "title": "" }, { "docid": "cef7ca34bf02dc3380331ccf11a13275", "score": "0.45754433", "text": "def get_ids\n ids = { doi: doi, pmid: pmid, pmcid: pmcid }\n missing_ids = ids.reject { |k, v| v.present? }\n return true if missing_ids.empty?\n\n result = get_persistent_identifiers(doi)\n\n if result.present? && result.is_a?(Hash)\n # remove PMC prefix\n result['pmcid'] = result['pmcid'][3..-1] if result['pmcid']\n\n new_ids = missing_ids.reduce({}) do |hash, (k, v)|\n val = result[k.to_s]\n hash[k] = val if val.present? && val != \"0\"\n hash\n end\n update_attributes(new_ids)\n else\n false\n end\n end", "title": "" }, { "docid": "ba009c752bdc274d54f9ce0f7def440e", "score": "0.4572158", "text": "def to_citation\n citation = {}\n # call self.metadata once and use the array for efficiency, don't\n # keep calling it. profiling shows it DOES make a difference. \n my_metadata = self.metadata\n\n if my_metadata['atitle'].present?\n citation[:title] = my_metadata['atitle']\n ['title','btitle','jtitle'].each do | t_type |\n if my_metadata[t_type].present?\n citation[:container_title] = my_metadata[t_type] \n break\n end\n end\n else # only top-level thing, no sub-thing\n ['title','btitle','jtitle'].each do | t_type |\n if my_metadata[t_type].present?\n citation[:title] = my_metadata[t_type]\n break\n end\n end \n end\n\n citation[:title_label] = I18n.t(\"umlaut.citation.title_of_x\", :x => self.type_of_thing, :default => \"umlaut.citation.title_label\")\n citation[:container_label] = self.container_type_of_thing \n\n # add publisher for books\n if (my_metadata['genre'] =~ /book/i)\n citation[:pub] = my_metadata['pub'] unless my_metadata['pub'].blank?\n end\n\n citation[:issn] = issn if issn\n citation[:isbn] = isbn if isbn\n \n ['volume','issue','date'].each do | key |\n citation[key.to_sym] = my_metadata[key]\n end\n\n if my_metadata[\"au\"].present?\n citation[:author] = my_metadata[\"au\"].strip\n elsif my_metadata[\"aulast\"]\n citation[:author] = my_metadata[\"aulast\"].strip\n if my_metadata[\"aufirst\"].present?\n citation[:author] += ', '+my_metadata[\"aufirst\"].strip\n else\n if my_metadata[\"auinit\"].present?\n citation[:author] += ', '+my_metadata[\"auinit\"].strip\n else\n if my_metadata[\"auinit1\"].present?\n citation[:author] += ', '+my_metadata[\"auinit1\"].strip\n end\n if my_metadata[\"auinitm\"].present?\n citation[:author] += my_metadata[\"auinitm\"].strip\n end\n end\n end\n elsif my_metadata[\"aucorp\"]\n citation[:author] = my_metadata[\"aucorp\"]\n end \n \tif my_metadata['spage']\n \t citation[:page] = my_metadata['spage']\n \t citation[:page] += ' - ' + my_metadata['epage'] if ! my_metadata['epage'].blank?\n \tend\n \tcitation[:identifiers] = []\n \tself.identifiers.each do | id |\n \t citation[:identifiers] << id unless (id.blank? || id.match(/^tag:/))\n \tend\n \treturn citation\n end", "title": "" }, { "docid": "adf61d98bf415bad3b2b840bd1b42797", "score": "0.45717657", "text": "def to_sanskrit_id(chapter_num, section_num, verse_num)\n if section_num == 0 && chapter_num == 0\n \"\\u{0965} #{to_devanagri_number(verse_num)} \\u{0965}\"\n elsif section_num == 0 \n \"\\u{0965} #{to_devanagri_number(chapter_num)}:#{to_devanagri_number(verse_num)} \\u{0965}\"\n else\n \"\\u{0965} #{to_devanagri_number(chapter_num)}:#{to_devanagri_number(section_num)}:#{to_devanagri_number(verse_num)} \\u{0965}\"\n end\n end", "title": "" }, { "docid": "c1d812c0a3e65c4e9f642c4b0c817efa", "score": "0.4569693", "text": "def parse_reproduction_note(marc)\n tag892 = marc['892']\n return '' unless tag892\n\n # collect subfields in input order; only ouput certain subfields\n tag892.subfields.collect { |s| s.value if 'abcdefmn3'.include? s.code }.join(' ').strip\n end", "title": "" } ]
044e7dce36ce333a4cf2723fcc56fcc4
def slug self.id end
[ { "docid": "ae2b0f34129f11215ab56acebf1bf7d5", "score": "0.0", "text": "def slug \n sloog = self.username.gsub(\" \", \"-\").downcase\n end", "title": "" } ]
[ { "docid": "7dad1254d3a356889bd6514c9761d69a", "score": "0.91281164", "text": "def id\n slug\n end", "title": "" }, { "docid": "848679c78b1626e19fd0acf896495758", "score": "0.8580922", "text": "def slug; end", "title": "" }, { "docid": "848679c78b1626e19fd0acf896495758", "score": "0.8580922", "text": "def slug; end", "title": "" }, { "docid": "7ee676db2406ef532700b25b832071e4", "score": "0.8394836", "text": "def slug_base_string\n self.id || sluggify\n end", "title": "" }, { "docid": "9983a0b8bce51354f7be617ae0e5243c", "score": "0.8344978", "text": "def id\n object.slug\n end", "title": "" }, { "docid": "9983a0b8bce51354f7be617ae0e5243c", "score": "0.8344978", "text": "def id\n object.slug\n end", "title": "" }, { "docid": "c37143b2c1bd73bf427e74a9e80f6cf3", "score": "0.81673926", "text": "def model_slug\n slug\n end", "title": "" }, { "docid": "cb0ed2b10e76181f0e5c520a0bdde64a", "score": "0.8129373", "text": "def slug\n self.fields[:slug]\n end", "title": "" }, { "docid": "47a4c40ff0c8deb23b857132352a0268", "score": "0.8086185", "text": "def friendly_id\n slug(true).to_friendly_id\n end", "title": "" }, { "docid": "24973a0e0f0a66f288e18c2e18379bce", "score": "0.8065199", "text": "def slug_string\n self.name\n end", "title": "" }, { "docid": "d90028d12ea40131b0957a4863b2332f", "score": "0.79295605", "text": "def to_param\n slug || id\n end", "title": "" }, { "docid": "5660a461d295ef3eb5b4d2cf916ec674", "score": "0.7927772", "text": "def slug\n path\n end", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.78976756", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.78976756", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.78767854", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.78767854", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "636a066f84678cb7257a92934daa96b8", "score": "0.78637457", "text": "def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend", "title": "" }, { "docid": "5607937223a958e12f758a99adef34a9", "score": "0.78328633", "text": "def slug\n ActiveModel::Naming.route_key(self.class.model)\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.78184605", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.78184605", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.78184605", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.78184605", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "443239728d430addf2ac3752183d8c22", "score": "0.7769982", "text": "def to_slug\n self.title.parameterize\n end", "title": "" }, { "docid": "1ac366554faa252e3d838abef0b13111", "score": "0.77450454", "text": "def slug\n self.name.downcase.gsub(' ', '-')\n end", "title": "" }, { "docid": "1ac366554faa252e3d838abef0b13111", "score": "0.77450454", "text": "def slug\n self.name.downcase.gsub(' ', '-')\n end", "title": "" }, { "docid": "02b6da91d85cc14a43565f0bd5c03f7b", "score": "0.77435815", "text": "def generate_slug\n self.slug = self.name.parameterize\n end", "title": "" }, { "docid": "1d837fc6810c828158f4ced282a7fb51", "score": "0.77307016", "text": "def slugify\n self.slug = name.parameterize \n end", "title": "" }, { "docid": "0553da98d03545ac757e49a1b07146ea", "score": "0.7725973", "text": "def slug\n self.name.gsub(\" \", \"-\").downcase\n end", "title": "" }, { "docid": "1d25c373a62fe8b35209267d460800a9", "score": "0.7724405", "text": "def slugando\n\t\tself.slug = summary.parameterize.to_s\n\tend", "title": "" }, { "docid": "414b434fbdd2760dbdf52e8b1af0d48e", "score": "0.77213854", "text": "def slugify\n self.slug = name.parameterize\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.7717202", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "d518daf223c6d7e50b63e2d854e701bc", "score": "0.76988006", "text": "def friendly_id; end", "title": "" }, { "docid": "2affc9c8bcea34e59de5cc345a6a776d", "score": "0.7693957", "text": "def compute_slug\n \"#{normalize_slug_base_string}-#{self.id || sluggify}\"\n end", "title": "" }, { "docid": "16d2848870d1deae77d84172be07176f", "score": "0.76922786", "text": "def to_param\n slug ? slug.to_friendly_id : id.to_s\n end", "title": "" }, { "docid": "c043912fd5e866d68679124910d4aef4", "score": "0.7676119", "text": "def set_slug\n self.slug = self.title.parameterize\n end", "title": "" }, { "docid": "0408ce865eecda494b3fb8b446ac2e53", "score": "0.76634437", "text": "def slug\n self.name.strip.gsub(\" \", \"-\").downcase\n end", "title": "" }, { "docid": "0408ce865eecda494b3fb8b446ac2e53", "score": "0.76634437", "text": "def slug\n self.name.strip.gsub(\" \", \"-\").downcase\n end", "title": "" }, { "docid": "cf173f08f2244e68a4267c9d409199ba", "score": "0.76534635", "text": "def to_param # overridden\n slug\n end", "title": "" }, { "docid": "d927e2bd605770f1d443a9fb467442a1", "score": "0.7642099", "text": "def generate_custom_slug\n\t\t# \"#{convert_to_lowercase_to} #{convert_to_lowercase_from}\"\n\t\t\"#{self.id}\"\n\tend", "title": "" }, { "docid": "3407dd8b4ca089594432223a680ccdf6", "score": "0.76366264", "text": "def to_param\n \"#{id}-#{self.slug}\"\n end", "title": "" }, { "docid": "3407dd8b4ca089594432223a680ccdf6", "score": "0.76366264", "text": "def to_param\n \"#{id}-#{self.slug}\"\n end", "title": "" }, { "docid": "3407dd8b4ca089594432223a680ccdf6", "score": "0.76366264", "text": "def to_param\n \"#{id}-#{self.slug}\"\n end", "title": "" }, { "docid": "72c2f41652d6e91e4ee0807fed809937", "score": "0.7634476", "text": "def slug\n self.title.downcase.gsub(\" \", \"-\") unless self.title.nil?\n end", "title": "" }, { "docid": "8cfb7921722985e371a92a0d4d7244a5", "score": "0.7589609", "text": "def slug\n name.downcase.gsub(\" \",\"-\")\n end", "title": "" }, { "docid": "243cb0dfd9d73c3c91265e72ac233e11", "score": "0.7589358", "text": "def slug_column; end", "title": "" }, { "docid": "243cb0dfd9d73c3c91265e72ac233e11", "score": "0.7589358", "text": "def slug_column; end", "title": "" }, { "docid": "d329a66bbe8cb5f9229cbdb7c766838d", "score": "0.75853115", "text": "def manage_slug\n \tself.slug = self.title.parameterize if self.slug.blank?\n end", "title": "" }, { "docid": "db984163f773b60dbcb49b4c45d8180a", "score": "0.75817233", "text": "def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end", "title": "" }, { "docid": "db984163f773b60dbcb49b4c45d8180a", "score": "0.75817233", "text": "def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end", "title": "" }, { "docid": "cf9ca47832cfa6dbad9afdfba9c6e301", "score": "0.7573624", "text": "def cached_slug\n id.to_s\n end", "title": "" }, { "docid": "c44cc11f3042e8998534634ef156439f", "score": "0.7554548", "text": "def generate_slug\n \tself.slug = title.parameterize\n end", "title": "" }, { "docid": "cc1ad0bed1c820d2f9ca5728cf593084", "score": "0.7547219", "text": "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "title": "" }, { "docid": "cc1ad0bed1c820d2f9ca5728cf593084", "score": "0.7547219", "text": "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "title": "" }, { "docid": "44b543452acd4879d20f1f69aed7e06c", "score": "0.75455785", "text": "def set_slug\n self.slug = title.parameterize\n end", "title": "" }, { "docid": "167297894df88c2273cd6b66c61d5c04", "score": "0.7511418", "text": "def set_slug\n \t \tself.slug = name.to_slug unless name.blank?\n\tend", "title": "" }, { "docid": "db9b786cdb6e3a51eaf87ea229d7f6e4", "score": "0.7508319", "text": "def unfriendly_id?; end", "title": "" }, { "docid": "a0996d4491097008377178abe39d1ef2", "score": "0.749846", "text": "def to_param\n id.to_s + \"-\" + slug\n end", "title": "" }, { "docid": "a0996d4491097008377178abe39d1ef2", "score": "0.749846", "text": "def to_param\n id.to_s + \"-\" + slug\n end", "title": "" }, { "docid": "46f37d0f3070dc8f799f9ef6ea44415e", "score": "0.7484283", "text": "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "title": "" }, { "docid": "9b9b73fe46e1fd79e89da763d80ce05a", "score": "0.7483451", "text": "def extra_slug\n extra_slugs[id]\n end", "title": "" }, { "docid": "1aa6b689da378e1c5cc5471bd47c4487", "score": "0.7480047", "text": "def slug\n self.name.downcase.gsub(/[^a-z0-9]/, '-').squeeze('-')\n end", "title": "" }, { "docid": "f1a42579653ab78f692abb839eeab56f", "score": "0.74735224", "text": "def to_param # This overwrites the 'to_param' method (That is called by default in the views with something like: 'edit_post_path(@post)'). It is overridden so that the slug can be executed.\n self.slug #.slug method comes from the 'slug' column in the 'posts' table.\n end", "title": "" }, { "docid": "592911bd57cc29c7ce6565460e3bc157", "score": "0.74706084", "text": "def to_param\n self._slug.blank? ? id.to_s : \"#{id}-#{self._slug}\"\n end", "title": "" }, { "docid": "6d3cda5811e0f7b1fe99195f5468ef54", "score": "0.7467118", "text": "def slug\n @attributes[:slug] = @attributes[:name] && PublicEarth::Db::Collection.create_slug(@attributes[:name]) unless @attributes[:slug] \n @attributes[:slug]\n end", "title": "" }, { "docid": "41a5d467563bb46084845acdc5f6eef2", "score": "0.74640775", "text": "def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end", "title": "" }, { "docid": "f33c9624b09757a0663c16e8680864a0", "score": "0.7458175", "text": "def to_param\n \"#{id}-#{slug}\"\n end", "title": "" }, { "docid": "c86cb2c505ceb77689b588ca8c41a6ae", "score": "0.74389917", "text": "def slug\n Inflector.parameterize(@title, \"_\")\n end", "title": "" }, { "docid": "652179fb6f960a65d37c7fb129056834", "score": "0.74383205", "text": "def generate_slug\n self.slug = title.parameterize if title\n end", "title": "" }, { "docid": "2a8eed1aa8804c3b0e3e8327d352f95e", "score": "0.7433926", "text": "def slug\n self.name.downcase.gsub(/[!@%&\"]/,'').tr(\" \", \"-\")\n end", "title": "" }, { "docid": "685470fc243e62b13dabb63d0f3343d0", "score": "0.74310976", "text": "def set_slug\n self.slug = title.downcase.tr(\" \", \"_\") if slug.blank?\n slug\n end", "title": "" }, { "docid": "dba784ac489b14680556d979afaac289", "score": "0.74243945", "text": "def set_slug\n self.slug = make_slug(name)\n end", "title": "" }, { "docid": "df969c8297958587e4cad806a63b4450", "score": "0.7412572", "text": "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "title": "" }, { "docid": "7fbe36d5b4a5311de73087c75431ec23", "score": "0.73908544", "text": "def as_slug\n Swift::Transliteration.slugize self\n end", "title": "" }, { "docid": "3ea07c328ae59ecd4f0d6f3c45b53bc4", "score": "0.73906296", "text": "def set_slug\n self.slug = full_name.parameterize\n end", "title": "" }, { "docid": "7ef1fb0e148a66488e1f9a09ede4802d", "score": "0.73892707", "text": "def generate_slug\n self.slug = name.parameterize if name.present?\n end", "title": "" }, { "docid": "8440f16058e95fca5b209c1623fc1c9e", "score": "0.7387073", "text": "def slug=(_arg0); end", "title": "" }, { "docid": "d8b82d09d12b53239c01a028573d40b1", "score": "0.73758525", "text": "def post_slug(other); end", "title": "" }, { "docid": "d471c305db91fc5c69b95c5144da2fec", "score": "0.73691475", "text": "def set_slug\n self.slug = title.downcase.gsub(\" \", \"_\") if slug.blank?\n slug\n end", "title": "" }, { "docid": "b909311bbe9bbdb4c47c7706d4a159d3", "score": "0.7367799", "text": "def to_param\n \"#{id}-#{slug}-\"\n end", "title": "" }, { "docid": "29574c8a56c510ad280f67c2895b4f46", "score": "0.7361811", "text": "def to_param\n \"#{id}-#{slug}\"\n end", "title": "" }, { "docid": "29574c8a56c510ad280f67c2895b4f46", "score": "0.7361811", "text": "def to_param\n \"#{id}-#{slug}\"\n end", "title": "" }, { "docid": "d23a9b83a927473912ab72e7e4900444", "score": "0.7340429", "text": "def slug\n @slug ||= begin\n raw = self['identifier'].find { |id| id.start_with?('slug:') }\n Spot::Identifier.from_string(raw).value unless raw.nil?\n end\n end", "title": "" }, { "docid": "250a586d09b8ba1883b38c219defa4da", "score": "0.73285735", "text": "def set_slug\n self.slug = KeyGenerator.generate(8) if self.slug.blank?\n end", "title": "" }, { "docid": "2c73084c2b730f56b2ff1cb57384cb96", "score": "0.7328363", "text": "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "title": "" }, { "docid": "87a1bb6cd3067eac4283755addd51f76", "score": "0.73271775", "text": "def slug\n name.downcase.gsub(\" \", \"-\")\n end", "title": "" }, { "docid": "953a684408c5e6bc197991738aec6f1a", "score": "0.7323294", "text": "def slug\n\t\tunless name.nil?\n\t\t\tname.downcase.gsub(\" \", \"-\")\t\t\t\n\t\tend\n\tend", "title": "" } ]
d5803add8e81c0e5439bb9e19b52f2ad
Update a template of network migration specification. Network migration specification once created and can be used as a template to indicate associated component which networks should be migrated and where. Currently migration template can be associated with compute collections which are managed by vCenter host profiles, to trigger automatic migration of networks for Stateless ESX hosts. Currently we only support creation of HostProfileNetworkMigrationSpec type of specification. For a HostProfileNetworkMigrationSpec which is already associated with a compute collection, updating it would mean next time the system needs to trigger migration for hosts managed by compute collection, it will use the updated migration specification.
[ { "docid": "9c20c81f06a61bb5b29b9ef255b11458", "score": "0.66542244", "text": "def update_network_migration_spec_with_http_info(template_id, network_migration_spec, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.update_network_migration_spec ...\"\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling NetworkTransportApi.update_network_migration_spec\"\n end\n # verify the required parameter 'network_migration_spec' is set\n if @api_client.config.client_side_validation && network_migration_spec.nil?\n fail ArgumentError, \"Missing the required parameter 'network_migration_spec' when calling NetworkTransportApi.update_network_migration_spec\"\n end\n # resource path\n local_var_path = \"/network-migration-specs/{template-id}\".sub('{' + 'template-id' + '}', template_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(network_migration_spec)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#update_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "7f0f5b4e72fa9c32bf83e2227fd2e7b6", "score": "0.70079887", "text": "def update_network_migration_spec(template_id, network_migration_spec, opts = {})\n data, _status_code, _headers = update_network_migration_spec_with_http_info(template_id, network_migration_spec, opts)\n return data\n end", "title": "" }, { "docid": "04b40eda432d9928872262e1106d5a2a", "score": "0.6997081", "text": "def update_network_migration_spec(template_id, network_migration_spec, opts = {})\n data, _status_code, _headers = update_network_migration_spec_with_http_info(template_id, network_migration_spec, opts)\n data\n end", "title": "" }, { "docid": "3703772ea175ff6147b1a52625c150fa", "score": "0.66669154", "text": "def update_network_migration_spec_with_http_info(template_id, network_migration_spec, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.update_network_migration_spec ...'\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.update_network_migration_spec\"\n end\n # verify the required parameter 'network_migration_spec' is set\n if @api_client.config.client_side_validation && network_migration_spec.nil?\n fail ArgumentError, \"Missing the required parameter 'network_migration_spec' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.update_network_migration_spec\"\n end\n # resource path\n local_var_path = '/network-migration-specs/{template-id}'.sub('{' + 'template-id' + '}', template_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(network_migration_spec)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#update_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d582d0f786867e70b8bc4ad07f311717", "score": "0.6002611", "text": "def create_network_migration_spec(network_migration_spec, opts = {})\n data, _status_code, _headers = create_network_migration_spec_with_http_info(network_migration_spec, opts)\n data\n end", "title": "" }, { "docid": "07f59cd09cbe49c5332e004201375673", "score": "0.59086305", "text": "def create_network_migration_spec_with_http_info(network_migration_spec, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.create_network_migration_spec ...'\n end\n # verify the required parameter 'network_migration_spec' is set\n if @api_client.config.client_side_validation && network_migration_spec.nil?\n fail ArgumentError, \"Missing the required parameter 'network_migration_spec' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.create_network_migration_spec\"\n end\n # resource path\n local_var_path = '/network-migration-specs'\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(network_migration_spec)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#create_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "5f0d17d92028a17f52a2679acd938630", "score": "0.5892265", "text": "def create_network_migration_spec_with_http_info(network_migration_spec, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.create_network_migration_spec ...\"\n end\n # verify the required parameter 'network_migration_spec' is set\n if @api_client.config.client_side_validation && network_migration_spec.nil?\n fail ArgumentError, \"Missing the required parameter 'network_migration_spec' when calling NetworkTransportApi.create_network_migration_spec\"\n end\n # resource path\n local_var_path = \"/network-migration-specs\"\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(network_migration_spec)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#create_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6be3f1347079646357a0d444296899b0", "score": "0.58894664", "text": "def create_network_migration_spec(network_migration_spec, opts = {})\n data, _status_code, _headers = create_network_migration_spec_with_http_info(network_migration_spec, opts)\n return data\n end", "title": "" }, { "docid": "4d92ef42c4d2237bf629449bc3e48276", "score": "0.54642934", "text": "def delete_network_migration_spec(template_id, opts = {})\n delete_network_migration_spec_with_http_info(template_id, opts)\n nil\n end", "title": "" }, { "docid": "8d40357d9a8da341eb030215034157e7", "score": "0.54254305", "text": "def get_network_migration_spec(template_id, opts = {})\n data, _status_code, _headers = get_network_migration_spec_with_http_info(template_id, opts)\n data\n end", "title": "" }, { "docid": "a85037d456df85fc5a731f58a6b8bd78", "score": "0.54006886", "text": "def delete_network_migration_spec(template_id, opts = {})\n delete_network_migration_spec_with_http_info(template_id, opts)\n return nil\n end", "title": "" }, { "docid": "3c12096c985cef8937f8955418675447", "score": "0.53734684", "text": "def get_network_migration_spec(template_id, opts = {})\n data, _status_code, _headers = get_network_migration_spec_with_http_info(template_id, opts)\n return data\n end", "title": "" }, { "docid": "954d0129a006c10b2ddcf0d33be21046", "score": "0.5181109", "text": "def get_network_migration_spec_with_http_info(template_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.get_network_migration_spec ...'\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.get_network_migration_spec\"\n end\n # resource path\n local_var_path = '/network-migration-specs/{template-id}'.sub('{' + 'template-id' + '}', template_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#get_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4af3307dc3e6c699918ed642d18ff013", "score": "0.5151455", "text": "def update_compute_collection_transport_node_template_and_tn_collection_with_http_info(template_id, compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.update_compute_collection_transport_node_template_and_tn_collection ...'\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.update_compute_collection_transport_node_template_and_tn_collection\"\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.update_compute_collection_transport_node_template_and_tn_collection\"\n end\n # resource path\n local_var_path = '/compute-collection-transport-node-templates/{template-id}'.sub('{' + 'template-id' + '}', template_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(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#update_compute_collection_transport_node_template_and_tn_collection\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3973f42e9b1249ae80c17ae6c64c08b3", "score": "0.5119505", "text": "def update_compute_collection_transport_node_template_with_http_info(template_id, compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.update_compute_collection_transport_node_template ...\"\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling NetworkTransportApi.update_compute_collection_transport_node_template\"\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling NetworkTransportApi.update_compute_collection_transport_node_template\"\n end\n # resource path\n local_var_path = \"/compute-collection-transport-node-templates/{template-id}\".sub('{' + 'template-id' + '}', template_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(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#update_compute_collection_transport_node_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "07361e54bf37afd1c99dba24d8d36f01", "score": "0.5095128", "text": "def get_network_migration_spec_with_http_info(template_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.get_network_migration_spec ...\"\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling NetworkTransportApi.get_network_migration_spec\"\n end\n # resource path\n local_var_path = \"/network-migration-specs/{template-id}\".sub('{' + 'template-id' + '}', template_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpec')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#get_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "be0ddfccf397d355568fbc262da53a63", "score": "0.5066054", "text": "def network_change_spec(network_device, network_obj, network_name, operation: :edit)\n if network_obj.is_a? RbVmomi::VIM::DistributedVirtualPortgroup\n Kitchen.logger.info format(\"Assigning network %s...\", network_obj.pretty_path)\n\n vds_obj = network_obj.config.distributedVirtualSwitch\n Kitchen.logger.info format(\"Using vDS '%s' for network connectivity...\", vds_obj.name)\n\n network_device.backing = RbVmomi::VIM.VirtualEthernetCardDistributedVirtualPortBackingInfo(\n port: RbVmomi::VIM.DistributedVirtualSwitchPortConnection(\n portgroupKey: network_obj.key,\n switchUuid: vds_obj.uuid\n )\n )\n elsif network_obj.is_a? RbVmomi::VIM::Network\n Kitchen.logger.info format(\"Assigning network %s...\", network_name)\n\n network_device.backing = RbVmomi::VIM.VirtualEthernetCardNetworkBackingInfo(\n deviceName: network_name\n )\n else\n raise Support::CloneError, format(\"Unknown network type %s for network name %s\", network_obj.class.to_s, network_name)\n end\n\n RbVmomi::VIM.VirtualDeviceConfigSpec(\n operation: RbVmomi::VIM::VirtualDeviceConfigSpecOperation(operation),\n device: network_device\n )\n end", "title": "" }, { "docid": "bc90572bf6966300e78de532d2d5bb4c", "score": "0.5012035", "text": "def tc_update_template(request)\n dashboard_request('POST', '/api/tc-templates', request)\n end", "title": "" }, { "docid": "b2cadb1854d8ff46fd88e7b948edb0bc", "score": "0.50080943", "text": "def delete_network_migration_spec_with_http_info(template_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.delete_network_migration_spec ...'\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.delete_network_migration_spec\"\n end\n # resource path\n local_var_path = '/network-migration-specs/{template-id}'.sub('{' + 'template-id' + '}', template_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(: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: ManagementPlaneApiNetworkTransportTransportNodesApi#delete_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "50ce37110ab58f2e04a010c62d4816ad", "score": "0.4948475", "text": "def delete_network_migration_spec_with_http_info(template_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.delete_network_migration_spec ...\"\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling NetworkTransportApi.delete_network_migration_spec\"\n end\n # resource path\n local_var_path = \"/network-migration-specs/{template-id}\".sub('{' + 'template-id' + '}', template_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(: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: NetworkTransportApi#delete_network_migration_spec\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "770c71fe09e12e63823890cc4d6e84c4", "score": "0.49096927", "text": "def update_inspect_template 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_update_inspect_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dlp::V2::InspectTemplate.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "f1c14f747a827e62c551312282ba69ab", "score": "0.48974013", "text": "def template_update(val)\n Role.transaction do\n update!(template: template.deep_merge(val))\n end\n end", "title": "" }, { "docid": "b1b063041aaa5ab32571aae7eb535313", "score": "0.48963454", "text": "def update_server_profile_template(moid, server_profile_template, opts = {})\n data, _status_code, _headers = update_server_profile_template_with_http_info(moid, server_profile_template, opts)\n data\n end", "title": "" }, { "docid": "8bbc14cee67d9d2fcdd6a07bd2047bf0", "score": "0.48918402", "text": "def update_compute_collection_transport_node_template(template_id, compute_collection_transport_node_template, opts = {})\n data, _status_code, _headers = update_compute_collection_transport_node_template_with_http_info(template_id, compute_collection_transport_node_template, opts)\n return data\n end", "title": "" }, { "docid": "d6d4c749036f531a4b9e66ab7eae5bdf", "score": "0.4875327", "text": "def set_node_template request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::SetNodeTemplateNodeGroupRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/nodeGroups/#{request_pb.node_group}/setNodeTemplate\"\n body = request_pb.node_groups_set_node_template_request_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "title": "" }, { "docid": "f3331a86178a4359e88eede9e4936a35", "score": "0.4871205", "text": "def migration_template(source, destination, config = T.unsafe(nil)); end", "title": "" }, { "docid": "4de762f09cf53db512e908a52240b17f", "score": "0.48494792", "text": "def update_compute_collection_transport_node_template_and_tn_collection(template_id, compute_collection_transport_node_template, opts = {})\n data, _status_code, _headers = update_compute_collection_transport_node_template_and_tn_collection_with_http_info(template_id, compute_collection_transport_node_template, opts)\n data\n end", "title": "" }, { "docid": "09a257c961f3b169e07d6a23102b3efd", "score": "0.48097864", "text": "def set_node_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_node_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "title": "" }, { "docid": "08592b4cbe7952cbdf23549badee1f14", "score": "0.48095432", "text": "def list_network_migration_specs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.list_network_migration_specs ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NetworkTransportApi.list_network_migration_specs, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NetworkTransportApi.list_network_migration_specs, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['HostProfileNetworkMigrationSpec'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of HostProfileNetworkMigrationSpec'\n end\n # resource path\n local_var_path = \"/network-migration-specs\"\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_system_owned'] = opts[:'include_system_owned'] if !opts[:'include_system_owned'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpecListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#list_network_migration_specs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d4b1e5acd9a93b4d9913c49c1f550754", "score": "0.47836328", "text": "def configure_networks(server_id, network_spec)\n with_thread_name(\"configure_networks(#{server_id}, ...)\") do\n raise Bosh::Clouds::NotSupported,\n format('network configuration change requires VM recreation: %s', network_spec)\n end\n end", "title": "" }, { "docid": "17b6e5a33283c8dcad6c2c2922d456c5", "score": "0.4766245", "text": "def list_network_migration_specs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.list_network_migration_specs ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiNetworkTransportTransportNodesApi.list_network_migration_specs, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiNetworkTransportTransportNodesApi.list_network_migration_specs, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['HostProfileNetworkMigrationSpec'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of HostProfileNetworkMigrationSpec'\n end\n # resource path\n local_var_path = '/network-migration-specs'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_system_owned'] = opts[:'include_system_owned'] if !opts[:'include_system_owned'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NetworkMigrationSpecListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#list_network_migration_specs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6042430d3f733d596a13ce0c135e96ed", "score": "0.47605112", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end", "title": "" }, { "docid": "317a0f6734cad991d7f85663e5c9a475", "score": "0.4724539", "text": "def update!(**args)\n @template = args[:template] if args.key?(:template)\n end", "title": "" }, { "docid": "90b3ae9fda8e2df2af1c1910cabcf946", "score": "0.47152922", "text": "def update_certificate_template 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_update_certificate_template_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", "title": "" }, { "docid": "51a31b9ea50cccd268e94f4cc4120980", "score": "0.47055236", "text": "def update_from_template!\n template_parser = ::Inverter::Parser.new(self._template_name)\n template_blocks = template_parser.blocks\n name = template_parser.name\n\n # add new blocks\n keys_to_add = template_blocks.keys - self._blocks.keys\n keys_to_add.each do |key|\n self._blocks[key] = template_blocks[key]\n end\n\n # remove old blocks\n keys_to_remove = self._blocks.keys - template_blocks.keys\n keys_to_remove.each do |key|\n self._blocks.delete(key)\n end\n\n # keep same blocks order as in template\n ordered_blocks = {}\n template_blocks.keys.each { |k| ordered_blocks[k] = self._blocks[k] }\n self._blocks = ordered_blocks\n\n # update page name\n self._name = name\n\n # force update_at change event the conten not changed\n self.updated_at = Time.now\n\n save\n end", "title": "" }, { "docid": "598c55c9951f4fc588e648be8ebaa9a3", "score": "0.47010034", "text": "def create_compute_collection_transport_node_template_with_http_info(compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.create_compute_collection_transport_node_template ...\"\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling NetworkTransportApi.create_compute_collection_transport_node_template\"\n end\n # resource path\n local_var_path = \"/compute-collection-transport-node-templates\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#create_compute_collection_transport_node_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ec297b5042cab87ce3d48783e22600b2", "score": "0.46768203", "text": "def update_vmware_engine_network 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_update_vmware_engine_network_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", "title": "" }, { "docid": "26e66acdf1b48f34bfb28e285d97be0f", "score": "0.46630737", "text": "def create_compute_collection_transport_node_template_and_tn_collection_with_http_info(compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportNodesApi.create_compute_collection_transport_node_template_and_tn_collection ...'\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling ManagementPlaneApiNetworkTransportTransportNodesApi.create_compute_collection_transport_node_template_and_tn_collection\"\n end\n # resource path\n local_var_path = '/compute-collection-transport-node-templates'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportNodesApi#create_compute_collection_transport_node_template_and_tn_collection\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "56de3de3a5244ad0be415dfc515e2879", "score": "0.46536592", "text": "def modify_template_nics_simple_spec(network_label, nic_type, network_adapter_device_key, datacenter)\n config_spec_operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('edit')\n # Get the portgroup and handle it from there.\n network = get_raw_network(network_label, datacenter)\n nic_backing_info = if network.is_a? RbVmomi::VIM::DistributedVirtualPortgroup\n # Create the NIC backing for the distributed virtual portgroup\n RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo(\n port: RbVmomi::VIM::DistributedVirtualSwitchPortConnection(\n portgroupKey: network.key,\n switchUuid: network.config.distributedVirtualSwitch.uuid\n )\n )\n else\n # Otherwise it's a non distributed port group\n RbVmomi::VIM::VirtualEthernetCardNetworkBackingInfo(deviceName: network_label)\n end\n connectable = RbVmomi::VIM::VirtualDeviceConnectInfo(\n allowGuestControl: true,\n connected: true,\n startConnected: true\n )\n device = RbVmomi::VIM.public_send nic_type.to_s,\n backing: nic_backing_info,\n deviceInfo: RbVmomi::VIM::Description(label: 'Network adapter 1', summary: network_label),\n key: network_adapter_device_key,\n connectable: connectable\n device_spec = RbVmomi::VIM::VirtualDeviceConfigSpec(\n operation: config_spec_operation,\n device: device\n )\n device_spec\n end", "title": "" }, { "docid": "52db70ab263ed5a15d9c1e97b18b4b5a", "score": "0.46231887", "text": "def network_device_changes(action_handler, vm_template, options)\n additions = []\n changes = []\n networks = options[:network_name]\n networks = [networks] if networks.is_a?(String)\n\n cards = find_ethernet_cards_for(vm_template)\n\n key = 4000\n networks.each_index do |i|\n label = \"Ethernet #{i + 1}\"\n backing_info = backing_info_for(action_handler, networks[i])\n if card = cards.shift\n key = card.key\n operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('edit')\n action_handler.report_progress \"changing template nic for #{networks[i]}\"\n changes.push(\n network_adapter_for(operation, networks[i], label, key, backing_info)\n )\n else\n key += 1\n operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('add')\n action_handler.report_progress \"will be adding nic for #{networks[i]}\"\n additions.push(\n network_adapter_for(operation, networks[i], label, key, backing_info)\n )\n end\n end\n [additions, changes]\n end", "title": "" }, { "docid": "61bddfb5026173b40a83006ec82363bf", "score": "0.46127847", "text": "def update_template(template_name, payload)\n request(:put, \"/service_template/#{get_unique_template_id(template_name)}\", payload)\n end", "title": "" }, { "docid": "a6ffa702e0b172965cefab9d7e14e2cd", "score": "0.46111083", "text": "def change_box_in_docker_template(template_path_of_cloned_config, node_name, new_box_name)\n template = JSON.parse(File.read(template_path_of_cloned_config))\n template[node_name][BOX] = new_box_name\n $out.info \"changing box for node: #{node_name} in template: #{template_path_of_cloned_config} to #{new_box_name}\"\n File.open(template_path_of_cloned_config, 'w') do |file|\n file.write(JSON.pretty_generate(template))\n end\n end", "title": "" }, { "docid": "234cee1e94592c41e6bdca79e9f335ad", "score": "0.45552117", "text": "def rest__promote_to_template\n assembly = ret_assembly_instance_object()\n\n unless (ret_request_params(:assembly_template_name) && ret_request_params(:service_module_name))\n assembly.update_object!(:version)\n # TODO: see how assembly[:version] can be set to nil and fix there\n unless assembly[:version].eql?('master') or assembly[:version].nil?\n fail ErrorUsage.new(\"You are not allow to push updates to service module versions!\") \n end\n end\n\n assembly_template_name, service_module_name, module_namespace = get_template_and_service_names_params(assembly, check_frozen_branches: true)\n\n if assembly_template_name.nil? || service_module_name.nil?\n fail ErrorUsage.new('SERVICE-NAME/ASSEMBLY-NAME cannot be determined and must be explicitly given')\n end\n\n project = get_default_project()\n opts = ret_symbol_params_hash(:mode)\n\n namespace = ret_request_params(:namespace) ||\n (ret_request_param_boolean(:use_module_namespace) ? module_namespace : Namespace.default_namespace_name)\n opts.merge!(namespace: namespace)\n\n if description = ret_request_params(:description)\n opts.merge!(description: description)\n end\n\n if local_clone_dir_exists = ret_request_params(:local_clone_dir_exists)\n opts.merge!(local_clone_dir_exists: local_clone_dir_exists)\n end\n\n # push-assembly-updates always updates master branch\n service_module = Assembly::Template.create_or_update_from_instance(project, assembly, service_module_name, assembly_template_name, opts.merge!(version: 'master'))\n rest_ok_response service_module.ret_clone_update_info()\n end", "title": "" }, { "docid": "e48feb529e101715f4d96fe7bc04da82", "score": "0.45452514", "text": "def update_compute_collection_fabric_template(fabric_template_id, compute_collection_fabric_template, opts = {})\n data, _status_code, _headers = update_compute_collection_fabric_template_with_http_info(fabric_template_id, compute_collection_fabric_template, opts)\n data\n end", "title": "" }, { "docid": "c4269ed2acee1f732cadd58d9bdeedbe", "score": "0.45431998", "text": "def register_template(template)\n @release_version_model.add_template(template)\n end", "title": "" }, { "docid": "c4269ed2acee1f732cadd58d9bdeedbe", "score": "0.45431998", "text": "def register_template(template)\n @release_version_model.add_template(template)\n end", "title": "" }, { "docid": "24fa7bdfa6494c498909020bd79c3cd2", "score": "0.45194224", "text": "def ot_update_attributes; update_attributes(OrganizationTemplate, params); end", "title": "" }, { "docid": "b3d864af5f9e4fba8174500b7060d5e3", "score": "0.45101365", "text": "def update_compute_collection_fabric_template(fabric_template_id, compute_collection_fabric_template, opts = {})\n data, _status_code, _headers = update_compute_collection_fabric_template_with_http_info(fabric_template_id, compute_collection_fabric_template, opts)\n return data\n end", "title": "" }, { "docid": "328ada5064097940c4e0310d1b1a3546", "score": "0.4495283", "text": "def transloadit_assembly_update_template!(template, context, options)\n options[:template_id] = template\n end", "title": "" }, { "docid": "c0a4a631d1f0d22a41382e85ba557ede", "score": "0.44945195", "text": "def cmdCreateNodeUpdateNet(type, net)\n params = {\n \"create_node_and_update_net\" => 1,\n \"id_player\" => @config[\"id\"],\n \"id_node\" => type,\n \"net\" => Serializer.generateNetwork(net),\n \"app_version\" => @config[\"version\"],\n }\n response = @client.request(params, @sid)\n return response.to_i\n end", "title": "" }, { "docid": "02e9f5b78a3f80135e8ecb821c5456e6", "score": "0.4492775", "text": "def normalize_template(name, driver, template, allow_no_roles = false, allow_no_vm_template = false)\n template = {\n :deployment => 'straight',\n :name => name,\n :ready_status_gate => false,\n :description => '',\n :roles => [],\n :custom_attrs => {}\n }.merge(template)\n\n fail \"You must specify at least 1 role for template '#{name}'\" if template[:roles].empty? && !allow_no_roles\n id_cache = {}\n template[:roles].map! do |role|\n fail \"Some roles in template '#{name}' are missing a name.\" if role[:name].nil?\n fail \"Role '#{role[:name]}' in template '#{name}' is missing a vm_template.\" if role[:vm_template].nil? && !allow_no_vm_template\n new_role = {\n :cardinality => role[:min_vms] || 1,\n :elasticity_policies => [],\n :scheduled_policies => []\n }.merge(role)\n if role[:vm_template].is_a?(String)\n if id_cache[role[:vm_template]].nil?\n template_from_one = driver.one.get_resource(:template, :name => role[:vm_template])\n fail \"Could not find a template with the name '#{role[:vm_template]}'\" if template_from_one.nil?\n id = template_from_one.to_hash['VMTEMPLATE']['ID'].to_i\n id_cache[role[:vm_template]] = id\n new_role[:vm_template] = id\n else\n new_role[:vm_template] = id_cache[role[:vm_template]]\n end\n end\n new_role\n end\n template\n end", "title": "" }, { "docid": "57f9a466f3faa286607b1a75ac236463", "score": "0.44714996", "text": "def migration_template(relative_source, relative_destination, template_options = {})\r\n migration_directory relative_destination\r\n migration_file_name = template_options[:migration_file_name] || file_name\r\n raise \"Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}\" if migration_exists?(migration_file_name)\r\n template(relative_source, \"#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb\", template_options)\r\n end", "title": "" }, { "docid": "681c523f26399f012e52607a992bbf6c", "score": "0.4465627", "text": "def update\n respond_to do |format|\n if params['commit']\n if @network.update(network_params)\n format.html { redirect_to @network, notice: 'Network was successfully updated.' }\n format.json { render :show, status: :ok, location: @network }\n else\n format.html { render :edit }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n elsif params['add_ipv4_pool']\n @network.assign_attributes(network_params)\n next_ipv4 = @network.next_ipv4_pool\n @network.ipv4_pools << Ipv4Pool.new(\n ipv4_config: :static,\n ipv4_first_address: next_ipv4&.address,\n ipv4_last_address: next_ipv4&.address,\n )\n format.html { render :edit }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n elsif params['add_ipv6_pool'] && @network.ipv6_network\n @network.assign_attributes(network_params)\n next_ipv6 = @network.next_ipv6_pool\n @network.ipv6_pools << Ipv6Pool.new(\n ipv6_config: :static,\n ipv6_first_address: next_ipv6&.address,\n ipv6_last_address: next_ipv6&.address,\n )\n format.html { render :edit }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n else\n @network.assign_attributes(network_params)\n format.html { render :edit }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "609e293c5ecf9356057d489bba10ce8d", "score": "0.4461997", "text": "def set_site_template\n @site_template = Network.find(params[:network_id]).site_template\n end", "title": "" }, { "docid": "614d53eee6f9a73854a039243cd5c967", "score": "0.44498754", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @template = args[:template] if args.key?(:template)\n end", "title": "" }, { "docid": "bf014d0f6224f1e44aeee98b1f2af26d", "score": "0.4446063", "text": "def update_network 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_update_network_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", "title": "" }, { "docid": "85f58e073a646c9ff9365184c900b05b", "score": "0.44169176", "text": "def create(network_definition)\n begin\n range_prefix, gateway = identify_subnet_range_prefix_and_gateway(network_definition)\n edge_cluster_id = get_edge_cluster_id(network_definition.t0_router_id)\n fail_if_switch_exists(network_definition.switch_name) unless network_definition.switch_name.nil?\n\n t1_router_id = create_t1_router(edge_cluster_id, network_definition.t1_name)\n enable_route_advertisement(t1_router_id)\n\n logger.debug(\"Attaching T1(#{t1_router_id}) to T0(#{network_definition.t0_router_id})\")\n @router_provider.attach_t1_to_t0(network_definition.t0_router_id, t1_router_id)\n\n if @block_subnet\n tags = [ NSXT::Tag.new(scope: TAG_SCOPE_NAME, tag: @block_subnet.id) ]\n end\n\n logger.info(\"Creating logical switch in zone #{network_definition.transport_zone_id}\")\n switch = @switch_provider.create_logical_switch(network_definition.transport_zone_id,\n name: network_definition.switch_name,\n tags: tags)\n switch_id = switch.id\n logger.debug(\"Attaching switch(#{switch_id}) to T1(#{t1_router_id})\")\n attach_switch_to_t1(switch_id, t1_router_id, gateway, range_prefix)\n rescue => e\n logger.error('Failed to create network. Trying to clean up')\n @router_provider.delete_t1_router(t1_router_id) unless t1_router_id.nil?\n @switch_provider.delete_logical_switch(switch_id) unless switch_id.nil?\n @ip_block_provider.release_subnet(@block_subnet.id) unless @block_subnet.nil?\n raise \"Failed to create network. Has router been created: #{!t1_router_id.nil?}. Has switch been created: #{!switch_id.nil?}. Exception: #{e.message}\"\n end\n\n if @block_subnet\n ManagedNetwork.new(switch, @block_subnet.cidr, gateway)\n else\n ManagedNetwork.new(switch)\n end\n end", "title": "" }, { "docid": "f7b19e95ff981f811b8852b64f2322ab", "score": "0.44134137", "text": "def virtual_network_from(network)\n template_path = File.join(template_directory, 'network.erb')\n data = { instance: network, identity: active_identity }\n data[:configuration] = { phydev: default_network_phydev }\n erb_render template_path, data\n end", "title": "" }, { "docid": "9c982bd746ab5c2cfb605ed5ebe3348b", "score": "0.44026673", "text": "def update_template(id:, **opts)\n req = {}\n req['type'] = opts[:type] if opts[:type]\n req['script'] = opts[:script] if opts[:script]\n\n if opts[:type]\n raise ArgumentError, \"Kapacitor template type can be either 'batch' or 'stream'\" unless opts[:type] == 'batch' or opts[:type] == 'stream'\n end\n\n api_patch(endpoint: \"templates/#{id}\", data: req) unless req.empty?\n end", "title": "" }, { "docid": "48447b4ae9ed93c3ec29b542f3017fbe", "score": "0.4401986", "text": "def patch_server_profile_template(moid, server_profile_template, opts = {})\n data, _status_code, _headers = patch_server_profile_template_with_http_info(moid, server_profile_template, opts)\n data\n end", "title": "" }, { "docid": "12eac5125c97c64a0e642f62920be5e8", "score": "0.43935642", "text": "def update_network_interface request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_network_interface_request request_pb\n response = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "title": "" }, { "docid": "349fe86f8acc6a5002b6dc0d63d7a3e1", "score": "0.4389729", "text": "def migration_template(relative_source, relative_destination, template_options = {})#:nodoc:\n increment_migration_count\n migration_directory relative_destination\n migration_file_name = template_options[:migration_file_name] || file_name\n if migration_exists?(migration_file_name)\n logger.exists \"#{existing_migrations(migration_file_name).first}\"\n else\n template(relative_source, \"#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb\", template_options)\n end\n end", "title": "" }, { "docid": "395ebc5973a6d3cdd0b02250c4ac5e77", "score": "0.4387432", "text": "def template=(template)\n if template.nil?\n fail ArgumentError, 'invalid value for \"template\", template cannot be nil.'\n end\n @template = template\n end", "title": "" }, { "docid": "782c16ab97970655448aec842e6762b9", "score": "0.4370761", "text": "def update\n respond_to do |format|\n if @lab_vmt_network.update_attributes(lab_vmt_network_params)\n format.html { redirect_to @lab_vmt_network, notice: 'Lab vmt network was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lab_vmt_network.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b8d666a8ddb39b7fffb28b0a6c58da0", "score": "0.4369243", "text": "def set_instance_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_instance_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "title": "" }, { "docid": "76fbd83924e73566244e87535eaeabc5", "score": "0.4363686", "text": "def create(spec)\n spec = spec.is_a?(String) ? spec : spec.to_xml\n nil_or_object(FFI::Libvirt.virNetworkCreateXML(interface, spec), Network)\n end", "title": "" }, { "docid": "1960aac709c10c018b6aeab9e0c1ff84", "score": "0.43548948", "text": "def update_template(type_hint, id, opts = {})\n data, _status_code, _headers = update_template_with_http_info(type_hint, id, opts)\n return data\n end", "title": "" }, { "docid": "b140586391454874f04bfb4408df4d0d", "score": "0.43477973", "text": "def template=(template)\n if template\n self.layout = template\n self.style = template\n end\n end", "title": "" }, { "docid": "ca17537c5d405377408d83f1aed2d66d", "score": "0.43475994", "text": "def update!(**args)\n @template = args[:template] unless args[:template].nil?\n @type = args[:type] unless args[:type].nil?\n end", "title": "" }, { "docid": "1f255dd9e38eb4ef61fd08bf66d18d2b", "score": "0.4346953", "text": "def set_instance_template 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_set_instance_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "bd385203984826fd56b82e2576f377de", "score": "0.4337054", "text": "def update!(**args)\n @template = args[:template] if args.key?(:template)\n @type = args[:type] if args.key?(:type)\n end", "title": "" }, { "docid": "bd385203984826fd56b82e2576f377de", "score": "0.4337054", "text": "def update!(**args)\n @template = args[:template] if args.key?(:template)\n @type = args[:type] if args.key?(:type)\n end", "title": "" }, { "docid": "bd385203984826fd56b82e2576f377de", "score": "0.4337054", "text": "def update!(**args)\n @template = args[:template] if args.key?(:template)\n @type = args[:type] if args.key?(:type)\n end", "title": "" }, { "docid": "5e1fa2234ebb56d00447c6b6fb4a5a0f", "score": "0.43334576", "text": "def update_tag_template 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_update_tag_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1beta1::TagTemplate.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "854f9be79853bb824b8223d3f5db0543", "score": "0.4326378", "text": "def template=(template)\n @template = template\n end", "title": "" }, { "docid": "13ce56070422125059de0b0a74a1de3b", "score": "0.43159997", "text": "def create\n @template = Template.find(params[:template_id])\n authorize @template, :transfer_customization?\n if @template.upgrade_customization?\n # If the customized template is not published it will not version, so publish it!\n previously_published = @template.published?\n @template.publish unless previously_published\n\n @new_customization = @template.upgrade_customization!\n\n # Reset the published flag if the customized template was not previously published\n @template.update(published: false) unless previously_published\n\n redirect_to org_admin_template_path(@new_customization)\n else\n flash.now[:alert] = _('That template is no longer customizable.')\n redirect_back(fallback_location: org_admin_templates_path)\n end\n end", "title": "" }, { "docid": "d279b14b91c1694a08e68762a4a60e00", "score": "0.43117234", "text": "def update\n if(@network.update_attributes(params[:network]))\n flash[:notice] = l(:notice_successful_update)\n end\n respond_to do |format|\n format.html { redirect_to edit_project_configuration_network_path(@project, @network) }\n format.xml { head :ok }\n format.api { render_validation_errors(@network) }\n end\n end", "title": "" }, { "docid": "49a8c8454f856efa8e26884ff3250a24", "score": "0.43087244", "text": "def change\r\n @template = ScheduleTemplate.find params[:template_id]\r\n @cells = params[:cells]\r\n render :layout => false\r\n end", "title": "" }, { "docid": "121367c4b1f29a18223e24f0bda8720e", "score": "0.4307275", "text": "def update_tag_template 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_update_tag_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1::TagTemplate.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "83f0fa25446bce4bec36c8dfd1cff331", "score": "0.43059146", "text": "def update_network(bootstrap_options, vapp, vm)\n ## TODO: allow user to specify network to connect to (see above net used)\n # Define network connection for vm based on existing routed network\n\n # vCloud Air inlining vapp() and vm()\n # vapp = vdc.vapps.get_by_name(bootstrap_options[:name])\n # vm = vapp.vms.find {|v| v.vapp_name == bootstrap_options[:name]}\n return if vm.ip_address != \"\" # return if ip address is set, as this isn't a new VM\n Chef::Log.debug(\"No IP address found. Must be a new VM.\")\n net = net(bootstrap_options)\n Chef::Log.debug(\"Searching for network: #{net.name}\")\n nc = vapp.network_config.find { |netc| netc if netc[:networkName].match(net.name) }\n Chef::Log.debug(\"Found network configuration: #{nc}\")\n networks_config = [nc]\n section = { PrimaryNetworkConnectionIndex: 0 }\n section[:NetworkConnection] = networks_config.compact.each_with_index.map do |network, i|\n connection = {\n network: network[:networkName],\n needsCustomization: true,\n NetworkConnectionIndex: i,\n IsConnected: true\n }\n ip_address = network[:ip_address]\n ## TODO: support config options for allocation mode\n # allocation_mode = network[:allocation_mode]\n # allocation_mode = 'manual' if ip_address\n # allocation_mode = 'dhcp' unless %w{dhcp manual pool}.include?(allocation_mode)\n # allocation_mode = 'POOL'\n # connection[:Dns1] = dns1 if dns1\n allocation_mode = \"pool\"\n connection[:IpAddressAllocationMode] = allocation_mode.upcase\n connection[:IpAddress] = ip_address if ip_address\n connection\n end\n\n ## attach the network to the vm\n nc_task = compute.put_network_connection_system_section_vapp(\n vm.id, section\n ).body\n compute.process_task(nc_task)\n end", "title": "" }, { "docid": "295dd98650a0879a0bc3a3086ed4b5b8", "score": "0.43031862", "text": "def set_instance_template request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/instanceGroupManagers/#{request_pb.instance_group_manager}/setInstanceTemplate\"\n body = request_pb.region_instance_group_managers_set_template_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "5dd71a3f9862cc96dbb09988ee68930b", "score": "0.42852357", "text": "def update(options) # rubocop:disable Metrics/AbcSize\n @util = Utilities.new\n networkconfig = SecIPList.new(options)\n options = args unless caller[0][/`([^']*)'/, 1] == '<top (required)>' || caller[0][/`([^']*)'/, 1].nil?\n case options[:action]\n when 'create'\n file = File.read(options[:create_json])\n update = JSON.parse(file)\n networkupdate.create_data = update\n networkupdate = networkconfig.update(options[:action])\n @util.response_handler(networkupdate)\n JSON.pretty_generate(JSON.parse(networkupdate.body))\n when 'delete'\n networkupdate = networkconfig.update(options[:action])\n @util.response_handler(networkupdate)\n JSON.pretty_generate(JSON.parse(networkupdate.body))\n else\n abort('invalid entry for action')\n end\n end", "title": "" }, { "docid": "f940dabda7d6fb9e4d2aa3e23e0afc6d", "score": "0.42786384", "text": "def update\n converge_if_changed do |_vars|\n # TODO(nelsonjr): Determine how to print indented like upd converge\n # TODO(nelsonjr): Check w/ Chef... can we print this in red?\n puts # making a newline until we find a better way TODO: find!\n compute_changes.each { |log| puts \" - #{log.strip}\\n\" }\n update_req =\n ::Google::Container::Network::Put.new(self_link(@new_resource),\n fetch_auth(@new_resource),\n 'application/json',\n resource_to_request)\n wait_for_operation update_req.send, @new_resource\n end\n end", "title": "" }, { "docid": "19898fa50eb74f3ea5758fe692a7a58d", "score": "0.42784622", "text": "def initialize_network(name, network_spec)\n network_type = NetworkConfigurator.network_type(network_spec)\n\n case network_type\n when 'dynamic'\n cloud_error('Only one dynamic network per instance should be defined') if @dynamic_network\n subnet_id = NetworkConfigurator.extract_subnet_id(network_spec)\n cloud_error(\"Dynamic network with id #{subnet_id} is already defined\") if @subnet_ids.include?(subnet_id)\n network = DynamicNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n @networks << network\n @subnet_ids << subnet_id\n @dynamic_network = network\n when 'manual'\n subnet_id = NetworkConfigurator.extract_subnet_id(network_spec)\n cloud_error('Manual network must have subnet_id') if subnet_id.nil?\n cloud_error(\"Manual network with id #{subnet_id} is already defined\") if @subnet_ids.include?(subnet_id)\n network = ManualNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n @networks << network\n unless subnet_id.nil?\n @subnet_ids << subnet_id\n end\n when 'vip'\n cloud_error('Only one VIP network per instance should be defined') if @vip_network\n @vip_network = VipNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n else\n cloud_error(\"Invalid network type `#{network_type}': HuaweiCloud \" \\\n \"CPI can only handle `dynamic', 'manual' or `vip' \" \\\n 'network types')\n end\n\n @security_groups.uniq!\n end", "title": "" }, { "docid": "dee0b04de5083dac5ed48632a5a53e5f", "score": "0.42773363", "text": "def set_instance_template request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instanceGroupManagers/#{request_pb.instance_group_manager}/setInstanceTemplate\"\n body = request_pb.instance_group_managers_set_instance_template_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "4e03f4a12ef355408e64a4dd13a252ce", "score": "0.4270876", "text": "def update!(**args)\n @networks = args[:networks] if args.key?(:networks)\n end", "title": "" }, { "docid": "bea91fa10affbb071ab6730db2cc4818", "score": "0.42663544", "text": "def initialize_network(name, network_spec)\n network_type = NetworkConfigurator.network_type(network_spec)\n\n case network_type\n when 'dynamic'\n cloud_error('Only one dynamic network per instance should be defined') if @dynamic_network\n net_id = NetworkConfigurator.extract_net_id(network_spec)\n cloud_error(\"Dynamic network with id #{net_id} is already defined\") if @net_ids.include?(net_id)\n network = DynamicNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n @networks << network\n @net_ids << net_id\n @dynamic_network = network\n when 'manual'\n net_id = NetworkConfigurator.extract_net_id(network_spec)\n cloud_error('Manual network must have net_id') if net_id.nil?\n cloud_error(\"Manual network with id #{net_id} is already defined\") if @net_ids.include?(net_id)\n network = ManualNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n @networks << network\n @net_ids << net_id\n when 'vip'\n cloud_error('Only one VIP network per instance should be defined') if @vip_network\n @vip_network = VipNetwork.new(name, network_spec)\n @security_groups += extract_security_groups(network_spec)\n else\n cloud_error(\"Invalid network type `#{network_type}': OpenStack \" \\\n \"CPI can only handle `dynamic', 'manual' or `vip' \" \\\n 'network types')\n end\n\n @security_groups.uniq!\n end", "title": "" }, { "docid": "3b69404e68b2f41a32fa1eadaeec93ec", "score": "0.42610705", "text": "def create_node_update_net(type, net, id = @id)\n @client.request_session(\n {\n 'create_node_and_update_net' => 1,\n 'id_player' => id,\n 'id_node' => type,\n 'net' => net,\n 'app_version' => @version\n },\n @sid\n )\n end", "title": "" }, { "docid": "588f703e92ec0f0896be5eda7784de5a", "score": "0.42573607", "text": "def update!(**args)\n @template_name = args[:template_name] if args.key?(:template_name)\n @test_order = args[:test_order] if args.key?(:test_order)\n end", "title": "" }, { "docid": "0ae7c1365702cfeab237667af8989587", "score": "0.42553607", "text": "def update_compute_collection_fabric_template_with_http_info(fabric_template_id, compute_collection_fabric_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricComputeCollectionsApi.update_compute_collection_fabric_template ...'\n end\n # verify the required parameter 'fabric_template_id' is set\n if @api_client.config.client_side_validation && fabric_template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'fabric_template_id' when calling ManagementPlaneApiFabricComputeCollectionsApi.update_compute_collection_fabric_template\"\n end\n # verify the required parameter 'compute_collection_fabric_template' is set\n if @api_client.config.client_side_validation && compute_collection_fabric_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_fabric_template' when calling ManagementPlaneApiFabricComputeCollectionsApi.update_compute_collection_fabric_template\"\n end\n # resource path\n local_var_path = '/fabric/compute-collection-fabric-templates/{fabric-template-id}'.sub('{' + 'fabric-template-id' + '}', fabric_template_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(compute_collection_fabric_template)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ComputeCollectionFabricTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricComputeCollectionsApi#update_compute_collection_fabric_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0ec735c3edc9c319f2056b62ab98d124", "score": "0.4239611", "text": "def update_prompt_template(id, alternate_content_id, new_email_id, og_email_id, new_example_video_id, opts = {})\n update_prompt_template_with_http_info(id, alternate_content_id, new_email_id, og_email_id, new_example_video_id, opts)\n return nil\n end", "title": "" }, { "docid": "5bc8defa884767e255b24798a09bc078", "score": "0.42359707", "text": "def update(components, opts = {})\n # get mapping between component instances and their templates\n # component templates indexed by component type\n links = get_instance_template_links(components, opts)\n rows_to_update = components.map do |cmp|\n cmp_template = links.template(cmp)\n {\n id: cmp[:id],\n module_branch_id: @module_branch_id,\n version: cmp_template[:version],\n locked_sha: nil, #this serves to let component instance get updated as this branch is updated\n implementation_id: cmp_template[:implementation_id],\n ancestor_id: cmp_template[:id],\n external_ref: cmp_template[:external_ref]\n }\n end\n Model.update_from_rows(@project_idh.createMH(:component), rows_to_update)\n update_children(links)\n end", "title": "" }, { "docid": "55ffccd353a0946d96b0f8de76dae3a9", "score": "0.4225904", "text": "def create\n @template = Template.find(params[:template_id])\n authorize @template, :transfer_customization?\n if @template.upgrade_customization?\n @new_customization = @template.upgrade_customization!\n redirect_to org_admin_template_path(@new_customization)\n else\n flash[:alert] = _(\"That template is no longer customizable.\")\n redirect_to :back\n end\n end", "title": "" }, { "docid": "428809dd2eb4a26d5f62e78cb416ee26", "score": "0.42138174", "text": "def update_email_template(email_template_id, request)\n start.uri('/api/email/template')\n .url_segment(email_template_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "638cc69d1eb5625775a07c9d8e19f5d4", "score": "0.42121878", "text": "def template(template)\n @template = template\n end", "title": "" }, { "docid": "7c16efdab17d548aedb5a58389ef2c4f", "score": "0.4200753", "text": "def update_network_interface request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instances/#{request_pb.instance}/updateNetworkInterface\"\n body = request_pb.network_interface_resource.to_json\n\n response = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "2c67e1ebaf00907b164d2caf554c4a06", "score": "0.419331", "text": "def manasource_tile_layout(tmx_spec)\n @state[\"tile_layout_filename\"] = tmx_spec\n @state[\"tile_layout_type\"] = \"manasource\"\n end", "title": "" }, { "docid": "c96a5389e09a0487300ef2fc8e320181", "score": "0.4191031", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @target_network = args[:target_network] if args.key?(:target_network)\n end", "title": "" }, { "docid": "c96a5389e09a0487300ef2fc8e320181", "score": "0.4191031", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @target_network = args[:target_network] if args.key?(:target_network)\n end", "title": "" }, { "docid": "c96a5389e09a0487300ef2fc8e320181", "score": "0.4191031", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @target_network = args[:target_network] if args.key?(:target_network)\n end", "title": "" }, { "docid": "7c2bb64f6a3b659f00e55d90f3ec0191", "score": "0.41907066", "text": "def modify_template\n template = File.read(@template_filename)\n working_template = template.gsub(/\\[\\[s[un]\\d+:p\\d:type\\]\\]/, 'topic')\n StringIO.new(string=working_template, 'r')\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "109c519c6fa8cd829702d96320d52f6d", "score": "0.0", "text": "def grip_params\n params.require(:grip).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
baaff5517ac7a2ca13a87b0c41cdfea4
Rotate by the given Angle anticlockwise about the origin.
[ { "docid": "cc3a949963618c9c5e5d8fd96b8bdb6a", "score": "0.0", "text": "def rotate(th)\n x = @x*th.cos - @y*th.sin\n y = @x*th.sin + @y*th.cos\n Point.new(x,y)\n end", "title": "" } ]
[ { "docid": "22f44a64e9dd1d065e55bafccfb2b697", "score": "0.6967181", "text": "def rotate(angle)\n @direction += angle\n end", "title": "" }, { "docid": "7dcb17f0203dfc6e2d5f818fa32d4a86", "score": "0.68100214", "text": "def rotate(angle)\n \n end", "title": "" }, { "docid": "9214d277b9f2c2e15b49ababc69f1b08", "score": "0.67919254", "text": "def rotate(angle, axis)\n rot = send(\"rotate_#{axis}_axis_by\", angle)\n rot.mult(self)\n ovwrite_me rot\n end", "title": "" }, { "docid": "122680b1bed12a45a77270ff502d8dd6", "score": "0.6774792", "text": "def rotate angle\n CGAffineTransformMakeRotation(angle)\n end", "title": "" }, { "docid": "8aafe8c662b38384fd174e428eff5ae0", "score": "0.6773834", "text": "def rotate(angle, around_x=0, around_y=0); end", "title": "" }, { "docid": "d2c2ed798c96b061fbe51598d4df0070", "score": "0.66627526", "text": "def rotate(rad, axis)\n local_rotation.fromAngleNormalAxis rad, axis\n self\n end", "title": "" }, { "docid": "152eba31d364c2881dac4f05804883f2", "score": "0.6605644", "text": "def rotate(axis, radi)\n rotation(axis, radi)\n end", "title": "" }, { "docid": "5d48c174d567534436441b62f2b51731", "score": "0.66008824", "text": "def rotate direction, origin = Vector[0,0,0], angle\n @atoms.each{|v| v.pos = v.pos.rotate(direction.to_v,origin.to_v,angle)}\n self\n end", "title": "" }, { "docid": "8318cbb89333daadbdcee48a12dcbb68", "score": "0.6515815", "text": "def rotate(radians)\n\t\tself.dup.rotate!(radians)\n\tend", "title": "" }, { "docid": "909e4a3f069dc2d8ce5adef8813a64cd", "score": "0.6513018", "text": "def rotate!(angle)\n rotationVector = Vector.new(cos(angle), sin(angle))\n rotationVector.crossProduct! Vector.new( -sin(angle), cos(angle) )\n\n rotationVector.crossProduct!(self)\n\n @x = rotationVector\n @y = rotationVector\n\n rotationVector\n end", "title": "" }, { "docid": "3b3faf8ddfd072522f410f580630394e", "score": "0.6489361", "text": "def rotate(amount = 1)\r\n self.angle += amount\r\n end", "title": "" }, { "docid": "853f30c2e7f23f88ae491bc40867477b", "score": "0.64820933", "text": "def rotate theta\n Vector.from_mag_dir(mag, dir + theta)\n end", "title": "" }, { "docid": "944a1fd6207cf6f5447fcd349934c6a3", "score": "0.64762825", "text": "def rotate(angle)\n transform(*Geo2D.rotation_transform(angle))\n end", "title": "" }, { "docid": "fdd02da1e08b64f45c9243f8fc33c3a9", "score": "0.64655495", "text": "def rotate(origin, direction)\n directions = {\n clockwise: 1,\n counter_clockwise: -1\n }\n\n relative_x = x - origin.x\n relative_y = y - origin.y\n\n self.x = origin.x - relative_y * directions.fetch(direction)\n self.y = origin.y + relative_x * directions.fetch(direction)\n\n self\n end", "title": "" }, { "docid": "c44cd0bc5bc681902d84b6ca98a739d4", "score": "0.6456502", "text": "def rotate(angle, x, y, z)\n CATransform3DRotate(identity, angle, x, y, z)\n end", "title": "" }, { "docid": "8a5264553fece8b6d7a4d4bdbaf5cc52", "score": "0.6437029", "text": "def rotate(angle)\n attr('rotation', angle)\n end", "title": "" }, { "docid": "447e26f12bc27309c67924c4a13767cf", "score": "0.64359814", "text": "def rotate(radians)\n x = (direction[0]*Math.cos(radians) - direction[1]*Math.sin(radians)).round\n y = (direction[0]*Math.sin(radians) + direction[1]*Math.cos(radians)).round\n\n @direction = [x, y]\n\n return self\n end", "title": "" }, { "docid": "5b2939ef444be835c18a7093b70e6f02", "score": "0.6432471", "text": "def rotate(theta)\n self\n end", "title": "" }, { "docid": "bd6c9290c879930aac26dea64a6cc0a5", "score": "0.6394333", "text": "def rotate(angle, pivot = nil)\n end", "title": "" }, { "docid": "8b75042a9a20bde5b260f05faf59af91", "score": "0.6393041", "text": "def rotate\n orientation.transform(self)\n self\n end", "title": "" }, { "docid": "226c694f572b1f5474358d481f6f8383", "score": "0.63876885", "text": "def rotate(angle)\n dup.tap { |t| t.rotate!(angle) }\n end", "title": "" }, { "docid": "da8f9690eaa2269554b43f6e224731c7", "score": "0.63561106", "text": "def rotate( angle, cx=0, cy=0 )\n a = (angle.to_f/180).to_d * Math::PI\n translate( cx, cy )\n transform( Math.cos(a), Math.sin(a), -Math.sin(a), Math.cos(a), 0, 0)\n translate( -cx, -cy )\n end", "title": "" }, { "docid": "71ea7e7b7a0d5223f1912ed04531f4d5", "score": "0.63439053", "text": "def rotate(angle)\n [angle.value * (Math::PI / 180.0)]\n end", "title": "" }, { "docid": "9a3be3a7e063969be98d927d8613c700", "score": "0.6330841", "text": "def transform_rotate(angle)\n # TODO: check if angle is a double\n execute(\"transform-rotate:#{angle}\")\n end", "title": "" }, { "docid": "4af8f6f6efa707fbe17a879e30b54edb", "score": "0.6318317", "text": "def turn(angle)\n @dir = (@dir + angle) % Math::PI\n end", "title": "" }, { "docid": "3a0c7f5cc6c425c0492eb550436c7924", "score": "0.63091487", "text": "def rotate(angle)\n theta = radians(angle)\n\n sin = Math.sin(theta)\n cos = Math.cos(theta)\n\n # translate point back to origin\n translated_point = target - position\n\n # rotate point\n x = translated_point.x * cos - translated_point.y * sin\n y = translated_point.x * sin + translated_point.y * cos\n\n rotated_point = Vector2D.new(x, y)\n\n # translate point back\n @target = rotated_point + position\n\n self\n end", "title": "" }, { "docid": "8b38e490cecd412b18ca11e88dce26d9", "score": "0.62773794", "text": "def rotate_X(angle)\n sinA = if angle.respond_to? :sin\n angle.sine\n else\n Math.sin(angle*Math::PI/180)\n end\n cosA = if angle.respond_to? :cos\n angle.cos\n else\n Math.cos(angle*Math::PI/180)\n end\n mat = Matrix[[1, 0, 0], [0, cosA, -1*sinA],[0, sinA, cosA]]\n rotate(mat) \n end", "title": "" }, { "docid": "f9c3f3b4d3a45abf06548fe21756edd7", "score": "0.62588924", "text": "def spin(angle)\n CATransform3DRotate(identity, angle, 0, 0, 1)\n end", "title": "" }, { "docid": "9aa19b02bd6a1a75a448fd923817d56f", "score": "0.62313575", "text": "def rotate!(angle)\n# \t\tcase(angle)\n# \t\twhen HALF_PI, -THREE_HALF_PI\n# \t\t\tself.set!(@y,-@x)\n# \t\twhen THREE_HALF_PI, -HALF_PI\n# \t\t\tself.set!(-@y,@x)\n# \t\twhen PI, -PI\n# \t\t\tself.set!(@y,-@x)\n# \t\twhen 0, TWO_PI, -TWO_PI\n# \t\t\tself.set!(@y,-@x)\n# \t\telse\n\t\t\tself.a += angle\n# \t\tend\n\t\treturn self\n\tend", "title": "" }, { "docid": "e0da3576e9751d50581842bb8ee55bbf", "score": "0.61762255", "text": "def rotate_clockwise\n rotate(1)\n end", "title": "" }, { "docid": "6c290cac46ca23680e997cddabc1de62", "score": "0.6175145", "text": "def rotate(angle)\n vec = copy\n vec.rotate!(angle)\n end", "title": "" }, { "docid": "5f7ac6a4797bcf17cd1cb086803d02b4", "score": "0.61412495", "text": "def rotate_towards(x, y)\n target_angle = Gosu.angle(@x, @y, x, y)\n @angle += 0.1 * Gosu.angle_diff(@angle, target_angle)\n end", "title": "" }, { "docid": "ff06832504ddf9413c1547a1682756c3", "score": "0.6123925", "text": "def spin angle\n @theta += angle\n @theta -= 360.0 while @theta >= 360.0\n @theta += 360.0 while @theta <= -360.0\n glutPostRedisplay\n end", "title": "" }, { "docid": "1e5ac678f17de51790f3a791ab7d5562", "score": "0.6120709", "text": "def rotate_origo(angle_x = 0, angle_y = 0, angle_z = 0)\n\t\[email protected] do |a|\n\t\t\ta.each do |b|\n\t\t\t\tx = b[0]; y = b[1]; z = b[2]\n\n\t\t\t\tx, y, z = rotate_point(x, y, z, 0, 0, 0, angle_x, angle_y, angle_z)\n\n\t\t\t\tb[0] = x; b[1] = y; b[2] = z\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "7240f12395c50b5be54287157c5d162d", "score": "0.6096862", "text": "def rotate(angle, absolute = true, mode = :degrees)\n if mode == :radians\n unless angle.kind_of? Numeric\n raise TypeError(\"#{angle} should be numeric if using with :radians mode\")\n end\n angle = radians_to_degrees(angle)\n end\n @canvas << js_method('rotate', angle, !!absolute)\n end", "title": "" }, { "docid": "df32c6776c53be9881de5ebbd59be53f", "score": "0.60877305", "text": "def rotation(theta) ; ; end", "title": "" }, { "docid": "c970c7a55dfc8191e3948f71eb57da22", "score": "0.60738814", "text": "def rotate!(degree)\n radian = VoltMath.radian(degree)\n\n x = @x\n cos = Math.cos(radian)\n sin = Math.sin(radian)\n\n self.tap do\n @x = x * cos - @y * sin\n @y = x * sin + @y * cos\n end\n \tend", "title": "" }, { "docid": "2364704cf8106f2c38d4bd7e7e74ef38", "score": "0.6056332", "text": "def yaw(radians)\n set_angles rotate(front, around: up, by: radians), up\n self\n end", "title": "" }, { "docid": "8e8b4e4c6fb7846403636bc42b5b9c69", "score": "0.60438263", "text": "def rotate_frame!(frame)\n frame_rotation_offset.times{frame.rotate!(90)}\n end", "title": "" }, { "docid": "5d8e5368b69232c31832c0257b5d932b", "score": "0.6037135", "text": "def rotate_180\n self[:Rotate] = (self[:Rotate].to_f() + 180)\n fix_rotation\n end", "title": "" }, { "docid": "2ff9b2017cb50d8ea567a507828091b8", "score": "0.6030937", "text": "def rotate_about p, theta\n v = self.-(p)\n p + v.rotate(theta)\n end", "title": "" }, { "docid": "dec9153dcbf5f07502f0a73750a93e8c", "score": "0.59924245", "text": "def roll(radians)\n set_angles front, rotate(up, around: front, by: radians)\n self\n end", "title": "" }, { "docid": "05de944420efdba164bb1f40eff8ff67", "score": "0.596404", "text": "def rotate(orientation); end", "title": "" }, { "docid": "989e83b36ba72e9554e0f5a90f55d9d0", "score": "0.5915337", "text": "def z_rotate! angle\r\n x = self[:x] * Math.cos(angle) - self[:y] * Math.sin(angle)\r\n y = self[:x] * Math.sin(angle) + self[:y] * Math.cos(angle)\r\n self.set!(x, y, self[:z])\r\n\r\n end", "title": "" }, { "docid": "4edfbeebc68bec6256c59d93afa5ea18", "score": "0.5902025", "text": "def rotate\n @rotation = (@rotation + 1) % 26\n rotation\n end", "title": "" }, { "docid": "d3e4957760b4a0e1f0d1abc10bcd871f", "score": "0.58944684", "text": "def rotate_Y(angle)\n sinA = if angle.respond_to? :sin\n angle.sine\n else\n Math.sin(angle*Math::PI/180)\n end\n cosA = if angle.respond_to? :cos\n angle.cos\n else\n Math.cos(angle*Math::PI/180)\n end\n mat = Matrix[[cosA, 0, -1*sinA],[0, 1, 0], [sinA, 0, cosA]]\n rotate(mat) \n end", "title": "" }, { "docid": "a72c51af3ee021fbdcc5660523ce9b5c", "score": "0.58841884", "text": "def rotate_by_angle(angle_degrees, center)\n rotate_by_radian(angle_degrees * Numeric::PI_OVER_ONE_EIGHTY, center)\n end", "title": "" }, { "docid": "fad7a1366521c9add914879d5cda3045", "score": "0.58758366", "text": "def rot180\n rot :d180\n end", "title": "" }, { "docid": "2444dbb10911f33c3539f0a0b3aef946", "score": "0.5873532", "text": "def rotate( coord )\n (coord + @offset) % @square.length\n end", "title": "" }, { "docid": "12920fb71c2d32fcab72e9af0c85c1cc", "score": "0.58643204", "text": "def rotate_Z(angle)\n sinA = if angle.respond_to? :sin\n angle.sine\n else\n Math.sin(angle*Math::PI/180)\n end\n cosA = if angle.respond_to? :cos\n angle.cos\n else\n Math.cos(angle*Math::PI/180)\n end\n \n mat = Matrix[[cosA, -1*sinA, 0],[sinA, cosA, 0], [0,0,1]]\n rotate(mat) \n end", "title": "" }, { "docid": "20b8c30a49f8ba84ad63f8fcfc2aa1f7", "score": "0.5853273", "text": "def rotate dir = \"LR\"\n orient dir\n end", "title": "" }, { "docid": "092053975b105f94ff08b7dd99637ec6", "score": "0.58522516", "text": "def rotate_clockwise!; end", "title": "" }, { "docid": "a3c15f3c3735a32ed71c1598b9d38025", "score": "0.58241737", "text": "def rotate!(angle)\n self.shape = self.shape.transpose.collect{|row| row.reverse} if angle % 90 == 0\n self.shape = self.shape.collect{|row| row.reverse}.reverse if angle % 180 == 0\n end", "title": "" }, { "docid": "bba0dc44f510a7801cb6bec17d526929", "score": "0.5794536", "text": "def reset_angle!\n self.angle = 0 # means pointing upward (north)\n end", "title": "" }, { "docid": "3c53b8f06a904f6bdfbbf2f11409e4e6", "score": "0.5783084", "text": "def rotate(direction)\n @orientation = Services::Rover::Rotate.call(self, direction)\n end", "title": "" }, { "docid": "7bfd44f8d1b8f148473066184b59ae24", "score": "0.57802624", "text": "def rotate!(axis, direction)\n return false unless ['clock', 'anti_clock'].include?(direction.to_s) and ['x', 'y', 'z'].include?(axis.to_s.downcase)\n direction_indicator = direction == 'clock' ? 1 : -1\n changed_coordinate = origin.public_send(axis) + (direction_indicator * public_send(axis))\n return false if changed_coordinate < 0\n origin.public_send(\"#{axis}=\", changed_coordinate)\n return true\n end", "title": "" }, { "docid": "c1f7bc36d83df2cd2fac76a002d86632", "score": "0.577251", "text": "def rotation(center, angle)\n center = Vector(center)\n lambda{|p| center + (p-center).rotate(angle)}\n end", "title": "" }, { "docid": "7526dfc2832fea0b99793c424a17e267", "score": "0.5759885", "text": "def rotate_clockwise; end", "title": "" }, { "docid": "6325629a6e62e98ee6637d346f760ab7", "score": "0.5754824", "text": "def rotate(angle, x = nil, y = nil, z = nil)\n z ||= 1.0 if OpenGL::App.use2D\n if block_given?\n matrix do\n glRotatef(angle.to_f, x || 0.0, y || 0.0, z)\n yield\n end\n else\n glRotatef(angle.to_f, x || 0.0, y || 0.0, z)\n end\n end", "title": "" }, { "docid": "60e42fe2090180cdae8db527bc1b2a40", "score": "0.57512695", "text": "def rotate(a)\n add_option(Rotate.new(a))\n self\n end", "title": "" }, { "docid": "60e42fe2090180cdae8db527bc1b2a40", "score": "0.5751104", "text": "def rotate(a)\n add_option(Rotate.new(a))\n self\n end", "title": "" }, { "docid": "5ec440024ae3d9b245d8958d4de48618", "score": "0.5744362", "text": "def rot90\n rot :d90\n end", "title": "" }, { "docid": "2948b3ac05374b07a2d82fa94099434f", "score": "0.57384646", "text": "def turn (degrees)\n @angle += degrees\n @angle %= 360\n end", "title": "" }, { "docid": "3e3383ee7b14b47de403343692fcfa01", "score": "0.57282484", "text": "def rotate_image (angle)\n\t\t@image = @original\n\t\t@image = @image.rotozoom(angle, 1)\n\tend", "title": "" }, { "docid": "86276dc506c572162b87019b67049376", "score": "0.5711246", "text": "def rotate!(degrees, center)\n # Your code goes here...\n end", "title": "" }, { "docid": "a878d49398177c885e599bd8cdfc5b6e", "score": "0.57094115", "text": "def rotate_180\n dup.rotate_180!\n end", "title": "" }, { "docid": "99f4403f281858acea1a241b051508e7", "score": "0.56921536", "text": "def rotate(angle_x = 0, angle_y = 0, angle_z = 0)\n\t\tc = 0; cx = 0; cy = 0; cz = 0\n\t\t# get middle point\n\t\[email protected] do |a|\n\t\t\ta.each do |b|\n\t\t\t\tcx += b[0]\n\t\t\t\tcy += b[1]\n\t\t\t\tcz += b[2]\n\t\t\t\tc +=1\n\t\t\tend\n\t\tend\n\t\tcx /= c; cy /= c; cz /= c\n\t\t# rotate points\n\t\[email protected] do |a|\n\t\t\ta.each do |b|\n\t\t\t\tx = b[0]; y = b[1]; z = b[2]\n\n\t\t\t\tx, y, z = rotate_point(x, y, z, cx, cy, cz, angle_x, angle_y, angle_z)\n\n\t\t\t\tb[0] = x; b[1] = y; b[2] = z\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "fae4fec379b7b9f9aa67056bc7f0bdb8", "score": "0.5691622", "text": "def start_rotate(degree_plus, duration)\n change_angle(@degree + degree_plus, duration)\n end", "title": "" }, { "docid": "fae4fec379b7b9f9aa67056bc7f0bdb8", "score": "0.5691622", "text": "def start_rotate(degree_plus, duration)\n change_angle(@degree + degree_plus, duration)\n end", "title": "" }, { "docid": "6491084cccd5e6c1fa215183badedc71", "score": "0.5690143", "text": "def rotate(degrees, center)\n # Your code goes here...\n end", "title": "" }, { "docid": "aee9dae5220c203573a2d8d86352eecf", "score": "0.568333", "text": "def rotate_axis(angle)\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\n%.3f %.3f %.3f %.3f 0 0 cm\"\n tx = [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad) ]\n add_content(tt % tx)\n self\n end", "title": "" }, { "docid": "54ebfe6e239f23e37e6fefcb9686e1a8", "score": "0.56804156", "text": "def rotate_180!; end", "title": "" }, { "docid": "3bcf095a982b72929df7cdfc4aa9b8ca", "score": "0.56766945", "text": "def rotate matrix, angle, x, y, z\n CATransform3DRotate(matrix, angle, x, y, z)\n end", "title": "" }, { "docid": "8a4d3a0b2b17ac59d353529e0e500b89", "score": "0.567367", "text": "def rotate(degrees)\n degrees = degrees.to_i % 360\n return self if degrees.zero?\n\n if (degrees % 90).nonzero?\n raise DynamicImage::Errors::InvalidTransformation,\n \"angle must be a multiple of 90 degrees\"\n end\n\n each_frame { |frame| frame.rotate(degrees) }\n end", "title": "" }, { "docid": "4593c7139f0a0d5c638b88125da344ef", "score": "0.5669875", "text": "def rotate(deg)\n puts \"image.rotate #{deg}\" if @verbose\n #transform = CGAffineTransformMakeRotation(radians(deg));\n transform = NSAffineTransform.transform\n transform.rotateByDegrees(-deg)\n filter 'CIAffineTransform', :inputTransform => transform\n self\n end", "title": "" }, { "docid": "21d913c5bfee29391b9f7d4e0a384734", "score": "0.5663274", "text": "def rotate_180\n \trotate_clockwise\n \trotate_clockwise\n end", "title": "" }, { "docid": "704111a799d4be64628c1406c389d8c4", "score": "0.5658702", "text": "def rotate(face, direction)\n face_for_symbol(ROTATIONS[symbol_for_face(face)][direction])\n end", "title": "" }, { "docid": "804c4dd153ee236342aaecc31f88cb41", "score": "0.5653713", "text": "def rotate(angle)\n return Vector2D.new(self.x * Math.cos(angle) - self.y * Math.sin(angle), self.x * Math.sin(angle) + self.y * Math.cos(angle))\n end", "title": "" }, { "docid": "6af02ed6e79906c0e66790ffb8bccaac", "score": "0.56423366", "text": "def rotate!\n self.rotate\n replace rotate\n end", "title": "" }, { "docid": "28fb0750cd2b2ac2358bad43b43d0f90", "score": "0.5639417", "text": "def cairo_apply_rotation(ctx)\n ctx.translate(center.x, center.y)\n ctx.rotate(rotation)\n ctx.translate(-center.x, -center.y)\n end", "title": "" }, { "docid": "37ebc410b144baa8c4cf7fcfe6c55cdd", "score": "0.5639396", "text": "def rotate_180; end", "title": "" }, { "docid": "d299d14baf8d642136610c529c3de506", "score": "0.5639303", "text": "def rotate(deg)\n puts \"path.rotate #{deg}\" if @verbose\n @transform = CGAffineTransformRotate(@transform, radians(deg))\n end", "title": "" }, { "docid": "d27083d204b08517460a90e19911e91e", "score": "0.56276846", "text": "def rotate_counter_clockwise; end", "title": "" }, { "docid": "9a15efde37ace1dab5886af0ae78b7bf", "score": "0.5619341", "text": "def rotate(center, rot_angle_deg, options = {:round => $round_by_default})# rotation angle expected in degrees\r\n if center.is_a?(Array)\r\n center = Point.new(center[0], center[1])\r\n end\r\n old_x, old_y = self.x, self.y\r\n cent_x, cent_y = center.x, center.y\r\n\r\n # translation to origin\r\n tmp_x = old_x - cent_x\r\n tmp_y = old_y - cent_y\r\n\r\n # calculates cosinus and sinus for rotation\r\n rot_angle_rad = rot_angle_deg * Math::PI / 180\r\n cos = Math.cos(rot_angle_rad)\r\n sin = Math.sin(rot_angle_rad)\r\n\r\n # rotation and translation back to previous position\r\n new_x = tmp_x*cos - tmp_y*sin + cent_x\r\n new_y = tmp_x*sin + tmp_y*cos + cent_y\r\n\r\n if options[:round] == true\r\n Point.new(new_x.round, new_y.round)\r\n else\r\n Point.new(new_x, new_y)\r\n end\r\n end", "title": "" }, { "docid": "7752556a2c62b87a85c459ca3dbb28e1", "score": "0.56154144", "text": "def draw_rot(x, y, image, angle, center_x=nil, center_y=nil)\n draw_ex(x, y, image, angle: angle, center_x: center_x, center_y: center_y)\n end", "title": "" }, { "docid": "85f70f9745001aff0b1ea8931e275c3d", "score": "0.5606443", "text": "def rotate!(theta, x=0, y=0)\n layer = layer!\n cr.set_source(Cairo::SurfacePattern.new(layer))\n cr.source.matrix = Cairo::Matrix.identity.translate(x, y).rotate(theta)\n cr.matrix = Cairo::Matrix.identity\n cr.paint\n end", "title": "" }, { "docid": "86d0fd1acafa9fa05824d0d1ae8f64fa", "score": "0.5603273", "text": "def rotate_counterclockwise\n rotate(-1)\n end", "title": "" }, { "docid": "65775afbbb94a24a86ef68de77649d3c", "score": "0.56005937", "text": "def rotate(degrees)\n radians = degrees * Math::PI/180\n cos = Math.cos(radians); sin = Math.sin(radians)\n x = (@x*cos - @y*sin).round.to_int\n y = (@x*sin + @y*cos).round.to_int\n @x = x\n @y = y\n end", "title": "" }, { "docid": "4f7ce4367c84b94077b8e2800398370c", "score": "0.559694", "text": "def rotate90(current_waypoint)\n x, y = *current_waypoint\n Vector[y, -x]\n end", "title": "" }, { "docid": "a0b35f7f22bad4f96957ee6db1591536", "score": "0.55845827", "text": "def spin rotations = 1\n rotate rotations\n end", "title": "" }, { "docid": "ca452271bf8945731c2ceb9994032706", "score": "0.55799735", "text": "def spin matrix, angle\n CATransform3DRotate(matrix, angle, 0, 0, 1)\n end", "title": "" }, { "docid": "09d1091c859048056ec4de4aa9036328", "score": "0.5579391", "text": "def rotX; end", "title": "" }, { "docid": "7287884cc021bfb828b1128ad60b9315", "score": "0.55483764", "text": "def rotate(degrees)\n # returns self\n throw NotImplementedError\n end", "title": "" }, { "docid": "a83a081668a5ab860927203cf37842fb", "score": "0.5546835", "text": "def rotate( angle )\n newx = self.x * Math.cos( angle ) - self.y * Math.sin( angle )\n newy = self.x * Math.sin( angle ) + self.y * Math.cos( angle )\n return V2D[ newx, newy ]\n end", "title": "" }, { "docid": "fc798fe7510f5d13dd3452051c48536f", "score": "0.5529178", "text": "def rate_of_turn(angle, speed)\n anglr = angle * Math::PI / 180\n rot = (1091 * Math::tan(anglr)) / speed\n rot\nend", "title": "" }, { "docid": "a28333f149c85e665dd8de353b8e80f1", "score": "0.55270666", "text": "def rotation\n @rotation || -Math::PI/2\n end", "title": "" }, { "docid": "868e8dda10417e39fdbedc948d7d2a13", "score": "0.55270666", "text": "def rotate(angle)\n return geom(MultiVector2D.new(cos(angle), 0.0, 0.0, sin(angle)))\n end", "title": "" }, { "docid": "207c5b280ef4c50992a2767fed468aaa", "score": "0.55207384", "text": "def set_rotate90( x, y )\n set(0, -1, 1, 0, x, y )\n self\n end", "title": "" }, { "docid": "9cf632fce9e1dacd376ad4e95beed03b", "score": "0.55079126", "text": "def update_anim\n self.angle += 1\n self.angle = 0 if angle == 360\n end", "title": "" }, { "docid": "f5d301f06e6334fda6c61af0bcf41d3a", "score": "0.55048394", "text": "def update(angle)\n @previous_angle = current_angle\n @current_angle = angle\n\n if completed_a_revolution?\n @rotations += direction\n end\n\n @previous_diff = current_diff\n end", "title": "" }, { "docid": "5c2642cca78a25ad36c8404eececcd06", "score": "0.5494228", "text": "def leftRotation(a, d)\n # Complete this function\n a.rotate(d)\nend", "title": "" } ]
c6388a447a0f9a6504b2fefa69297b07
Provides a container for each of the property elements
[ { "docid": "941b7540944a61fd6fa7100cf7c9e24f", "score": "0.57923377", "text": "def profile_property_element(options={}, &proc)\n defaults = {:type => :table, :editable => false, :update => false}\n options = defaults.merge(options).symbolize_keys\n\n concat tag(:div, {:id => options[:id], :style => options[:style]}.merge(:class => \"row\"), true), proc.binding\n case options[:type]\n when :table\n concat tag(:table, {:cellpadding => \"0\", :cellspacing => \"0\"}, true), proc.binding\n concat profile_property_columns_tag(options), proc.binding\n concat tag(:tr, {}, true), proc.binding\n yield\n concat \"</tr>\", proc.binding\n concat \"</table>\", proc.binding\n when :form\n concat tag(:table, {:cellpadding => \"0\", :cellspacing => \"0\"}, true), proc.binding\n concat tag(:tr, {}, true), proc.binding\n concat content_tag(:td, '', :style => \"vertical-align:top;width:80px;\" ), proc.binding\n concat tag(:td, {:style => \"vertical-align:top;width:400px;\"}, true), proc.binding\n yield\n concat \"</td>\", proc.binding\n concat \"</tr>\", proc.binding\n concat \"</table>\", proc.binding\n else\n yield\n end\n concat \"</div>\", proc.binding\n end", "title": "" } ]
[ { "docid": "f5eb111f893b18a42dfa059c0f009b1f", "score": "0.6998946", "text": "def properties\n keys = @_properties.keys\n ret = []\n\n # example element, if there is one\n if @define\n @_properties['emptyElement'] = %($sel(\"#resources? .#{@item_id}:1:1\"))\n ret << _partial_properties(['emptyElement'])\n end\n\n # outlets first\n if keys.include?('outlets')\n outlets = @_properties['outlets']\n @_properties['outlets'] = '[\"' + (outlets * '\",\"') + '\"]'\n ret << _partial_properties(['outlets'])\n ret << _partial_properties(outlets,\",\\n\\n\")\n keys.reject! { |k| outlets.include?(k) || (k == 'outlets') }\n end\n\n bindings = keys.reject { |k| !k.match(/Binding$/) }\n if bindings.size > 0\n ret << _partial_properties(bindings)\n keys.reject! { |k| bindings.include?(k) }\n end\n\n if keys.size > 0\n ret << _partial_properties(keys)\n end\n\n ret = ret * \",\\n\\n\"\n ' ' + ret.gsub(\"\\n\",\"\\n \")\n end", "title": "" }, { "docid": "4382e87160b5d8e7be298720801baa21", "score": "0.6752939", "text": "def properties\n map(element_type: :hash) { |v| v.properties }\n end", "title": "" }, { "docid": "67be7f5aacd3423211e68e28643c5072", "score": "0.66619784", "text": "def properties\n @properties ||= Element::Properties.new(self)\n end", "title": "" }, { "docid": "d259e1d393b11bb86ace352a3fc61948", "score": "0.658837", "text": "def properties\n { 'object_type' => 'array', 'elements' => @elements.map(&:properties) }\n end", "title": "" }, { "docid": "a0a54e22ecdaeb3520e40ee4fe51f2b8", "score": "0.6504214", "text": "def expand_properties\n @properties.each do |key,value|\n value.expand_to_element self\n end\n end", "title": "" }, { "docid": "c557ea3538fdba0e5d67ae700bfe4f9d", "score": "0.646402", "text": "def properties\n @properties = Ken::Collection.new\n types.each do |type|\n @properties.concat(type.properties)\n end\n @properties\n end", "title": "" }, { "docid": "2e1d28bb5c450f676bccc7d4f8150aaa", "score": "0.6456266", "text": "def values_for_properties; end", "title": "" }, { "docid": "6aeb716d4a31e76424972c27d5f66fc4", "score": "0.63885564", "text": "def populate_properties_from(element)\n self.class.properties.each do |p|\n if element.has_element?(p)\n val = element.element(p).value\n unless val.nil? \n val = val.to_s.to_created_time if self.class.timestamps.include? p\n val = val.to_s.strip_html if p.to_s == 'source' && !val.to_s.empty?\n unless block_given? && p.to_s == 'text'\n val = HttpUtility.html_decode val if p.to_s == 'text'\n self.send(\"#{p}=\".to_sym, val) \n else\n yield val\n end\n end\n end\n end\n end", "title": "" }, { "docid": "ffa836e0bc9298e34f6e1f46cb0a3f24", "score": "0.63335246", "text": "def eachproperty\n # properties is a private method\n properties.each { |property|\n yield property\n }\n end", "title": "" }, { "docid": "16b5f50f52de7e458d04c776a8342e1d", "score": "0.63089395", "text": "def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end", "title": "" }, { "docid": "50d39443582170e61c9b3b13277baeec", "score": "0.6172318", "text": "def properties\n []\n end", "title": "" }, { "docid": "b431a89881d6a1d218a8bcd1f6de1705", "score": "0.61507875", "text": "def get_widgets(property)\n widgets = []\n\n type = property.type\n values = property.values\n\n label = Gtk::Label.new(\"#{property.label}:\")\n label.xalign = 0\n\n widget, getter, setter = create_widget(property, type, values)\n\n val = property.get(@instance)\n setter.call(val) unless setter.nil?\n\n return [label, widget], [getter, setter, property]\n end", "title": "" }, { "docid": "c3e3d623237eccf88eb1f2d9792b6c9d", "score": "0.61286664", "text": "def children\n properties \n end", "title": "" }, { "docid": "fde4b8af10b71b584c6aa33373630c79", "score": "0.60905004", "text": "def property_properties\n _property_properties\n end", "title": "" }, { "docid": "261e117a979284289ef3ae597057c282", "score": "0.6082419", "text": "def properties\n component ? component.properties : []\n end", "title": "" }, { "docid": "23c3b493d75634888df28103fcb274ac", "score": "0.6054895", "text": "def each_property_name\n @properties_list.keys.each do |edge|\n yield(edge[1])\n end\n end", "title": "" }, { "docid": "1d71449ea528f17cd01cf50a9c18ff74", "score": "0.60401446", "text": "def computed prop\n a = []\n \n # dummy lookup\n @collection.each do |e|\n a << e.style[prop.to_s] \n end\n \n a\n end", "title": "" }, { "docid": "96fc5458180ec5e931aa10d3efa76493", "score": "0.6032251", "text": "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "title": "" }, { "docid": "3eb05fe04c52e88f5eb142d0dcea9612", "score": "0.60292965", "text": "def properties(&block)\n if !@content\n @content = Azure::Atom::Content.new\n @m_properties = Azure::Atom::PropertyList.new\n @content << @m_properties\n end\n\n yield @m_properties if block_given?\n\n @m_properties\n end", "title": "" }, { "docid": "7908d36f8e2c277c808890c32e23e56a", "score": "0.60284185", "text": "def properties\n self.values\n end", "title": "" }, { "docid": "1d1d448aa3651326eb157fc95f243a48", "score": "0.6014394", "text": "def properties\n []\n end", "title": "" }, { "docid": "744d0cfd3e82d914254c296d16c580ac", "score": "0.6013662", "text": "def properties\n decorate_with_methods(read_attribute(:properties))\n end", "title": "" }, { "docid": "0989ae3fd5c728bc7a2d4de5fafce7fa", "score": "0.5959949", "text": "def attrs_from_props\n @doc.find('//apps:property').each do |entry|\n prop_name = entry.attributes['name'].to_sym\n if @map.keys.include?(prop_name)\n instance_variable_set \"@#{@map[prop_name]}\", check_value(entry.attributes['value'])\n end\n end\n end", "title": "" }, { "docid": "d7379dc39e5e5fe8a95e16bf8f08315a", "score": "0.5959341", "text": "def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end", "title": "" }, { "docid": "572dae1657bb0b53790bb2e385ca6020", "score": "0.59497106", "text": "def parse_properties(element, properties)\n properties.each_pair do |name, prop_fields|\n if name == 'UserData'\n # Special case\n code = extract_code(prop_fields)\n element << CFDoc::Model::Property.new(name, CFDoc::Model::UserData.new(name, code))\n elsif name.match(REF_REGEX)\n # TODO: resolve - we may need to wait, as some are a forward-reference and haven't been parsed yet. Perhaps another pass? Or, resolve on demand?\n ref = CFDoc::Model::Ref.new(prop_fields)\n if element.property?\n element.value = ref\n else\n element << ref\n end\n elsif name.match(FUNCTION_REGEX)\n func = CFDoc::Model::Function.new(name)\n parse_function(func, prop_fields)\n element << func\n elsif prop_fields.kind_of?(Hash)\n prop = CFDoc::Model::Property.new(name)\n parse_properties(prop, prop_fields)\n element << prop\n elsif prop_fields.kind_of?(Array)\n prop = CFDoc::Model::Property.new(name)\n list = CFDoc::Model::List.new(nil) # no name for lists that are used as values for a property\n prop_fields.each do |item|\n if item.kind_of?(Hash)\n # recurse the hash, allowing subsequent calls to fill the list with properties (and possibly nested properties)\n parse_properties(list, item)\n else\n list.items << item\n end\n end\n prop.value = list\n element << prop\n elsif prop_fields.kind_of?(String)\n prop = CFDoc::Model::Property.new(name, prop_fields)\n element << prop\n end\n end\n element\n end", "title": "" }, { "docid": "e964a365c5aacd33da6b29585a43cf0b", "score": "0.5936141", "text": "def properties\n @properties ||= {\n size: Integer.new(@value.size),\n length: Integer.new(@value.size),\n empty?: Boolean.new(@value.size.zero?),\n first: @value.first,\n head: @value.first,\n last: @value.last,\n rest: List.new(@value.rest),\n tail: List.new(@value.tail),\n }\n end", "title": "" }, { "docid": "1e99012872d6bfc18f90c6f6e04e0d6d", "score": "0.592283", "text": "def property_options\n return @array.map {|property|\n {\n name: property.print_list,\n value: property.property_id\n }\n }\n end", "title": "" }, { "docid": "597ba436a97affafaf5b2cc7be069daf", "score": "0.5916657", "text": "def props()\n @props\n end", "title": "" }, { "docid": "a5c4210ab2a68d6520cb212e75233648", "score": "0.58666813", "text": "def properties\n @properties\n end", "title": "" }, { "docid": "d240544001f21188e10ad2254228ea2d", "score": "0.58270967", "text": "def props\n ret = {}\n property_names.each do |property_name|\n ret[property_name] = respond_to?(property_name) ? send(property_name) : send(:[], property_name)\n end\n ret\n end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "fe704db3d40ab3204f14f147617fc26f", "score": "0.5826272", "text": "def properties; end", "title": "" }, { "docid": "8bee5675e8c01a25df5be4675a5bb622", "score": "0.5824149", "text": "def properties\n properties = []\n relations = self.property_relations\n relations.each do |relationship|\n properties.push relationship.property\n end\n properties\n end", "title": "" }, { "docid": "60dbc178ffd36c20b85705c14a047922", "score": "0.5822753", "text": "def embed_property_value_list( property_value_list )\n count = 1 \n property_value_list.each do |property_value_pair|\n PropertyValue.create(:item_id => self.id, \n :property_id => property_value_pair[:property_id],\n :value_id => property_value_pair[:value_id],\n :position => count)\n count += 1 \n end\n end", "title": "" }, { "docid": "30b51b1e4338b957363e899388e4cfdb", "score": "0.5818013", "text": "def properties(ctx)\n properties = Properties.new()\n ctx.each { |key, value| properties.put(key, value) }\n return properties\n end", "title": "" }, { "docid": "51f2f53b6c47b53ccb43252a1a8fcfec", "score": "0.58177197", "text": "def item\n self.properties\n end", "title": "" }, { "docid": "0a20b969c6f2456fc46964a06a3999cb", "score": "0.58011657", "text": "def properties\n @properties\n end", "title": "" }, { "docid": "191fae5b3988656ecc804139134823ff", "score": "0.5796702", "text": "def properties\n @properties ||= {}\n end", "title": "" }, { "docid": "24e7dc12269a8b19e9b89fde89bc137d", "score": "0.5792291", "text": "def properties\n @properties = PropertyList.new(self.prototype) if @properties.nil?\n @properties\n end", "title": "" }, { "docid": "45db70623c8fa0639f4973135ec9015e", "score": "0.57828605", "text": "def properties\n @properties ||= {}\n end", "title": "" }, { "docid": "45db70623c8fa0639f4973135ec9015e", "score": "0.57828605", "text": "def properties\n @properties ||= {}\n end", "title": "" }, { "docid": "8324e781a81aa5216211db5ddd0e7a98", "score": "0.57784206", "text": "def all\n @all ||= property_hashes.map do |hash|\n Entities::PropertyType.new(\n id: hash[\"id\"],\n name: hash[\"rentals_united_name\"],\n roomorama_name: hash[\"roomorama_name\"],\n roomorama_subtype_name: hash[\"roomorama_subtype_name\"]\n )\n end\n end", "title": "" }, { "docid": "e1f2dc7a852a4008dd25140d8563ed8d", "score": "0.57693344", "text": "def property_map\n self.class.properties.map do |name, opts|\n if opts\n yreq = opts[:req] ? :req : :opt\n [\"@#{ name }\", yreq] if yreq\n end\n end.compact\n end", "title": "" }, { "docid": "ff9e18a156fdd317479faa221cbd32c9", "score": "0.5769075", "text": "def new_property_set\n @properties.push []\n @data << [@selectors[-1], @properties[-1] ]\n end", "title": "" }, { "docid": "ff9e18a156fdd317479faa221cbd32c9", "score": "0.5769075", "text": "def new_property_set\n @properties.push []\n @data << [@selectors[-1], @properties[-1] ]\n end", "title": "" }, { "docid": "1719e5e8520e97bb82b4573766e8fa17", "score": "0.5768266", "text": "def properties\n @properties ||= {}\n end", "title": "" }, { "docid": "80deeeb92d53afbce469b436589920b5", "score": "0.57500386", "text": "def properties\n self.class.properties.keys\n end", "title": "" }, { "docid": "40c7bae99f8cd5a8b19429ea687cce23", "score": "0.57481927", "text": "def properties\n _properties\n end", "title": "" }, { "docid": "de7ea3bd2f93348fae355ddfdfe4ed7f", "score": "0.57469904", "text": "def property_details\n @property_details ||= Hash.new.tap do |result|\n details.each do |detail|\n detail.group_content.each do |group|\n title = group.title.text\n key = title.titleize.delete(' ').underscore\n break unless keys_white_list.include? key\n items = []\n group.items.each { |item| items << item.text }\n result[key.to_sym] = items unless items.empty?\n end\n end\n end\n end", "title": "" }, { "docid": "ab1bab9cba4e4e893b5e981b7518fcec", "score": "0.5739659", "text": "def parse_props(pom_doc)\n return pom_doc.css('properties').children.map {|c| [c.name, c.text]}.to_h\n end", "title": "" }, { "docid": "9e3d052b063ccae944ee4da89b47fae8", "score": "0.5738613", "text": "def returning(*properties)\n @options['=.proplist'] ||= []\n properties.each do |property|\n @options['=.proplist'] << \"#{property}\"\n end\n self\n end", "title": "" }, { "docid": "ad09b651579232dbc46d4e8bad609a65", "score": "0.5725264", "text": "def properties\n return @properties\n end", "title": "" }, { "docid": "1bb737c2d1bd9141ed1c74e686afef85", "score": "0.5722297", "text": "def web_properties\n Management::WebProperty.all(self)\n end", "title": "" }, { "docid": "b83626f635832865b1551fe513dacbca", "score": "0.57146174", "text": "def property_definitions\n set_attributes_for(PropertyDefinition)\n PropertyDefinition.find(:all)\n end", "title": "" }, { "docid": "50edd119d233b17c8c39d9338e753efe", "score": "0.5706854", "text": "def property_all\n @properties.keys.sort.each do |global_type|\n values = @properties[global_type]\n if ! values.empty?\n yield global_type, values\n end\n end\n end", "title": "" }, { "docid": "e162bd3ccc40754bf40ba811725edbeb", "score": "0.5689212", "text": "def attribute_list(el); end", "title": "" }, { "docid": "69c5f85ac52c3edface6a8127605c207", "score": "0.5671833", "text": "def apply_properties xml, props={}\n props.inject(xml) do |memo, item|\n self.send(\"add_%s\" % item.first, memo, item.last) \n memo\n end\n end", "title": "" }, { "docid": "578c8d2d3bd891313531879df99bfdea", "score": "0.5665425", "text": "def parse_properties(parent_component, property_name_prefix = '')\n properties = @pointer ? @pointer : {}\n\n properties.each do |xml_property|\n (namespace, tag_name) = Tilia::Xml::Service.parse_clark_notation(xml_property['name'])\n\n property_name = tag_name\n property_value = nil\n property_parameters = {}\n property_type = 'text'\n\n # A property which is not part of the standard.\n if namespace != Tilia::VObject::Parser::Xml::XCAL_NAMESPACE && namespace != Tilia::VObject::Parser::Xml::XCARD_NAMESPACE\n property_name = 'xml'\n value = \"<#{tag_name} xmlns=\\\"#{namespace}\\\"\"\n\n xml_property['attributes'].each do |attribute_name, attribute_value|\n value += \" #{attribute_name}=\\\"#{attribute_value.gsub('\"', '\\\\\"')}\\\"\"\n end\n value += \">#{xml_property['value']}</#{tag_name}>\"\n\n property_value = [value]\n\n create_property(\n parent_component,\n property_name,\n property_parameters,\n property_type,\n property_value\n )\n\n next\n end\n\n # xCard group.\n if property_name == 'group'\n next unless xml_property['attributes'].key?('name')\n\n @pointer = xml_property['value']\n parse_properties(\n parent_component,\n xml_property['attributes']['name'].upcase + '.'\n )\n\n next\n end\n\n # Collect parameters.\n xml_property['value'] = xml_property['value'].map do |xml_property_child|\n if !xml_property_child.is_a?(Hash) || 'parameters' != self.class.tag_name(xml_property_child['name'])\n xml_property_child\n else\n xml_parameters = xml_property_child['value']\n\n xml_parameters.each do |xml_parameter|\n property_parameter_values = []\n\n xml_parameter['value'].each do |xml_parameter_values|\n property_parameter_values << xml_parameter_values['value']\n end\n\n property_parameters[self.class.tag_name(xml_parameter['name'])] = property_parameter_values.join(',')\n end\n\n nil # We will delete this with compact()\n end\n end\n\n xml_property['value'].compact!\n\n property_name_extended = (@root.is_a?(Tilia::VObject::Component::VCalendar) ? 'xcal' : 'xcard') + ':' + property_name\n\n case property_name_extended\n when 'xcal:geo'\n property_type = 'float'\n property_value ||= {}\n property_value['latitude'] = 0.0\n property_value['longitude'] = 0.0\n\n xml_property['value'].each do |xml_request_child|\n property_value[self.class.tag_name(xml_request_child['name'])] = xml_request_child['value']\n end\n when 'xcal:request-status'\n property_type = 'text'\n\n property_value ||= {}\n xml_property['value'].each do |xml_request_child|\n property_value[self.class.tag_name(xml_request_child['name'])] = xml_request_child['value']\n end\n when 'xcal:freebusy', 'xcal:categories', 'xcal:resources', 'xcal:exdate'\n property_type = 'freebusy' if property_name_extended == 'xcal:freebusy'\n # We don't break because we only want to set\n # another property type.\n\n xml_property['value'].each do |special_child|\n property_value ||= {}\n property_value[self.class.tag_name(special_child['name'])] = special_child['value']\n end\n when 'xcal:rdate'\n property_type = 'date-time'\n property_value ||= []\n\n xml_property['value'].each do |special_child|\n tag_name = self.class.tag_name(special_child['name'])\n\n if 'period' == tag_name\n property_parameters['value'] = 'PERIOD'\n property_value << special_child['value'].values.join('/')\n else\n property_value << special_child['value']\n end\n end\n else\n property_type = self.class.tag_name(xml_property['value'][0]['name'])\n\n property_value ||= []\n xml_property['value'].each do |v|\n property_value << v['value']\n end\n\n property_parameters['value'] = 'DATE' if 'date' == property_type\n end\n\n create_property(\n parent_component,\n property_name_prefix + property_name,\n property_parameters,\n property_type,\n property_value\n )\n end\n end", "title": "" }, { "docid": "86ff97cc222b987bff78c1152a1c8ee1", "score": "0.56567466", "text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "title": "" }, { "docid": "914d224aad8d70a7dd69b69e7474e524", "score": "0.5651051", "text": "def properties\n @properties ||= Properties.new self\n end", "title": "" }, { "docid": "add4688ed1228599acf9c1b399177a76", "score": "0.56427073", "text": "def process_properties(properties); end", "title": "" }, { "docid": "801f0b296b06b16bf8ccb48f8f614af1", "score": "0.5637797", "text": "def modify_properties(properties_element)\n end", "title": "" }, { "docid": "5debe91077007d4b84b5de1805d3cf7b", "score": "0.56315", "text": "def components\n @contents.inject([]) do |m,c|\n if c.is_a?( Symbol )\n m += space.role( c )\n else\n m << c\n end\n m\n end\n end", "title": "" }, { "docid": "91b322320810223b9a39fd4f00c0fd63", "score": "0.5629827", "text": "def return_property_yaml(prop, spaces)\n block = minimal_return_block(prop, spaces)\n if prop.is_a? Api::Type::NestedObject\n block.concat(nested_return(prop.properties, spaces))\n elsif prop.is_a?(Api::Type::Array) &&\n prop.item_type.is_a?(Api::Type::NestedObject)\n block.concat(nested_return(prop.item_type.properties, spaces))\n else\n block\n end\n end", "title": "" }, { "docid": "865c85f724495074b93adfd7987cb9ee", "score": "0.5620614", "text": "def to_configure_properties\n ['@security', '@channel_flags', '@clas', '@race', '@traits', '@sign', '@stuff']\n end", "title": "" }, { "docid": "6b3776f77950531d1c79c0194e44d854", "score": "0.56081206", "text": "def fields #:nodoc:\n f = @properties.to_a\n last = f.pop\n f.push @elements\n f.push last\n end", "title": "" }, { "docid": "4e21a7513b05ff85a2758f181736958a", "score": "0.5607895", "text": "def property_ids\n result = Array.new\n self.properties.each do |p|\n result << p.id\n end\n result\n end", "title": "" }, { "docid": "6f407b3a09113bef800d6c2e044af3ba", "score": "0.5576526", "text": "def props\n ret = {}\n iter = @internal_node.getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = @internal_node.getProperty(key)\n end\n ret\n end", "title": "" }, { "docid": "2e8b1e8a714ad7cfa3aae1e4561414b8", "score": "0.55734545", "text": "def get_property(element, property)\n prop = nil\n\n return [element.get_attribute(property)] if element.has_attribute?(property)\n\n props = element.xpath(\"./#{property}\")\n return [] if props.nil?\n\n results = []\n props.each do |prop|\n # we should now have an element\n next if ! prop.kind_of?(Nokogiri::XML::Element)\n\n resolved_children = resolve_elements(prop.children)\n if property =~ /\\[(.*)\\]$/\n results << resolved_children[$1.to_i]\n end\n results << resolved_children\n end\n return results\n end", "title": "" }, { "docid": "7cb1a4db7e1443960e067afd4aa53419", "score": "0.5572688", "text": "def container_properties(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container\", name)\n\n ContainerProperty.new(response.headers)\n end", "title": "" }, { "docid": "0976cb65cc748a4f72ee02a3a0c0b752", "score": "0.556089", "text": "def properties\n $properties ||= Properties.new\n end", "title": "" }, { "docid": "bf943c3ab4515cbb507c568cc6e941c2", "score": "0.55299497", "text": "def properties\n @properties ||= Hash.new\n end", "title": "" }, { "docid": "570049b02e8a1a801635b88f7387cbdb", "score": "0.55267525", "text": "def add_property(property, index)\n\n add_widgets = lambda do |ws, i|\n ws[0].width_request = 64\n ws[1].width_request = 100\n @table.attach(ws[0], 0, 1, i, i+1, Gtk::FILL, Gtk::FILL)\n @table.attach(ws[1], 1, 2, i, i+1, Gtk::FILL, Gtk::FILL)\n end\n\n widgets, accessors = get_widgets(property)\n\n next_index = index + 1\n \n if widgets[1].is_a? Array\n @table.attach(widgets[0], 0, 2, index, index+1, Gtk::FILL, Gtk::FILL)\n widgets[1].each_with_index { |ws, i| add_widgets.call(ws, index+1+i) }\n next_index = index + widgets[1].length\n else\n add_widgets.call(widgets, index)\n end\n @accessors << accessors\n return next_index\n end", "title": "" }, { "docid": "adebde5e9c2efe3177c5b723b5c697c3", "score": "0.5523454", "text": "def properties_via(group)\n properties = []\n property_relations_via(group).each do |relationship|\n property = relationship.property\n properties.push(property)\n end\n properties\n end", "title": "" }, { "docid": "4f3207a7d82d6c0afddd9b0fb13f7b5b", "score": "0.5522275", "text": "def property(name, opts)\n @properties ||= []\n @properties << Property.new(name, opts)\n end", "title": "" }, { "docid": "39a92cf8c6e7c7afdace2014331914a4", "score": "0.5520243", "text": "def extractToolkitPropertyInfo( propertyMacro )\n\n # Extract the property name, type\n property = $propertyStruct.new;\n\n # Split the macro definition by comma and quotes, close bracket and delete any empty segments\n data = propertyMacro.split(/[\\s,\")]/).reject { |s| s.empty? }\n\n if(data[1] == \"PropertyRegistration\")\n\n # Properties defined in Control using PropertyRegistration\n # const PropertyRegistration Control::Impl::PROPERTY_1(typeRegistration, \"styleName\", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);\n\n # Creates an array of strings that looks like this:\n # const 0\n # PropertyRegistration 1\n # Control::Impl::PROPERTY_1 2\n # typeRegistration 3\n # styleName 4\n # Toolkit::Control::Property::STYLE_NAME 5\n # Property::STRING 6\n # &Control::Impl::SetProperty 7\n # &Control::Impl::GetProperty 8\n #\n\n property.name = data[4]\n\n propertyType = data[6].rpartition(\"::\")\n property.type = propertyType[2]\n\n propertyEnum = data[5].rpartition(\"::\")\n property.enum = propertyEnum[2]\n\n else\n\n # Properties defined in macro DALI_PROPERTY_REGISTRATION or DALI_ANIMATABLE_PROPERTY_REGISTRATION or DALI_CHILD_PROPERTY_REGISTRATION\n # or DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT:\n # DALI_PROPERTY_REGISTRATION(Toolkit, TextLabel, \"multiLine\", BOOLEAN, MULTI_LINE)\n # DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, ImageView, \"pixelArea\", Vector4(0.f, 0.f, 1.f, 1.f), PIXEL_AREA)\n\n # Creates an array of strings that looks like this:\n # DALI_PROPERTY_REGISTRATION( 0\n # Toolkit 1\n # PageTurnView 2\n # pageSize 3\n # VECTOR2 4\n # PAGE_SIZE 5\n #\n\n property.name = data[3]\n\n #puts property.name\n if property.name == \"image\"\n property.name = \"imageMap\"\n end\n\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(\" )\n # TODO: Need to work out the property type from the value\n property.type = \"VECTOR4\"\n else\n property.type = data[4]\n end\n\n property.enum = data[data.length-1]\n\n end\n\n # e.g. turn styleName into StyleName\n property.name[0] = property.name[0].capitalize\n\n property.writable = true\n property.animatable = false\n property.constrainInput = false\n property.childProperty = false;\n\n # check to see if it's a child property\n if( data[0] == \"DALI_CHILD_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is child property \")\n property.childProperty = true;\n end\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is animatable\")\n property.animatable = true;\n end\n\n return property;\nend", "title": "" }, { "docid": "6b18fdd09890f0f286434806d279687a", "score": "0.5518009", "text": "def properties\n pairs_properties = @pairs.map { |key, value| { 'key' => key.properties, 'value' => value.properties } }\n { 'object_type' => 'map', 'pairs' => pairs_properties }\n end", "title": "" }, { "docid": "5c568bfbc42ded07c6b4fd19e04061be", "score": "0.55060005", "text": "def property_names\n @properties.values.map(&:name)\n end", "title": "" }, { "docid": "84ead30045743ba4dc6468ae2f8f96be", "score": "0.5497829", "text": "def property_names\n trait[:PROPERTIES].keys\n end", "title": "" }, { "docid": "184811facbebab409a6a67c92296aa7f", "score": "0.5490668", "text": "def get_properties()\n return @properties\n end", "title": "" }, { "docid": "41c5d5d949e9694c7a77cd069b78b4d6", "score": "0.5477524", "text": "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key,value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n props.each do |prop|\n pname = prop.to_sym\n properties_info[pname] ||= {}\n properties_info[pname][:defined] = true\n \n define_method(pname) do\n get_property(pname.to_s)\n end\n\n name = (pname.to_s() +\"=\").to_sym\n define_method(name) do |value|\n set_property(pname.to_s, value)\n end\n end\n end", "title": "" }, { "docid": "d3b07bb2bbd6ef2afe0600c0ec6923e8", "score": "0.54716223", "text": "def properties\n @properties ||= []\n return((superclass.respond_to?(:properties) ? superclass.properties : []) + @properties)\n end", "title": "" }, { "docid": "9de5869c7cc7d77cede1eda3b4982805", "score": "0.5466207", "text": "def data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\n end", "title": "" }, { "docid": "59a6dfb3db583171556af40f86d8a82e", "score": "0.5465997", "text": "def element_props(index)\n\t\tif @overrides.has_key? index\n\t\t\treturn @meta.merge @overrides[index]\n\t\telse\n\t\t\treturn @meta\n\t\tend\n\tend", "title": "" }, { "docid": "4633c24118879ce495eb1feeddebd87e", "score": "0.5463896", "text": "def properties_presenter\n @properties_presenter ||= V1::PropertiesPresenter.new(@properties, @template)\n end", "title": "" }, { "docid": "1fa9c278d6382c0fdfc904e67263017d", "score": "0.5452144", "text": "def property_details(separator = ': ')\n variant_properties.collect {|vp| [vp.property.display_name ,vp.description].join(separator) }\n end", "title": "" }, { "docid": "0a86593a07df95cf16766433f1f7a276", "score": "0.5443108", "text": "def properties\n properties = []\n\n rules.values.each do |declarations|\n declarations.each {|property, value| properties << [property, value] }\n end\n \n properties\n end", "title": "" }, { "docid": "14d00bee8a7ef28a4e747d83943f9dd6", "score": "0.5428562", "text": "def properties\n self.class.properties.collect { |prop| @parameters[prop.name] }.compact\n end", "title": "" }, { "docid": "1a1f2b7a6c09789d14a94c0ac0e315b8", "score": "0.5428362", "text": "def attributes\n unless(@attributes)\n @attributes = Hash.new()\n self.properties_.each do |property|\n @attributes[property.name] = property.value\n end\n end\n @attributes\n end", "title": "" }, { "docid": "6f6128af786de31671a8e42b44d09eda", "score": "0.5419521", "text": "def add_item_prop(item_prop)\n properties = Itemprop.parse(item_prop, @page_url)\n properties.each { |name, value| (@properties[name] ||= []) << value }\n end", "title": "" }, { "docid": "f76e1e8efb3caed5a3e0174ca1f094f8", "score": "0.5409494", "text": "def properties\n self.class.properties\n end", "title": "" }, { "docid": "a1f1be9e8856abae989290504242c637", "score": "0.54043704", "text": "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key, value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n props.each do |prop|\n pname = prop.to_sym\n properties_info[pname] ||= {}\n properties_info[pname][:defined] = true\n\n define_method(pname) do\n self[pname]\n end\n\n name = (pname.to_s() +\"=\").to_sym\n define_method(name) do |value|\n self[pname] = value\n end\n end\n end", "title": "" }, { "docid": "51520cfaf93ddbb31da1e896108bc141", "score": "0.5401653", "text": "def property_tree\n properties = Hash[self.explore.properties.map {|p| [p.id, p]}]\n properties.keys.each do |key|\n prop = properties[key]\n prop.parents.each {|par| properties[par].children << prop if properties[par]}\n end\n roots = properties.values.select {|p| p.parents.empty?}\n root = LinkedData::Client::Models::Property.new\n root.children = roots\n root\n end", "title": "" }, { "docid": "3ebda49c8e0d254d5e4851da042dea05", "score": "0.5397728", "text": "def property_objects\n hash = {}\n self.class.properties.each { |prop| hash[prop] = @properties[prop] }\n hash\n end", "title": "" } ]
6ad308405418f8293b5bf1145c5c8cb5
POST /books POST /books.json
[ { "docid": "9541281650d9e4ca8e4f9d2a1e4dc113", "score": "0.0", "text": "def create\n @book_request = BookRequest.new(book_request_params)\n respond_to do |format|\n if @book_request.save\n format.html { redirect_to account_reader_book_requests_path, notice: 'Book request was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "3622d3bdcdce424b7485f979c9b796eb", "score": "0.73853105", "text": "def create\n @books = Books.new(params[:books])\n\n respond_to do |format|\n if @books.save\n format.html { redirect_to @books, :notice => 'Book was successfully created.' }\n format.json { render :json => @books, :status => :created, :location => @books }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @books.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aea3a8cf8c45e85bca7ae6a5a676620d", "score": "0.73365504", "text": "def create\n book = Book.new(book_params)\n if book.save\n render json: book\n else\n render nothing: true, status: :bad_request\n end\n end", "title": "" }, { "docid": "1cd4b663fee271c052147b863b0fac35", "score": "0.69861966", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book,\n :notice => 'Book was successfully created.' }\n format.json { render :json => @book,\n :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a717025b848a1a37eb2aaa2e128286f", "score": "0.6968103", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a717025b848a1a37eb2aaa2e128286f", "score": "0.6968103", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a717025b848a1a37eb2aaa2e128286f", "score": "0.6968103", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a717025b848a1a37eb2aaa2e128286f", "score": "0.6968103", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97edee77c6da1fcc29dddc50c6177568", "score": "0.6906531", "text": "def create\n @book = Book.new(params[:book])\n respond_to do |format|\n if @book.save\n \n format.html { redirect_to @book, notice: 'book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718755", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718755", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718755", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718755", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718755", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82010ba8e7ec53d9d0b7887b5486b403", "score": "0.68718064", "text": "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c855e3c361ad41fc8ca4a2b6b0b9723d", "score": "0.685961", "text": "def create\n \n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ae33ff0c3ddb0cebde1406b2604ff73", "score": "0.68454224", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2df28c4bbe5c791ab196c29c0a6d94c1", "score": "0.68355435", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4f6bbd16607f2e697d84122663aa9f1", "score": "0.68278396", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_url, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "589341a2ed3e26756782e98ccb65ff96", "score": "0.67934906", "text": "def create\n @book = Book.create(create_params)\n if @book.present?\n render json: @book, status: :ok\n else\n render json: {error: 'Not create'}, status: :error\n end\n end", "title": "" }, { "docid": "4c356d9514f75cd9806b2c816262615d", "score": "0.67841715", "text": "def create\n @book = Book.new(book_params)\n\n if @book.save\n render :show, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b564a39d6282fdd1d27366aed39f99a7", "score": "0.6777309", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3f462780343a1647df362d35d0ba6dd", "score": "0.67726904", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3968a9bfb826f5a8cff653ccb76595fe", "score": "0.67606753", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3968a9bfb826f5a8cff653ccb76595fe", "score": "0.67606753", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3968a9bfb826f5a8cff653ccb76595fe", "score": "0.67606753", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b79b8ceca9745ad3f0a28c7cca47417", "score": "0.67586553", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b79b8ceca9745ad3f0a28c7cca47417", "score": "0.67586553", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b79b8ceca9745ad3f0a28c7cca47417", "score": "0.67586553", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c13a7a37223eff0a5de1341f614d1e46", "score": "0.6751837", "text": "def create\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "421b24a099c6404d858c8e4f05b0a1ec", "score": "0.67478836", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce4ec28f0e6d4914da7e8ab0e732e073", "score": "0.6743202", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"http://5.135.175.184/books/#{@book.id}\", notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e27280e0d2e2f7cc3a8a2bec282c37ba", "score": "0.67262167", "text": "def create\n @book = Book.new(book_params)\n\n\n respond_to do |format|\n if @book.save \n \n \n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de4a74b4963b72bfe49d98e13234ac35", "score": "0.67071325", "text": "def create\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4a3c79dbff80052cd4c36b46161858d", "score": "0.6702286", "text": "def create\n book = params[:book]\n\n book_name = book[:name]\n author_id = book[:author_id]\n year = book[:year]\n\n google_book_id = get_google_book_id(book_name, author_id, year)\n @book = Book.new(name: book_name, author_id: author_id, year: year, google_book_id: google_book_id)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1b80cf9e4806b4cb322d1519a54cc95", "score": "0.6698212", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1b80cf9e4806b4cb322d1519a54cc95", "score": "0.6698212", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1b80cf9e4806b4cb322d1519a54cc95", "score": "0.6698212", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85b50ce68c8fc2063331f07a9f046c83", "score": "0.66937166", "text": "def create\n\t\t@book = Book.new(book_params)\n\n\t\trespond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n\tend", "title": "" }, { "docid": "7abb823b17b96f6fcf5a4bbf032b30ff", "score": "0.6679547", "text": "def create\r\n @book = Book.new(book_params)\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\r\n format.json { render :show, status: :created, location: @book }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "0c4b286459a4e7bebd0a74aa5ffbd3b2", "score": "0.6675253", "text": "def create\n @api_book = Api::Book.new(api_book_params)\n respond_to do |format|\n if @api_book.save\n format.html { redirect_to @api_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @api_book }\n else\n format.html { render :new }\n format.json { render json: @api_book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c93bf47e6bd44a5dda1100eb8978992", "score": "0.666678", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to @book }\n format.json { render :show, status: :created, location: @book }\n else\n flash[:warning] = 'Failed to save new book.'\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a403d14c1ddf1f74120b1cfdeff3ebb", "score": "0.66577524", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'El libro se creó correctamente.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63d8d6611b5d9df147b3a36deab90f5f", "score": "0.66528064", "text": "def create\n @book = Book.new(params[:book])\n @book.save\n respond_with(@book)\n end", "title": "" }, { "docid": "39634fb66236759bb00e90505dec2e0b", "score": "0.6633279", "text": "def create_book(response_body)\n @body = BodyCreateBook.new.body_create_book.to_json\n @response = self.class.post('/Books',\n :headers => {\"Content-Type\": 'application/json; charset=utf-8; v=1.0'},\n :body => @body)\n $code_success = @response.code\n $response_body = @response\n end", "title": "" }, { "docid": "4c925c58c654f8efd4a97047b060eaf6", "score": "0.6621438", "text": "def create\n @books_on_loan = BooksOnLoan.new(params[:books_on_loan])\n respond_to do |format|\n if @books_on_loan.save\n format.json { render json: @books_on_loan, status: :created, \n location: @books_on_loan }\n else\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95f900465ccfb1ec68b5e4a2157c2e76", "score": "0.6612024", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html {redirect_to @book, notice: 'Book was successfully created.'}\n format.json {render :show, status: :created, location: @book}\n else\n format.html {render :new}\n format.json {render json: @book.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "a8e839b0271cabc38baa8f8d20a602fa", "score": "0.66099256", "text": "def create\n @book = Book.new(params[:book])\n @relation = Hash.new\n \n respond_to do |format|\n if @book.save \n format.html { redirect_to @book, notice: '책이 성공적으로 추가되었습니다.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf4c9589f160e07340f2d945e32d23ee", "score": "0.6604425", "text": "def create\n @book = Book.new(book_params)\n # @author_books = @book.author_books.\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d0ebeb2290e2913f2f2e240f3af034e", "score": "0.6599689", "text": "def create \n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to action: :index }\n flash[:success] = 'Book was successfully created.'\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83e25337ef21dd71b8a3462320b0a09e", "score": "0.65658355", "text": "def create\n @book = Book.new(book_params) \n respond_to do |format|\n if @book.save\n flash[:success] = \"Successfully created book.\"\n redirect_to @book and return\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "833a7481518ae8a38207c3a8f3ce10b9", "score": "0.65521705", "text": "def create\n @user = User.find(params[:user_id])\n @book = @user.books.build(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to([@book.user, @book], :notice => 'Book was successfully created.') }\n format.json { render :json => @book, :status => :created, :location => [@book.user, @book] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b9ce447ffe84666b88660138f323978", "score": "0.65459126", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n #end\n end", "title": "" }, { "docid": "570bf649b823da07555b64c3804ec7b3", "score": "0.6541123", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '蔵書情報が登録されました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a076adccf68738fa06c0bd63c4858368", "score": "0.65404356", "text": "def create\n @book = current_user.books.build(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b5eb4991ec0096e543fa7256474bb26", "score": "0.65265036", "text": "def create\n @book = Book.new(book_params) \n respond_to do |format|\n if @book.save\n flash[:success] = \"Successfully created book.\"\n redirect_to @book and return\n else \n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90ef4094c59e051b28085ba7a41968b3", "score": "0.65070987", "text": "def create\n @add_book = AddBook.new(add_book_params)\n\n respond_to do |format|\n if @add_book.save\n format.html { redirect_to @add_book, notice: 'Add book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @add_book }\n else\n format.html { render action: 'new' }\n format.json { render json: @add_book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c6ff04dc7f3a2d45e3c2bebceab2f90", "score": "0.65068525", "text": "def create\n puts \"in create!!! #{params}\"\n bookId = params[:book][:id];\n @book = BookService.save_or_update(params[:book][:file],\n bookId,\n params[:book][:title],\n params[:book][:description],\n params[:book][:labels],\n params[:book][:author],\n session[:userId])\n respond_to do |format|\n format.js { render json: { book: @book } }\n end\n end", "title": "" }, { "docid": "8d42556a5ece4d54e70a346db470a6ea", "score": "0.64926225", "text": "def create\n @book = Book.create(params[:book])\n respond_with(@user)\n end", "title": "" }, { "docid": "13db5b81d02142c1d84c17bee76e066a", "score": "0.6487947", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to backstage_books_url, notice: 'book was successfully created.' }\n # format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n # format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f44516ade8bc98811714d74e820b6691", "score": "0.6466915", "text": "def create\n@book = current_user.books.build(book_params)\n\n\trespond_to do |format|\n\tif @book.save\n\tformat.html { redirect_to @book, notice: 'Book was successfully created.' }\n\tformat.json { render :show, status: :created, location: @book }\n\telse\n\tformat.html { render :new }\n\tformat.json { render json: @book.errors, status: :unprocessable_entity }\n\tend\n\tend\n\tend", "title": "" }, { "docid": "f81f7dc9ccff04122b3af1708f0e8ef3", "score": "0.6466025", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to author_path(@book.author_id), notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e28a914b4279bbb858274f11bc64cc3", "score": "0.6464641", "text": "def create\n @book = current_user.books.build(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d331788b9c3480a6267d8b0a1ffdc42b", "score": "0.64571524", "text": "def create\n\t\t@book = Book.new(book_params)\n\t\[email protected]_id = current_user.id\n\n\t\trespond_to do |format|\n\t\t\tif @book.save \n\t\t\t\t@books = Book.where(\"user_id = ?\", current_user.id).order(\"title\")\n\t\t\t\t@books [email protected](page: params[:page], per_page: 16)\n\t\t\t\tformat.html { redirect_to @book; flash[:success] = 'Book was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @book }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @book.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "b26246158d9d062e80ad6c539a74daf3", "score": "0.6452707", "text": "def create\n book = Book.new(\n name: prod_params[:name],\n author: prod_params[:author],\n description: prod_params[:description],\n release_date: prod_params[:release_date]\n )\n\n if book.save\n AddBookWorker.perform_async(prod_params[:name], prod_params[:author])\n render json: book, status: 200\n else\n render json: {error: \"Error creating new book record\"}\n end\n end", "title": "" }, { "docid": "fcaed33d681e3a1632d5eee31cf0e76a", "score": "0.6446413", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: book_params }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61b60322c2ab0342bf073fa2134ed58d", "score": "0.6443084", "text": "def create\n @newbook = Newbook.new(newbook_params)\n\n respond_to do |format|\n if @newbook.save\n format.html { redirect_to @newbook, notice: 'Newbook was successfully created.' }\n format.json { render :show, status: :created, location: @newbook }\n else\n format.html { render :new }\n format.json { render json: @newbook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efa3af67e8786004937cfac63c98ad30", "score": "0.6429264", "text": "def create\n @booksale = Booksale.new(params[:booksale])\n\n respond_to do |format|\n if @booksale.save\n format.html { redirect_to @booksale, :notice => 'Booksale was successfully created.' }\n format.json { render :json => @booksale, :status => :created, :location => @booksale }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @booksale.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d50c02790554e368f519b3e87cc3bc1", "score": "0.6394281", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n #redirect to show\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f1da019a8a1c6077cf96bdf4e108fa5", "score": "0.63893825", "text": "def create\n @book = Book.new(book_params)\n @book.user_id = current_user.id\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_url, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "533668087d0e5ffdcc784932f375adb6", "score": "0.6387978", "text": "def new\n @books = Books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @books }\n end\n end", "title": "" }, { "docid": "4463fee187c86c3bbe088f10684bf9ac", "score": "0.637497", "text": "def create\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to [:admin, @book], :notice => 'Book was successfully created.' }\n format.json { render :show, :status => :created, :location => @book }\n else\n format.html { render :new }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9a279ad237c4c5357f60e04dc3bf749", "score": "0.6374392", "text": "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n @book[:status] = true\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1f800244be6b28e80d0557e56bd5f07", "score": "0.63720924", "text": "def create\n authorize\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"http://localhost:3000/books/#{@book.id}\", notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f295bd57c02610049cde4f63d9d0345", "score": "0.6367136", "text": "def create\n @mybook = Mybook.new(params[:mybook])\n\n respond_to do |format|\n if @mybook.save\n format.html { redirect_to @mybook, notice: 'Mybook was successfully created.' }\n format.json { render json: @mybook, status: :created, location: @mybook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mybook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b87dfea69562a13d1863f215f8ae1778", "score": "0.6340757", "text": "def create\n @book = Book.create(book_params)\n end", "title": "" }, { "docid": "359ba49d3582708eefafa673a5066540", "score": "0.63373774", "text": "def create\n @book = Book.new(book_params)\n @book.user_id = current_user.id\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book,\n notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9dd3efac836287f063eaf8ac0906d95", "score": "0.63257307", "text": "def create\n @authorbook = Authorbook.new(params[:authorbook])\n\n respond_to do |format|\n if @authorbook.save\n format.html { redirect_to @authorbook, notice: 'Authorbook was successfully created.' }\n format.json { render json: @authorbook, status: :created, location: @authorbook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @authorbook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0707237bf11f23fe4835f2fccada39f3", "score": "0.63203394", "text": "def create\n # Create a new variable @book\n # with the attributes filled out on\n # the form, passed to the create method\n # through the submit button, which triggers a POST action.\n @book = Book.new(book_params)\n\n respond_to do |format|\n # Saves @book to the database\n # if retuns true if @book was saved\n if @book.save\n # Send message to the view\n # and redirect to @book\n # which is shorthand for book_path(@book)\n # which is that book's show page.\n flash[:success] = \"Book #{@book.title.titleize} was added to the library!\"\n format.html { redirect_to @book }\n format.json { render :show, status: :created, location: @book }\n # if @book.save returns false\n # which means there were errors\n else\n # Render books/new.html.erb again\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ef77adea5bdb4918c9dd03c1b408b5e", "score": "0.6319198", "text": "def create\n @book = Book.new(book_params)\n @book.user_id = current_user.id\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, success: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
16c621c74b381d10d07a94583a00085f
handle the +attr+ attribute as a "fileupload" column, generating additional methods as explained above. You should pass the attribute's name as a symbol, like this: file_column :image You can pass in an options hash that overrides the options in +DEFAULT_OPTIONS+.
[ { "docid": "b8b77bf3eb156596b1fc068ab8055715", "score": "0.7200059", "text": "def file_column(attr, options={})\n options = DEFAULT_OPTIONS.merge(options) if options\n \n my_options = FileColumn::init_options(options, \n ActiveSupport::Inflector.underscore(self.name).to_s,\n attr.to_s)\n \n state_attr = \"@#{attr}_state\".to_sym\n state_method = \"#{attr}_state\".to_sym\n \n define_method state_method do\n result = instance_variable_get state_attr\n if result.nil?\n result = FileColumn::create_state(my_options, self, attr.to_s)\n instance_variable_set state_attr, result\n end\n result\n end\n \n private state_method\n \n define_method attr do |*args|\n send(state_method).absolute_path *args\n end\n \n define_method \"#{attr}_relative_path\" do |*args|\n send(state_method).relative_path *args\n end\n\n define_method \"#{attr}_dir\" do\n send(state_method).absolute_dir\n end\n\n define_method \"#{attr}_relative_dir\" do\n send(state_method).relative_dir\n end\n\n define_method \"#{attr}=\" do |file|\n instance_variable_set state_attr, send(state_method).assign(file)\n if my_options[:after_assign]\n my_options[:after_assign].each do |sym|\n self.send sym\n end\n end\n end\n \n define_method \"#{attr}_temp\" do\n send(state_method).temp_path\n end\n \n define_method \"#{attr}_temp=\" do |temp_path|\n instance_variable_set state_attr, send(state_method).assign_temp(temp_path)\n end\n \n after_save_method = \"#{attr}_after_save\".to_sym\n \n define_method after_save_method do\n instance_variable_set state_attr, send(state_method).after_save\n end\n \n after_save after_save_method\n \n after_destroy_method = \"#{attr}_after_destroy\".to_sym\n \n define_method after_destroy_method do\n send(state_method).after_destroy\n end\n after_destroy after_destroy_method\n \n define_method \"#{attr}_just_uploaded?\" do\n send(state_method).just_uploaded?\n end\n \n define_method \"#{attr}_options\" do\n send(state_method).options\n end\n \n private after_save_method, after_destroy_method\n\n FileColumn::Magick::file_column(self, attr, my_options) if options[:magick]\n end", "title": "" } ]
[ { "docid": "560f3dd79c790edaeb4973dbd66f8bf2", "score": "0.7608237", "text": "def image_column( attr, options={} )\n options[:crop] ||= false\n options[:web_root] ||= \"/images\"\n options[:root_path] ||= File.join(RAILS_ROOT, \"public\", \"images\")\n options[:mime_extensions] ||= IMAGE_MIME_EXTENSIONS\n options[:extensions] ||= IMAGE_EXTENSIONS\n \n register_functions( attr, UploadedImage, options )\n end", "title": "" }, { "docid": "f3d84b5fe52a83ef6a100b3c60827791", "score": "0.665732", "text": "def uploader_option(column, option); end", "title": "" }, { "docid": "d1468e7757888b3b1de518eed1a400db", "score": "0.6397389", "text": "def custom_file_field(obj, attr, opts = {})\n max_size = MO.image_upload_max_size\n max_size_in_mb = (max_size.to_f / 1024 / 1024).round\n file_field = file_field(\n obj,\n attr,\n opts.merge(\n max_upload_msg: :validate_image_file_too_big.l(max: max_size_in_mb),\n max_upload_size: max_size\n )\n )\n content_tag(:span, :select_file.t + file_field,\n class: \"file-field btn btn-default\") +\n content_tag(:span, :no_file_selected.t)\n end", "title": "" }, { "docid": "1d9693783119ec3a8e7b3601a9ab034b", "score": "0.6369586", "text": "def custom_file_field(obj, attr, opts = {})\n max_size = MO.image_upload_max_size\n max_size_in_mb = (max_size.to_f / 1024 / 1024).round\n file_field = file_field(\n obj,\n attr,\n opts.merge(\n max_upload_msg: :validate_image_file_too_big.l(max: max_size_in_mb),\n max_upload_size: max_size\n )\n )\n content_tag(:span, :select_file.t + file_field, class: \"file-field btn\") +\n content_tag(:span, :no_file_selected.t)\n end", "title": "" }, { "docid": "5d6c8e9d87705cfd0e04cc74d5ff5f74", "score": "0.63552266", "text": "def file_control(col, attrs = {})\n errorify_field(attrs, col)\n file_field(control_name_value(col, attrs))\n end", "title": "" }, { "docid": "552f7449dce4b7088f83305e178712dd", "score": "0.6345656", "text": "def create_from_file\n super @@columns_for_file_upload\n end", "title": "" }, { "docid": "caaff277eb755bed57cd4821765ab5ff", "score": "0.6301725", "text": "def fileupload_asset(method)\n if fileuploads_columns.include?(method.to_sym)\n asset = new_record? ? self.class.fileupload_find(method, fileupload_guid) : send(method)\n asset ||= send(\"build_#{method}\") if respond_to?(\"build_#{method}\")\n asset\n end\n end", "title": "" }, { "docid": "99768c74a58e6488e5269d382b065bfd", "score": "0.62122166", "text": "def fileupload_asset(method)\n if fileuploads_columns.include?(method.to_sym)\n asset = new_record? ? self.class.fileupload_find(method, fileupload_guid) : send(method)\n asset ||= send(\"build_#{method}\") if respond_to?(\"build_#{method}\")\n asset\n end\n end", "title": "" }, { "docid": "86b30fa17ffa69194b265ba0fa2e953e", "score": "0.60883045", "text": "def file_field_sub(col_name, file_info, options)\n fields_for(\"file_info[#{col_name}]\", file_info) do |f|\n f.file_field(:uploaded_data, {:size=>20}.merge(options))\n end\n end", "title": "" }, { "docid": "95a2280adafa7015855cad49c26745a1", "score": "0.6068769", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n super\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def remote_#{column}_url=(url)\n column = _mounter(:#{column}).serialization_column\n send(:attribute_will_change!, :#{column})\n super\n end\n RUBY\n end", "title": "" }, { "docid": "c3b2b0e819005cd3fac2f756876b03df", "score": "0.6032984", "text": "def file_data_column\n edit_phase ? :edit_file_data : :file_data\n end", "title": "" }, { "docid": "6a8074cb5151900bac33fe38b47b4ffa", "score": "0.5922345", "text": "def file_field(attribute, options = {})\n form_field(attribute, options) do\n file_tag(attribute, options) do\n file_label_tag(attribute, options) do\n # Input for selecting the file\n control = super(attribute, options.reverse_merge(class: \"file-input\"))\n\n # File select label\n label = file_select_label_tag(attribute, options)\n\n # File select filename\n name = file_select_name_tag(attribute, options) do\n if object.send(attribute).present? && !options[:skip_initial_name]\n object.send(attribute).original_filename\n else\n \"No file selected\"\n end\n end\n\n content = control\n\n # Add the label if \"skip_label\" option is false\n content += label unless options[:skip_label]\n\n # Add the filename if \"skip_name\" option is false\n content += name unless options[:skip_name]\n\n content\n end\n end\n end\n end", "title": "" }, { "docid": "ee01c3c1400526440373bcb2bc77a657", "score": "0.5913169", "text": "def mount_uploader(column, uploader, options={}, &block)\n options[:mount_on] ||= \"#{column}_filename\"\n field options[:mount_on]\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_save \"store_#{column}!\".to_sym\n before_save \"write_#{column}_identifier\".to_sym\n after_destroy \"remove_#{column}!\".to_sym\n end", "title": "" }, { "docid": "ad49bc5d04526e9543f8c8b764c81b8b", "score": "0.5890158", "text": "def column_for_attribute(name); end", "title": "" }, { "docid": "ef4dbe84b262b02f18bfd6bf7e8a1ae0", "score": "0.58821213", "text": "def mount_uploader(column, uploader, options={}, &block)\n options[:mount_on] ||= \"#{column}_filename\"\n key options[:mount_on]\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_save \"store_#{column}!\".to_sym\n before_save \"write_#{column}_identifier\".to_sym\n after_destroy \"remove_#{column}!\".to_sym\n end", "title": "" }, { "docid": "7cc56fab3c4cd0fccc2c6916d5c7e561", "score": "0.585382", "text": "def grid_data_cell_edit(field, value, prop, **opt)\n if field == :file_data\n opt[:render] ||= :render_grid_file_input\n end\n super\n end", "title": "" }, { "docid": "d413858375216f1e89fcf50c93c29b7c", "score": "0.58472466", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n options[:mount_on] ||= \"#{column}_filename\"\n field options[:mount_on]\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_save :\"store_#{column}!\"\n before_save :\"write_#{column}_identifier\"\n after_destroy :\"remove_#{column}!\"\n before_update :\"store_previous_model_for_#{column}\"\n after_save :\"remove_previously_stored_#{column}\"\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{column}=(new_file)\n column = _mounter(:#{column}).serialization_column\n\n begin\n value = __send__(column)\n send(:\"\\#{column}_will_change!\")\n rescue TypeError, NoMethodError\n end\n column = value\n\n super\n end\n\n def #{column}_changed?\n column = _mounter(:#{column}).serialization_column\n send(:\"\\#{column}_changed?\")\n end\n RUBY\n\n end", "title": "" }, { "docid": "b738acc84bb5392f1bcb7e6959958451", "score": "0.5842944", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n super\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n attr_accessor :#{column}_data_filename, :#{column}_data_mimetype\n\n def #{column}_data_uri=(data)\n self.#{column} = CarrierWave::Neo4j::DataUri::Parser.new(data).to_file original_filename: self.#{column}_data_filename, content_type: self.#{column}_data_mimetype\n end\n RUBY\n end", "title": "" }, { "docid": "a6e3300fb3f1e20888f48c13ef856255", "score": "0.5838144", "text": "def column_definition_sql(column)\n column.delete(:default) if column[:type] == File || (column[:type] == String && column[:text] == true)\n super\n end", "title": "" }, { "docid": "ff0814651190df24edf57b060df4ddf1", "score": "0.5803785", "text": "def file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n @view_context.file_field_tag field_name(field), options\n end", "title": "" }, { "docid": "0837c11bee52d3b1931ee881acd759db", "score": "0.57861674", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n field options[:mount_on] || column\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n public :read_uploader\n public :write_uploader\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n #validates_download_of column if uploader_option(column.to_sym, :validate_download)\n\n after_save :\"store_#{column}!\"\n before_save :\"write_#{column}_identifier\"\n after_destroy :\"remove_#{column}!\"\n before_update :\"store_previous_model_for_#{column}\"\n after_save :\"remove_previously_stored_#{column}\"\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{column}=(new_file)\n column = _mounter(:#{column}).serialization_column\n send(:\"\\#{column}_will_change!\")\n super\n end\n\n def #{column}_changed?\n changed_attributes.has_key?(\"#{column}\")\n end\n\n def find_previous_model_for_#{column}\n if self.embedded?\n ancestors = [[ self.metadata.key, self._parent ]].tap { |x| x.unshift([ x.first.last.metadata.key, x.first.last._parent ]) while x.first.last.embedded? }\n first_parent = ancestors.first.last\n reloaded_parent = first_parent.class.unscoped.find(first_parent.to_key.first)\n association = ancestors.inject(reloaded_parent) { |parent,(key,ancestor)| (parent.is_a?(Array) ? parent.find(ancestor.to_key.first) : parent).send(key) }\n association.is_a?(Array) ? association.find(to_key.first) : association\n else\n self.class.unscoped.find(to_key.first)\n end\n end\n\n def remote_#{column}_url=(url)\n column = _mounter(:#{column}).serialization_column\n send(:\"\\#{column}_will_change!\")\n super\n end\n\n def remove_#{column}!\n super\n _mounter(:#{column}).remove = true\n _mounter(:#{column}).write_identifier\n end\n\n def serializable_hash(options=nil)\n hash = {}\n\n except = options && options[:except] && Array.wrap(options[:except]).map(&:to_s)\n only = options && options[:only] && Array.wrap(options[:only]).map(&:to_s)\n\n self.class.uploaders.each do |column, uploader|\n if (!only && !except) || (only && only.include?(column.to_s)) || (except && !except.include?(column.to_s))\n hash[column.to_s] = _mounter(column).uploader.serializable_hash\n end\n end\n super(options).merge(hash)\n end\n RUBY\n\n end", "title": "" }, { "docid": "0eb3cfaeec8eeef48081788d3abe528e", "score": "0.5764486", "text": "def type_literal_generic_file(column)\n :image\n end", "title": "" }, { "docid": "0eb3cfaeec8eeef48081788d3abe528e", "score": "0.5764486", "text": "def type_literal_generic_file(column)\n :image\n end", "title": "" }, { "docid": "0eb3cfaeec8eeef48081788d3abe528e", "score": "0.5764486", "text": "def type_literal_generic_file(column)\n :image\n end", "title": "" }, { "docid": "abc39cde1b69465b6169751647637950", "score": "0.5748041", "text": "def mount_uploader(column, uploader, options={}, &block)\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n public :read_uploader\n public :write_uploader\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_save \"store_#{column}!\"\n before_save \"write_#{column}_identifier\"\n after_destroy \"remove_#{column}!\"\n end", "title": "" }, { "docid": "7403450d71b41a26a8f4c24e55f40bd2", "score": "0.57341284", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n super\n\n alias_method :read_uploader, :get\n alias_method :write_uploader, :set\n public :read_uploader\n public :write_uploader\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_insert :\"store_#{column}!\"\n after_update :\"store_#{column}!\"\n\n before_insert :\"write_#{column}_identifier\"\n before_update :\"write_#{column}_identifier\"\n\n after_remove :\"remove_#{column}!\"\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{column}=(new_file)\n column = _mounter(:#{column})\n super\n end\n RUBY\n\n end", "title": "" }, { "docid": "460621fe504705bc7f09590d47fe562c", "score": "0.57255965", "text": "def column(opts = {}, &block)\n options = {\n :column_name => '',\n :td_html_attrs => {},\n :model_class => nil,\n :attribute_name => nil,\n :no_filter => false,\n :custom_filter => nil,\n :in_csv => true,\n :in_html => true,\n :boolean_filter_true_label => Defaults::BOOLEAN_FILTER_TRUE_LABEL,\n :boolean_filter_false_label => Defaults::BOOLEAN_FILTER_FALSE_LABEL,\n :filter_all_label => Defaults::CUSTOM_FILTER_ALL_LABEL,\n :custom_order => nil,\n :helper_style => Defaults::HELPER_STYLE,\n :table_alias => nil,\n :negation_in_filter => Defaults::NEGATION_IN_STRING_FILTERS,\n :detach_with_id => nil\n }\n\n Wice.deprecated_call(:filter_options, :custom_filter, opts)\n Wice.deprecated_call(:column_label, :column_name, opts)\n Wice.deprecated_call(:td_html_options, :td_html_attrs, opts)\n\n options.merge!(opts)\n\n unless options[:model_class].nil?\n options[:model_class] = options[:model_class].constantize if options[:model_class].is_a? String\n raise WiceGridArgumentError.new(\"Option :model_class can be either a class or a string instance\") unless options[:model_class].is_a? Class\n end\n\n if options[:attribute_name].nil? && options[:model_class]\n raise WiceGridArgumentError.new(\"Option :model_class is only used together with :attribute_name\")\n end\n\n if options[:attribute_name] && options[:attribute_name].index('.')\n raise WiceGridArgumentError.new(\"Invalid attribute name #{options[:attribute_name]}. An attribute name must not contain a table name!\")\n end\n\n if block.nil?\n if ! options[:attribute_name].blank?\n block = lambda{|obj| obj.send(options[:attribute_name])}\n else\n raise WiceGridArgumentError.new(\n \"Missing column block without attribute_name defined. You can only omit the block if attribute_name is present.\")\n end\n end\n\n klass = ViewColumn\n if options[:attribute_name] &&\n col_type_and_table_name = @grid.declare_column(options[:attribute_name], options[:model_class],\n options[:custom_filter], options[:table_alias])\n\n db_column, table_name, main_table = col_type_and_table_name\n col_type = db_column.type\n \n if options[:custom_filter]\n \n custom_filter = if options[:custom_filter] == :auto\n lambda{ @grid.distinct_values_for_column(db_column) } # Thank God Ruby has higher order functions!!!\n\n elsif options[:custom_filter].class == Symbol\n lambda{ @grid.distinct_values_for_column_in_resultset([options[:custom_filter]])}\n \n elsif options[:custom_filter].class == Hash\n options[:custom_filter].keys\n \n options[:custom_filter].to_a\n \n elsif options[:custom_filter].class == Array\n if options[:custom_filter].empty?\n []\n elsif options[:custom_filter].all_items_are_of_class(Symbol)\n lambda{ @grid.distinct_values_for_column_in_resultset(options[:custom_filter]) }\n \n elsif options[:custom_filter].all_items_are_of_class(String) || options[:custom_filter].all_items_are_of_class(Numeric)\n options[:custom_filter].map{|i| [i,i]}\n \n elsif options[:custom_filter].all_items_are_of_class(Array)\n options[:custom_filter] \n else\n raise WiceGridArgumentError.new(\n ':custom_filter can equal :auto, an array of string and/or numbers (direct values for the dropdown), ' +\n 'a homogeneous array of symbols (a sequence of methods to send to AR objects in the result set to ' +\n 'retrieve unique values for the dropdown), a Symbol (a shortcut for a one member array of symbols), ' +\n 'a hash where keys are labels and values are values for the dropdown option, or an array of two-item arrays, ' +\n 'each of which contains the label (first element) and the value (second element) for a dropdown option'\n )\n end\n end\n \n klass = ViewColumnCustomDropdown\n else\n klass = ViewColumn.handled_type[col_type] || ViewColumn\n end\n end\n\n vc = klass.new(block, options, @grid, table_name, main_table, custom_filter)\n \n vc.negation = options[:negation_in_filter] if vc.respond_to? :negation=\n\n vc.filter_all_label = options[:filter_all_label] if vc.kind_of?(ViewColumnCustomDropdown)\n if vc.kind_of?(ViewColumnBoolean)\n vc.boolean_filter_true_label = options[:boolean_filter_true_label]\n vc.boolean_filter_false_label = options[:boolean_filter_false_label]\n end\n add_column(vc)\n end", "title": "" }, { "docid": "72c6e55b635c0df9370702ad6910bd12", "score": "0.5722064", "text": "def url_for_file_column(object, method, options=nil)\n case object\n when String, Symbol\n object = instance_variable_get(\"@#{object.to_s}\")\n end\n\n # parse options\n subdir = nil\n absolute = false\n if options\n case options\n when Hash\n subdir = options[:subdir]\n absolute = options[:absolute]\n when String, Symbol\n subdir = options\n end\n end\n \n relative_path = object.send(\"#{method}_relative_path\", subdir)\n return nil unless relative_path\n\n url = \"\"\n if object.send(\"#{method}_state\").is_a?(FileColumn::PermanentUploadedFile) && object.send(\"#{method}_options\")[:s3] && object.send(\"#{method}_in_s3?\")\n url << FileColumn::S3FileColumnExtension::Config.s3_distribution_url\n else\n url << request.relative_url_root.to_s if absolute\n end\n url << \"/\"\n url << object.send(\"#{method}_options\")[:base_url] << \"/\"\n url << relative_path\n end", "title": "" }, { "docid": "e40e4ba74e4c2e8b64cb6c79f3ad79e1", "score": "0.5718631", "text": "def file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n @template.file_field_tag field_name(field), options\n end", "title": "" }, { "docid": "18ea641f7fc17fec9bd0e7ed34193188", "score": "0.5716642", "text": "def mount_uploader(column, uploader, options={}, &block)\n super\n\n alias_method :read_uploader, :attribute_get\n alias_method :write_uploader, :attribute_set\n after :save, \"store_#{column}!\".to_sym\n pre_hook = ::DataMapper.const_defined?(:Validate) ? :valid? : :save\n before pre_hook, \"write_#{column}_identifier\".to_sym\n after :destroy, \"remove_#{column}!\".to_sym\n\n # FIXME: Hack to work around Datamapper not triggering callbacks\n # for objects that are not dirty. By explicitly calling\n # attribute_set we are marking the record as dirty.\n class_eval <<-RUBY\n def remove_image=(value)\n _mounter(:#{column}).remove = value\n attribute_set(:#{column}, '') if _mounter(:#{column}).remove?\n end\n RUBY\n end", "title": "" }, { "docid": "6c1c9794de8f8947dfd7fcde2b512241", "score": "0.5707177", "text": "def file_field(method, options = {})\n self.multipart = true\n @template.file_field(@object_name, method, objectify_options(options))\n end", "title": "" }, { "docid": "c926db307c66484f7f981929d4d62c87", "score": "0.5690311", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n #field options[:mount_on] || column\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n public :read_uploader\n public :write_uploader\n\n include CarrierWave::Validations::ActiveModel\n\n validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n\n after_save :\"store_#{column}!\"\n before_save :\"write_#{column}_identifier\"\n before_update :\"store_previous_model_for_#{column}\"\n after_save :\"remove_previously_stored_#{column}\"\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{column}=(new_file)\n column = _mounter(:#{column}).serialization_column\n # send(:\"\\#{column}_will_change!\")\n super\n end\n\n\n\n def serializable_hash(options=nil)\n hash = {}\n self.class.uploaders.each do |column, uploader|\n if (!options[:only] && !options[:except]) || (options[:only] && options[:only].include?(column)) || (options[:except] && !options[:except].include?(column))\n hash[column.to_s] = _mounter(:#{column}).uploader.serializable_hash\n end\n end\n super(options).merge(hash)\n end\n\n RUBY\n end", "title": "" }, { "docid": "f5b0400b31957c4c80f60fa4ec31746c", "score": "0.567638", "text": "def file_field(object_name, method, options = {})\n InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_input_field_tag(\"file\", options)\n end", "title": "" }, { "docid": "4b93a240963c00d0f5f89ed655963157", "score": "0.5656695", "text": "def draw_file(f, col_or_sym, options={})\n col_name = get_column_name(col_or_sym)\n file_info = FileInfo.safe_find(f.object.send(col_name))\n error_wrapping(\n if file_info\n file_field_dom = \"file_info_#{col_name}_uploaded_data\"\n file_link_dom = \"file_info_#{col_name}_link\"\n\n file_field_sub(col_name, file_info, options.merge(:style=>'display:none')) +\n ' ' +\n content_tag(:span, :id=>file_link_dom) do\n link_to(file_info.filename,\n {:action => 'file_download',\n :id => f.object.id,\n :column => col_name}) + ' ' +\n link_to_function(\"[#{t('edgarj.default.clear')}]\",\n sprintf(\"Edgarj.clear_file('%s', '%s', '%s')\",\n file_field_dom,\n \"#{f.object_name}_#{col_name}\",\n file_link_dom))\n end +\n f.hidden_field(col_name)\n else\n file_field_sub(col_name, FileInfo.new, options)\n end, f.object.errors.on(col_name)\n )\n end", "title": "" }, { "docid": "f9c7ee394d9a40b7af587f9d6ebb0c5b", "score": "0.5648281", "text": "def mount_uploaders(column, uploader=nil, options={}, &block)\n super\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def remote_#{column}_urls=(url)\n column = _mounter(:#{column}).serialization_column\n send(:attribute_will_change!, :#{column})\n super\n end\n RUBY\n end", "title": "" }, { "docid": "59d4b216796ea03500355f632e863551", "score": "0.5646337", "text": "def croppable_picture_column(new_column, options = {})\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Check styles\n\t\t\t\t\t\tif !options[:styles]\n\t\t\t\t\t\t\traise \"Please define attachment styles.\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Prepare cropped style\n\t\t\t\t\t\tif options[:cropped_style]\n\t\t\t\t\t\t\tcropped_style = options[:cropped_style]\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcropped_style = nil\n\t\t\t\t\t\t\toptions[:styles].each do |style, style_geometry|\n\t\t\t\t\t\t\t\tif style_geometry.end_with?(\"#\")\n\t\t\t\t\t\t\t\t\tcropped_style = style\n\t\t\t\t\t\t\t\t\tbreak\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 cropped_style.nil?\n\t\t\t\t\t\t\t\traise \"Unable to resolve cropped style. Please define style with ...x...# geometry or set :cropped_style option.\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Prepare croppable style\n\t\t\t\t\t\tif options[:croppable_style]\n\t\t\t\t\t\t\tcroppable_style = options[:croppable_style]\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcroppable_style = nil\n\t\t\t\t\t\t\toptions[:styles].each do |style, style_geometry|\n\t\t\t\t\t\t\t\tif style_geometry.end_with?(\">\")\n\t\t\t\t\t\t\t\t\tcroppable_style = style\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcroppable_style = :original if croppable_style.nil?\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Define attachment\n\t\t\t\t\t\thas_attached_file new_column.to_sym, styles: options[:styles], processors: [ :cropper ]\n\t\t\t\t\t\tvalidates_attachment_content_type new_column.to_sym, content_type: /\\Aimage\\/.*\\Z/\n\n\t\t\t\t\t\t# Cropped styles method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_cropped_style\".to_sym) do\n\t\t\t\t\t\t\treturn cropped_style\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Croppable styles method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_croppable_style\".to_sym) do\n\t\t\t\t\t\t\treturn croppable_style\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Geometry method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_geometry\".to_sym) do |style = :original|\n\t\t\t\t\t\t\t@paperclip_geometry ||= {}\n\t\t\t\t\t\t\t@paperclip_geometry[new_column.to_sym] ||= {}\n\t\t\t\t\t\t\t@paperclip_geometry[new_column.to_sym][style] ||= Paperclip::Geometry.from_file(self.send(new_column.to_sym).path(style))\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# URL method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_url\".to_sym) do\n\t\t\t\t\t\t\tvalue = self.send(new_column.to_sym)\n\t\t\t\t\t\t\tif value && value.present?\n\t\t\t\t\t\t\t\treturn self.send(new_column.to_sym).url\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Reprocess method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_reprocess\".to_sym) do\n\t\t\t\t\t\t\tself.send(new_column.to_sym).assign(self.send(new_column.to_sym))\n\t\t\t\t\t\t\tself.send(new_column.to_sym).save\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Bind after update event\n\t\t\t\t\t\tafter_update(\"#{new_column}_reprocess\".to_sym, :if => \"#{new_column}_perform_cropping?\".to_sym)\n\n\t\t\t\t\t\t# Define virtual crop attributes if needed => specify crop dimensions\n\t\t\t\t\t\t[:crop_x, :crop_y, :crop_w, :crop_h].each do |suffix|\n\t\t\t\t\t\t\tattribute = \"#{new_column}_#{suffix}\".to_sym\n\t\t\t\t\t\t\tif !column_names.include?(attribute.to_s)\n\t\t\t\t\t\t\t\tattr_accessor attribute \n\t\t\t\t\t\t\t\tdefine_method(\"#{new_column}_#{suffix}=\".to_sym) do |value|\n\t\t\t\t\t\t\t\t\tself.instance_variable_set(\"@#{attribute}\".to_sym, value.nil? ? nil : value.to_i) if value.nil? || value.is_numeric?\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tdefine_method(\"#{new_column}_#{suffix}=\".to_sym) do |value|\n\t\t\t\t\t\t\t\t\tsuper(value.nil? ? nil : value.to_i) if value.nil? || value.is_numeric?\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\n\t\t\t\t\t\t# Picture is already cropped if all crop attributes set to some value\n\t\t\t\t\t\tdefine_method(\"#{new_column}_already_cropped?\".to_sym) do\n\t\t\t\t\t\t\t[:crop_x, :crop_y, :crop_w, :crop_h].each do |suffix|\n\t\t\t\t\t\t\t\treturn false if self.send(\"#{new_column}_#{suffix}\".to_sym).blank?\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Define virtual cropping attribute => specify if cropping should be performed\n\t\t\t\t\t\tperform_cropping_attribute = \"#{new_column}_perform_cropping\".to_sym\n\t\t\t\t\t\tattr_accessor perform_cropping_attribute\n\n\t\t\t\t\t\t# Perform cropping method\n\t\t\t\t\t\tdefine_method(\"#{new_column}_perform_cropping?\".to_sym) do\n\t\t\t\t\t\t\treturn !self.send(perform_cropping_attribute).blank?\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend", "title": "" }, { "docid": "ed7f953000c36be0d3033678434bc113", "score": "0.5641137", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n super\n\n mod = Module.new\n prepend mod\n mod.class_eval <<-RUBY, __FILE__, __LINE__+1\n def remote_#{column}_url=(url)\n column = _mounter(:#{column}).serialization_column\n __send__(:\"\\#{column}_will_change!\")\n super\n end\n RUBY\n end", "title": "" }, { "docid": "516db6b2f7bbddacaa40f628e8f4c939", "score": "0.5637055", "text": "def file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n @template.file_field_tag field_name(field), options\n end", "title": "" }, { "docid": "caace2ee2c77d8d06e37af4b6b662b2e", "score": "0.5627049", "text": "def image_file_field(obj, attr, opts={})\n validated_file_field(obj, attr, opts.merge(\n :max_upload_msg => :validate_image_file_too_big.l(:max => \"#{(MO.image_upload_max_size.to_f/1024/1024).round}Mb\"),\n :max_upload_size => MO.image_upload_max_size\n ))\n end", "title": "" }, { "docid": "80c947d556e473c80f13747cc86bd0ec", "score": "0.55963874", "text": "def cms_image_or_upload_field(form_builder, method)\n klass = form_builder.object.class.name.sub('Cms::','')\n name = \"#{klass.underscore}[#{method}]\"\n file_display = !form_builder.object.send(method).path.blank?\n file_input = content_tag(:div, content_tag(:div, file_field_tag(name)), class: 'controls', style: (file_display ? 'display: none;' : ''))\n image = content_tag(:div, image_tag(form_builder.object.send(method).url, onclick: \"$('##{name.gsub(/[\\[\\]]/,'_').sub(/_$/,'').underscore}').parent().parent().show();$(this).hide();\"), style: file_display ? '' : 'display: none;')\n content_tag(:div, (label_tag(name, t(\".#{method}\"), :class => 'control-label').concat(image).concat(file_input)), class: 'control-group')\n end", "title": "" }, { "docid": "05fecc31e084cd19f7259b7f8fc22fa1", "score": "0.5571961", "text": "def write_uploader(column, identifier); end", "title": "" }, { "docid": "05fecc31e084cd19f7259b7f8fc22fa1", "score": "0.5571961", "text": "def write_uploader(column, identifier); end", "title": "" }, { "docid": "05fecc31e084cd19f7259b7f8fc22fa1", "score": "0.5571961", "text": "def write_uploader(column, identifier); end", "title": "" }, { "docid": "d502859ed55632cfe2f76057932e1474", "score": "0.554214", "text": "def method_missing(method, *args)\n FauxColumn.new(method, *args)\n end", "title": "" }, { "docid": "059f3ce3d70104b6a4a18f47dd7acbe7", "score": "0.5535474", "text": "def set_attributes_and_image( prod , row ) super end", "title": "" }, { "docid": "6678108e1a4e2d8d8f9732e832cf6f85", "score": "0.55248815", "text": "def wizard_file_field(field, options = {})\n # return a file field\n return file_field(self.wizard_model_tableized, field, options)\n end", "title": "" }, { "docid": "c0b49abea496a9e0cd75767d3a15a1c9", "score": "0.5515334", "text": "def file_field(object_name, method, options = {})\n options = { include_hidden: multiple_file_field_include_hidden }.merge!(options)\n\n Tags::FileField.new(object_name, method, self, convert_direct_upload_option_to_url(options.dup)).render\n end", "title": "" }, { "docid": "b777b218562b7bb13101fe870d594b7a", "score": "0.54964024", "text": "def upload_file(file, column: 'image')\n return true unless file\n result = self.class.upload file.tempfile, file.original_filename, content_type: file.content_type\n if result\n send \"#{column}=\", {\"name\" => result[\"name\"], \"__type\" => \"File\", \"url\" => result[\"url\"]}\n else\n errors.add column, 'File upload failed'\n return false\n end\n end", "title": "" }, { "docid": "6e1ef1f252347e2cf150ed860cee0a97", "score": "0.5493561", "text": "def file_field(how, what)\n return FileField.new(self, how, what)\n end", "title": "" }, { "docid": "d3fa9c17f66092afbf9ab36d76bd151a", "score": "0.5492314", "text": "def file_field(attrs = {})\n attrs.merge!(:type => \"file\")\n attrs.add_html_class!(\"file\")\n optional_label(attrs) { self_closing_tag(\"input\", attrs) }\n end", "title": "" }, { "docid": "8dd06d81561176f41f974dd5d40b0153", "score": "0.54909146", "text": "def url_for_file_column(*args)\n return args.join(\"/\") << \".jpg\"\n end", "title": "" }, { "docid": "c4c779ac2d54e2ee8ebef3a2f3292333", "score": "0.5487367", "text": "def column(*args, &block)\n name = args[0].to_s.titleize\n if block_given?\n method = block\n options = args[1]\n # t.column :full_name\n elsif args[1].nil?\n method = args[0]\n # t.column :created_at, :display_created_at\n elsif args[1].is_a? Symbol\n method = args[1]\n options = args[2]\n # t.column :body, :partial => 'awesome_tables/posts/body'\n # t.column :comments, :with_header => 'comments.png'\n else\n method = if args[1].keys.include?(:partial)\n args[1].delete(:partial)\n else\n args[0]\n end \n options = args[1]\n end\n @columns << { :header => name, :method => method, :options => options ||= {} }\n end", "title": "" }, { "docid": "c5362073ad964294b5654adf640bc3af", "score": "0.54833984", "text": "def upload(attribute, options = {})\n self.multipart = true\n options[:optional] = options[:optional].nil? ? true : options[:optional]\n alt_text = label_for(attribute)\n\n file = object.send attribute\n template = \"\"\n template += label(attribute, label_for(attribute) + required_for_attribute(attribute))\n template += upload_help(attribute, options)\n template += @template.file_field @object_name, attribute\n\n template += extension_whitelist_help(options[:extension_whitelist]) if options[:extension_whitelist].present?\n template += image_dimensions_help(options[:dimensions_info]) if options[:dimensions_info].present?\n\n if file_is_image?(file)\n template += if file.present?\n @template.content_tag :label, I18n.t(\"current_image\", scope: \"decidim.forms\")\n else\n @template.content_tag :label, I18n.t(\"default_image\", scope: \"decidim.forms\")\n end\n template += @template.link_to @template.image_tag(file.url, alt: alt_text), file.url, target: \"_blank\", rel: \"noopener\"\n elsif file_is_present?(file)\n template += @template.label_tag I18n.t(\"current_file\", scope: \"decidim.forms\")\n template += @template.link_to file.file.filename, file.url, target: \"_blank\", rel: \"noopener\"\n end\n\n if file_is_present?(file)\n if options[:optional]\n template += content_tag :div, class: \"field\" do\n safe_join([\n @template.check_box(@object_name, \"remove_#{attribute}\"),\n label(\"remove_#{attribute}\", I18n.t(\"remove_this_file\", scope: \"decidim.forms\"))\n ])\n end\n end\n end\n\n if object.errors[attribute].any?\n template += content_tag :p, class: \"is-invalid-label\" do\n safe_join object.errors[attribute], \"<br/>\".html_safe\n end\n end\n\n template.html_safe\n end", "title": "" }, { "docid": "df9ee872f92ad82ec19b045571d00183", "score": "0.5477284", "text": "def delete_file(column: 'image')\n unless attributes.keys.include? column.to_s\n raise ArgumentError, \"Unknown column #{column} for #{self.class}\"\n end\n self.class.delete_file attributes[column.to_s]\n send \"#{column}=\", nil\n end", "title": "" }, { "docid": "f9d557909b14c08d32d0b8f0f567d9b9", "score": "0.54676056", "text": "def mount_uploader(column, uploader, options={}, &block)\n if _props[column]\n warn \"Defining property for an uploader is deprecated at #{caller[2]}\"\n _props.delete(column)\n end\n\n uploader_property = if options[:mount_on]\n _props[options[:mount_on]]\n else\n property column\n column\n end\n\n super\n\n alias_method :read_uploader, :read_attribute\n alias_method :write_uploader, :write_attribute\n\n pre_hook = :save # ::Oriented.const_defined?(:Validations) ? :valid? : :save\n define_hook :before_save\n define_hook :after_save\n define_hook :after_destroy\n \n before_save \"write_#{column}_identifier\".to_sym\n before_save \"store_#{column}!\".to_sym\n after_destroy \"remove_#{column}!\".to_sym\n\n\n uploader_property\n end", "title": "" }, { "docid": "ab48a29aedebe7615b6724f7b02407fa", "score": "0.5462828", "text": "def file_select_widget(f, method, options = {})\n unique_id = Time.now.to_i\n field = \"#{f.object.class.to_s.downcase}_#{method}\"\n thumbnail_url = f.object.send(\"#{method}_asset_url\".to_sym).blank? ? f.object.send(\"#{method}_icon_path\".to_sym) : f.object.send(\"#{method}_asset_url\".to_sym)\n content = \"\"\n\n # Build the links\n links = [link_to(\"Upload From Computer\", '#', :class => \"upload-file\"), link_to(\"Choose From Library\", '#', :class => \"select-asset\")]\n links << remove_child_link(\"Remove\", f) if options[:allow_destroy]\n links << content_tag(:label, check_box_tag(\"remove_asset\") + \"Remove this asset\") if options[:allow_remove]\n\n # Build the rest of the widget\n content << image_tag(thumbnail_url, :class => \"form-thumbnail\") unless thumbnail_url.blank? # If the form failed, show the thumbnail of the previously selected asset\n content << f.hidden_field(\"#{method}_asset_id\".to_sym, :class => \"file-widget-asset-id\") # Eg. avatar_asset_id\n content << f.hidden_field(\"#{method}_asset_url\".to_sym, :class => \"file-widget-asset-url\") # Eg. avatar_asset_url\n content << content_tag(:small, content_tag(:div, \"\", :class => \"spacer\") + links.join('<br />').html_safe)\n return content_tag :div, content.html_safe, :class => \"extendable-inset\"\n end", "title": "" }, { "docid": "0a33b3d5b0b87ded505bc6caf540a110", "score": "0.54273105", "text": "def grid_data_cell_render_pair(label, value, field:, prop:, col: nil, **opt)\n if field == :file_data\n value = json_parse(value)\n opt[:'data-value'] = value.to_json if value\n file_name, file_type = value && ManifestItem.file_name_type(value)\n file_type_entries =\n FILE_TYPES.map do |t|\n if t == file_type\n html_div(file_name, class: \"from-#{t} active\")\n else\n html_div(nil, class: \"from-#{t}\", 'aria-hidden': true)\n end\n end\n value = safe_join(file_type_entries)\n opt[:value_css] ||= FILE_NAME_CLASS\n opt[:value_css] = css_classes(opt[:value_css], 'complete') if file_name\n opt[:wrap] = css_classes(UPLOADER_CLASS, opt[:wrap])\n end\n super\n end", "title": "" }, { "docid": "cde7219bafa8ad008ca320bbe8384b68", "score": "0.5422321", "text": "def uploader_option(column, option)\n if uploader_options[column].has_key?(option)\n uploader_options[column][option]\n else\n uploaders[column].send(option)\n end\n end", "title": "" }, { "docid": "cde7219bafa8ad008ca320bbe8384b68", "score": "0.5422321", "text": "def uploader_option(column, option)\n if uploader_options[column].has_key?(option)\n uploader_options[column][option]\n else\n uploaders[column].send(option)\n end\n end", "title": "" }, { "docid": "4c321412e6b729315ef1a9890bf6c82b", "score": "0.5416296", "text": "def column_for_attribute(attr)\n if attribute_set[attr]\n OpenStruct.new type: attribute_set[attr].type.to_s.demodulize.downcase.to_sym\n end\n end", "title": "" }, { "docid": "8dacfa2d96c63573e27c1f8f6659de52", "score": "0.5391036", "text": "def write_uploader(column, value)\n content_block.images[column.to_s] = value\n end", "title": "" }, { "docid": "472593533d45afe74af2ce905b9a285d", "score": "0.5383979", "text": "def url_for_image_column(object, method, options=nil)\n case object\n when String, Symbol\n object = instance_variable_get(\"@#{object.to_s}\")\n end\n subdir = nil\n if options\n subdir = object.send(\"#{method}_state\").create_magick_version_if_needed(options)\n end\n if subdir.nil?\n nil\n else\n url_for_file_column(object, method, subdir)\n end\n end", "title": "" }, { "docid": "c7c4ce64ba312a6f3c4d79f485a8a188", "score": "0.5374842", "text": "def upload_column_styles; stylesheet_link_tag \"uc_icons/upload_column\"; end", "title": "" }, { "docid": "7ed74c6a2c75ac61b0b2bf8f565bf06b", "score": "0.536082", "text": "def uploader method, options = {}\n # add an ID to the options\n options[:id] = field_id(method, options[:index]) unless options[:id].present?\n\n # Set the fieldname\n fieldname = @object_name + \"[#{method}_association_attributes][asset_id]\"\n\n # Create the uploader\n value = @object.nil? ? nil : @object.send(method)\n\n # Add the asset preview or the empty preview div\n if asset = asset_record(method)\n asset_preview = asset_html(asset, fieldname)\n else\n asset_preview = content_tag(:div, \"\", class: \"uploader-preview\")\n end\n\n # uploaer html with preview and input\n uploader_html = content_tag(:div, (asset_preview), class: \"uploader-assets-wrapper\")\n\n # Create and return the uploader html\n uploader_wrapper = content_tag(:div, uploader_html, class: \"uploader #{'uploader-has-asset' if asset} #{options[:class]}\", id: options[:id], :'data-uploader-input-name' => fieldname, :'data-uploader-directions' => get_directions(options), :'data-max-file-size' => get_max_file_size(options), :'data-resize' => get_resize(options))\n return uploader_wrapper\n end", "title": "" }, { "docid": "44bc94cddc4b3aeec0d5a2612e70db78", "score": "0.53438574", "text": "def zurb_file_field(method, options = { label: {}, field: {} }) \n set_options(options) # If only :field set throws error when accessing :label, and vice versa.\n errors = get_field_errors(method)\n add_error_class_to(options) if errors.any?\n\n field = @template.label_tag(@object_name,\n \"#{options[:label][:label] || method.to_s.humanize}\n #{@template.file_field(@object_name, method, options[:field])}\".html_safe,\n options[:label]\n )\n\n errors.any? ? add_error_message(field, errors) : field\n end", "title": "" }, { "docid": "cdc64ae141f41203e52411047ab076cb", "score": "0.53408974", "text": "def add_image(prod , row ) super end", "title": "" }, { "docid": "13072e7390af15fce48218b47d73882f", "score": "0.53344095", "text": "def after_render_field(record, column); end", "title": "" }, { "docid": "3495903a9404b9bd2bf7f2fea4963acb", "score": "0.5317871", "text": "def mount_uploader(column, uploader, options={}, &block)\n # We need to set the mount_on column (or key in MongoMapper's case)\n # since MongoMapper will attempt to set the filename on \n # the uploader instead of the file on a Document's initialization.\n options[:mount_on] ||= \"#{column}_filename\"\n key options[:mount_on]\n \n super\n alias_method :read_uploader, :[]\n alias_method :write_uploader, :[]=\n after_save \"store_#{column}!\".to_sym\n before_save \"write_#{column}_identifier\".to_sym\n after_destroy \"remove_#{column}!\".to_sym\n end", "title": "" }, { "docid": "7d2a6f32aa16366d29e24f4a33a24210", "score": "0.5313707", "text": "def upload(name, options={})\n @upload_reflection.store name.to_sym, options\n # Exemple of upload hash for col_name:\n # { :type=>\"image/jpeg\", \n # :filename=>\"default.jpeg\", \n # :tempfile=>#<File:/var/folders/J0/J03dF6-7GCyxMhaB17F5yk+++TI/-Tmp-/RackMultipart.12704.0>, \n # :head=>\"Content-Disposition: form-data; name=\\\"model[col_name]\\\"; filename=\\\"default.jpeg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\", \n # :name=>\"model[col_name]\"\n # }\n #\n # SETTER\n define_method name.to_s+'=' do |upload_hash|\n return if upload_hash==\"\" # File in the form is unchanged\n \n if upload_hash.nil?\n destroy_files_for(name) unless self.__send__(name).nil?\n super('')\n else\n h = {}\n h.merge!(identify(upload_hash[:tempfile].path))\n \n @tempfile_path ||= {}\n @tempfile_path[name.to_sym] = upload_hash[:tempfile].path\n h[:name] = name.to_s << upload_hash[:filename].to_s[/\\.[^.]+$/].to_s # sometimes there is no filename\n h[:type] ||= upload_hash[:type]\n h[:size] = upload_hash[:tempfile].size\n\n $log.debug(\"saving #{name}\", :data=>h)\n super(h.inspect)\n end\n end\n # GETTER\n define_method name.to_s do |*args|\n eval(super(*args).to_s)\n end\n end", "title": "" }, { "docid": "7d7dc5abe0e56825f9ea15d344fb3d02", "score": "0.53113896", "text": "def allow_uploading(instance, attribute)\n instance_name = instance.class.name.underscore.downcase\n have_tag(\"form[enctype='multipart/form-data'] input[type='file'][name='#{instance_name}[#{attribute}]']\")\n end", "title": "" }, { "docid": "adb4d47bd2dfd108a11cb17c307e1f8a", "score": "0.53070945", "text": "def column_for_attribute(method)\n if method.to_s == \"value\" && [VTYPE_BOOLEAN,\n VTYPE_NUMBER,\n VTYPE_DATETIME].include?(self.vtype)\n dressed_like_column = OpenStruct.new(\n name: \"value\", type: nil, sql_type: nil, klass: nil,\n coder: nil, default: false, null: true, primary: false,\n limit: nil, precision: nil, scale: nil\n )\n case self.vtype\n when VTYPE_BOOLEAN\n dressed_like_column.type = :boolean\n dressed_like_column.sql_type = \"boolean\"\n dressed_like_column.klass = Object\n when VTYPE_NUMBER\n dressed_like_column.type = :decimal\n dressed_like_column.sql_type = \"numeric\"\n dressed_like_column.klass = BigDecimal\n when VTYPE_DATETIME\n dressed_like_column.type = :datetime\n dressed_like_column.sql_type = \"timestamp without time zone\"\n dressed_like_column.klass = Time\n end\n dressed_like_column\n else\n super(method)\n end\n end", "title": "" }, { "docid": "95323f3d6819b32dc62c53827d5bc410", "score": "0.5296269", "text": "def file_input(method, options)\n basic_input_helper(:file_field, :file, method, options)\n end", "title": "" }, { "docid": "40cf3949f620054b012cf3a203f295c3", "score": "0.5294358", "text": "def column_attribute_class(attribute)\n \"column-#{attribute}\".parameterize\n end", "title": "" }, { "docid": "790605441331670c31b45681ef650984", "score": "0.5288877", "text": "def set_column data_type, column_name, model_class_name,file_name\n write_file = File.open(\"app/models/#{file_name}.rb\",\"a+\")\n write_file.each_line do |line|\n if line.scan\"class #{model_class_name}\"\n column_name.zip(data_type).each do |value|\n write_file.write\"\\s\\sattr_access :#{value.first} , :#{value.last}\\n\"\n end\n end\n end\n write_file.write(\"end\")\n write_file.close\n end", "title": "" }, { "docid": "0dbf2d90c071f58780c7ed11b5ffa56a", "score": "0.5288509", "text": "def file_field(name, *arguments)\n type = :file_field\n selector = discover_selector(arguments)\n\n define_all_readers type, name, selector, :value\n\n define_method \"attach_file_to_#{name}\" do |filepath|\n name_for_capybara_attaching = arguments.last[:name]\n @browser.attach_file name_for_capybara_attaching, filepath\n end\n end", "title": "" }, { "docid": "df73b3353a8d5bacfc3b46af2a0ad7de", "score": "0.52811426", "text": "def input_field(attr, html_options = {})\n type = column_type(@object, attr)\n if type == :text\n text_area(attr, html_options)\n elsif belongs_to_association?(attr, type)\n belongs_to_field(attr, html_options)\n elsif attr.to_s.include?('password')\n password_field(attr, html_options)\n else\n custom_field_method = :\"#{type}_field\"\n if respond_to?(custom_field_method)\n send(custom_field_method, attr, html_options)\n else\n text_field(attr, html_options)\n end\n end\n end", "title": "" }, { "docid": "c9a081e07cacfae35e133c5298203ab8", "score": "0.5276725", "text": "def input_field(attr, html_options = {})\n type = column_type(@object, attr)\n if type == :text\n text_area(attr, html_options)\n elsif association_kind?(attr, type, :belongs_to)\n belongs_to_field(attr, html_options)\n elsif association_kind?(attr, type, :has_and_belongs_to_many, :has_many)\n has_many_field(attr, html_options)\n elsif attr.to_s.include?('password')\n password_field(attr, html_options)\n else\n custom_field_method = :\"#{type}_field\"\n if respond_to?(custom_field_method)\n send(custom_field_method, attr, html_options)\n else\n text_field(attr, html_options)\n end\n end\n end", "title": "" }, { "docid": "6ebff3cadbb5bbd524fc8d5cdcb8994a", "score": "0.52607906", "text": "def attr(attr, header = nil, html_options = {}, &block)\n header ||= attr_header(attr)\n block ||= ->(e) { format_attr(e, attr) }\n add_css_class(html_options, align_class(attr))\n col(header, html_options, &block)\n end", "title": "" }, { "docid": "a72d4dc3177dc0f8419255828226cfc6", "score": "0.52577287", "text": "def fileupload_asset(method)\n if fileupload_associations.include?(method.to_sym)\n asset = new_record? ? self.class.fileupload_find(method, fileupload_guid) : send(method)\n asset ||= send(\"build_#{method}\") if respond_to?(\"build_#{method}\")\n asset\n end\n end", "title": "" }, { "docid": "fbbe5c6aa48ae3f8394a436c5a97cbed", "score": "0.5254429", "text": "def field(method_or_column, options = {})\n validate_options!(options)\n column = resolve_column!(method_or_column, options['postback'])\n \n send(\n column.respond_to?(:helper) && column.helper || case column.type\n when :text : :text_area\n when :boolean : :check_box\n when :date : :date_select\n when :datetime, :timestamp : :datetime_select\n when :time : :time_select\n when :collection : :collectable # TODO: Test\n when :group : :group\n else :text_field\n end, column, options\n )\n end", "title": "" }, { "docid": "152f7e93e478eb87d948cd7e7276d2c2", "score": "0.52521896", "text": "def render_grid_file_input(_name, _value, css: UPLOADER_DISPLAY_CLASS, **opt)\n prepend_css!(opt, css)\n display = html_div(opt)\n controls = FILE_INPUT_TYPES.map { |type| file_input_popup(src: type) }\n controls = html_div(*controls, class: \"#{APPEND_CONTROLS_CLASS} hidden\")\n controls << display\n end", "title": "" }, { "docid": "1d90f5d4e35552d5052d3f66b514097b", "score": "0.52510285", "text": "def reflect_on_upload_columns\n @upload_columns || {}\n end", "title": "" }, { "docid": "430966cd5f821d472fc52d43fec19a29", "score": "0.52467537", "text": "def field(attr_name, proc = nil, **options)\n attr_accessor(attr_name)\n define_read_method_with_default(attr_name, options[:default])\n define_write_method(attr_name, proc, options)\n end", "title": "" }, { "docid": "ac93eb0d9cf12c88a69dea2a23f61b3c", "score": "0.5240495", "text": "def mount_uploader(column, uploader=nil, options={}, &block)\n string_attr options[:mount_on] || \"#{column}_store\".to_sym\n super\n\n include CarrierWave::Validations::ActiveModel\n include CarrierWave::AWS::Record::Model::Uploaders\n\n #validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)\n #validates_processing_of column if uploader_option(column.to_sym, :validate_processing)\n #validates_download_of column if uploader_option(column.to_sym, :validate_download)\n\n after_save :\"store_#{column}!\"\n before_save :\"write_#{column}_identifier\"\n after_destroy :\"remove_#{column}!\"\n before_update :\"store_previous_model_for_#{column}\"\n after_save :\"remove_previously_stored_#{column}\"\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{column}_changed?\n #{column}_store_changed?\n end\n RUBY\n end", "title": "" }, { "docid": "b869a90db380d2f8bceec7bbeddca2b0", "score": "0.5234296", "text": "def mount_uploader(column, uploader, options={}, &block)\n super\n\n alias_method :read_uploader, :attribute\n alias_method :write_uploader, :attribute=\n public :read_uploader\n public :write_uploader\n\n # left in incase we want to add validations\n # include CarrierWave::Sequel::Validations\n\n manager = (self.name + \"Manager\").constantize\n manager.mount_uploader(column)\n end", "title": "" }, { "docid": "4e79bc58aec2d658198d7b9fbc197d0a", "score": "0.5232924", "text": "def file_field(name, attributes = {})\n attributes[:accept] = Array(attributes[:accept]).join(ACCEPT_SEPARATOR) if attributes.key?(:accept)\n attributes = {type: :file, name: _displayed_input_name(name), id: _input_id(name)}.merge(attributes)\n\n input(attributes)\n end", "title": "" }, { "docid": "a6ab52dacf58548ecccb96961582da2f", "score": "0.5225159", "text": "def file_field(name, **attributes)\n form_attributes[:enctype] = \"multipart/form-data\"\n\n attributes[:accept] = Array(attributes[:accept]).join(ACCEPT_SEPARATOR) if attributes.key?(:accept)\n attributes = {type: :file, name: _input_name(name), id: _input_id(name), **attributes}\n\n input(**attributes)\n end", "title": "" }, { "docid": "5a52b717818f5700e1cabfd8d82078ea", "score": "0.5213974", "text": "def mount_uploader(column, uploader, options={}, &block)\n if properties.named?(column)\n warn \"Defining property for an uploader is deprecated at #{caller[2]}\"\n properties.delete(properties[column])\n end\n\n uploader_property = if options[:mount_on]\n properties[options[:mount_on]]\n else\n property column, Property::Uploader\n end\n\n super\n\n alias_method :read_uploader, :attribute_get\n alias_method :write_uploader, :attribute_set\n\n pre_hook = ::DataMapper.const_defined?(:Validations) ? :valid? : :save\n\n before pre_hook, \"write_#{column}_identifier\".to_sym\n after :save, \"store_#{column}!\".to_sym\n after :destroy, \"remove_#{column}!\".to_sym\n\n # FIXME: Hack to work around Datamapper not triggering callbacks\n # for objects that are not dirty. By explicitly calling\n # attribute_set we are marking the record as dirty.\n class_eval <<-RUBY\n def remove_#{column}=(value)\n _mounter(:#{column}).remove = value\n attribute_set(:#{uploader_property.name}, '') if _mounter(:#{column}).remove?\n end\n\n def #{column}=(value)\n attribute_set(:#{uploader_property.name}, value)\n super(value)\n end\n RUBY\n\n uploader_property\n end", "title": "" }, { "docid": "b29021648251afe5ba455eae24aee946", "score": "0.52102333", "text": "def with_uploaded_file_format(&block)\n if self.has_file_attribute?\n self.with_format(Formats::FileUploadFormat) do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "d0fa813bfbf8ce39868cd9204556a2eb", "score": "0.52093434", "text": "def multiple_image_field(method, options={})\n options = options.symbolize_keys\n\n label = options.delete(:label) || method.to_s.singularize.camelize\n\n @template.render(\n :partial =>'layouts/acts_as_image_store/multiple_image',\n :locals => {\n :object => @object,\n :model => @object_name,\n :column => method.to_s.singularize,\n :label => label,\n :options => options\n })\n end", "title": "" }, { "docid": "09ea2707fbec3883d89bf9f152e49ed9", "score": "0.5205633", "text": "def upload_file_attributes\n attributes.values.each { |a| a.upload! if a.is_a?(Attribute::Type::File) }\n end", "title": "" }, { "docid": "f884cab76ca54e1eab41f02012b5648a", "score": "0.5202313", "text": "def image_file_field(label, options = {})\n before_text = \"\"\n before_text += if @object.size\n @template.image_tag(@object.public_filename)\n else\n \"no file uploaded\"\n end\n before_text += @template.tag('br')\n self.file_field(label, options.merge({:before_text => before_text}))\n end", "title": "" }, { "docid": "1644571c75b7d40deb14fc43fd025eb5", "score": "0.51999414", "text": "def read_attribute(attr_name, options={})\n attr_name = attr_name.to_s\n column = column_for_attribute(attr_name)\n if column\n # First check if the attribute is already in the attributes hash\n if @attributes.has_key?(attr_name) and options.blank?\n super(attr_name)\n # Elsif the column exist, we try to lazy load it\n elsif !(is_loaded?(attr_name)) and attr_name != self.class.primary_key and !new_record?\n unless self.all_attributes_loaded? and attr_name =~ /\\A#{self.class.default_family}:/\n if options.blank?\n # Normal behavior\n\n # Retrieve the version of the attribute matching the current record version\n options[:timestamp] = self.updated_at.to_bigrecord_timestamp if self.has_attribute?(\"#{self.class.default_family}:updated_at\") and self.updated_at\n\n # get the content of the cell\n value = connection.get(self.class.table_name, self.id, attr_name, options)\n\n set_loaded(attr_name)\n write_attribute(attr_name, column.type_cast(value))\n else\n # Special request... don't keep it in the attributes hash\n options[:timestamp] ||= self.updated_at.to_bigrecord_timestamp if self.has_attribute?(\"#{self.class.default_family}:updated_at\") and self.updated_at\n\n # get the content of the cell\n value = connection.get(self.class.table_name, self.id, attr_name, options)\n\n if options[:versions] and options[:versions] > 1\n value.collect{ |v| column.type_cast(v) }\n else\n column.type_cast(value)\n end\n end\n else\n write_attribute(attr_name, column.default)\n end\n else\n write_attribute(attr_name, column.default)\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "4f44946d0c0e66225ed435a6917f0e2e", "score": "0.51856554", "text": "def active_file_data\n self[file_data_column]\n end", "title": "" }, { "docid": "3b194e8935245435f91d4cf50d2b7599", "score": "0.5178385", "text": "def bootstrap_file_field(method_name, text = nil, options = {})\n switches = process_options(options, method_name)\n field= self.file_field method_name, options\n bootstrap_field(field, method_name, text, options.merge(switches))\n end", "title": "" }, { "docid": "4de7af232432391379e6fa96d940b15a", "score": "0.51746625", "text": "def file_field(how, what = nil)\r\n locate if defined?(locate)\r\n FileField.new(self, how, what)\r\n end", "title": "" }, { "docid": "fc6f96a269d434819a256152dac61941", "score": "0.51711506", "text": "def data_file_model(obj)\n obj.respond_to?(\"data_file_type\") ? obj.data_file_type.to_s.demodulize.tableize : \"data_files\"\n end", "title": "" }, { "docid": "13355021ab14392f10ed121333120e02", "score": "0.5164018", "text": "def file_field(name, identifier = {:index => 0}, &block)\n standard_methods(name, identifier, 'file_field_for', &block)\n define_method(\"#{name}_is_file_field\") do\n\n end\n end", "title": "" }, { "docid": "98870175f0361860275d15d60b138a0a", "score": "0.5157545", "text": "def url_for_file_column(object, method, options=nil, store_url_for_options={})\n case object\n when String, Symbol\n object = instance_variable_get(\"@#{object.to_s}\")\n end\n\n # parse options\n subdir = nil\n absolute = false\n if options\n case options\n when Hash\n subdir = options[:subdir]\n absolute = options[:absolute]\n when String, Symbol\n subdir = options\n end\n end\n\n context_path = absolute ? get_relative_url_for_rails(Rails::VERSION::MAJOR) : nil\n object.send(\"#{method}_download_url\", context_path, subdir, store_url_for_options)\n\n end", "title": "" }, { "docid": "0804d1e535770f822841c4c298379bcc", "score": "0.51541144", "text": "def attachment_field(method, options = {})\n render(partial:\"admin/shared/forms/attachment_field\", locals: {\n f: self,\n method: method,\n options: options,\n })\n end", "title": "" } ]
94f0f85eccef7ba5571ed7d78dcb7b1b
shows the user resevation if the topic is user_reservation
[ { "docid": "45291dabc1d9fb6418e5283a131838b2", "score": "0.81959045", "text": "def user_reservation\n if topic_type == \"UserReservation\" then\n self.topic\n else\n nil\n end\n end", "title": "" } ]
[ { "docid": "4f061458745b238a4497e0ac0025f75d", "score": "0.8362259", "text": "def topic_is_user_reservation\n topic_type == \"UserReservation\"\n end", "title": "" }, { "docid": "2ddc87201d941c8bfcffa5773279c92b", "score": "0.6973622", "text": "def show\n if current_user && (current_user.admin? || current_user.id == @reservation.user_id)\n allow\n else\n deny\n end\n end", "title": "" }, { "docid": "c32faeb4e6eaaddcef3ab52cb0096d72", "score": "0.6658835", "text": "def show\n user=User.find(session[:user_id]).id\n @showing_reservation=Reservation.where(\"user_id =?\",user)\n end", "title": "" }, { "docid": "0bcbec0a27cbb1377d1e03de1c9bb406", "score": "0.6462629", "text": "def show\n @user_active_reservation = Reservation.find_user_reservation(current_customer.id)\n end", "title": "" }, { "docid": "637ea37fb7fb2a3e2e56adab85df6deb", "score": "0.6416175", "text": "def show\n redirect_to :root unless @reservation.requester == current_user\n end", "title": "" }, { "docid": "d51f7f0baf99d8dde84dbabecb6972af", "score": "0.63403094", "text": "def current_user_sees_topic\n current_user.view_topic!(@topic)\n (session[:topics] ||= {})[@topic.id] = Time.now.utc\n end", "title": "" }, { "docid": "73987f5510c20ae65297903c0e1702b6", "score": "0.6313076", "text": "def show\n redirect_to :root if @reservation.user != current_user \n end", "title": "" }, { "docid": "da34dada97317a71fb1a776cd51cba2c", "score": "0.63124657", "text": "def show\n @checkout_for_user = false\n if (current_user.role != 'customer' && @reservation.current == true)\n @checkout_for_user = true\n end\n end", "title": "" }, { "docid": "dcad98a937236fc543d2c00c131a3e14", "score": "0.6203902", "text": "def print_reservations(user)\n if user.reservations.count == 0\n puts \"You have no reservations at this time.\" \n return\n end\n user.reservation_list_helper.each{|reservation| p \"Restaurant: #{reservation[0]}, Date: #{reservation[1]}, Guests: #{reservation[2]}\"}\n end", "title": "" }, { "docid": "3fb3f854b4a86d8877536a928082829c", "score": "0.61347085", "text": "def show\n @users = User.all\n @event = Event.find(params[:id])\n @is_private = session[:user_id] == @event.creator.id\n mgs1 = 'Unregister From The Event'\n msg2 = 'Join The Event'\n @register_label = User.find(session[:user_id]).attended_events.include?(@event) ? mgs1 : msg2\n @button_class = User.find(session[:user_id]).attended_events.include?(@event) ? 'bg_red w272' : 'bg_green w272'\n end", "title": "" }, { "docid": "6de928e46cd732a4e4085e22de3dcaee", "score": "0.60993534", "text": "def subscribed_to_reservation\n unless subscribed?(@reservation)\n message = \"Vous n'êtes pas inscrit(e) à cette réservation\"\n respond_to do |format|\n format.html { redirect_to reservations_url, alert: message }\n format.json { render 'show', status: :unauthorized, alert: message }\n end\n end\n end", "title": "" }, { "docid": "83f5081bf5857120f1096b550265db66", "score": "0.6047963", "text": "def show\n\t@user = User.find(params[:id])\n @reservations = Reservation.where(\"user_id = #{params[:id]}\")\n end", "title": "" }, { "docid": "cc0925aae1ab440d9d13eee543b3a83f", "score": "0.599918", "text": "def show\n @user = User.find(params[:id])\n @listing_tags = ListingTag.all\n @tags = Tag.all\n @tag = Tag.new\n # @reservations = Reservation.where(user_id: params[:id])\n if params[:reservation] == \"unpaid\"\n @reservations = Reservation.unpaid\n respond_to do |format|\n format.js\n format.html {redirect_to user_path(current_user)}\n end\n elsif params[:reservation] == \"all\"\n @reservations = Reservation.all\n respond_to do |format|\n format.js\n format.html {redirect_to user_path(current_user)}\n end\n else\n @reservations = Reservation.all\n end \n end", "title": "" }, { "docid": "b8b4a2340140f9e979a5aade5606c5b4", "score": "0.5973577", "text": "def show\n\n puts params\n\n @user = User.find(params[:id])\n\n if (@user == current_user)\n\n @important_topics = Topic.all_of_interest_to(@user)\n\n #reorder the topics so user can see current relevant one first\n if (params[:topic] && first_topic=Topic.find_by_id(params[:topic]))\n @important_topics = @important_topics - Array.new.unshift(first_topic)\n @important_topics.unshift(first_topic)\n end\n\n @voted_agreements = Hash.new\n @important_topics.each do |topic|\n @voted_agreements[\"#{topic.slug}\"] = Agreement.all_voted_on_by_user_and_topic(@user, topic)\n end\n\n else\n\n @important_topics = Topic.all_written_to(@user)\n \n @authored_agreements = Hash.new\n @important_topics.each do |topic|\n @authored_agreements[\"#{topic.slug}\"] = Agreement.all_written_by_user_on_topic(@user, topic)\n end\n\n end\n\n end", "title": "" }, { "docid": "d2a150a6f0632e9fead0e7ba50253ed5", "score": "0.5948649", "text": "def show\n authorize! :show, @user\n @reservations = Reservation.select{|res| res.teacher_id == @user.id}\n end", "title": "" }, { "docid": "3d5e4d0a45ea6edfbbd299144e1a72d1", "score": "0.591242", "text": "def show\n if (current_user.id != @mcm_topic.user_id)\n redirect_to \"/mcm_topics\"\n end\n end", "title": "" }, { "docid": "ddd5e03daea38d489264f22bd907f73e", "score": "0.5907823", "text": "def has_reserved\n if @contestsolution.reservation != current_user.sk.id\n flash[:danger] = \"Vous n'avez pas réservé.\"\n redirect_to contestproblem_path(@contestproblem, :sol => @contestsolution)\n end\n end", "title": "" }, { "docid": "a55cb1b26e6adb1c5557bb9846629d5e", "score": "0.5907368", "text": "def show\n if current_user.is_admin == true && @user_reclamation.vue != true\n @user_reclamation.update(vue: true)\n end\n end", "title": "" }, { "docid": "a31b96070c46a67211ddbb1666241564", "score": "0.59066045", "text": "def set_reservation\n @reservation = current_user.reservation\n end", "title": "" }, { "docid": "187d04235e66492216bfec5c84d3f4cf", "score": "0.5906586", "text": "def show\n @user = User.find(@reservation.user_id)\n @schedule = Schedule.find(@reservation.schedule_id)\n @salon = Salon.find(@schedule.salon_id)\n @owner = User.find(@salon.user_id)\n end", "title": "" }, { "docid": "def976e254442c4cde5afbf39215a1e8", "score": "0.5872059", "text": "def user_reservations\n @user_reservations = current_user.reservations\n end", "title": "" }, { "docid": "3e0390d8aec5b5890eb788a4a7951583", "score": "0.5856925", "text": "def show\n @rsvp = Rsvp.new\n @attendaces = nil\n @my_attendace = current_user.rsvps.where(event_id: @event.id) if current_user\n\n #Show the Attendes to this event if I am the author or I am Administrator\n if (current_user && (current_user.roles.include? :admin ) || (@event.user==current_user))\n @attendaces = @event.rsvps\n end\n end", "title": "" }, { "docid": "806c563a61aa2e63d8f4fb273f07cca2", "score": "0.58265775", "text": "def outgoingreservations\n if current_user.user_status === \"Host\"\n @user = User.find(current_user.id)\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "f46aadad7226dea8b787021f84429b4f", "score": "0.5824107", "text": "def correct_user\n @reservation = Reservation.find_by(id: params[:id])\n @yourreservation = current_user.reservations.find_by(id: params[:id])\n return unless !current_user?(@reservation.space.user) && @yourreservation.nil?\n\n redirect_to root_url\n flash[:danger] = \"You're not authorised\"\n end", "title": "" }, { "docid": "433954d89b427baebc0c684b0ee7fc98", "score": "0.5815322", "text": "def display_user_reservations_helper\n # self.user <- User who is logged in\n # self.user.restaurants <- All of the restaurants associated with the User\n # self.user.reservations <- All of the reservation instances\n # refer to Eric's video around 1:22:55 for more info on getting specific info out of objects! \n # all_choices = []\n #need to pull up Reservation.all\n #need to .find_by restaurant id && matches the self.user.id\n \n if self.user.reservations.count > 0\n my_rez = self.user.reservations.reservation_id\n # binding.pry\n choice_id = prompt.select(\"What reservation do you want to see?\", my_rez)\n # binding.pry\n see_chosen_reservation(choice_id)\n\n # sleep 5 #after 5 seconds of inactivity\n # self.main_menu #goes back to main menu\n # # self.main_menu <- To take me back to the main_menu\n else \n puts \"You don't have any reservations! Let's dine somewhere\"\n sleep 2\n display_all_restaurants_helper()\n end\n end", "title": "" }, { "docid": "f13b2fe7ff15e700783f4dfcac588420", "score": "0.57998", "text": "def show\n @reservation = Reservation.find(params[:id])\n @user = User.find(@reservation.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "title": "" }, { "docid": "3c6504a15457f1bf273f7a6ff066c194", "score": "0.57981837", "text": "def show\n @user = User.find(session[:user_id])\n @reservation = @user.reservations.find(params[:id])\n \n if @reservation == nil\n redirect_to root_url, :notice => \"Nice Try, Hacker!\"\n return\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reservation }\n end\n end", "title": "" }, { "docid": "2b6dd17089d95150573d1c0a55d33760", "score": "0.57938373", "text": "def reservation_summary\n if SchedulingAccessRule.violated_access_rules(current_user).size > 0\n render :text=>''\n return\n end\n @user = current_user\n if instructor? \n @reservations = Reservation.find(:all,:conditions=>[\"instructor_id = ? and reservation_type='booking' and status!='canceled' and time_end>?\",@user.id,Time.new],:order=>'time_start desc') \n else\n @reservations = Reservation.find(:all,:conditions=>[\"created_by = ? and reservation_type='booking' and status!='canceled' and time_end>?\",@user.id,Time.new],:order=>'time_start desc')\n end\n render :partial => 'reservation_summary'\nend", "title": "" }, { "docid": "e21c505b30f658c3c90bdbd38eb298de", "score": "0.5791853", "text": "def your_reservations \n\t@your_reservations = Reservation.where(user_id: current_user.id)\n\trender \"your_reservations\"\nend", "title": "" }, { "docid": "21cbc813177c3d990511735953f9c2ef", "score": "0.5789526", "text": "def new\n if !params.has_key?(:topic_id) || !params.has_key?(:topic_type) then\n render :file => \"public/404.html\", :status => :precondition_failed\n return\n end\n\n #check if the review has already been done\n case params[:topic_type]\n when \"UserReservation\"\n reservation = UserReservation.find(params[:topic_id])\n #check if you actually own the reservation\n if reservation.user_id != current_user.id then\n render :file => \"public/404.html\", :status => :not_authorized\n end\n\n #check if the reservation is alreday done\n if reservation.review.nil? then\n @review = current_user.reviews.new({topic_id:params[:topic_id], topic_type:params[:topic_type]} )\n else\n @review = reservation.review\n redirect_to edit_user_review_path(current_user, @review)\n end\n else\n #generic new review\n @review = current_user.reviews.new({topic_id:params[:topic_id], topic_type:params[:topic_type]} )\n end\n\n\n end", "title": "" }, { "docid": "61fc161f16208ad175bddac8ca3c2ff6", "score": "0.57835525", "text": "def show\n if current_user.isAdmin\n @user = User.find(params[:id])\n @topics = Topic.all\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "1305f7b30f820b07c0fccfc6ce805c1a", "score": "0.57386255", "text": "def show\n # Control ownership\n if @press_release.newsroom == current_newsroom\n @owner = true\n else\n @owner = false\n end\n end", "title": "" }, { "docid": "f58e58989219b4f07e02a2794853d6a2", "score": "0.57327485", "text": "def limit_event_show\n if current_user.role == \"administrator\"\n elsif @event.user_id == current_user.id\n elsif @event.event_approved == \"false\"\n flash[:danger] = 'You cannot view an unapproved event.'\n redirect_to events_path\n end\n end", "title": "" }, { "docid": "5ffc364e77a0582adfed9fa385eed534", "score": "0.5727421", "text": "def show\n @user=\"Wait for Admin approval\"\n end", "title": "" }, { "docid": "f58c33a7c8a861b5165237caa5a91ca9", "score": "0.5646627", "text": "def topics_creatable_by?(user=nil)\n (user != :false && topics_created_by_id <= user.user_level.position) || (user == false && topics_created_by == UserLevel.find_by_name(\"User\"))\n end", "title": "" }, { "docid": "7b43a6f32354433eb29e004b69ed4d4d", "score": "0.56437045", "text": "def show\n @topic = Topic.find(params[:id])\n if @topic.enroll && session[:user_tel].present?\n @user_enroll_info = Enroll.where(tel: session[:user_tel], topic_id: @topic.id).first\n end\n create_access_log\n set_back_url\n render :activity_detail if @topic.enroll\n end", "title": "" }, { "docid": "be2a85a31ebef4312a8adb943b466ac0", "score": "0.5642974", "text": "def set_reservation\n @reservation = @property ? @property.reservations.find(params[:id]) : Reservation.find(params[:id])\n if (current_user.role.name == 'guest' && @reservation.user != current_user) then\n redirect_to reservations_path\n end\n if (current_user.role.name == 'host' && @reservation.property.user_id != current_user.id)\n redirect_to reservations_path\n end\n end", "title": "" }, { "docid": "dc1c0652b6fb2d47c5beaacb6dae6b80", "score": "0.5632273", "text": "def show\n render \"recieved\" if !current_user\n end", "title": "" }, { "docid": "d8b9669a1862d8bd8aa9bd7c1484aed2", "score": "0.5624653", "text": "def show\n @reservation = Reservation.new\n begin\n @current_reservation = Reservation.where(\n itinerary_id: @itinerary.id,\n guest_phone: @user.phone_number,\n status: 1)\n .first\n rescue Exception => e\n puts \"e.message\"\n end\n end", "title": "" }, { "docid": "d833429ecf99bf8daa1eee23968bded6", "score": "0.56179845", "text": "def your_articles\n @articles = current_user.reservations\n end", "title": "" }, { "docid": "e50a7c5aabd7d6276eb451c867ddd537", "score": "0.5613589", "text": "def show?\n # Peuvent voir ceux qui font partie de la mission ou ceux sont qui sont associés\n if record.status == \"in_progress\"\n user_is_part_of_mission? || user.jouve_associate\n else\n (user_is_part_of_mission? || user.jouve_associate) && user_is_jouve?\n end\n #user_is_owner_or_admin? A faire plus tard une fois que les admins seront crées\n end", "title": "" }, { "docid": "eff93bc2ae41d8348f99231c51cbc958", "score": "0.5606698", "text": "def show\n @tilte = \"Show user account\"\n @user = User.find(params[:id])\n \n unless @user.userrights.any?\n flash.now[:notice] = \"No user right has been asigned yet.\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "title": "" }, { "docid": "1711cc71e2f7780034203832d897a901", "score": "0.5586892", "text": "def reservation\n opt = @view.reservations\n if opt == \"1\"\n tickets\n elsif opt == \"2\"\n #\n else\n error\n end \n end", "title": "" }, { "docid": "7cd01f58323acd105f6173f62a9a4eea", "score": "0.5580697", "text": "def show\n if current_user.moderator?\n @reservation = Reservation.includes(:listing).find(params[:id])\n elsif params.keys.include? 'user_id'\n @reservation = current_user.get_listings_reservations.includes(:listing).find(params[:id])\n elsif params.keys.include? 'listing_id'\n @reservation = current_user.listings.find(params[:listing_id]).reservations.includes(:listing).find(params[:id])\n else\n @reservation = current_user.reservations.includes(:listing).find(params[:id])\n end\n\n render 'show'\n\n end", "title": "" }, { "docid": "547930442915b2b05837624a31976bbb", "score": "0.5578249", "text": "def show\n @user_futur_events = @user.events\n @user_administrate = Event.where(administrator_id: @user.id)\n end", "title": "" }, { "docid": "dbfbb5dc3440b8a7e49f1bc48813ff53", "score": "0.55768716", "text": "def check_if_owner\n reservation = Reservation.find(params[:id])\n if reservation.profile_id != current_user.id\n # send them to another page\n redirect_to \"/reservations\", notice: \"Access Not Granted\"\n end\nend", "title": "" }, { "docid": "a56fc68fff567e1978263a2b5fa3e88e", "score": "0.5566758", "text": "def show\n #only show users events\n \n end", "title": "" }, { "docid": "28babbe7d50d25509f91189b665aafc3", "score": "0.5556425", "text": "def current_user_is_reviewer?(current_user_id)\n user_id == current_user_id\n end", "title": "" }, { "docid": "85ad95581ef8e76332ee7dd39d9160ec", "score": "0.55415905", "text": "def show\n @reminder = Reminder.find(params[:id])\n @user_subscription = @reminder.user_subscription\n end", "title": "" }, { "docid": "d982f995ee46a62ac5d5f52c3c7b9639", "score": "0.5536627", "text": "def is_revealed(user)\n subscription = Subscription.where(:user_id => user.id, :payer_id => self.id, :subscribable_type => 'RevealIdentity')\n subscription.present? ? true : false\n end", "title": "" }, { "docid": "58471702c42a30c25e31f38abda3d395", "score": "0.55299187", "text": "def member_notified?(other_user)\r\n notification_preferences.members.detect { |pref| pref.notifiable == other_user && pref.preference == 'new_reviews' }\r\n end", "title": "" }, { "docid": "9a84008f5cd12e94ffbe98a024e47398", "score": "0.55274814", "text": "def has_topic\n !@vm_topic.nil?\n end", "title": "" }, { "docid": "6d67fbe610b373b8149d4c4e4c4336df", "score": "0.5519763", "text": "def show?\n @current_user.permission('Delivery', :guest)\n end", "title": "" }, { "docid": "a89f1e4fb07ed8ac28c044074d6bd064", "score": "0.55150115", "text": "def show\n @room_types = @hostel.room_types\n @can_comment = false\n if user_signed_in?\n hostel_registration = @hostel.hostel_registrations.find_by(user: current_user)\n if hostel_registration\n unless hostel_registration.reservations.select { |r| (r.payed && r.started?) }.count.zero?\n @can_comment = true\n end\n end\n end\n end", "title": "" }, { "docid": "0ab9dc58be67cbc8b264e0e169638f0b", "score": "0.5507902", "text": "def show\n @user = User.find(params[:id])\n\t\t@topics = Topic.where(:user_id => @user).order(\"created_at DESC\").limit(15)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "title": "" }, { "docid": "e95678dfb715fb5b9f75d63b665787c0", "score": "0.5503839", "text": "def show\n @reservations= ReservationDecorator.decorate_collection(@user.reservations)\n @functions_hash ={\"admin\" => \"Administrador do Sistema\",\n \"sector_admin\" => \"Administração de Setor\",\n \"secretary\" => \"Secretaria\",\n \"basic\" => \"Básica\",\n \"receptionist\" => \"Recepção\"}\n end", "title": "" }, { "docid": "ae23210c7fbd5cc93413365695fc9f03", "score": "0.5499741", "text": "def resell_to_user\n @reservation.update_by_admin = true\n create_reservation_owner\n\n if @reservation.resell_to_user(@owner)\n SegmentAnalytics.sold_resell_booking(@reservation, current_user || current_admin)\n ActivityLog.record_log(:reservation_updated, current_admin.company.id, current_admin, @reservation)\n head :ok\n else\n render json: { errors: { '0' => @reservation.errors.full_messages } }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9c884515f12b01ed40cb54338417c162", "score": "0.54911816", "text": "def show\n @user = User.find(params[:id])\n if(current_user == @user)\n @my_posts = @user.my_posts\n @upcoming_trips = @user.upcoming_trips\n @previous_trips = @user.previous_trips\n render :template => \"users/show/_#{layout_prefix}-show\"\n else\n render :template => \"users/public-show/_public-show\"\n end\n end", "title": "" }, { "docid": "b514d5b517821af14b9063d556d798a8", "score": "0.5487787", "text": "def new_review\n @reservation = Reservation.find_by(id: params[\"id\"])\n @restaurant = Restaurant.find_by(id: @reservation.restaurant_id)\n if session[\"user_id\"].blank?\n redirect_to \"/login\"\n elsif @reservation.user_id != session[\"user_id\"]\n flash[:danger] = \"This reservation does not belong to you!\"\n redirect_to \"/reservations\"\n else\n render 'new_review'\n end\n end", "title": "" }, { "docid": "cf5cb687615ec4e2e36cca1c8756b3a4", "score": "0.54874045", "text": "def show\n @requisition = Requisition.find(params[:id])\n user = User.find(session[:user_id])\n @view_costs = user.has_right?(\"View Costs\")\n\t@view_doc = user.has_right?(\"Procurement_docs Show\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requisition }\n end\n end", "title": "" }, { "docid": "65f3b87afdd91b2d8b185fe693fa04ef", "score": "0.54864436", "text": "def show\n\t\t@reservation = Reservation.find(params[:id])\n\tend", "title": "" }, { "docid": "3e6d8e2551aace7c52be798197ea9f12", "score": "0.5482749", "text": "def show\n\t@auteur = Article.find(params[:id]).user\n\t@pas_lauteur = true\n if @auteur == current_user\n\t\t@pas_lauteur = false\n\tend\n end", "title": "" }, { "docid": "af3dfb4d3e2516d9aa88a82f49d95680", "score": "0.54740864", "text": "def show\n begin\n ActiveRecord::Base.transaction do\n if !current_user.nil? and current_user.type.eql?(\"Admin\")\n flash[:warning] = \"Por favor cierre sesión para ir a la vista de instancia.\"\n redirect_to root_path\n else\n @sale_event = SaleEvent.includes(:location_types).find(params[:event_id])\n @reservation = Reservation.new(client_id: current_user.id) if !current_user.nil?\n end\n end\n rescue Exception => exc\n flash[:danger] = exc.message\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "525c33b20863cb3254a844a00cfff812", "score": "0.5469901", "text": "def show\n \n\t if current_user.admin == false || current_user.member = false\n\t correct_user\n end\n \n end", "title": "" }, { "docid": "29c7cda30f31fca6b53e4f67ff8ddbba", "score": "0.54560435", "text": "def set_user_topic\n @user_topic = UserTopic.find(params[:id])\n end", "title": "" }, { "docid": "0eb879f52dd27d0f707bd6d3fc416eef", "score": "0.54524034", "text": "def show\n @restaurant = Restaurant.find(params[:id])\n \n if current_user\n @reservation = @restaurant.reservations.build\n end\n end", "title": "" }, { "docid": "c6edcd088109e9e7e89c0816d377a960", "score": "0.54421246", "text": "def show\n unless current_user.is_organizer? or @mentorship_notification.user_id == current_user.id\n redirect_to index_path, error: 'No permission'\n end\n end", "title": "" }, { "docid": "f38b551b435a5cea871bdc9c04495be5", "score": "0.5439795", "text": "def show\n @reservation = Reservation.find(params[:id])\n\n if false # need to figure out if json mode or not...\n if !super_user? or !signed_in? or (@reservation.user_id != current_user.id and \n @reservation.tire_listing.tire_store.account_id != current_user.account_id)\n redirect_to root_path, :alert => \"You do not have access to that page.\"\n return\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "title": "" }, { "docid": "84901a670062af864eceea1b9d9f3b52", "score": "0.54362154", "text": "def index\n @reservations = current_user.admin? || current_user.superadmin? ? Reservation.all : Reservation.where('user_id = ?', current_user.id)\n end", "title": "" }, { "docid": "a9c5ce647d9f82aba8fe2f64734196a4", "score": "0.54342484", "text": "def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end", "title": "" }, { "docid": "55819623631906f4f7a2b39e1d7732dd", "score": "0.5427738", "text": "def can_view(message)\n true if !message.nil? and (rezm_user.id == message.sender_id or rezm_user.id == message.receiver_id)\n end", "title": "" }, { "docid": "54dbbedd1036a4c7febfa5c85b99eced", "score": "0.5422886", "text": "def set_topic\n @topic = @vacation.topics.find(params[:id])\n end", "title": "" }, { "docid": "25297fa77f7a17f103f22b8ec9564566", "score": "0.5420068", "text": "def current_user_is_reviewer?(current_user_id)\n return user_id == current_user_id\n end", "title": "" }, { "docid": "2e254780642997ba76b8d5e5afddf4ba", "score": "0.54139125", "text": "def link_to_reservation_if(schedule)\n if user_signed_in?\n link_to schedule.klass.name, new_schedule_reservation_path(schedule)\n else\n link_to schedule.klass.name, schedule_path(schedule)\n end\n end", "title": "" }, { "docid": "72d7d05551054f9feec7681fa0c4c175", "score": "0.5411301", "text": "def is_editable(user)\n self.is_upcoming and self.user_id == user.id\n end", "title": "" }, { "docid": "4b9cd23bcb253023bd334aef9c9b530f", "score": "0.54050934", "text": "def show\n if session.has_key?(:username_cookie_system) && session.has_key?(:usertype_cookie_system)\n\t\t#prsn = Person.find_by_username(session[:username_cookie_system])\n\t\t#if prsn != nil\n\t\t if session[:usertype_cookie_system] == \"false\"\n\t\t\t@reservation = Reservation.find(params[:id])\n\n\t\t\trespond_to do |format|\n\t\t\t format.html # show.html.erb\n\t\t\t format.json { render json: @reservation }\n\t\t\tend\n\t\t else\n\t\t \trender \"public/500.html\" \n\t\t end\n\t\t#else\n\t\t#\trender \"app/views/login/login.html.erb\"\n\t\t#end\n\telse\n\t render \"app/views/login/login.html.erb\"\n\tend\n end", "title": "" }, { "docid": "d597dda50568434a5903c1ca67053ec7", "score": "0.5404395", "text": "def show\n @user = User.find(params[:id])\n \t@tickets = @user.tickets\n \t\n \tif @user != current_user\n \t\t@selling = true\n \telse\n \t\t@selling = false\n \tend\n \t\n \t@tickets = @tickets.select { |t| t.status == \"reserved\" }\n \t#if [email protected]?\n \t#\t@invoice = session[:invoice] ? Invoice.find(session[:invoice]) : nil\n \t#\tif !@invoice\n \t#\t\t@invoice = Invoice.make_invoice @tickets\n \t#\t\tsession[:invoice] = @invoice.id.to_s\n \t#\telsif @invoice.tickets != @tickets\n \t#\t\[email protected]_invoice(@tickets)\n \t#\tend\n \t#end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end", "title": "" }, { "docid": "ec31b1654b8c24dc5f596b5f3b11f4e6", "score": "0.54024476", "text": "def show \r\n #create topic for display\r\n @topic = Topic.find(params[:id]) \r\n #get all replies related to topic \r\n @replies = @topic.replies\r\n #prepare a new reply\r\n @reply = Reply.new\r\n #Get currently signed in user\r\n @user = current_user\r\n end", "title": "" }, { "docid": "6f081f54690152c86111df6234d35654", "score": "0.5396142", "text": "def notice_admins_update\n if !current_user.admin?\n AdminMailer.with(subject: 'Reserva de turno', text: \"#{@reserva.user.nombre_completo} ha actualizado su reserva del Club.\", link: reserva_url(@reserva)).email_notificacion.deliver_later\n elsif @por_aprobar && @reserva.aprobado\n AdminMailer.with(to: @reserva.user.email, subject: 'Turno aprobado', text: \"#{current_user.nombre_completo} ha aprobado tu reserva en el Club.\", link: reserva_url(@reserva)).email_notificacion.deliver_later\n end\n end", "title": "" }, { "docid": "d4864d3f3c0cc34c8c18c2b1b246c380", "score": "0.5389721", "text": "def user_has_viewed(user_id) \n user_viewed = false\n if self.users_viewed.include? user_id\n user_viewed = true\n end\n user_viewed\n end", "title": "" }, { "docid": "03898bb617ee7eeae9df72e0564b0726", "score": "0.5386327", "text": "def has_vm_node_topic\n @vm_node.has_topic\n end", "title": "" }, { "docid": "fedb409327d51fe14878cbcffef68028", "score": "0.53855306", "text": "def index\n @reservations = current_user.reservations\n end", "title": "" }, { "docid": "7778a63c4f9d1f8a29282888ad33d087", "score": "0.53850996", "text": "def show\n \t@event = Event.find_by(id: params[:id])\n \t@user_event = UserEvent.find_by(user_id: current_user, event_id: @event) if current_user\n \t@users = User.includes(user_events: [:event]).where(user_events: {is_attending: true, events: {on_going: true, id: @event.id}})\n \tif @user_event\n \t\tflash[:alert] = \"#{current_user.name} is #{@user_event.is_attending ? \"\" : \"not\"} attending the #{@event.name} event.\"\n \tend\n end", "title": "" }, { "docid": "53edcdcd9b68e2531d3c97403f455d67", "score": "0.5383305", "text": "def reminder\n @user = User.find(self.user_id);\n UpdateReservations.update_reservation(user, self).deliver_now\n end", "title": "" }, { "docid": "a101d05db90db0ced82706102fcaecf6", "score": "0.53690505", "text": "def show\n if current_user.user_type=='U' and @proposal.user_id!=current_user.id\n redirect_to home_path\n end\n end", "title": "" }, { "docid": "f1caa22ed70671426da5b637499bdd54", "score": "0.53689945", "text": "def show\n @is_approval = true\n end", "title": "" }, { "docid": "f5b5045841d1012462d252e33ce61544", "score": "0.53684545", "text": "def show\n @topic = Topic.find(params[:id])\n @replies = @topic.replies.asc(:_id).all.includes(:user).reject { |r| r.user.blank? }\n \n fresh_when(:etag => [@topic, @replies])\n \n drop_breadcrumb(\"列表\", topics_path)\n drop_breadcrumb t(\"topics.read_topic\")\n end", "title": "" }, { "docid": "11fb406632493f79c7d3c9225c981294", "score": "0.53681546", "text": "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "title": "" }, { "docid": "11fb406632493f79c7d3c9225c981294", "score": "0.53681546", "text": "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "title": "" }, { "docid": "11fb406632493f79c7d3c9225c981294", "score": "0.53681546", "text": "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "title": "" }, { "docid": "2390c2337ec928f0c339d09f6c1c04ae", "score": "0.5367768", "text": "def show\n @user = current_user\n @events = current_user.events\n @upcoming_events = @events.where(\"? <= date\", Date.today).order(date: :asc, time: :asc)\n @e_others = Event.all\n @reccos = current_user.get_reccomendations(@events, @e_others)\n end", "title": "" }, { "docid": "472af5e2face4a55c370c82326c90fc4", "score": "0.53608394", "text": "def role_reifier?\n Topic.role_reifier?(self.id)\n end", "title": "" }, { "docid": "3b280fbe4b1443202dc6e90bddaa31e6", "score": "0.53578967", "text": "def display\n # faking this user as logged in, remove after user completed\n @user = User.find(16) \n @current_events = Event.where(\"event_date >?\", Time.now)\n end", "title": "" }, { "docid": "6f47fb2e15c078350f85aeb3a1c18cec", "score": "0.5357404", "text": "def show\n unless @tid_log.user == current_user || @tid_log.public?\n redirect_to root_path, notice: 'Not authorized to view that.'\n end\n end", "title": "" }, { "docid": "446d6d8ece1c0bdbb8ed3d048a2068fb", "score": "0.5354848", "text": "def show\n\n \t@user = User.find(params[:id])\n\n # load user's approved post\n @user_post = @user.posts.where('approved = true').first\n\n # for new notification form\n @notification = Notification.new\n \n respond_to do |format|\n # don't load layout - make like a partial\n format.html { render :layout => false }\n end \n end", "title": "" }, { "docid": "b38cdd9a87e4fc846d42d9b8db63593d", "score": "0.5353442", "text": "def reservation_approaching\n UserMailer.reservation_approaching\n end", "title": "" }, { "docid": "7b0a88994e004e0a723f7754b4861241", "score": "0.5353403", "text": "def show\n @event_volunteer_slots = EventVolunteerSlot.joins('LEFT JOIN event_volunteers on event_volunteer_slots.id = event_volunteers.event_volunteer_slot_id and scheduled = true')\n .where(event_id: params[:id])\n .group(:id)\n .order(:role_id, :start_time)\n if !current_user.admin?\n @event_volunteer_slots = @event_volunteer_slots.select{ |slot| current_user.roles.include?(slot.role) }\n end\n @users = User.all\n end", "title": "" }, { "docid": "ce71a7f3327061eb6bbc1b5610b3b889", "score": "0.5350309", "text": "def show\n if params[:topic]\n @topic = params[:topic]\n else\n @topic = \"Service\"\n end\n end", "title": "" }, { "docid": "b3e8294aa1770ef68cf420ea866a31ab", "score": "0.5346198", "text": "def check_reservation_button(room)\n (!params[:reservation].blank? && params[:reservation][:room_id] == room.id)\n end", "title": "" }, { "docid": "7ace4655ecf3b39c8fc2a4cfa1e93044", "score": "0.53446853", "text": "def accept_proposal\n # ensure token is there\n if !params.has_key?(:t) then\n Rails.logger.error \"No token to view reservation\"\n render file: \"public/401.html\", status: :unauthorized\n return\n end\n\n @reservation = UserReservation.find(params[:reservation_id])\n #ensure that the status is operator_new_proposal\n if [email protected]_new_proposal? then\n Rails.logger.error \"No token to view reservation\"\n render file: \"public/401.html\", status: :unauthorized\n return\n end\n\n\n #up the the status and send out notice about this\n # include case history about the user doing this\n @reservation.transaction do\n @reservation.reservation_confirmed!\n ur_case_history = @reservation.ur_turk_case.ur_turk_case_history.new({\n action:UrTurkCaseHistory.actions[:user_accept_proposal],\n action_by: current_user.id\n })\n ur_case_history.save!\n end\n UserReservationMailer.user_accept_proposal(@reservation).deliver_later\n end", "title": "" } ]
01242cfb26f51259076dc9e21cd76640
Parses out everyhting in the mzIdentML file
[ { "docid": "58df7c9350dbf7b0dcc89aacf92b64ab", "score": "0.5623219", "text": "def parse\n #Target\n doc = nokogiriDoc(@target)\n load_peptides(doc)\n \n doc.xpath(\"//xmlns:SpectrumIdentificationResult\").each do |result|\n count = result.xpath(\".//xmlns:SpectrumIdentificationItem\").length\n listNum = result.xpath(\"./@id\").to_s.split(\"_\")[-1]\n 1.upto(count) {|i| @matches << psm(doc, result, \"1\", listNum, i)}\n end\n \n #Decoy\n doc = nokogiriDoc(@decoy)\n load_peptides(doc)\n \n doc.xpath(\"//xmlns:SpectrumIdentificationResult\").each do |result|\n count = result.xpath(\".//xmlns:SpectrumIdentificationItem\").length\n listNum = result.xpath(\"./@id\").to_s.split(\"_\")[-1]\n 1.upto(count) {|i| @matches << psm(doc, result, \"-1\", listNum, i)}\n end\n end", "title": "" } ]
[ { "docid": "0dfe398413ad1b1e3b8b185120a922dd", "score": "0.62365836", "text": "def parse (filename)\n\t\tf = File.open(filename)\n\t\tf.each do\t|line|\n\t\t\tnext if line =~ /^#/\n\t\t\tsym, val = line.split(':')\n\t\t\tsym_strip = sym.gsub(/\\s+/, \"\").strip\n\t\t\tval_strip = val.strip\n\t\t\tadd_accesor sym_strip, val_strip\n\t\tend\n # p \"XMP: file parsed\"\n\t\tf.close\n\tend", "title": "" }, { "docid": "4b53521776093921eac4d49eb3d32213", "score": "0.6207334", "text": "def convert_to_mzIdentML(files)\n files.each do |pair|\n pair.each {|file| exec(\"#{$path}../../mzIdentML/bin/search2mzidentml_cl.rb #{file} #{extractDatabase(@dbID)}\") if fork == nil}\n end\n \n # Wait for the conversion to finish before moving on.\n waitForAllProcesses\n end", "title": "" }, { "docid": "e3120472803dea928efc983326343ea0", "score": "0.59210634", "text": "def extract_from_files(mzml_file, search_hits_file)\n search_hits = search_hits(search_hits_file)\n abort \"no search hits! aborting...\" unless search_hits.size > 0\n\n sorted_search_hits = search_hits.sort_by(&:score).reverse\n\n # currently assumes that the file is the same searched\n # could check this in future\n Mspire::Mzml.open(mzml_file) do |mzml|\n sorted_search_hits.each do |search_hit|\n case search_hit\n when SearchHit\n #p search_hit\n #index = search_hit.spec_id_result.spectrum_index\n #puts \"INDEX:\"\n #p index\n #spectrum = mzml[index]\n #p spectrum\n #index = spectrum.find_nearest_index(search_hit.mz_exp)\n #p index\n abort 'still need to figure out mapping: not obvious at all!'\n when ABSciexSearchHit\n puts \"**********************************\"\n puts \"AASEQ: #{search_hit.peptide.aaseq}\"\n puts \"CHARGE: #{search_hit.charge}\"\n puts \"MODS: #{search_hit.peptide.mods}\"\n puts \"MZ THEOR: #{search_hit.mz_theor}\"\n puts \"MZ EXP: #{search_hit.mz_exp}\"\n prec_spectrum = mzml[search_hit.precursor_spectrum_id]\n puts \"PREC SPEC ID: #{prec_spectrum.id}\"\n puts \"PREC MS LEVEL: #{prec_spectrum.ms_level}\"\n dist_detail = IsotopeDistDetail.new(prec_spectrum, search_hit.mz_exp, search_hit.charge)\n (mzs, ints) = dist_detail.peaks_spectrum\n puts \"TRAP AREA:\"\n puts mzs.join(\",\")\n puts ints.join(\",\")\n puts \"ISOTOPE_PEAKS (mz,mz...:int,int...)\"\n dist_detail.isotope_peaks.each do |ip|\n puts ip.mzs.join(',') + ':' + ip.ints.join(',')\n end\n end\n end\n end\n\n end", "title": "" }, { "docid": "9ef781958cd19f9813c1b9af23402544", "score": "0.58895916", "text": "def convert(opts={})\n puts \"Creating file...\\n\\n\"\n \n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.mzIdentML(:id => \"\",\n :version => \"1.0.0\",\n 'xsi:schemaLocation' => \"http://psidev.info/psi/pi/mzIdentML/1.0 ../schema/mzIdentML1.0.0.xsd\",\n 'xmlns' => \"http://psidev.info/psi/pi/mzIdentML/1.0\",\n 'xmlns:xsi' => \"http://www.w3.org/2001/XMLSchema-instance\",\n :creationDate => @format.date) {\n cvList(xml)\n analysisSoftwareList(xml)\n #provider(xml) #Doesn't pass the validator, so I'm leaving it out.\n sequenceCollection(xml)\n analysisCollection(xml)\n analysisProtocolCollection(xml)\n dataCollection(xml)\n }\n end\n \n @format.display_missed_mappings\n File.open(base_file + \".mzid\", 'w') {|io| io.puts builder.to_xml}\n end", "title": "" }, { "docid": "5721d393e83959d9b58192e518f56ed1", "score": "0.58516484", "text": "def convert(opts={})\n puts \"Creating file...\\n\\n\"\n year, month, day, hour, min, sec = Time.now.year, Time.now.month, Time.now.day, Time.now.hour, Time.now.min, Time.now.sec\n day = Time.now.day.to_s.insert(0,\"0\") if day < 10\n month = Time.now.month.to_s.insert(0,\"0\") if month < 10\n min = Time.now.min.to_s.insert(0,\"0\") if min < 10\n sec = Time.now.sec.to_s.insert(0,\"0\") if sec < 10\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.MzIdentML(:id => \"\",\n :version => \"1.1.0\",\n 'xsi:schemaLocation' => \"http://psidev.info/psi/pi/mzIdentML/1.1 ../../schema/mzIdentML1.1.0.xsd\",\n 'xmlns' => \"http://psidev.info/psi/pi/mzIdentML/1.1\",\n 'xmlns:xsi' => \"http://www.w3.org/2001/XMLSchema-instance\",\n :creationDate => \"#{year}-#{month}-#{day}T#{hour}:#{min}:#{sec}\") {\n cvList(xml)\n analysisSoftwareList(xml)\n #analysisSampleCollection(xml)\n provider(xml) \n auditCollection(xml)\n sequenceCollection(xml)\n analysisCollection(xml)\n analysisProtocolCollection(xml)\n dataCollection(xml)\n }\n end\n \n @pepxml.display_missed_mappings\n File.open(base_file + \".mzid\", 'w') {|io| io.puts builder.to_xml}\n end", "title": "" }, { "docid": "1c3a3f4ffd3aa2b7c328804aa0724dc6", "score": "0.5740678", "text": "def parse\n #Target\n doc = nokogiriDoc(@target)\n load_peptides(doc)\n \n doc.xpath(\"//xmlns:SpectrumIdentificationResult\").each do |result|\n count = result.xpath(\".//xmlns:SpectrumIdentificationItem\").length\n listNum = result.xpath(\"./@id\").to_s.split(\"_\")[-1]\n 1.upto(count) {|i| @matches << psm(doc, result, \"1\", listNum, i)}\n end\n \n #Decoy\n doc = nokogiriDoc(@decoy)\n load_peptides(doc)\n \n doc.xpath(\"//xmlns:SpectrumIdentificationResult\").each do |result|\n count = result.xpath(\".//xmlns:SpectrumIdentificationItem\").length\n listNum = result.xpath(\"./@id\").to_s.split(\"_\")[-1]\n 1.upto(count) {|i| @matches << psm(doc, result, \"-1\", listNum, i)}\n end\n end", "title": "" }, { "docid": "6a5b9b8274eeabaac3a2a155151e1ddb", "score": "0.57394606", "text": "def get_ids(filename)\n $stderr.puts \"fetching ids from #{filename}\"\n\n ests_file=File.new(filename,'r')\n ests_file.each_line {|line|\n line.chomp!\n next if /^;/.match(line) # ignore comment lines\n @@contig_est_gbacc[line] = 1\n }\nend", "title": "" }, { "docid": "6ad1ea7c085810a1f4880292d3e4bddc", "score": "0.5600416", "text": "def parse_image_file\n # Open xml file with namespace\n rdf_xml = Nokogiri::XML('<rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:dcterms=\"http://purl.org/dc/terms/\"\n xmlns:eprofiles=\"http://purl.org/escidoc/metadata/profiles/0.1/\"\n xmlns:eterms=\"http://purl.org/escidoc/metadata/terms/0.1/\"\n xmlns:exif=\"http://www.w3.org/2003/12/exif/ns#\"\n xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"\n xmlns:imeji=\"http://imeji.org/terms/\"\n xmlns:imeji-metadata=\"http://imeji.org/terms/metadata/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"></rdf:RDF>')\n doc = File.open(metadata_file) { |f| Nokogiri::XML(f) }\n rdf_xml.root << doc.root.children\n\n create_collections unless @debug\n\n count = 0\n # Each xml file has multiple items\n rdf_xml.xpath('//imeji:image').each do |item|\n count += 1\n puts \"Starting import of #{count}\"\n # Set defaults\n work_id = nil\n col_id = nil\n attributes = {}\n files = []\n remote_files = []\n error = ''\n\n # Parse metadata file\n all_metadata = get_metadata(item)\n attributes = all_metadata[0]\n collection_url = all_metadata[1]\n remote_files = all_metadata[2]\n\n # get collection attributes\n collection_attrs = collections.fetch(collection_url, {}) unless collection_url.blank?\n collection_ids = [collection_attrs.fetch(:id, nil)]\n\n if debug\n log_progress(metadata_file, work_id, col_id, attributes, remote_files, error)\n next\n end\n\n # Import image\n begin\n # Set work id to be same as the id in metadata\n work_id = attributes[:id] unless attributes.fetch(:id, nil).blank?\n h = Importers::HyraxImporter.new('Image', attributes, files, remote_files, collection_ids, work_id)\n h.import\n rescue StandardError => exception\n error = exception.backtrace.unshift(exception.message)\n end\n\n # log progress\n log_progress(metadata_file, work_id, col_id, attributes, remote_files, error)\n end\n end", "title": "" }, { "docid": "7cbc638f0e5ab808806c779db7119cd6", "score": "0.55722356", "text": "def parse_file(filename); end", "title": "" }, { "docid": "f76fc475ab2ac7bde31a68ce8524deec", "score": "0.5562903", "text": "def parse\n infile = File.open @infilename\n obj_id = in_node = nil\n node_re = Regexp.union(@node_types)\n \n while l = infile.gets do \n if l =~ /^\\s+([a-zA-Z0-9_.]+)\\s+\\[/\n # we've found a line like \"\tmeter1\t [fillcolor=2,\"\n temp_object_name = $1\n unless in_node.nil?\n raise \"I found the start of the next object without finding a position for #{in_node}.\\nLine: #{l}\"\n end \n #if @node_types.include? $1 # <--- This is original 'if' line here...\n if temp_object_name.match(node_re) \n #@node_types.find_all {|v| $1.grep(/v/)}\n #or if $1.match(node_re)\n obj_id = temp_object_name\n puts temp_object_name\n in_node = @prefix + temp_object_name\n puts \"Searching for position of node #{in_node}\"\n end\n elsif !in_node.nil? && l =~ /.*pos=\"(-*[0-9.]+),(-*[0-9.]+)\",/\n puts \"Found position of node #{in_node}\"\n @nodes << [obj_id, in_node, scale($1), scale($2)]\n obj_id = in_node = nil\n end\n end\n \n raise \"I hit the end of the file without finding a position for #{in_node}\" unless in_node.nil?\n infile.close\n end", "title": "" }, { "docid": "8cdd142f1f6512e4251cb853f03d67bd", "score": "0.55357176", "text": "def parse_file()\n unless @file.nil?\n @file.each do |line|\n line.chomp!\n # puts line\n if line.empty? || line =~ /(\\s*)#(.*)/i\n next\n else\n info = extract_info(line)\n store info\n end\n end\n end\n end", "title": "" }, { "docid": "a9981a1f66297d197d448afcb90fcb0c", "score": "0.550396", "text": "def mdtm(filename); end", "title": "" }, { "docid": "12579b71ae7c8baa994b2834442e8367", "score": "0.547693", "text": "def parse\n raise \"Not ready for parsing\" unless @state == :ready\n pbx = File.open(@filename, 'r')\n \n line_num = 0\n group_name = []\n # group = []\n section_type = nil\n section = nil\n item = nil\n list_name = nil\n list = nil\n grouplist_name = nil\n grouplist = nil\n \n # Read our file\n pbx.each_line do |line|\n if (line_num == 0 && !line.match(Regexp.new(Regexp.escape('// !$*UTF8*$!'))))\n raise \"Unknown file format\"\n end\n \n # Main level Attributes\n if (group_name.count == 0 && !section_type && m = line.match(/\\s+(.*?) = (.*?)( \\/\\* (.*) \\*\\/)?;/))\n # d = { :value => m[2], :comment => m[4] }\n self.instance_variable_set(\"@#{m[1]}\", PBXTypes::BasicValue.new(:value => m[2], :comment => m[4]))\n \n next\n end\n \n # Begin object group\n if (m = line.match(/\\s+(.*) = \\{/))\n group_name.push m[1]\n # group.push {}\n end\n \n # End our object group\n if (line.match(/\\s+\\};/))\n group_name.pop\n # group.pop\n \n if (item && group_name.count < 2)\n @sections[section_type].push item\n item = nil\n end\n end\n \n # Begin section\n if (m = line.match(/\\/\\* Begin (.*) section \\*\\//))\n section_type = m[1]\n @sections[section_type] = []\n\n next\n end\n \n # One line section data, simple. huh?\n if (section_type && group_name.count < 3 && m = line.match(/\\s+(.*?) (\\/\\* (.*?) \\*\\/ )?= \\{(.*)\\};/))\n begin\n # cls = PBXProject::PBXProject::const_get(section_type)\n # item = cls.new\n item = eval(\"PBXTypes::#{section_type}\").new\n \n item.guid = m[1]\n item.comment = m[3]\n # m[4].scan(/(.*?) = (.*?)( \\/\\* (.*) \\*\\/)?; ?/).each do |v|\n # 1: name\n # 2: value\n # 3: /* comment */\n # 4: comment\n m[4].scan(/(\\S*?) = (\\s*?(.*?)(?:(?={){[^}]*}|(?: \\/\\* (.*?) \\*\\/)?(?=;)))/).each do |v|\n if (v[3])\n # d = { :value => v[1], :comment => v[3]}\n item.instance_variable_set(\"@#{v[0]}\", PBXTypes::BasicValue.new(:value => v[2], :comment => v[3]))\n else\n item.instance_variable_set(\"@#{v[0]}\", v[1][/^{/] ? v[1] : v[2])\n end\n end\n \n @sections[section_type].push item\n item = nil\n rescue NameError => e\n puts e.inspect\n end\n \n next\n end\n \n # Multiline with lists\n if (section_type && group_name.count < 3 && m = line.match(/\\s+(.*?) (\\/\\* (.*?) \\*\\/ )?= \\{/))\n begin\n # cls = PBXProject::PBXProject::const_get(section_type)\n # item = cls.new\n item = eval(\"PBXTypes::#{section_type}\").new\n \n item.guid = m[1]\n item.comment = m[3]\n \n # puts item.inspect\n rescue NameError => e\n puts e.inspect\n end\n \n next\n end\n \n # Next line in multiline\n if (item && m = line.match(/^\\s*(.*?) = (.*?)(?: \\/\\* (.*) \\*\\/)?;$/))\n if (group_name.count < 3)\n # i = { :value => m[2], :comment => m[3] }\n item.instance_variable_set(\"@#{m[1]}\", PBXTypes::BasicValue.new(:value => m[2], :comment => m[3]))\n else\n grp = item.instance_variable_get(\"@#{group_name.last}\")\n if (!grp.kind_of?(Hash))\n grp = {}\n end\n # grp[m[1]] = { :value => m[2], :comment => m[3] }\n grp[m[1]] = PBXTypes::BasicValue.new :value => m[2], :comment => m[3]\n item.instance_variable_set(\"@#{group_name.last}\", grp)\n end\n \n next\n end\n \n # And the multiline list begin\n if (item && m = line.match(/\\s+(.*?) = \\(/))\n if (group_name.count < 3)\n list_name = m[1]\n list = []\n else\n grouplist_name = m[1]\n grouplist = []\n end\n \n next\n end\n \n # And list items\n if (item && m = line.match(/\\s+(.*?)( \\/\\* (.*?) \\*\\/)?,/))\n if (group_name.count < 3)\n # i = { :item => m[1], :comment => m[3] }\n list.push PBXTypes::BasicValue.new :value => m[1], :comment => m[3]\n else\n # i = { :item => m[1], :comment => m[3] }\n grouplist.push PBXTypes::BasicValue.new :value => m[1], :comment => m[3]\n end\n \n next\n end\n \n if (item && line.match(/\\s+\\);/))\n if (group_name.count < 3)\n item.instance_variable_set(\"@#{list_name}\", list)\n list = nil\n list_name = nil\n else\n grp = item.instance_variable_get(\"@#{group_name.last}\")\n if (!grp.kind_of?(Hash))\n grp = {}\n end\n grp[grouplist_name] = grouplist\n item.instance_variable_set(\"@#{group_name.last}\", grp)\n grouplist_name = nil\n grouplist = nil\n end\n \n next\n end\n \n # End section\n if (m = line.match(/\\/\\* End (.*) section \\*\\//))\n section_type = nil\n section = nil\n end\n \n # Increse our line counter\n line_num += 1\n end\n \n @state = :parsed\n \n true\n end", "title": "" }, { "docid": "f2ff9d03a67262927ae28bef69781838", "score": "0.54388595", "text": "def parse_file(filepath); end", "title": "" }, { "docid": "cfe3871f593ae8b7bd95ebeca2d53f59", "score": "0.5434527", "text": "def parse_opml_file(file)\n r = []\n \n f = File.new(file)\n \n doc = REXML::Document.new(f)\n \n doc.root.each_element('//outline[@type]') { |ele| r << ele.attributes if ele.attributes.has_key?('xmlUrl') }\n\n f.close\n \n r\nend", "title": "" }, { "docid": "d6bce4fc1295f2be9ed87a769a0469fb", "score": "0.541736", "text": "def parse_file_list file, nick\n debug 'parsing', \"Parsing file list for: '#{nick}' at '#{file}'\"\n xml = Bzip2::Reader.open file\n doc = LibXML::XML::Document.io xml\n doc.order_elements!\n doc\n end", "title": "" }, { "docid": "afdcf505fd7d2c6bc7048de290b2289e", "score": "0.5411022", "text": "def parse_file\n done = false\n idx = 0\n contents = @contents.split(/\\n/)\n contents = contents[5..contents.size-1]\n contents = contents.join(\"\\n\")\n content_elements = []\n r = /^([A-Z0-9\\s])+([0-9]+)?(\\s)?:/\n until done\n et = r.match(contents, idx)\n if et.nil?\n done = true\n else\n et = et.to_s\n unless et.empty?\n idx = contents.index(et, idx) + et.size + 1\n next_et = r.match(contents, idx)\n if next_et.nil?\n next_et = contents.size\n else\n next_et = next_et.to_s\n next_et = contents.index(next_et, idx)\n end\n @elements << ContentElement.new(et.strip.gsub(/:/,''), contents[idx-1..next_et-1].gsub(/\\n|\\\\n|\\r|\\t/, '').strip)\n end\n end\n end\n end", "title": "" }, { "docid": "b5e8ae80de84f4ecc855fe60022babf4", "score": "0.53980666", "text": "def\tparse_file\n File.open( @file ).each do |f|\n f.each_line do |line|\n store_find_detail(line)\n end\n end\n end", "title": "" }, { "docid": "59a9ba54158d232609107841186888cb", "score": "0.53745884", "text": "def process_file_containing_imdbids inputfile\n filename = inputfile\n file = File.new(filename, \"r\");\n array=file.readlines;\n file.close\n return array\nend", "title": "" }, { "docid": "59a9ba54158d232609107841186888cb", "score": "0.53745884", "text": "def process_file_containing_imdbids inputfile\n filename = inputfile\n file = File.new(filename, \"r\");\n array=file.readlines;\n file.close\n return array\nend", "title": "" }, { "docid": "ec9c06c9fa282a272a29ec4f2eb04411", "score": "0.53726196", "text": "def get_ids_from_raw_marc(raw_marc)\n return raw_marc if raw_marc.nil?\n ids = []\n reader = MARC::Reader.new(StringIO.new(raw_marc))\n reader.each { |rec| ids << rec['001'].value.to_i if rec['001'] }\n ids\nend", "title": "" }, { "docid": "7d6f6e0183f1939a56761a5ff36e4c4f", "score": "0.53708386", "text": "def parseOSM(filename)\n\tnodes = {} # Nodes from file, OSM ID as id\n\tways = {} # Ways from file, OSM ID as id\n\troutes = {}\n\tcurrent_way_id = nil # Are we analysing a way?\n\tcurrent_way = nil # Are we analysing a way?\n\tcurrent_rel_id = nil\n\tcurrent_rel = nil\n\tcurrent_bus_number = nil\n\ttypes = [\"amenity\", \"barrier\", \"highway\", \"building\", \"barrier\", \"natural\", \n\t\t\t\t\t \"waterway\", \"railway\", \"landuse\", \"power\", \"amenity\", \"shop\"] # Basic types to look for\n\t\n\tf = File.open(filename) # Open the OSM file\n\treader = Nokogiri::XML::Reader(f) # Pass it to Nokogiri to parse\n\n\tmaxLon, maxLat, minLon, minLat = nil, nil, nil, nil # Bounding box\n\n\treader.each do |elem|\n\t\tif elem.name == \"node\" \n\t\t\tnodes[elem.attribute(\"id\")] = {:lat => elem.attribute(\"lat\").to_f, :lon => elem.attribute(\"lon\").to_f} # Strip and add to list\n\t\t\t\n\t\t\tif maxLon.nil? # First node !\n\t\t\t\tmaxLon = elem.attribute(\"lon\").to_f\n\t\t\t\tminLon = elem.attribute(\"lon\").to_f\n\t\t\t\tmaxLat = elem.attribute(\"lat\").to_f\n\t\t\t\tminLat = elem.attribute(\"lat\").to_f\n\t\t\telse # Handle bounding box\n\t\t\t\tmaxLon = [maxLon, elem.attribute(\"lon\").to_f].max\n\t\t\t\tminLon = [minLon, elem.attribute(\"lon\").to_f].min\n\t\t\t\tmaxLat = [maxLat, elem.attribute(\"lat\").to_f].max\n\t\t\t\tminLat = [minLat, elem.attribute(\"lat\").to_f].min\n\t\t\tend \n\t\telsif elem.name == \"way\"\n\t\t\tcurrent_way_id = elem.attribute(\"id\") # We found a way!\n\t\t\tcurrent_way = {:nodes => [], :key_type => \"unclassified\", :type => \"unclassified\"}\n\t\telsif elem.name == \"nd\" # A node in a way!\n\t\t\tcurrent_way[:nodes].push(elem.attribute(\"ref\")) # Add the node ID to the way's list\n\t\telsif elem.name == \"tag\"\n\t\t\tif !current_way_id.nil? && (types.include? elem.attribute(\"k\")) # Tags for ways\n\t\t\t\tcurrent_way[:key_type] = elem.attribute(\"k\")\n\t\t\t\tcurrent_way[:type] = elem.attribute(\"v\")\n\t\t\t\tways[current_way_id] = current_way\n\t\t\t\tcurrent_way_id = nil\n\t\t\telsif !current_rel_id.nil?\n\t\t\t\tif elem.attribute(\"v\") == \"bus\"\n\t\t\t\t\tcurrent_rel[:id] = current_rel_id\n\t\t\t\t\troutes[current_bus_number] = current_rel\n\t\t\t\telsif elem.attribute(\"k\") == \"ref\"\n\t\t\t\t\tcurrent_bus_number = elem.attribute(\"v\")\n\t\t\t\tend\n\t\t\tend\n\t\telsif elem.name == \"member\" # Bus route\n\t\t\tif !current_rel_id.nil?\n\t\t\t\tif elem.attribute(\"type\") == \"way\"\n\t\t\t\t\tif ways[elem.attribute(\"ref\")] != nil\n\t\t\t\t\t\tcurrent_rel[:nodes].push([])\n\t\t\t\t\t\tways[elem.attribute(\"ref\")][:nodes].each do |node_id|\n\t\t\t\t\t\t\tcurrent_rel[:nodes].last.push({:id => node_id, :lat => nodes[node_id][:lat], :lon => nodes[node_id][:lon]})\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\telsif elem.name == \"relation\"\n\t\t\tcurrent_way_id = nil # Making sure we're not adding nd when it's a rel\n\t\t\tcurrent_rel_id = elem.attribute(\"id\")\n\t\t\tcurrent_rel = {:nodes => [], :id => nil}\n\t\tend\n\tend\n\t\n\tf.close\n\t\n\t# Bounds of the file\n\tbounds = {:maxLat => maxLat, :minLat => minLat, :maxLon => maxLon, :minLon => minLon}\n\n\t# This portion of code is here in case further work wants to be done\n\t# in the real time bus visualisation\n\t# It takes all the bus routes from a file given by TfL\n\t# And finds the position of the bus stops with the data stored in the DB\n\t# See StoreBusStops for more information\n\n\t# routes_stops = CSV.read(\"./bus_routes.csv\")\n\t# naptan_routes = {}\n\n\t# routes_stops.each do |stop|\n\t# \tif routes.keys.include? stop[0]\n\t# \t\tif naptan_routes[stop[0]] == nil\n\t# \t\t\tnaptan_routes[stop[0]] = []\n\t# \t\tend\n\n\t# \t\tcoord = BusStop.first(:naptan_id => stop[5])\n\n\t# \t\tif !coord.nil?\n\t# \t\t\tnaptan_routes[stop[0]].push({:naptan_id => stop[5], :lat => coord[:lat], :lon => coord[:lon]})\n\t# \t\tend\n\t# \tend\n\t# end\n\n\troute_portions = {}\n\n\troutes.each do |bus_num, nodes_sequence|\n\t\tnodes_sequence[:nodes] = orderWays(nodes_sequence[:nodes])\n\t\troute_portions[bus_num] = []\n\n\t\tnodes_sequence[:nodes].each do |portion|\n\t\t\troute_portions[bus_num].push({:bounds => {:maxLat => portion.first[:lat], :minLat => portion.first[:lat], :maxLon => portion.first[:lon], :minLon => portion.first[:lon]}, :portion => portion})\n\n\t\t\tportion.each do |node|\n\t\t\t\troute_portions[bus_num].last[:bounds][:maxLat] = [node[:lat], route_portions[bus_num].last[:bounds][:maxLat]].max\n\t\t\t\troute_portions[bus_num].last[:bounds][:maxLon] = [node[:lon], route_portions[bus_num].last[:bounds][:maxLon]].max\n\t\t\t\troute_portions[bus_num].last[:bounds][:minLat] = [node[:lat], route_portions[bus_num].last[:bounds][:minLat]].min\n\t\t\t\troute_portions[bus_num].last[:bounds][:minLon] = [node[:lon], route_portions[bus_num].last[:bounds][:minLon]].min\n\n\t\t\tend\n\t\tend\n\tend\n\n\t# Attempt to merge the bus stops from TfL into the OSM dataset\n\t# Failure and success are detailed in the report\n\n\t# final_routes = {}\n\n\t# naptan_routes.each do |bus_num, stop_sequence|\n\t# \tfinal_routes[bus_num] = []\n\t# \tfit = false\n\t# \tcurrent_portion = 0\n\n\t# \tprint \"\\n\"\n\t# \tprint bus_num\n\t# \tprint \"\\n\"\n\t# \tprint route_portions[bus_num]\n\t# \tprint \"\\n\\n\"\n\n\t# \tstop_sequence.each_index do |i|\n\t# \t\tstop = stop_sequence[i]\n\n\t# \t\tif current_portion < route_portions[bus_num].length\n\t# \t\t\tif !withinBounds(stop, route_portions[bus_num][current_portion][:bounds]) && fit\n\t# \t\t\t\tfit = false\n\t# \t\t\t\tcurrent_portion = current_portion + 1\n\t# \t\t\t\t# Retry same node on next segment!!\n\t# \t\t\telsif withinBounds(stop, route_portions[bus_num][current_portion][:bounds])\n\t# \t\t\t\tif fit == false\n\t# \t\t\t\t\tfit = true\n\t# \t\t\t\t\tfinal_routes[bus_num].push([])\n\t# \t\t\t\tend\n\n\t# \t\t\t\tposition = findPosition(route_portions[bus_num][current_portion][:portion], stop)\n\t# \t\t\t\tprint \"Stop no #{i} found at #{position}\"\n\t# \t\t\t\tprint \"\\n\"\n\t# \t\t\t\tprint \"http://www.openstreetmap.org/?mlat=#{stop[:lat]}&mlon=#{stop[:lon]}&zoom=30&relation=308536\\nhttp://www.openstreetmap.org/?mlat=#{route_portions[bus_num][current_portion][:portion][position][:lat]}&mlon=#{route_portions[bus_num][current_portion][:portion][position][:lon]}&zoom=30&relation=308536\\n\"\n\t# \t\t\tend\n\t# \t\tend\n\t# \tend\n\t# end\n\t\n\t# Create and save all the map objects in one single transaction\n\tMapObject.transaction do \n\t\tMapObject.destroy\n\n\t ways.each do |way_id, way_values| \n\t base_node = nodes[way_values[:nodes][0]]\n\t base_node_cart = toCartesian(base_node, bounds)\n\t shapeNodes = [{:id => way_values[:nodes][0], :x => 0, :y => 0}]\n\t\t\t\n\t local_maxLon = base_node[:lon]\n\t local_minLon = base_node[:lon]\n\t local_maxLat = base_node[:lat]\n\t local_minLat = base_node[:lat]\n\n\t way_values[:nodes][1..-1].each do |node_id|\n\t local_maxLon = [local_maxLon, nodes[node_id][:lon]].max\n\t local_minLon = [local_minLon, nodes[node_id][:lon]].min\n\t local_maxLat = [local_maxLat, nodes[node_id][:lat]].max\n\t local_minLat = [local_minLat, nodes[node_id][:lat]].min\n\t\t\t\t\n\t cart_node = toCartesian(nodes[node_id], bounds)\n\t cart_node[:x] -= base_node_cart[:x]\n\t cart_node[:y] -= base_node_cart[:y]\n\t cart_node[:id] = node_id\n\t shapeNodes.push(cart_node)\n\t end\n\t\t\t\n\t r = Random.new\n\t new_way = MapObject.new(:key_type => way_values[:key_type], \n\t :type => way_values[:type], \n\t :shape => shapeNodes, \n\t :lat => base_node[:lat],\n\t :lon => base_node[:lon],\n\t :x => base_node_cart[:x],\n\t :y => base_node_cart[:y],\n\t :minLon => local_minLon,\n\t :minX => lonToCartesian(local_minLon, bounds),\n\t :minLat => local_minLat,\n\t :minY => latToCartesian(local_minLat),\n\t :maxLon => local_maxLon,\n\t :maxX => lonToCartesian(local_maxLon, bounds),\n\t :maxLat => local_maxLat,\n\t :maxY => latToCartesian(local_maxLat),\n\t :height => r.rand(20...42))\n\t new_way.save\n\t end\n\n\t route_portions.each do |bus_num, portions|\n\t\t\tportions.each do |segment|\n\t\t\t\tbase_node = segment[:portion].first\n\t\t base_node_cart = toCartesian(base_node, bounds)\n\t\t shapeNodes = [{:x => 0, :y => 0, :id => base_node[:id]}]\n\t\t\t\t\n\t\t local_maxLon = base_node[:lon]\n\t\t local_minLon = base_node[:lon]\n\t\t local_maxLat = base_node[:lat]\n\t\t local_minLat = base_node[:lat]\n\n\t\t segment[:portion][1..-1].each do |node|\n\t\t local_maxLon = [local_maxLon, node[:lon]].max\n\t\t local_minLon = [local_minLon, node[:lon]].min\n\t\t local_maxLat = [local_maxLat, node[:lat]].max\n\t\t local_minLat = [local_minLat, node[:lat]].min\n\t\t\t\t\t\n\t\t cart_node = toCartesian(node, bounds)\n\t\t cart_node[:x] -= base_node_cart[:x]\n\t\t cart_node[:y] -= base_node_cart[:y]\n\t\t cart_node[:id] = node[:id]\n\t\t shapeNodes.push(cart_node)\n\t\t end\n\t\t\t\t\n\t\t new_way = MapObject.new(:key_type => \"bus_route\", \n\t\t :type => bus_num, \n\t\t :shape => shapeNodes, \n\t\t :lat => base_node[:lat],\n\t\t :lon => base_node[:lon],\n\t\t :x => base_node_cart[:x],\n\t\t :y => base_node_cart[:y],\n\t\t :minLon => local_minLon,\n\t\t :minX => lonToCartesian(local_minLon, bounds),\n\t\t :minLat => local_minLat,\n\t\t :minY => latToCartesian(local_minLat),\n\t\t :maxLon => local_maxLon,\n\t\t :maxX => lonToCartesian(local_maxLon, bounds),\n\t\t :maxLat => local_maxLat,\n\t\t :maxY => latToCartesian(local_maxLat),\n\t\t :height => 0)\n\t\t new_way.save\n\t\t end\n\t\tend\n\tend\nend", "title": "" }, { "docid": "821eb9f92a6dbc35cf872f02e3763cf7", "score": "0.53616005", "text": "def get_file_ids\n @mets.search(\"./mets/structMap/div/div\").each do |ele|\n file_data = {}\n dmdid = ele.xpath(\"@DMDID\").text\n file_data['dmdid'] = dmdid unless dmdid.blank?\n fptr = ele.xpath('./fptr')\n fileid = fptr.xpath(\"@FILEID\").text\n file_data['fileid'] = fileid unless fileid.blank?\n @files_metadata << file_data if file_data.any?\n end\n end", "title": "" }, { "docid": "cf173fc618ba5e5a8da8e446d1831465", "score": "0.53447384", "text": "def parse_kml_file(filename)\n result = {\n filename: filename,\n date: date_from_filename(filename),\n header: [],\n timestamps: [],\n coords: [],\n footer: [],\n }\n\n cur_section = :header\n\n File.readlines(filename).each do |line|\n line.strip!\n\n cur_section = :timestamps if cur_section == :header && line.start_with?(\"<when>\")\n cur_section = :coords if cur_section == :timestamps && line.start_with?(\"<gx:coord>\")\n cur_section = :footer if cur_section == :coords && !line.start_with?(\"<gx:coord>\")\n\n result[cur_section] << line\n end\n\n result\nend", "title": "" }, { "docid": "8739e4219cc7df52e022fbc97fe8bdaa", "score": "0.532846", "text": "def parse_file()\n datum_list = []\n while @cur_token\n datum_list << datum()\n end\n datum_list\n end", "title": "" }, { "docid": "b761bf4270d9d13504a60275ffdc1b65", "score": "0.53056926", "text": "def parse_metadata(dir, metadata_file, measurement_file)\n attributes = {}\n errors = []\n metadata = File.open(metadata_file) { |f| Nokogiri::XML(f) }\n\n # To import the sample data in: https://github.com/antleaf/nims-ngdr-development-2018/tree/master/sample_data_from_msuzuki\n # the model object is: https://github.com/antleaf/nims-hyrax/blob/develop/hyrax/app/models/dataset.rb\n # fields that have multiple fields have been called ComplexXXX.\n # For example see complex_date https://github.com/antleaf/nims-hyrax/blob/develop/hyrax/app/models/concerns/complex_date.rb\n # Complex object validation is handled by https://github.com/antleaf/nims-hyrax/blob/develop/hyrax/app/models/concerns/complex_validation.rb\n # The model object is based on a model NIMS provided: http://ngdr.antleaf.com/contexts/datasets/\n\n # A sample mandatory file: https://github.com/antleaf/nims-ngdr-development-2018/blob/master/sample_data_from_msuzuki/AES-narrow/mandatory.xml\n\n # There are fields such as instrument_type, which in http://ngdr.antleaf.com/contexts/datasets/\n # links instrument to instrument application profile at http://ngdr.antleaf.com/profiles/ngdr_instrument/\n # This shows a line with a label \"instrument type\" has property name \"alternative title\" so it would be saved into the model as:\n # https://github.com/antleaf/nims-hyrax/blob/develop/hyrax/app/models/concerns/complex_instrument.rb#L6\n\n # NOTE there are errors in the test data such as \"specime\" instead of \"specimen\":\n # https://github.com/antleaf/nims-ngdr-development-2018/blob/master/sample_data_from_msuzuki/AES-narrow/mandatory.xml#L16\n # There are a few errors in other places, e.g. authority files having incorrect spellings.\n\n # NOTE that in config/authorities, if the field key is in there, the value has to be one of the values in the corresponding file\n # can access those file by their relevant service though, in app/services/ like\n # opts = AnalysisFieldService.new.select_all_options where opts would be a list of lists with values term, id\n # then try to find the term in the list of objects\n # can do AnalysisFieldService.label(VALUE) where label is the term in the yml file\n # but WE DON'T KNOW IF THE VALUES IN THE XML ARE THE IDs OR THE TERMS...\n # if it is not found will throw a key error - in which case do not accept the import at all\n # if it is found, I must replace whatever we do have with the ID value from the authority file\n\n # All the valid keys of the Dataset attributes are listed below - try to read each into the metadata\n\n # Set title with the folder title as it does not appear in the meta\n # title: ['test dataset'],\n attributes['title'] = [metadata_file.split('/')[-2]]\n\n metadata.xpath('//meta').each do |meta|\n # description: ['description 1'],\n if meta['key'] == 'material_description'\n attributes['description'] ||= []\n attributes['description'] << meta.content\n\n # TODO Anusha to provide info of how to save embargo data - which I will parse out of something like embargo_till_2019-09-30\n # see: https://github.com/antleaf/nims-ngdr-development-2018/blob/master/sample_data_from_msuzuki/AES-narrow/mandatory.xml#L15\n # As that field is defined only as a String in the sample XML, there is no way to know what format it could appear as\n # in other documents, and also it would be a very brittle way to provide such data when the point of XML is that it could\n # be provided in more granular fashion. For now this has been agreed as the approach...\n #elsif meta['key'] == 'data_accessibility'\n\n # data_origin: ['informatics and data science']\n elsif meta['key'] == 'data_origin'\n attributes['data_origin'] ||= []\n term = DataOriginService.new.find_by_id_or_label(meta.content)\n if term.any?\n attributes['data_origin'] << term['id']\n else\n errors << \"#{meta.content} not in data origin authority\"\n end\n\n # complex_identifier_attributes: [{identifier: '0000-0000-0000-0000', scheme: 'uri_of_ORCID_scheme', label: 'ORCID'}],\n elsif meta['key'] == 'data_id' or meta['key'] == 'previous_process_id' or meta['key'] == 'relational_id' or meta['key'] == 'reference'\n attributes['complex_identifier_attributes'] ||= []\n term = IdentifierService.new.find_by_id_or_label(meta['key'])\n if term.any?\n attributes['complex_identifier_attributes'] << {identifier: meta.content, label: term['id']}\n else\n errors << \"#{meta['key']} not in identifier authority\"\n end\n\n # complex_date_attributes: [{date: '1978-10-28', description: 'http://purl.org/dc/terms/issued',}],\n # NOTE created and modified are also present in the sample XML, but as all are the same it is not clear if\n # this is data that should be imported into the system or if new created/modified dates relevant to import time\n # should be all that is required (in which case they will be added automatically when the attributes are saved)\n elsif meta['key'] == 'data_registration_date' or meta['key'] == 'processing_data'\n if meta['key'] == 'processing_data'\n desc = 'Processed'\n else\n desc = 'Registered'\n end\n attributes['complex_date_attributes'] ||= []\n attributes['complex_date_attributes'] << {date: meta.content, description: desc}\n\n # complex_person_attributes: [{\n # name: 'Foo Bar',\n # uri: 'http://localhost/person/1234567',\n # affiliation: 'author affiliation',\n # role: 'Author',\n # complex_identifier_attributes: [{identifier: '1234567',scheme: 'Local'}]\n # }],\n elsif meta['key'] == 'entrant'\n # agreed to use Anonymous User and data depositor\n attributes['complex_person_attributes'] ||= [\n {name: 'Anonymous User', role: 'data depositor'}]\n attributes['complex_person_attributes'][0]['complex_identifier_attributes'] = [{identifier: meta.content, scheme: 'Local'}]\n\n elsif meta['key'] == 'entrant_affiliation'\n attributes['complex_person_attributes'] ||= [{}]\n attributes['complex_person_attributes'][0]['affiliation'] = meta.content\n\n # instrument_attributes: [{\n # title: 'Instrument title'\n elsif meta['key'] == 'instrument_name'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['title'] = meta.content\n\n # description: 'Instrument description',\n elsif meta['key'] == 'instrument_description'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['description'] = meta.content\n\n # function_1: ['Has a function'],\n elsif meta['key'] == 'instrument_function_tier_1'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['function_1'] ||= []\n attributes['instrument_attributes'][0]['function_1'] << meta.content\n\n # function_2: ['Has two functions'],\n elsif meta['key'] == 'instrument_function_tier_2'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['function_2'] ||= []\n attributes['instrument_attributes'][0]['function_2'] << meta.content\n\n # organization: 'Organisation',\n elsif meta['key'] == 'instrument_registered_organization'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['organization'] = meta.content\n\n # manufacturer: 'Manufacturer name',\n elsif meta['key'] == 'instrument_manufacturer'\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['manufacturer'] = meta.content\n\n # complex_person_attributes: [{name: ['Name of operator'], role: ['Operator']}],\n elsif meta['key'] == 'instrument_operator'\n # NOTE this does not actually contain a name, it appears to be an ID like 9999-8888-7777-3210\n # but there is no name to use, and the complex person attributes do not include ID, so this value will be put in as name\n # see https://github.com/antleaf/nims-ngdr-development-2018/blob/master/sample_data_from_msuzuki/AES-narrow/mandatory.xml#L29\n attributes['instrument_attributes'] ||= [{}]\n attributes['instrument_attributes'][0]['complex_person_attributes'] ||= []\n attributes['instrument_attributes'][0]['complex_person_attributes'] << {name: [meta.content], role: ['operator']}\n\n # alternative_title: 'An instrument title',\n # complex_date_attributes: [{date: ['2018-02-14'], description: 'Processed'}],\n # complex_identifier_attributes: [{identifier: ['123456'], label: ['Local']}],\n # }],\n\n # NOTE that the sample data being used does not appear to have instrument alternative title, dates, or identifiers\n # but it DOES have instrument_type and instrument_registered_department, which are not in the model, so not used\n # ALSO I have checked all the other sample mandatory files and they all contain the same keys\n\n # specimen_type_attributes: [{\n # chemical_composition: 'chemical composition',\n # crystallographic_structure: 'crystallographic structure',\n # description: 'Description',\n # complex_identifier_attributes: [{identifier: '1234567'}],\n # material_types: 'material types',\n # purchase_record_attributes: [{date: ['2018-02-14'], identifier: ['123456'], purchase_record_item: ['Has a purchase record item'], title: 'Purchase record title'}],\n # complex_relation_attributes: [{url: 'http://example.com/relation', relationship: 'is part of'}],\n # structural_features: 'structural features',\n # title: 'Instrument 1'\n # }],\n elsif meta['key'] == 'specimen_process_purchase_date'\n attributes['specimen_type_attributes'] = [ { purchase_record_attributes: [{date: meta.content}] } ]\n\n # NOTE the sample data does not have any of the other complex specimen type fields,\n # but it DOES have specime_initial_state (note the incorrect spelling) and specimen_final_state\n # neither of which seem to have corresponding keys in the model to insert them into\n # For now agreed to collate specimen fields into the specimen_set string, and import specime as specimen\n # specimen_set: 'Specimen set',\n elsif meta['key'] == 'specime_initial_state' or meta['key'] == 'specimen_initial_state' or meta['key'] == 'specime_final_state' or meta['key'] == 'specimen_final_state'\n attributes['specimen_set'] ||= ''\n attributes['specimen_set'] += meta['key'] + ':' + meta.content + ';'\n\n # NOTE also that all of the fields below that are defined in our model appear to be missing in\n # the sample data. At least \"title\" seems to be mandatory for our model, so it does not seem that any of this data could be acceptable\n\n # ALSO perhaps relation_attributes would better suit what have been entered above as complex_identifier_attributes\n # but without some way to know what sort of relation a relation_id is meant to be, or what a reference really is,\n # there is no way to know how to use these relation_attributes for them.\n\n # Lastly, if there is a meta item in the mandatory XML that does not conform to one of the known keys above,\n # the following else line will cause the import for the data in question to be skipped\n # NOTE that for now this means none of them would succeed, as there are 4 key names described above\n # which do not yet conform to any of our model keys.\n else\n # puts 'Mandatory XML file contains an unknown key, which has been imported as a custom property instead: ' + meta['key'] + ' at ' + metadata_file\n # custom_property_attributes: [{label: 'Full name', description: 'My full name is ...'}]\n attributes['custom_property_attributes'] ||= []\n attributes['custom_property_attributes'] << {label: meta['key'], description: meta.content}\n # return {}\n\n # source: ['Source 1'],\n # keyword: ['keyword 1', 'keyword 2'],\n # language: ['language 1'],\n # publisher: ['publisher 1'],\n # subject: ['subject 1'],\n # properties_addressed: ['chemical -- impurity concentration'],\n # alternative_title: 'Alternative Title',\n # characterization_methods: 'charge distribution',\n # computational_methods: 'computational methods',\n # origin_system_provenance: 'origin system provenance',\n # synthesis_and_processing: 'Synthesis and processing methods',\n # complex_rights_attributes: [{date: '1978-10-28', rights: 'CC0'}],\n # complex_version_attributes: [{date: '1978-10-28', description: 'Creating the first version', identifier: 'id1', version: '1.0'}],\n # relation_attributes: [{\n # title: 'A related item',\n # url: 'http://example.com/relation',\n # complex_identifier_attributes: [{identifier: ['123456'], label: ['local']}],\n # relationship: 'Is part of'\n # }]\n\n end\n end\n unless attributes.any?\n message = \"Error: Could not extract any metadata from \" + metadata_file\n write_log(message)\n end\n write_errors(metadata_file, errors) if errors.any?\n\n # also agreed to parse a measurement.xml file if present, so just do that here for the time being, if it exists in the same folder\n if File.file?(measurement_file)\n measures = File.open(measurement_file) { |f| Nokogiri::XML(f) }\n measures.xpath('//meta').each do |meta|\n # custom_property_attributes: [{label: 'Full name', description: 'My full name is ...'}]\n attributes['custom_property_attributes'] ||= []\n attributes['custom_property_attributes'] << {label: meta['key'], description: meta.content}\n end\n end\n return attributes\n end", "title": "" }, { "docid": "19e8b92c4c4bbbfacd989267324312bd", "score": "0.5272212", "text": "def parse_file(filename)\n # Parses a single file specified in corpus-file-info.rb\n # corpus_metadata omitted. Not sure what to do about the file_info hash.\n # Maybe an additional optional \"metadata\" file?\n\n # Get filename from file_info hash\n puts \"Parsing file #{filename}\"\n lines = File.readlines(filename)\n\n # grab the file fields\n fields = []\n last_field = ''\n lines.each do |line|\n case line\n # previously @, \\*, and % were all separate fields, but that seems\n # unecessary since the code is the same, so I joined them\n when /^@/, # UTF8, @PID:, @Date, @Media (basically metadata)\n /^\\*/, # *CHI, *LOI, TODO find out\n /^%/ # %mor, %gra, %act TODO find out\n fields = fields.push(last_field) unless last_field == ''\n last_field = line\n when /^\\t/ then # Some lines are tabbed in, line continuation\n # This just makes sure line continuations are good to go\n last_field += line\n else fail \"Don't know how to handle line: #{line}\" end\n end\n\n utt_num = 0\n utterances = []\n metadata = []\n last_utterance = []\n\n fields.each do |field|\n # Get rid of line break\n field.gsub!(/[\\n]/, ' ')\n case field\n when /^@/ then # @PID, @Comment, etc - add to metadata file\n metadata = metadata.push(field) unless field == ''\n when /^\\*/ then # These are Utterances *CHI, *PAT, etc\n unless last_utterance == []\n # corpus_metadata param omitted, file_info hash -> filename\n utterances.push(Utterance.new(utt_num += 1,\n last_utterance,\n filename,\n metadata))\n end\n # Initialize our last utterance - so * marks beginning of utterances\n last_utterance = [field]\n when /^%/ then # Add to our last_utterance Array\n last_utterance = last_utterance.push(field)\n else fail \"Don't know how to handle field: #{field}\" end\n end\n\n utterances\nend", "title": "" }, { "docid": "f03a6f9d3a04421ad85fcd43e2f36954", "score": "0.5258763", "text": "def parse(filename)\n File.readlines(filename).map { |line| parse_wire(line) }\nend", "title": "" }, { "docid": "5f61d9ceeae6a0712e0617ca1e3a3514", "score": "0.5251793", "text": "def identifier(file)\n\t\tlineNum = 0\n\t\tcommline = 0 \n\t\tcommcol = 0 \n\t\t\n\n\t\tfile.each_line do |line|\n\t\t\t# En cada iteracion (salto de linea), el numero de linea aumenta.\n\t\t\t# y el numero de columna vuelve a 1.\n\t\t\tlineNum += 1\n\t\t\tcolNum = 1\n\t\t\t# Cuando lo que queda de la linea es un salto de pagina, pasamos a la\n\t\t\t# proxima linea (arriba)\n\t\t\twhile line != \"\"\n\t\t\t\ttokAccepted=false\n\t\t\t\t$tokens.each do |expr,lexeme|\n\t\t\t\t\tif line =~ expr\n\t\t\t\t\t#si coincide se agrega a la lista de los lexemas leidos\n\t\t\t\t\t\tword = line[expr]\n\t\t\t\t\t\tline = line.partition(word).last\n\t\t\t\t\t\t@tokensList << Token.new(lexeme,word,[lineNum, colNum])\n\t\t\t\t\t\tcolNum += word.size\n\t\t\t\t\t\ttokAccepted=true\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif not tokAccepted\n\t\t\t\t\tcase line\n\n\t\t\t\t\t#Si encuentra {- ignora todo hasta encontrar -}, si no lo encuentra da error. \n\t\t\t\t\t# Este es para las tabulaciones, las cuenta como 4 espacios. \n\t\t\t\t\twhen /^\\t+/\n\t\t\t\t\t\tword = line[/^\\t+/]\n\t\t\t\t\t\tline = line.partition(word).last\n\t\t\t\t\t\tcolNum += 4\n\t\t\t\t\n\t\t\t\t\t# Este es para los espacios en blanco o saltos de linea.\n\t\t\t\t\twhen /^\\s+/\n\t\t\t\t\t\tword = line[/^\\s+/]\n\t\t\t\t\t\tline = line.partition(word).last\n\t\t\t\t\t\tcolNum += word.size\n\t\t\t\t\twhen /^#/ \n\t\t\t\t\t\tword = line[/^#/]\n\t\t\t\t\t\tline = line.partition(word).last\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tword = line[/^./]\n\t\t\t\t\t\tline = line.partition(word).last\n\t\t\t\t\t\t@errList << Token.new(\"\", word,[lineNum, colNum])\n\t\t\t\t\t\tcolNum += word.size\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# Si hubo algun caracter invalido, se imprime y se borra el arreglo de tokens validos.\n\t\tif (@errList.any? == true)\n\t\t\[email protected](@tokensList.length)\n\t\t\t#printErrors\n\t\t\treturn false\n\t\t# Si todos los caracteres son validos, se imprimen los tokens.\n\t\telse\n\t\t\t#printTokens\n\t\t\treturn true\n\t\tend\n\tend", "title": "" }, { "docid": "5555bbdb0c0af250976f66ede2d2e396", "score": "0.52457136", "text": "def load_representations\n reps = @tipr.xpath('mets:mets/mets:fileSec/mets:fileGrp[not(@USE=\"METADATA\")]//mets:FLocat/@xlink:href', \n TIPR::NS)\n reps.map { |r| SIPRepresentation.new(File.join(@path, r)) }\n end", "title": "" }, { "docid": "aa9f2bb0157c3a166c7976c853299d00", "score": "0.5243139", "text": "def convert_newick_to_nexus(newick_name,nexus_name)\n newick_file = File.open(newick_name,\"r\")\n nexus_file = File.open(nexus_name,\"w\")\n items = Array.new\n while(line = newick_file.gets())\n position = line.split(\"|\")\n if (position.size() > 1)\n items.push(position[0])\n end\n end\n nexus_file << \"#NEXUS\\n\"\n nexus_file << \"begin taxa;\\n\"\n nexus_file << \"\\tdimensions ntax=#{items.size()};\\n\"\n nexus_file << \"\\ttaxlabels\\n\"\n items.each do |f|\n nexus_file << \"\\t'#{f}'\\n\"\n end\n nexus_file << \";\\n\"\n nexus_file << \"end;\\n\"\n nexus_file << \"begin trees;\\n\"\n nexus_file << \"\\ttree tree_1 = [&R]\\n\"\n newick_file.rewind\n while(line = newick_file.gets())\n position = line.split(\"|\")\n if (position.size() > 1)\n nexus_file << \"'#{position[0]}'\"\n if(position[1] == \"known\")\n nexus_file << \"[&nodeColor=\\\"255,0,0\\\"]\"\n else if (position[1] == \"pred\")\n nexus_file << \"[&nodeColor=\\\"0,255,0\\\"]\"\n\n else\n #nexus_file << \"[&nodeColor=\\\"0,0,255\\\"]\"\n end\n end\n nexus_file << position[2]\n else\n nexus_file << line\n end\n end\n nexus_file << \"end;\"\nend", "title": "" }, { "docid": "3dee74f37b171a70431ef910ab2722eb", "score": "0.52417713", "text": "def load_files(file_list, package)\n files = {}\n id_list = @doc.xpath('//mets:file', NS)\n\n id_list = id_list.select do |f|\n file_list.include?(f.xpath('mets:FLocat/@xlink:href', NS).first.content)\n end\n \n id_list.each do |f|\n results = file_info(f, @ieid, @dfid_map, @doc)\n sum, oid, format = results[:sum], results[:oid], results[:format]\n path = package ? File.join(package, results[:path]) : results[:path]\n files[:\"#{results[:oid]}\"] = (DIPFile.new(sum, path, oid, format)) \n end\n files\n end", "title": "" }, { "docid": "3ce76114e745e916fc60f7038f113c24", "score": "0.5233562", "text": "def has_charge_information(input_filename)\n #<precursorList count=\"1\">\n # <precursor spectrumRef=\"controllerType=0 controllerNumber=1 scan=59\">\n # <isolationWindow>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000827\" name=\"isolation window target m/z\" value=\"939.43\" unitCvRef=\"MS\" unitAccession=\"MS:1000040\" unitName=\"m/z\"/>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000828\" name=\"isolation window lower offset\" value=\"2.0\" unitCvRef=\"MS\" unitAccession=\"MS:1000040\" unitName=\"m/z\"/>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000829\" name=\"isolation window upper offset\" value=\"2.0\" unitCvRef=\"MS\" unitAccession=\"MS:1000040\" unitName=\"m/z\"/>\n # </isolationWindow>\n # <selectedIonList count=\"1\">\n # <selectedIon>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000744\" name=\"selected ion m/z\" value=\"939.432189941406\" unitCvRef=\"MS\" unitAccession=\"MS:1000040\" unitName=\"m/z\"/>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000041\" name=\"charge state\" value=\"2\"/>\n # <cvParam cvRef=\"MS\" accession=\"MS:1000042\" name=\"peak intensity\" value=\"1321.692016601563\" unitCvRef=\"MS\" unitAccession=\"MS:1000131\" unitName=\"number of counts\"/>\n # </selectedIon>\n # </selectedIonList>\n \n reader=XML::Reader.file(input_filename) \n \n while(reader.read)\n \n if ( reader.local_name==\"precursor\")\n \n subdoc=reader.read_inner_xml\n \n if ( subdoc =~ /MS:1000041/ )\n return true\n end\n \n end\n \n end\n \n return false\n \nend", "title": "" }, { "docid": "c895e926e7c28f6344b4aabb3121bab7", "score": "0.5208329", "text": "def extract(data)\n return data if @markup.format == :txt\n data.gsub(/(@startuml\\r?\\n.+?\\r?\\n@enduml\\r?$)/m) do\n id = Digest::SHA1.hexdigest($1)\n @map[id] = { :code => $1 }\n id\n end\n end", "title": "" }, { "docid": "1359274447b9d92d503489398504267a", "score": "0.52081114", "text": "def initialize(mixed, id)\n @code = \"pe\"\n # load data\n if mixed.is_a? MarcNode\n # TODO, load data when the marc_node is passed as parameter\n # output directory will certainly have to be changed\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n # home dir\n @out_path = \"#{Rails.root}/public/incipits/#{id[12,14]}/\"\n\n\n if RISM::BASE == \"uk\" then\n @number = mixed.fetch_first_by_tag('a').content || \"na\"\n @number = @number + \"-\" + mixed.fetch_first_by_tag('b').content || \"nb\" rescue @number + \"-\" + \"nb\"\n @number = @number + \"-\" + mixed.fetch_first_by_tag('c').content || \"nc\" rescue @number + \"-\" + \"nc\"\n else\n @number = mixed.fetch_first_by_tag('a').content || \"no-number\"\n @number = @number + \".\" + mixed.fetch_first_by_tag('b').content || \"?\" rescue @number + \".\" + \"?\"\n @number = @number + \".\" + mixed.fetch_first_by_tag('c').content || \"?\" rescue @number + \".\" + \"?\"\n end\n \n @clef = mixed.fetch_first_by_tag('g').content || 'none' rescue @clef = 'none'\n @keysig = mixed.fetch_first_by_tag('n').content || 'none' rescue @keysig = 'none'\n @timesig = mixed.fetch_first_by_tag('o').content || 'none' rescue @timesig = 'none'\n @incipit = mixed.fetch_first_by_tag('p').content || 'none' rescue @incipit = 'none'\n @keymode = mixed.fetch_first_by_tag('r').content || ' ' rescue @keymode = ' ' ## 80390 out of 113435\n @file_name = id.to_s + \"-\" + @number\n elsif mixed.is_a? WorkIncipit\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n id_string = \"0\" + mixed.id.to_s\n @out_path = \"#{Rails.root}/public/incipits/#{id_string[0,2]}/\"\n #@number = mixed.movement || \"no-number\"\n #@number = @number + \".\" + mixed.excerpt || \"none\" rescue @number + \".\" + \"none\"\n #@number = @number + \".\" + mixed.heading || \"none\" rescue @number + \".\" + \"none\"\n @clef = mixed.clef || 'G-2' rescue @clef = 'G-2'\n @keysig = mixed.key_signature || '' rescue @keysig = ''\n @timesig = mixed.time_signature || '' rescue @timesig = ''\n @incipit = mixed.notation || '' rescue @incipit = ''\n # cleanup output directory\n @file_name = id_string #+ \"-\" + @number\n if mixed.code == \"da\"\n @code = \"darms\"\n end\n else\n @tmp_path = \"#{Rails.root}/tmp/incipits/input/\"\n @out_path = \"#{Rails.root}/public/incipits/input/\"\n @file_name = rand.to_s\n @clef = mixed[:clef] || 'G-2' rescue @clef = 'G-2'\n @keysig = mixed[:keysig] || '' rescue @keysig = ''\n @timesig = mixed[:timesig] || '' rescue @timesig = ''\n @incipit = mixed[:incipit] || '' rescue @incipit = ''\n # cleanup output directory\n FileUtils.rm Dir.glob(\"#{@out_path}*\") \n end\n @results = \"\"\n end", "title": "" }, { "docid": "e7f12f5973571d6fa785ce73d1181ce4", "score": "0.52025074", "text": "def parse_maps(content)\n lines = content.split(\"\\n\")\n lines.map do |line|\n s = line.scan(%r{^([0-9a-f]+)-([0-9a-f]+)\\s([rwxp-]{4})[^/|\\[]*([/|\\[].+)?$})[0]\n next nil if s.nil?\n\n s[0], s[1] = s[0, 2].map { |h| h.to_i(16) }\n s[3] ||= '' # some segments don't have a name\n s\n end.compact\n end", "title": "" }, { "docid": "2fbd1141a5d3803251f00ea5c01e38ba", "score": "0.5180865", "text": "def extract; end", "title": "" }, { "docid": "2fbd1141a5d3803251f00ea5c01e38ba", "score": "0.5180865", "text": "def extract; end", "title": "" }, { "docid": "c0eb66b01713b052078585c43d6d332a", "score": "0.5163953", "text": "def extract_annotations_from(file, pattern); end", "title": "" }, { "docid": "d31e2d5d406c66b0f9567a29caa470fb", "score": "0.51494956", "text": "def parse\n if File.exist? @Filename \n File.open(@Filename).each{ |line| \n @Attributes[line.split[0]] = line.split[1]\n }\n else \n File.open(@Filename, 'w') \n end \n end", "title": "" }, { "docid": "aebbca20990651f95019dae5db646fac", "score": "0.51472014", "text": "def parse_map_file()\n File.open(@options.map_file).each_line do |line| \n parts = line.chomp.split(/\\s/)\n snp = Snp.new(parts[1],parts[0],parts[3])\n @snps.push(snp)\n end #each line\n end", "title": "" }, { "docid": "e30ab58dd4038d6d597fc527c62863b4", "score": "0.5144", "text": "def parse\n File.readlines(@filename).each_slice(3).map do |definition, term, _|\n {:definition => definition.chomp, :term => term.chomp}\n end\n end", "title": "" }, { "docid": "6ff880297a53c0aa4996413a853ba63d", "score": "0.514115", "text": "def each_psm(use_pbar=@use_pbar)\n reader = Nokogiri::XML::Reader(File.open(@mzid_file))\n pbar = ProgressBar.new(\"PSMs\", @num_spec) if use_pbar\n reader.each do |node|\n next if node.name != \"SpectrumIdentificationResult\" \n # parse local spec result entry\n tmp_node = Nokogiri::XML.parse(node.outer_xml)\n tmp_node.remove_namespaces!\n root = tmp_node.root\n # parse spectrum id item\n psms_of_spec = root.xpath('.//SpectrumIdentificationItem')\n psms_of_spec.each do |psm_node|\n # get PSM object\n psm = get_psm(psm_node)\n # yield psm object\n yield psm\n end\n pbar.inc if use_pbar\n end\n pbar.finish if use_pbar\n end", "title": "" }, { "docid": "686070fea5b1604eb0f81a5cc30bf226", "score": "0.51370156", "text": "def parse_xml(filename)\n Zlib::GzipReader.open(filename, encoding: \"BINARY\") { |f|\n Nori.new.parse f.read.gsub /&#x[a-zA-Z0-9]{2};/, ''\n }\nend", "title": "" }, { "docid": "cc13dfc651a5424fc58c4f267292aeae", "score": "0.5128952", "text": "def parse_indexes(marc)\n tag868 = marc['868']\n return [] unless tag868\n\n indexes = []\n\n marc.each_by_tag('868') do |t868|\n indexes.push(t868.subfields.collect { |s| s.value if s.code == 'a' }.join(' ').strip)\n end\n\n indexes\n end", "title": "" }, { "docid": "977006a1ceb0cc7c6191b002af9aa19a", "score": "0.51225007", "text": "def extract_meta\n doc = Nokogiri::XML(@xml)\n stageattr = nil\n if @type =~ /res$/\n @genre = 'resolution'\n stageattr = 'resolution-stage'\n end\n if @type =~ /^(hr|s)$/\n @genre = 'bill'\n stageattr = 'bill-type'\n end\n @stage = doc.xpath(\"//#{@genre}\").attr(stageattr).content unless ( doc.xpath(\"//#{@genre}\").nil? || doc.xpath(\"//#{@genre}\").attr(stageattr).nil? )\n @title = doc.xpath('//official-title').first.content.gsub(/[[:space:]]+/,' ')\n @dctitle = doc.xpath('//dc:title', 'dc' => DC_NS).first.content unless doc.xpath('//dc:title', 'dc' => DC_NS).first.nil?\n @dctitle = title.dup if @dctitle.nil?\n @dctitle = Iconv.iconv('ascii//translit', 'utf-8', @dctitle)[0]\n\n @short_title = doc.xpath('//short-title').first.content unless doc.xpath('short-title').first.nil?\n @legisnum = doc.xpath('//legis-num').first.content\n content, @topics = @title.summarize( :topics => true )\n @topics = Iconv.iconv('ascii//translit', 'utf-8', @topics)[0]\n @topics.gsub!(/,\\s*,/,',')\n @topics.gsub!(/,(\\S)/,', \\1')\n bflat = @legisnum.gsub(/\\.\\s+/, '_').downcase\n bnumber = @legisnum.split(/\\s+/).last\n @uri = RDF::URI(\"#{BILL_URI_PREFIX}/#{@congress}_#{bflat}\")\n end", "title": "" }, { "docid": "e20230f599dec71669129553ea20db3a", "score": "0.5120747", "text": "def parsed; end", "title": "" }, { "docid": "8cff8d90e7c28d45bd25067f532637eb", "score": "0.51198643", "text": "def extract_iso19139_metadata(doc)\n h = {}\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString', NS).tap do |node|\n h[:title] = [node.text.strip]\n end\n\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox', NS).tap do |node|\n w = node.at_xpath('gmd:westBoundLongitude/gco:Decimal', NS).text.to_f\n e = node.at_xpath('gmd:eastBoundLongitude/gco:Decimal', NS).text.to_f\n n = node.at_xpath('gmd:northBoundLatitude/gco:Decimal', NS).text.to_f\n s = node.at_xpath('gmd:southBoundLatitude/gco:Decimal', NS).text.to_f\n h[:coverage] = GeoConcerns::Coverage.new(n, e, s, w).to_s\n end\n\n doc.at_xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString', NS).tap do |node|\n h[:description] = [node.text.strip]\n end\n\n doc.xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue=\\'originator\\']', NS).each do |node|\n h[:creator] = begin\n [node.at_xpath('ancestor-or-self::*/gmd:individualName', NS).text.strip]\n rescue\n [node.at_xpath('ancestor-or-self::*/gmd:organisationName', NS).text.strip]\n end\n end\n\n # TODO: Not sure if custodian is the same as source\n doc.xpath('//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue=\\'custodian\\']', NS).each do |node|\n h[:source] = begin\n [node.at_xpath('ancestor-or-self::*/gmd:individualName', NS).text.strip]\n rescue\n [node.at_xpath('ancestor-or-self::*/gmd:organisationName', NS).text.strip]\n end\n end\n\n h\n end", "title": "" }, { "docid": "fd1417faef88f193e387f5363cd81883", "score": "0.5113706", "text": "def amis\n content.map do |line|\n Ami.new(\n line.split[7],\n line.split[4],\n line.split[5],\n line.split[6],\n line.split[8..9].last)\n end\n end", "title": "" }, { "docid": "ebda050429381562152d7a96a34423a8", "score": "0.5110996", "text": "def parse(file)\n xml_string = open(file, \"r\").read.to_s\n return parse_fnt_xml_info(xml_string), parse_fnt_xml_char_data(xml_string), parse_fnt_xml_kerning_data(xml_string), parse_fnt_xml_file(xml_string)\n end", "title": "" }, { "docid": "ebda050429381562152d7a96a34423a8", "score": "0.5110996", "text": "def parse(file)\n xml_string = open(file, \"r\").read.to_s\n return parse_fnt_xml_info(xml_string), parse_fnt_xml_char_data(xml_string), parse_fnt_xml_kerning_data(xml_string), parse_fnt_xml_file(xml_string)\n end", "title": "" }, { "docid": "5d938956e4905b3cf794fddf60fbdc18", "score": "0.51100326", "text": "def mzs\r\n @data[0]\r\n end", "title": "" }, { "docid": "0c47e7880e8d39499548527345e86cf6", "score": "0.51092994", "text": "def parse_index_list\n self.seek(self.stat.size - 200)\n # parse the index offset\n tmp = self.read\n tmp =~ MzML::RGX::INDEX_OFFSET\n offset = $1\n # if I didn't match anything, compute the index and return\n unless (offset)\n return compute_index_list\n end\n @index = {}\n self.seek(offset.to_i)\n tmp = Nokogiri::XML.parse(self.read).root\n tmp.css(\"index\").each do |idx|\n index_type = idx[:name].to_sym\n @index[index_type] = {}\n idx.css(\"offset\").each do |o|\n @index[index_type][o[:idRef]] = o.text().to_i\n end\n end\n return @index\n end", "title": "" }, { "docid": "5c992738078fd55d4beaf0f584d51e39", "score": "0.51089793", "text": "def parse \n end", "title": "" }, { "docid": "9e6798d3a090530a634bd0731a46f0cb", "score": "0.5108334", "text": "def read_mapping_from_list\n say 'Reading identities from raw text list'\n reader = reader(opts[:m])\n @identities = reader.each.map(&:to_f)\n reader.close\n end", "title": "" }, { "docid": "48e043016455c2970f8c0c8f9aa4c619", "score": "0.510672", "text": "def load_files \n repfiles = @rep.xpath('mets:mets/mets:fileSec//mets:file', TIPR::NS)\n \n # Map to [filepath, checksum], and update fid_map\n repfiles.map do |f|\n file = f.xpath('mets:FLocat/@xlink:href', TIPR::NS).first.content\n sum = f.xpath('@CHECKSUM', TIPR::NS).first.content\n id = f.xpath('@ID', TIPR::NS).first.content\n s = SIPFile.new(file, sum)\n @fid_map[:\"#{id}\"] = s\n s\n end\n \n end", "title": "" }, { "docid": "6ba5d01bf3516dd704a6724f066e605f", "score": "0.5102635", "text": "def parse_lgen(lgen_file)\n\t people = []\n person = nil\n File.open(lgen_file).each_line do |line|\n parts = line.chomp.split(/\\s/)\n if nil == person || parts[1] != person.number then\n # if nil == person || parts[1].to_i != person.number.to_i then\n if person then\n people.push(person)\n print \".\"\n STDOUT.flush\n if 0 == people.size % 1000 then\n puts \"\"\n STDOUT.flush\n end\n \t \n end\n #next/new person\n person = Person.new(parts[0],parts[1],nil,nil,nil,nil)\n end\n\n #Family\tSample ID\tSNP Name\tAllele1 - Top\tAllele2 - Top\n snp = @snps.detect {|s| s.name == parts[2].downcase}\n unless snp then\n snp = Snp.new(parts[2], 0, 0)\n @snps.push(snp)\n end\n\n alleles = [parts[3].downcase,parts[4].downcase]\n person.add_genotype(Genotype.new(snp,alleles)) \n end #each line\n if person then\n people.push(person)\n end\n people\n\tend", "title": "" }, { "docid": "de5f1d78c31d345088567fadc8c69c4b", "score": "0.50953394", "text": "def parse_this_file()\n\tputs \"parsing network notes...\"\n\t$func = method( :parse_file_header )\n\t$head = method( :header_print_none )\n\tlines = IO.readlines( $0 )\n\tif ( $generateCODE )\n\t\tlines.each { |l| $func.call( l ) }\n\tend\n\treturn lines\nend", "title": "" }, { "docid": "3aa66c3b8f1d86fd48f3581f28f4b799", "score": "0.5091914", "text": "def transform_aleph_marc_xml_to_mods(aleph_marc_xml, pdf_uri, id)\n logger.debug \"#{Time.now.to_s} DEBUG: Running XSLT transformation of Aleph MARC XML to MODS...\"\n tmp_doc = ConversionService.transform_aleph_to_slim_marc(aleph_marc_xml, pdf_uri)\n mods = ConversionService.transform_marc_to_mods(tmp_doc)\n\n recInfo = Nokogiri::XML::Node.new('recordInfo', mods)\n identifier = Nokogiri::XML::Node.new('recordIdentifier', mods)\n identifier.content = id\n identifier.set_attribute('source', 'kb-aleph')\n recInfo.children = identifier\n mods.css('mods location').last.add_next_sibling(recInfo)\n\n empty_uri_identifier_element = Nokogiri::XML::Node.new('identifier', mods)\n empty_uri_identifier_element.content = ''\n empty_uri_identifier_element.set_attribute('type', 'uri')\n mods.css('mods location').last.add_next_sibling(empty_uri_identifier_element)\n mods\n end", "title": "" }, { "docid": "3f3b567cdaeb1ad0bea086c21f929f07", "score": "0.50864476", "text": "def extract\n machine = @parser\n isa = nil\n machine.first.flatmap do |isa_l| \n isa = isa_l\n break\n end\n \n data_hash = {}\n\n # First CHECK to Make sure we have received a valid response\n isa.iterate(:GS) do |gs| \n gs.iterate(:ST) do |st|\n st.iterate(:HL) do |hl|\n if hl.element(1).map(&:node).map(&:value).fetch(nil) == '3' # 3 = Patient Type User\n aaa = hl.find(:NM1).fetch(nil).find(:AAA).fetch(nil)\n debug_log aaa.inspect\n if aaa\n Rails.logger.error \"EDI Failure Text Below: \\n #{@edi_content}\"\n return {}\n end\n end\n end\n end\n end\n\n eb_counter = 1\n isa.iterate(:GS) do |gs| \n gs.iterate(:ST) do |st|\n st.iterate(:HL) do |hl|\n if hl.element(1).map(&:node).map(&:value).fetch(nil) == '3' # 3 = Patient Type User\n insured = {}\n el(hl.find(:NM1), 1){|e| insured[:party_type] = e }\n el(hl.find(:NM1), 2){|e| insured[:party_individual] = e }\n el(hl.find(:NM1), 3){|e| insured[:party_last_name] = e }\n el(hl.find(:NM1), 4){|e| insured[:party_first_name] = e }\n el(hl.find(:NM1), 5){|e| insured[:party_middle_name] = e }\n el(hl.find(:NM1), 6){|e| insured[:party_prefix_name] = e }\n el(hl.find(:NM1), 7){|e| insured[:party_suffix_name] = e }\n el(hl.find(:NM1), 8){|e| insured[:party_id_type] = e }\n el(hl.find(:NM1), 9){|e| insured[:party_id_value] = e }\n \n n3 = hl.find(:NM1).fetch(nil).find(:N3)\n\n el(n3, 1){|e| insured[:party_address_line_1] = e }\n el(n3, 2){|e| insured[:party_suite] = e }\n\n n4 = n3.fetch(nil).find(:N4)\n\n el(n4, 1){|e| insured[:party_city] = e }\n el(n4, 2){|e| insured[:party_state] = e }\n el(n4, 3){|e| insured[:party_zip] = e }\n\n dmg = n3.fetch(nil).find(:DMG)\n\n el(dmg, 2){|e| insured[:party_date] = e }\n el(dmg, 3){|e| insured[:party_gender] = e }\n el(dmg, 4){|e| insured[:party_marital_status] = e }\n \n data_hash[:insured] = insured\n end\n \n hl.find(:NM1).fetch(nil).iterate(:EB) do |eb|\n eligibility = {}\n el(eb, 1){|e| eligibility[:eb_code] = e }\n el(eb, 2){|e| eligibility[:coverage_level_code] = e }\n el(eb, 3){|e| eligibility[:service_type_code] = e }\n el(eb, 4){|e| eligibility[:insurance_type_code] = e }\n el(eb, 5){|e| eligibility[:plan_coverage_description] = e }\n el(eb, 6){|e| eligibility[:time_period_qualifier] = e }\n el(eb, 7){|e| eligibility[:monetary_amount] = e.to_f }\n el(eb, 8){|e| eligibility[:percent_as_decimal] = e }\n el(eb, 9){|e| eligibility[:quantity_qualifier] = e }\n el(eb, 10){|e| eligibility[:quantity] = e.to_f }\n el(eb, 11){|e| eligibility[:authorization_indicator] = e }\n el(eb, 12){|e| eligibility[:in_plan_network_indicator] = e }\n el(eb, 13){|e|\n #Special Processing for procedure codes\n code = e.split('|')[1]\n value = e\n value = @hcpc_codes[code] if @hcpc_codes[code] \n eligibility[:medical_procedure_identifier] = value \n }\n if true \n # pp eb.successors\n end\n\n dtp_counter = 1\n eb.iterate(:DTP) do |dtp|\n el(dtp, 1){|e| \n value = e\n value = cms_label( eligibility[:service_type_code], value) \n eligibility[:\"date_time_period_qualifier_#{dtp_counter}\"] = value \n }\n el(dtp, 3){|e| eligibility[:\"date_time_period_#{dtp_counter}\"] = e }\n dtp_counter = dtp_counter + 1\n end\n\n ref = eb.find(:REF)\n el(ref, 1){|e| eligibility[:reference_id_qualifier] = e }\n el(ref, 2){|e| eligibility[:reference_id] = e }\n el(ref, 3){|e| eligibility[:reference_description] = e }\n\n msg = eb.find(:MSG)\n el(msg, 1){|e| eligibility[:message] = e }\n \n ls = eb.find(:LS).fetch(nil)\n if ls\n related_parties_counter = 1\n ls.iterate(:N1G) do |nm1|\n eligibility[:related_parties] = {} if eligibility[:related_parties].nil?\n related = {}\n el(nm1, 1){|e| related[:party_type] = e }\n el(nm1, 2){|e| related[:party_individual] = e }\n el(nm1, 3){|e| related[:party_last_name] = e }\n el(nm1, 4){|e| related[:party_first_name] = e }\n el(nm1, 5){|e| related[:party_middle_name] = e }\n el(nm1, 6){|e| related[:party_prefix_name] = e }\n el(nm1, 7){|e| related[:party_suffix_name] = e }\n el(nm1, 8){|e| \n value = e\n value = \"CMS NPI\" if value == 'CodeList.external(537)'\n related[:party_id_type] = value\n }\n el(nm1, 9){|e| \n related[:party_id_value] = e\n }\n eligibility[:related_parties][:\"related_party_#{related_parties_counter}\"] = related\n related_parties_counter += 1\n end\n end\n\n if eligibility.blank? == false\n data_hash[:\"eligibility_or_benefit_#{eb_counter}\"] = eligibility\n eb_counter = eb_counter + 1\n end\n end\n end\n end\n end \n data_hash\n end", "title": "" }, { "docid": "90b0c777c7b87bb4ad193ab7756fcd80", "score": "0.5069379", "text": "def get_annotations_xml(xmlfile)\n annos = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] ={} } }\n @doc = Nokogiri::XML(File.open(xmlfile))\n geneid = (@doc.xpath(\"//xmlns:xref\"))[0]['id']\n\n (@doc.xpath(\"//xmlns:go-xref\")).each do |p|\n ## Descriptions might have [\"] characters that would results unexpected comma separation, so replace with [']\n info = p['category'] + '\",\"' + (p['name']).gsub(/\\\"/, \"'\")\n annos[geneid][p['db']][p['id']] = info\n end\n\n (@doc.xpath(\"//xmlns:signature\")).each do |p|\n library = \"\"\n p.children.each do |k|\n k.to_s =~ /signature-library-release.*library=\"(.*)\"/\n test = $1\n\t\t if test =~ /\\w/\n library = test\n end\n end\n info = \"\"\n next unless p['name'] =~ /\\w/\n if p['desc'] !~ /\\w/\n info = (p['name']).gsub(/\\\"/, \"'\")\n else\n info = (p['name']).gsub(/\\\"/, \"'\") + '\",\"' + (p['desc']).gsub(/\\\"/, \"'\")\n end\n annos[geneid][library][p['ac']] = info\n end\n \n annos\nend", "title": "" }, { "docid": "1e5abefd1f5eeebedc1b85f049bc6695", "score": "0.5065112", "text": "def parse\n info \"---- Digest DB and store data in mRNA Hash (LruCache)\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = SeekRecList.new(@iter.fh,@options[:parser],@lru) # Store containers, like genes, contigs\n @orflist = SeekLinkedRecs.new # Store linked gene records\n @mrnalist = SeekLinkedRecs.new # Store linked mRNA records\n @cdslist = SeekLinkedRecs.new\n @exonlist = SeekLinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @iter.each_rec do |fpos, line|\n rec = case @options[:parser]\n when :bioruby\n Bio::GFF::GFF3::BioRubyFileRecord.new(fpos, line)\n when :line\n Bio::GFF::GFF3::FastParserFileRecord.new(fpos, line)\n else\n raise 'Unknown parser'\n end\n store_record(rec)\n end\n @iter.each_sequence do | id, bioseq |\n @sequencelist[id] = bioseq.to_s\n end\n validate_mrnas \n validate_cdss\n show_unrecognized_features\n @genelist = @count_ids.keys \n read_fasta\n @lru.display('After reading files')\n end", "title": "" }, { "docid": "cd3c728dec019153048e75385973f052", "score": "0.50650775", "text": "def loadFromONSData( filename, mini = nil )\n lines = Array.new();\n puts \"opened file #{filename}\"\n ## singleton mini = MiniMacro.instance;\n if( mini.nil? ) then\n puts \" creating a new minimacro \"\n mini = MiniMacro.new ;\n end\n \n IO.foreach( filename ){\n |line|\n lines << line;\n }\n pos = 0;\n while not( lines[ pos ] =~ /92.*/ ) # skip \n pos += 1;\n end\n pos -= 1 \n while pos < lines.length\n ## puts \"starting block on lines[#{pos}] = #{lines[ pos ]} \";\n # match the header line, which lools like:\n ## 92CBZWMU 01987 1 ET 3.1 1 0 0 1 33\n # there are annual, quarterly and monthly versions in the data. \n # The (M) picks the header for the monthly one.\n # the monthly data follows two lines below\n if( lines[ pos ] =~ /92(\\w{4,4})(M)([A|U])([\\d| ]{4,4})([\\d| ]{4,4})([\\d| ]{2,2}).*/ ) then\n puts \"matched monthly line; 1 #{$1} 2 #{$2} 3 #{$3}\"\n id = $1.downcase();\n period = $2;\n adjusted = $3;\n baseYear = $5; \n baseMonth = $6;\n ## puts \"matched 92 RE\";\n pos = matchMonthly( mini, lines, pos, id, period, adjusted, baseYear, baseMonth )\n elsif( lines[ pos ] =~ /92(\\w{4,4})([A|Q])([A|U])([\\d| ]{4,4})([\\d| ]{4,4})([\\d| ]{2,2}).*/ ) then\n puts \"matched 92 RE\";\n ## this is quarterly data. near duplicate of above... \n period = $2;\n baseYear = $5;\n baseMonth = $6;\n adjusted = $3;\n id = $1.downcase();\n pos = matchQuarterly( mini, lines, pos, id, period, adjusted, baseYear, baseMonth )\n else\n pos += 1 ## skip to next line\n end; #92:header\n end; #while not eofcg\n mini.sortDates();\n return mini;\nend", "title": "" }, { "docid": "21f12b8b38f04d9497b258f2616ab3bc", "score": "0.5052316", "text": "def records\n @marcxml.xpath('//xmlns:record')\n end", "title": "" }, { "docid": "7fd9ba677f7bf1b034f32300a57a6d03", "score": "0.5045373", "text": "def parse\n \n end", "title": "" }, { "docid": "3d9c45acd1ecb76c3fde617e6b9fe3f2", "score": "0.50388443", "text": "def to_mzML\n puts \"\\n--------------------------------\"\n puts \"Transforming raw file to mzML format...\\n\\n\"\n \n host = config_value(\"//Host/@ip\")\n port = 2200 # Completely arbitrary\n \n client = TCPSocket.open(host, port)\n\n fileName = @file.split(\"/\")[-1].chomp(File.extname(@file))\n \n puts \"Sending raw file\"\n client.puts fileName\n data = IO.read(@file)\n client.print data\n client.print \"\\r\\r\\n\\n\" #This is the delimiter for the server\n \n puts \"Receiving mzML file\"\n file = File.open(\"#{$path}../data/spectra/#{fileName}.mzML\", 'wb')\n data = client.gets(\"\\r\\r\\n\\n\")\n file.print data\n \n client.close\n end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.50327355", "text": "def parse; end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.50327355", "text": "def parse; end", "title": "" }, { "docid": "3c7e809b09238c9980113e7b7bd85c03", "score": "0.5032059", "text": "def extract(inputName, outputName)\n # output file\n outputFile = File.open(outputName, \"w\")\n\n # input file\n File.open(inputName, \"r\") do |inputFile|\n wordPattern = /^(\\S+?),/\n lemmaPattern = /^(\\S+?,){#{LEMMA_INDEX+4}}(\\S+?),/\n while line = inputFile.gets\n if line =~ wordPattern\n word = $~[1]\n end\n\n if line =~ lemmaPattern\n lemma = $~[2]\n end\n\n if word != lemma\n if (isKatakana?(word) && isKatakana?(lemma)) || (isKanji?(word) && isKanji?(lemma) && word.length == lemma.length)\n outputFile.puts \"#{lemma} #{line}\"\n end\n end\n end\n end\n\n outputFile.close\nend", "title": "" }, { "docid": "8b11070805b56c5a1c49951cd49c3ef3", "score": "0.5020529", "text": "def to_mzXML\n puts \"\\n--------------------------------\" # These puts statements at the begining of each class is my way of showing the progress of the program to the user.\n puts \"Transforming raw file to mzXML format...\\n\\n\"\n \n options = config_value(\"//ReAdW/@commandLine\")\n basename = File.basename(@file).chomp(File.extname(@file))\n system(\"wine readw.exe #{options} --mzXML #{@file} #{$path}../data/spectra/#{basename}.mzXML 2>/dev/null\")\n end", "title": "" }, { "docid": "9220c7e8c19863bdce1a37563b71fe48", "score": "0.50152194", "text": "def to_xml(filename=nil)\n # TODO: support indexed mzml files\n io = filename ? File.open(filename, 'w') : StringIO.new\n xml = Builder::XmlMarkup.new(:target => io, :indent => 2)\n xml.instruct!\n\n mzml_atts = Default::NAMESPACE.dup\n mzml_atts[:version] = @version || Default::VERSION\n mzml_atts[:accession] = @accession if @accession\n mzml_atts[:id] = @id if @id\n\n xml.mzML(mzml_atts) do |mzml_n|\n # the 'if' statements capture whether or not the list is required or not\n raise \"#{self.class}#cvs must have > 0 Mspire::Mzml::CV objects\" unless @cvs.size > 0 \n Mspire::Mzml::CV.list_xml(@cvs, mzml_n)\n @file_description.to_xml(mzml_n)\n if @referenceable_param_groups\n Mspire::Mzml::ReferenceableParamGroup.list_xml(@referenceable_param_groups, mzml_n)\n end\n if @samples && @samples.size > 0\n Mspire::Mzml::Sample.list_xml(@samples, mzml_n)\n end\n Mspire::Mzml::Software.list_xml(@software_list, mzml_n)\n if @scan_settings_list && @scan_settings_list.size > 0\n Mspire::Mzml::ScanSettings.list_xml(@scan_settings_list, mzml_n)\n end\n icl = Mspire::Mzml::InstrumentConfiguration.list_xml(@instrument_configurations, mzml_n)\n Mspire::Mzml::DataProcessing.list_xml(@data_processing_list, mzml_n)\n @run.to_xml(mzml_n)\n end\n \n if filename\n io.close \n self\n else\n io.string\n end\n end", "title": "" }, { "docid": "73cffa498de4eb0d52f0476156316031", "score": "0.501171", "text": "def ark_id\n element = @mets.xpath(\"/mets:mets/@OBJID\")\n element = element.to_s\n return nil unless element.include?(\"ark\")\n element\n end", "title": "" }, { "docid": "a51b46b60ea38b48d0f84c601cf66e83", "score": "0.50097454", "text": "def parse_fnt_xml_info(xml_string)\n info = nil\n xml_string.scan(/<info face=\"(.*)\" size=\"(.*)\" bold=\"(.*)\" italic=\"(.*)\" charset=\"(.*)\" unicode=\"(.*)\" stretchH=\"(.*)\" smooth=\"(.*)\" aa=\"(.*)\" padding=\"(.*)\" spacing=\"(.*)\" outline=\"(.*)\"\\/>/) do |m|\n info = {\n :face => m[0],\n :size => m[1].to_i,\n :bold => int_to_bool(m[2]),\n :italic => int_to_bool(m[3]),\n :charset => m[4],\n :unicode => m[5],\n :stretchH => m[6].to_f,\n :smooth => int_to_bool(m[7]),\n :aa => int_to_bool(m[8]),\n :padding => string_list_to_int_list(m[9]),\n :spacing => string_list_to_int_list(m[10])\n }\n end\n xml_string.scan(/<common lineHeight=\"(.*)\" base=\"(.*)\" scaleW=\"(.*)\" scaleH=\"(.*)\" pages=\"(.*)\" packed=\"(.*)\"\\/>/) do |m|\n info = {\n :lineHeight => m[0].to_i,\n :base => m[1].to_i,\n :scaleW => m[2].to_i,\n :scaleH => m[3].to_i,\n :pages => m[4].to_i,\n :packed => int_to_bool(m[5])\n }.merge(info)\n end\n info\n end", "title": "" }, { "docid": "a51b46b60ea38b48d0f84c601cf66e83", "score": "0.50097454", "text": "def parse_fnt_xml_info(xml_string)\n info = nil\n xml_string.scan(/<info face=\"(.*)\" size=\"(.*)\" bold=\"(.*)\" italic=\"(.*)\" charset=\"(.*)\" unicode=\"(.*)\" stretchH=\"(.*)\" smooth=\"(.*)\" aa=\"(.*)\" padding=\"(.*)\" spacing=\"(.*)\" outline=\"(.*)\"\\/>/) do |m|\n info = {\n :face => m[0],\n :size => m[1].to_i,\n :bold => int_to_bool(m[2]),\n :italic => int_to_bool(m[3]),\n :charset => m[4],\n :unicode => m[5],\n :stretchH => m[6].to_f,\n :smooth => int_to_bool(m[7]),\n :aa => int_to_bool(m[8]),\n :padding => string_list_to_int_list(m[9]),\n :spacing => string_list_to_int_list(m[10])\n }\n end\n xml_string.scan(/<common lineHeight=\"(.*)\" base=\"(.*)\" scaleW=\"(.*)\" scaleH=\"(.*)\" pages=\"(.*)\" packed=\"(.*)\"\\/>/) do |m|\n info = {\n :lineHeight => m[0].to_i,\n :base => m[1].to_i,\n :scaleW => m[2].to_i,\n :scaleH => m[3].to_i,\n :pages => m[4].to_i,\n :packed => int_to_bool(m[5])\n }.merge(info)\n end\n info\n end", "title": "" }, { "docid": "49e0c89a3bb19adc56956d9a7d52e866", "score": "0.5008039", "text": "def parse(filename)\n notes = {}\n if filename.downcase =~ EXTS\n if File.file?(filename)\n File.open(filename, 'r') do |file|\n ext = filename[filename.rindex('.'), filename.length].downcase\n number = 1\n file.each do |line|\n if line =~ COMMENT[ext]\n if line.downcase =~ NOTE\n for pattern in TRIM[ext]\n line.sub!(pattern, '')\n end\n notes[number] = line\n end\n end\n number += 1\n end\n end\n end\n end\n return notes\nend", "title": "" }, { "docid": "625d342b80537b76713652e91b840ab6", "score": "0.50075996", "text": "def process_mets\n sips = sip_file_nodes\n aips = aip_file_nodes\n Rails.logger.warn(\"Couldn't find all of the file_sets\") if sips.count >= actual_num_filesets\n \n sips.each do |file_node|\n fset = find_referenced_fileset_by_label(file_set_id(file_node))\n if fset.blank?\n Rails.logger.warn(\n \"Couldn't find fileset with label #{file_set_id(file_node)}\"\n ) unless excluded_label?(file_set_id(file_node))\n else\n add_or_update_file(fset, 'original', file_node)\n fset.reload\n fset.mets_extracted = true\n fset.save\n # Process aip files, assume there is a max of one per sip file\n related_files(file_node).each do |rel|\n node = aips.select { |n| uuid(n) == rel }.first\n unless node.blank?\n add_or_update_file(fset, 'preservation', node)\n fset.reload\n fset.mets_extracted = true\n fset.save\n end\n end\n Rails.logger.info(\n \"Updated FileSet #{fset.id}: #{file_set_id(file_node)}\"\n )\n end\n end\n file_set.mets_extracted = true && file_set.save unless sips.count >= actual_num_filesets\n true\n rescue StandardError => e\n Rails.logger.error(e.message)\n false\n end", "title": "" }, { "docid": "8c3652f6520915ab2dc7ff28bc467307", "score": "0.50072974", "text": "def parse_isni_response res_body\n \n results = []\n parsed_response = MultiXml.parse(res_body)['searchRetrieveResponse']\n #logger.debug \"Entire parsed response from ISNI: \\n\" + parsed_response.ai\n return unless parsed_response['records']\n @total_items = parsed_response['numberOfRecords'].to_i\n records = parsed_response['records']['record']\n records = [records] if !records.kind_of? Array\n \n records.each do |r| \n rdata = r['recordData']['responseRecord']['ISNIAssigned']\n #logger.debug \"full ISNI metadata record: \" + rdata.ai\n isni = rdata['isniUnformatted']\n isni_uri = rdata['isniURI']\n #logger.debug \"sources: \" + rdata['ISNIMetadata']['sources'].ai\n\n # ToDo: grab sources list also\n\n\n # Collect all personal names into a single master list\n names = rdata['ISNIMetadata']['identity']['personOrFiction']['personalName']\n names.nil? or logger.info \"Found #{names.size} personal name(s) in ISNI record\"\n name_variants = rdata['ISNIMetadata']['identity']['personOrFiction']['personalNameVariant']\n name_variants.nil? or logger.info \"Found #{name_variants.size} personal name variants in ISNI record\"\n names = [names] if !names.kind_of? Array\n name_variants = [name_variants] if !name_variants.kind_of? Array \n namelist = []\n is_first = 1\n family_name = \"\"\n given_names = \"\"\n (names + name_variants).each do |pname| \n next if pname.nil?\n next if pname['surname'] == \"\" && pname['forename'] == \"\"\n pnamestring = (pname['surname']||\"\") + \", \" + (pname['forename']||\"\")\n namelist.push pnamestring\n\n # We'll arbitrarily grab the 1st name on the list and set as the \"primary\" \n if is_first\n logger.info \"Setting #{pname['surname']}, #{pname['forename']} as the primary pname\"\n family_name = pname['surname']\n given_names = pname['forename']\n is_first = nil\n end\n\n end\n\n # there's loads of name duplications in the ISNI records, so let's uniquify the list\n namelist.uniq! \n if namelist.size == 0 \n logger.info \"no names found for ISNI \" + isni\n next\n end\n logger.debug \"Got total #{namelist.size} personal name(s) after cleaning:\"\n namelist.each do |n|\n logger.debug \" - pname: #{n}\"\n end\n\n # And finally set all the names except the first one as other names for this person\n namelist.shift\n\n # Extract list of associated works in the ISNI profile\n logger.debug \"Associated works data in ISNI record: \\n\" + rdata['ISNIMetadata']['identity']['personOrFiction']['creativeActivity'].ai\n works = []\n titles = rdata['ISNIMetadata']['identity']['personOrFiction']['creativeActivity']['titleOfWork']\n identifiers = rdata['ISNIMetadata']['identity']['personOrFiction']['creativeActivity']['identifier']\n unless identifiers.nil?\n identifiers = [identifiers] if !identifiers.kind_of? Array\n logger.info \"Got #{identifiers.size} work identifiers\"\n identifiers.each do |i|\n works << {\n 'identifier' => i['identifierValue'],\n 'identifierType' => i['identifierType'] }\n end\n works.uniq!\n logger.info \"Got a uniquified set of work identifiers associated with ISNI #{isni}:\\n\" + works.ai\n end\n \n # Execute the block passed in by the caller\n yield isni, isni_uri, family_name, given_names, namelist, works\n \n end\n end", "title": "" }, { "docid": "3baf1fa04fb072aab893f0f2b899162c", "score": "0.50051254", "text": "def import_indoor_gml_geometry_ver1\n counter = 0\n # @@model.start_operation(\"Import IndoorGml File\",true)\n if @@xmldoc.elements['.//CellSpace'].nil? && !@@xmldoc.elements['.//core:CellSpace'].nil?\n @@xmldoc.elements.each('.//core:CellSpace') do |csg|\n process_cell_space_ver1 csg\n counter += 1\n puts counter\n end\n elsif !@@xmldoc.elements['.//core:cellSpaceMember'].nil?\n @@xmldoc.elements.each('.//core:cellSpaceMember') do |csg|\n process_cell_space_ver1 csg\n counter += 1\n puts counter\n end\n else\n @@xmldoc.elements.each('.//CellSpace') do |csg|\n process_cell_space_ver1 csg\n counter += 1\n puts counter\n end\n end\n end", "title": "" }, { "docid": "54e10fd2c10dd301986ed24e16b2b949", "score": "0.50050586", "text": "def parse_ped_file()\n File.open(@options.ped_file).each_line do |line|\n parts = line.chomp.split(/\\s/)\n #Family_ID Person_ID\tPaternal_ID\tMaternal_ID\tSex Phenotype calls\n person = Person.new(parts[0],parts[1],parts[2],parts[3],parts[4],parts[5])\n offset = 6\n marker = 0\n alleles = nil\n parts.slice(offset,parts.size).each_with_index do |c,i|\n raise \"Nil marker at #{line} for #{@snps.inspect}, at #{marker}\" unless @snps[marker]\n# marker_name = parts[@snps[marker]].name\n if nil == alleles then\n alleles = [c]\n else\n alleles.push(c)\n geno = Genotype.new(nil,alleles)\n person.add_genotype(geno) #unless @skip_markers.include?(marker_name)\n marker+=1\n alleles = nil\n end\n end\n \n if :compare == @options.mode\n compare(person)\n elsif :lgen_output == @options.mode\n @snps.each do |snp|\n puts \"#{person.family}\\t#{person.number}\\t#{snp}\\t#{person.genotypes[snp].alleles.join(\"\\t\")}\"\n end\n elsif :sums == @options.mode\n output_sums(person,@plink_sum_output) \n else\n @people.push(person)\n end\n \n end #each line\n end", "title": "" }, { "docid": "44260fa8b887700f736a579d10bbf080", "score": "0.5000853", "text": "def get_my_Ips\n\tfile = File.open(@nta_path, 'r')\n\twhile line = file.gets\n \tx,y = line.split\t\n \tif x == @node\n \t@my_ips << y\n \tend \n\tend\n\tfile.close\nend", "title": "" }, { "docid": "aa49d18b9d9e20b9542d54da503ed507", "score": "0.5000383", "text": "def extract_measures\n measure_files = MATMeasureFiles.create_from_zip_file(@measure_zip)\n\n measures = []\n if measure_files.components.present?\n measure, component_measures = create_measure_and_components(measure_files)\n measures.push(*component_measures)\n else\n measure = create_measure(measure_files)\n end\n measure.package = CQM::MeasurePackage.new(file: BSON::Binary.new(@measure_zip.read))\n measures << measure\n\n measures.each { |m| CqlLoader.update_population_set_and_strat_titles(m, @measure_details[:population_titles]) }\n return measures\n end", "title": "" }, { "docid": "05e261400e44837036dd794d9859127a", "score": "0.50000393", "text": "def gather_metadata\n @io_pointer.seek(@read_length + 4)\n metadata_raw = @io_pointer.read(80)\n\n # The next @read_length amount of data when unpacked should equal 84\n check = @io_pointer.read(@read_length).unpack(\"#{@type}#{@endian}\")[0]\n raise StandardError, \"Invalid DCD format, expected 84 but saw #{check}\" if check != 84\n\n unpacked_meta = metadata_raw.unpack(\"L#{@endian}9a4L#{@endian}*\")\n\n @metadata[:is_charmm] = unpacked_meta[-1] != 0 # 76 - 79\n @metadata[:nset] = unpacked_meta[0] # 0-3\n @metadata[:istart] = unpacked_meta[1] # 4-7\n @metadata[:nsavc] = unpacked_meta[2] # 8-11\n @metadata[:nstep] = unpacked_meta[3] # 12-15 # not present in XPLOR files - is 0\n # unpacked_meta[4] - unpacked_meta[7] are zeros\n @metadata[:num_fixed] = unpacked_meta[8] # 32 - 35\n @metadata[:step_size] = unpacked_meta[9].unpack(@metadata[:is_charmm] ? (@endian == '>' ? 'g' : 'e') : (@endian == '>' ? 'G' : 'E'))[0] # 36 - 39\n @metadata[:charmm_extrablock] = unpacked_meta[10] != 0 # 40 - 43\n @metadata[:w_coords] = unpacked_meta[11] == 1 # 44 - 47\n end", "title": "" }, { "docid": "fed34700808a36ea035ad1c719cd8d41", "score": "0.49867436", "text": "def extract_information\n # Extract information from main file\n @info = {}\n @info[:source_code] = source = read_source_code\n @info[:class_name] = extract_class_name(source)\n @info[:title] = extract_title(source)\n @info[:width] = extract_dimension(source, 'width')\n @info[:height] = extract_dimension(source, 'height')\n @info[:description] = extract_description(source)\n @info[:libraries] = extract_libraries(source)\n @info[:real_requires] = extract_real_requires(source)\n hash_to_ivars @info\n @info\n end", "title": "" }, { "docid": "bbd16e976c643b6275a9c9844115abe0", "score": "0.49792826", "text": "def extract_meta(data)\n file, brief, defgroup, ingroup = nil\n data.each do |block|\n block[:comments].each_line do |comment|\n m = []\n file = m[1] if m = /@file (.*?)$/.match(comment)\n brief = m[1] if m = /@brief (.*?)$/.match(comment)\n defgroup = m[1] if m = /@defgroup (.*?)$/.match(comment)\n ingroup = m[1] if m = /@ingroup (.*?)$/.match(comment)\n end\n end\n {:file => file, :brief => brief, :defgroup => defgroup, :ingroup => ingroup}\n end", "title": "" }, { "docid": "dbfe6bbab3f91e331282ccd995d37b98", "score": "0.49788612", "text": "def parse_file(filename: \"\", type: \"level\")\n !filename.empty? ? file = File.binread(filename) : return\n case type\n when \"level\"\n mode = file[12].reverse.hd # game mode: 0 = solo, 1 = coop, 2 = race, 4 = unset\n title = file[38..165].split(//).delete_if{ |b| b == \"\\x00\" }.join\n author = \"\"\n map = parse_map(data: file[184..-1], type: \"new\")\n return nil if map.nil?\n when \"attract\"\n map_length = file[0..3].reverse.hd\n demo_length = file[4..7].reverse.hd\n map_data = file[8 .. 8 + map_length - 1]\n demo_data = file[8 + map_length .. 8 + map_length + demo_length - 1]\n\n level_id = map_data[0..3].reverse.hd\n title = map_data[30..157].split(//).delete_if{ |b| b == \"\\x00\" }.join\n index = map_data[159..-1].split(//).find_index(\"\\x00\") + 158\n author = map_data[159..index]\n map = parse_map(data: map_data[index + 2..-1], type: \"new\")\n # demo = parse_demo(data: demo_data, attract: true) # no se si el attract hace falta, comparar esto con una replay normal\n when \"old\"\n title = file.split('#')[0][1..-1]\n author = \"Metanet Software\"\n map = parse_map(data: file.split(\"#\")[1], type: \"old\")\n return nil if map.nil?\n else\n print(\"ERROR: Incorrect type (level, attract, old).\")\n return 0\n end\n {title: title, author: author, tiles: map[:tiles], objects: map[:objects]}\nend", "title": "" }, { "docid": "ae13b1a74d04c7153a00b1f1a50756ba", "score": "0.496619", "text": "def parse(xml)\n # assume only one 'works' node\n xml.xpath('//work').map do |work|\n make_node = work.at_xpath('exif/make')\n model_node = work.at_xpath('exif/model')\n image_url_node = work.at_xpath(\"urls/url[@type='small']\")\n\n # Do nothing unless the Work has usable data\n next unless make_node && model_node && image_url_node\n\n {\n make: make_node.text,\n model: model_node.text,\n image_url: image_url_node.text\n }\n end.compact\n end", "title": "" }, { "docid": "484ad1d05840ffb05b634c2082b3f19b", "score": "0.49661854", "text": "def parse_incident_numbers\n IO.read(@filename).scan(/\\b[12]\\d-?\\d{7}\\b/)\n end", "title": "" }, { "docid": "a25f42100489332d0b405b1c22d73e2a", "score": "0.49468315", "text": "def create_xdom(result_file, config)\n puts \"\\nD. CREATING XDOM FILE\"\n puts \"=\"*25\n if (config[:parsepfs][:filename].nil?)\n xdom_file = File.basename(config[:files][:fasta], \".*\")\n outfile = File.new(\"#{xdom_file}.xdom\", \"w\")\n else\n outfile = File.new(config[:parsepfs][:filename], \"w\")\n end\n\n dom_start_field = (config[:parsepfs][:envelope]) ? 2 : 3\n dom_end_field = (config[:parsepfs][:envelope]) ? 3 : 4\n dom_name_field = (config[:parsepfs][:acc]) ? 5 : 6\n consider_clans = config[:parsepfs][:clans]\n pid_regexp = config[:parsepfs][:PIDregexp]\n remove_empty = config[:parsepfs][:rempty]\n\n count = 0\n current_id = nil \n last_id = nil \n current_xdom = Array.new\n\n IO.foreach(result_file) {|line|\n next if (line[0] == '#')\n\n if m = pid_regexp.match(line)\n fields = line.chomp!.split\n current_id = m[1]\n if ( current_id != last_id and (not last_id.nil?) )\n count += 1\n print \"\\rParsing entry %d... \" % [count]\n if (config[:parsepfs][:resolve_overlaps])\n current_xdom = resolve_overlaps(current_xdom)\n end\n outfile.puts current_xdom.join(\"\\n\") unless (remove_empty and current_xdom.length == 1)\n last_id = current_id\n current_xdom = [\">#{current_id}\"]\n end \n current_xdom << \">#{current_id}\" if current_xdom.empty?\n name = fields[dom_name_field]\n if (consider_clans)\n name = fields[14] unless(fields[14] == 'No_clan')\n end\n next if ( (not config[:parsepfs][:cutoff].nil? ) and (fields[12].to_f > config[:parsepfs][:cutoff]) )\n current_xdom << \"#{fields[dom_start_field]}\\t#{fields[dom_end_field]}\\t#{name}\\t#{fields[12]}\"\n last_id = current_id\n end \n }\n if (config[:parsepfs][:resolve_overlaps])\n current_xdom = resolve_overlaps(current_xdom)\n end\n outfile.puts current_xdom.join(\"\\n\") unless (remove_empty and current_xdom.length == 1)\n outfile.close\n print \"\\rParsing entry %d... done\\n\\n\" % [count]\nend", "title": "" }, { "docid": "762e8a39ed84ec08db359dfc74944fcf", "score": "0.49430332", "text": "def get_id_data(rec)\n id_data = { '001' => '',\n '003' => '',\n '019' => [],\n '035' => [],\n '035z' => [],\n '035q' => []}\n \n Traject::MarcExtractor.cached('001:003:019:035a', alternate_script: false).each_matching_line(rec) do |field, spec, extractor|\n case field.tag\n when '001'\n id_data['001'] = field.value\n when '003'\n id_data['003'] = field.value\n when '019'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['019'] << sf.value\n end\n when '035'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['035'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'z' }.each do |sf|\n id_data['035z'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'q' }.each do |sf|\n id_data['035q'] << sf.value\n end\n end\n end\n \n return id_data\n end", "title": "" }, { "docid": "44a51b98c674d6adba96c7bc02538688", "score": "0.49414605", "text": "def iids\n return @xml_document.xpath(\"//mods:identifier[translate(@type, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=\\\"IID\\\"]\", 'mods' => MODS_NAMESPACE).children.map { |xt| xt.to_s }\n rescue => e\n return []\n end", "title": "" }, { "docid": "a4d5494df35bea236c5ced8916f4ab3f", "score": "0.4940053", "text": "def parse_nem12_500(_line, _options = {}); end", "title": "" }, { "docid": "2ad0fdf5fd101d3b847a52cead74786b", "score": "0.49374944", "text": "def parsescape(filename)\n `/bin/bash -c \"aubio notes -T ms <(sox #{filename} -t wav - highpass 1k) 2>&1\"`.split(/\\n/).map { |s| s.split(/\\t/) }\n .select { |w| w.size == 3 }.first # Detected pitches appear as <pitch>\\t<begin-ms>\\t<end-ms>\nend", "title": "" }, { "docid": "30a9087baa1d50c979362a168f8a7433", "score": "0.49373397", "text": "def parse_file(filename)\n matcher = @format.to_regex\n defined_attributes = @format.defined_attributes\n\n File.open(filename) do |file|\n file.each_line do |line|\n m = line.match(matcher).to_a\n\n r = {}\n m[1..m.count].zip(defined_attributes).each do |match, attr|\n r[attr[:label]] = match\n end\n\n if block_given?\n yield r\n else\n r\n end\n end\n end\n end", "title": "" }, { "docid": "259656d6d8d3fedae23c1e1a7b77b33c", "score": "0.4932568", "text": "def parse\n fd = case @file\n when /\\.gz$/\n require 'zlib'\n Zlib::GzipReader.new(File.open(@file,'rb'), external_encoding: 'ASCII-8BIT')\n else\n File.open(@file,'rb')\n end\n fd.each do |line|\n next if line =~ /^\\s*$/\n # Oct 18 07:01:38 secaucus-ba30137 {user.info} god: msgs here\n tokens = line.split(/\\s+/)\n hour = tokens[2].split(/:/).first\n @entries[hour] ||= {}\n matched_keys = []\n @strings.each_with_index do |str,i|\n line.match(%r{\\b#{str}\\b}i) do |md|\n md.to_a.each do |val|\n matched_keys << val\n debug 'val', val\n if matched_keys.size == @strings.size # all regex requested must match\n _key = matched_keys.join(' && ')\n @entries[hour][_key] ||= 0 # default to 0\n @entries[hour][_key] += 1\n end \n end\n end\n end\n debug hour, @entries[hour]\n end\n fd.close\n @entries\n end", "title": "" }, { "docid": "e90da198e14636ee3d6b27e26eee022e", "score": "0.49311978", "text": "def parseSymbols(file)\n cSet = Set[]\n dSet = Set[]\n dSet1 = Set[]\n iSet1 = Set[]\n string = Array.new()\n sens = []\n acSubClass = []\n subClass = []\n symSubClass = []\n exactConcept = []\n symPrntClass = []\n acSubClass = []\n acClass = []\n acpropString = []\n ac = []\n acocElement = []\n sens = []\n i = 0\n j = 0\n value = 0\n res = 0\n min = 0\n max = 0\n qc = 0\n maxobj = 0\n minobj = 0\n qcobj = 0\n \n subj = Array.new()\n pred = Array.new()\n obj = Array.new() \n RDF::RDFXML::Reader.open(file) do |reader|\n reader.each_triple do |subject, predicate, object|\n subj[i] = subject\n pred[i] = predicate\n obj[i] = object\n i += 1\n end\n end\n begin \n value = checkPredicateString(pred[j])\n\n if (value == 1)\n string = pred[j]\n else\n string = obj[j]\n end\n case string \n \n when Classtype \n # puts \"Class\" \n symClass = Symbols.new(CLASS, subj[j])\n acClass = AtomicConcept.new(symClass)\n cSet.add(symClass)\n\n when ObjProptype \n #puts \"Obj\"\n symObjProp = Symbols.new(ROLE, subj[j])\n acObjProp = AtomicConcept.new(symObjProp)\n dSet.add(symObjProp)\n\n when SubClasstype\n if obj[j].to_s.include? \"_:g\"\n if qc == 1\n exactConcept = ExactConcept.new(acpropString, qcobj, acocElement)\n subClass = exactConcept\n qc = 0\n\n elsif min == 1\n minConcept = MinConcept.new(acpropString, minobj , acocElement) \n subClass = minConcept\n min = 0\n elsif max == 1\n maxConcept = MaxConcept.new(acpropString, maxobj , acocElement)\n subClass = maxConcept\n max = 0\n end \n symPrntClass = Symbols.new(CLASS, subj[j]) \n else \n symSubClass = Symbols.new(CLASS, subj[j])\n subClass = AtomicConcept.new(symSubClass)\n symPrntClass = Symbols.new(CLASS, obj[j])\n end\n #symPrntClass = Symbols.new(CLASS, subj[j])\n acPrntClass = AtomicConcept.new(symPrntClass)\n cs1 = ConceptSubsumption.new(acPrntClass, subClass) #acPrntClass)\n sens.push(cs1)\n\n when OnPropertytype\n #puts \"OnPropertytype\"\n propString = Symbols.new(ROLE, obj[j])\n acpropString = AtomicObjectProperty.new(propString)\n # nodeElement.push(acpropString)\n when QualifiedContType\n qcobj = obj[j]\n qc = 1\n\n when Mintype\n min = 1\n minobj = obj[j]\n\n when Maxtype\n max = 1\n maxobj = obj[j]\n\n when OnClass\n symocElement = Symbols.new(CLASS,obj[j])\n acocElement = AtomicConcept.new(symocElement)\n\n when Restrictiontype \n res = 0 \n else \n #puts \"Element not found\"\n end\n j = j + 1\n end until (subj.length == j)\n iSet1 = Set[]\n sig = Signature.new(cSet, dSet, dSet1, iSet1)\n onto1 = Ontology.new(sig, sens)\n #p onto1\n return onto1\n\nend", "title": "" }, { "docid": "af9dc29ca60a4bb533fbc7cb01023a17", "score": "0.49247003", "text": "def parse\n @builder.section('xmlns' => MEI_NS) {\n @builder.comment(\" #{@line} \")\n do_staffs()\n }\n end", "title": "" }, { "docid": "9458574aa98d1f0dfe770dda2d4cb129", "score": "0.49225166", "text": "def extract_entries\n @doc.xpath('//cda:component/cda:section[cda:templateId/@root=\"2.16.840.1.113883.10.20.24.2.1\"]/cda:entry')\n end", "title": "" }, { "docid": "e7702aa09106d998e04af352c031e5fb", "score": "0.49160546", "text": "def list_all_ds_in_set(foxmlpath,outputfilename)\r\nputs \"listing all ds in \"+foxmlpath\r\nidmap = []\r\nDir.foreach(foxmlpath)do |item|\r\n# we dont want to try and act on the current and parent directories\r\nnext if item == '.' or item == '..'\r\n path = foxmlpath +\"/\" + item.to_s\r\n\t\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\t\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\r\n\tds_ids = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\tds_ids.each { |id| \r\n\t\tidname = id.attr('ID')\t\t\r\n\t\t\tif !idmap.include? idname\r\n\t\t\t\tidmap.push(idname)\t\t\t\r\n\t\t\tend\t \r\n\t}\t\r\nend\r\n\tidmap.each { |id| \r\n\t\twrite_to_ds_list(outputfilename,id) \r\n\t}\r\n\tdoc = nil\r\n\tputs \"all done\"\r\nend", "title": "" }, { "docid": "ace4c21f52c2ead86ac2443276e1fb6b", "score": "0.49153557", "text": "def parse()\n result = nil\n line_count = 0\n detector_fin1_res = V3::ContextDetector.new( FIN1_RESULT_TYPEDEF )\n detector_fin2_res = V3::ContextDetector.new( FIN2_RESULT_TYPEDEF )\n detector_fin1_sta = V3::ContextDetector.new( FIN1_STARTLIST_TYPEDEF )\n detector_csi_res = V3::ContextDetector.new( CSI_RESULT_TYPEDEF )\n\n File.open( @full_pathname ) do |f|\n f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:\n curr_line = EncodingTools.force_valid_encoding( curr_line )\n line_count += 1\n # While reading the file line by line, detect the type:\n if detector_fin1_res.feed_and_detect( curr_line, line_count, nil )\n @parsing_defs = V3::FinResultDefs.new()\n @content_parser = V3::FinResultParser.new( @full_pathname, @parsing_defs )\n break # Break as soon as we have a match (FIFO wins)\n\n elsif detector_fin2_res.feed_and_detect( curr_line, line_count, nil )\n @parsing_defs = V3::Fin2ResultDefs.new()\n @content_parser = V3::FinResultParser.new( @full_pathname, @parsing_defs )\n break\n\n elsif detector_fin1_sta.feed_and_detect( curr_line, line_count, nil )\n @parsing_defs = V3::FinStartListDefs.new()\n @content_parser = V3::FinResultParser.new( @full_pathname, @parsing_defs )\n break\n\n elsif detector_csi_res.feed_and_detect( curr_line, line_count, nil )\n # TODO Adapt CsiResultParser\n @parsing_defs = nil\n @content_parser = nil\n break\n\n else\n nil\n end\n end\n end\n end", "title": "" }, { "docid": "c2d8155bd9777fca1651e172f909bc28", "score": "0.4915192", "text": "def parse_file(filename)\n labels, lines = nil, nil\n\n file = File.open(filename, 'r+') do |file|\n labels, lines = preprocess_file file\n end\n\n remaining_lines, data_start, data = read_data_section_from lines\n read_instructions_from remaining_lines, labels\n\n { :data_start => data_start, :data => data,\n :instructions => @instruction_parser.instructions }\n end", "title": "" } ]
cb688dec4dd857028791ca278d1da46c
Provides an asynchronous callback mechanism
[ { "docid": "ff57c277b76760b1d310013dc9759274", "score": "0.0", "text": "def notify(*args)\r\n @reactor.schedule do # just in case we are on a different event reactor\r\n if @pending && @pending.length > 0\r\n callbacks = @pending\r\n @reactor.next_tick do\r\n callbacks.each do |callback|\r\n callback[2].call(*args)\r\n end\r\n end\r\n end\r\n end\r\n self\r\n end", "title": "" } ]
[ { "docid": "a8d7928b0ddac8f0ac73a8dfba37513a", "score": "0.74686307", "text": "def callback_call; end", "title": "" }, { "docid": "bce3e1d1089bf6d6722900bd3cac0f36", "score": "0.742427", "text": "def callback\n end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.73232967", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.73232967", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.73232967", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.73232967", "text": "def callback; end", "title": "" }, { "docid": "891b4b28448a3428e8c54787f7a8c08b", "score": "0.72411", "text": "def async; end", "title": "" }, { "docid": "a9476710ae72853a44c7c05b3209017e", "score": "0.7115555", "text": "def callback(&block)\n @callback = block\n end", "title": "" }, { "docid": "f552ce76029d749203b10044e31ef587", "score": "0.7092877", "text": "def callback(&block)\n @callback = block if block_given?\n \n @callback\n end", "title": "" }, { "docid": "efc7cda3339b2c53d31d254c0b0788da", "score": "0.70831573", "text": "def callback(&block)\n @mutex.synchronize do\n @callback = block\n end\n end", "title": "" }, { "docid": "074e99dd0cd29e6efce760dc69391be9", "score": "0.6967084", "text": "def callback\n puts \"callbacked\"\n end", "title": "" }, { "docid": "d2017c792b5cb4a29d674d3213c78c5b", "score": "0.6933434", "text": "def async_executor; end", "title": "" }, { "docid": "98960953055055799b1928f9bd99186b", "score": "0.6913773", "text": "def callback(&block)\n @callback = block if block\n @callback\n end", "title": "" }, { "docid": "88bbbdec8430262c959d81dd036f1a6f", "score": "0.67494607", "text": "def callback\n collected[:callback]\n end", "title": "" }, { "docid": "6cc51382ecd6aa4bc89bd12e8ea6fee2", "score": "0.6728553", "text": "def async(*arguments, **options, &block); end", "title": "" }, { "docid": "6cc51382ecd6aa4bc89bd12e8ea6fee2", "score": "0.6728553", "text": "def async(*arguments, **options, &block); end", "title": "" }, { "docid": "6cc51382ecd6aa4bc89bd12e8ea6fee2", "score": "0.6728553", "text": "def async(*arguments, **options, &block); end", "title": "" }, { "docid": "b57cb98d75b1fa47452aaebced04469e", "score": "0.6718093", "text": "def yield\n wait\n callback\n end", "title": "" }, { "docid": "9d37c8d289dac67c46949f9576d4cd3a", "score": "0.6685406", "text": "def callback &block\n return unless block\n @deferred_status ||= :unknown\n if @deferred_status == :succeeded\n block.call(*@deferred_args)\n elsif @deferred_status != :failed\n @callbacks ||= []\n @callbacks.unshift block # << block\n end\n self\n end", "title": "" }, { "docid": "915cad10262c380fb6cfe41b48c28c03", "score": "0.6655575", "text": "def callback_in_async\n callback\n rescue Exception => e\n # nothing we can do here for an asynchronous exception,\n # so we just log the error\n # TODO: add error_log_method\n warn \"RestCore: ERROR: #{e}\\n from #{e.backtrace.inspect}\"\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.6637483", "text": "def execute_callbacks; end", "title": "" }, { "docid": "86c74542931e678d290783d55c1bab40", "score": "0.6587169", "text": "def callback(&block)\n self.callbacks << block\n end", "title": "" }, { "docid": "6988b8e180cf2e20aa8a0373eda58d90", "score": "0.65147805", "text": "def invoke_callback\n raise \"Not implemented for worker\"\n end", "title": "" }, { "docid": "1c43515b8e83e49f7191d4db60d2815c", "score": "0.6513298", "text": "def on_success(&block); end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.65031266", "text": "def callbacks; end", "title": "" }, { "docid": "3803f2e575072b471e844979364477a4", "score": "0.6496087", "text": "def async_result()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "7689b8fb6174ad7d763f4b75ed0fcd1c", "score": "0.6464029", "text": "def on_callback(data)\r\n \r\n end", "title": "" }, { "docid": "c3c976e79a49988976a1d295d70c91f7", "score": "0.6447573", "text": "def response_callback(&block)\n @response_callback = block if block_given?\n \n @response_callback\n end", "title": "" }, { "docid": "dfb717abdd9809bf76e67867faaf2916", "score": "0.6438341", "text": "def use_callback(&block)\n if block_given?\n on(:failure, &block)\n on(:success, &block)\n end\n end", "title": "" }, { "docid": "9f231367a74a9afe4e3d0e33a01d8878", "score": "0.6432032", "text": "def on_finished(&block)\n @on_finished_cb = block\n end", "title": "" }, { "docid": "037d88ff1fb51bf23a17c7a6f3b12690", "score": "0.64113873", "text": "def callback(&block)\n @callback = Proc.new\n end", "title": "" }, { "docid": "c3ff2fe3bb50f1f000a037b25f5f280b", "score": "0.6383549", "text": "def on_http_success &block\n\t@http_success_callback = block\n end", "title": "" }, { "docid": "aee1bec905d61286223a071d7f24f61f", "score": "0.6379364", "text": "def add_callback(&block); end", "title": "" }, { "docid": "7946c542009404d91d7808751f009a7e", "score": "0.63497216", "text": "def success &block\n @client.callback &block\n end", "title": "" }, { "docid": "60c64a0f669fbc24ec6b907a059e5dcf", "score": "0.6336621", "text": "def perform_response_callback\n response_callback(self, @arguments)\n end", "title": "" }, { "docid": "32ecfb2c1b045f08a8ace9dc79753a47", "score": "0.6312782", "text": "def handler\n raise \"Must override AsyncHandler#handler\"\n end", "title": "" }, { "docid": "0e15414b8f1969aba2c78f2d4f55d198", "score": "0.6312265", "text": "def async\n @async\n end", "title": "" }, { "docid": "92b70ad493d18974735a6c70af9df6f1", "score": "0.6282051", "text": "def fire_callback(callback)\n # TODO: Implement fire_callback\n end", "title": "" }, { "docid": "02ebcbe4ad911c91b4dd54451637f23a", "score": "0.6281205", "text": "def callback(*a, &b); end", "title": "" }, { "docid": "5ee836916501d238881f346c9b1836d7", "score": "0.62681276", "text": "def notify_of_completion\n on_complete_proc.call\n end", "title": "" }, { "docid": "7936d77a131197fc97ee6c87e6e67494", "score": "0.62620085", "text": "def block_callback\n collected[:block_callback]\n end", "title": "" }, { "docid": "e661e9b34fd0e5ff0c5e15953a4ca7f4", "score": "0.62412256", "text": "def achieve_asynchronously(options = Hash.new, &block)\n options = Kernel.validate_options options,\n :emit_on_success => true,\n :callback => proc { }\n\n worker_thread = Thread.new do\n begin\n result = block.call\n if engine\n engine.queue_worker_completion_block do |plan|\n begin\n options[:callback].call(result)\n if options[:emit_on_success]\n emit\n end\n rescue Exception => e\n emit_failed(e)\n end\n end\n end\n\n rescue Exception => e\n if engine\n engine.queue_worker_completion_block do |plan|\n emit_failed(e)\n end\n end\n end\n end\n engine.register_worker_thread(worker_thread)\n worker_thread\n end", "title": "" }, { "docid": "e297b27ca38ef12fca45da36f41a27b0", "score": "0.6230206", "text": "def callback_listener\n # just to check callback recieved\n print(\"callback received =>>>>>>>>>>>>>>\") \n end", "title": "" }, { "docid": "c87ec0fec308372614a657bee177e7cc", "score": "0.62284917", "text": "def receive notification\n @callback.call notification\n end", "title": "" }, { "docid": "55b9af1c64797fccd21385a09c9f1823", "score": "0.6221511", "text": "def async\n @async\n end", "title": "" }, { "docid": "37cb71366ea738ca77ae743d9504df39", "score": "0.62038255", "text": "def fire_callback\n begin\n response = RestClient.post(callback_url, {:job => self.to_json})\n Thread.new { self.destroy } if response && response.code == 201\n rescue RestClient::Exception => e\n puts \"Failed to fire job callback. Hmmm, what should happen here?\"\n end\n end", "title": "" }, { "docid": "5d3159448b55cfd385a474a72e51139c", "score": "0.6203481", "text": "def set_callback\n easy.on_complete do |easy|\n request.finish(Response.new(easy.to_hash))\n hydra.release_easy(easy)\n hydra.add(hydra.queued_requests.shift) unless hydra.queued_requests.empty?\n end\n end", "title": "" }, { "docid": "26eb58f36f97f69952cdd08913797a4a", "score": "0.6156759", "text": "def callback(name, &block)\n BotaBot::Callbacks[name] = block\n end", "title": "" }, { "docid": "01d73a4c348da94364f0a9d2e29db079", "score": "0.6156707", "text": "def process_async(&block)\n end", "title": "" }, { "docid": "01d73a4c348da94364f0a9d2e29db079", "score": "0.6156707", "text": "def process_async(&block)\n end", "title": "" }, { "docid": "88d14eaed8b2b10a408ac9c9183b6e99", "score": "0.61537564", "text": "def synchronous; end", "title": "" }, { "docid": "88d14eaed8b2b10a408ac9c9183b6e99", "score": "0.61537564", "text": "def synchronous; end", "title": "" }, { "docid": "94b2e9f5ea2704ceb3f6fb4f532778d0", "score": "0.614617", "text": "def future(*args, &block); end", "title": "" }, { "docid": "9ef196e6fe95b4211245f99222037927", "score": "0.613261", "text": "def _run_callbacks(kind, *args); end", "title": "" }, { "docid": "0d8cf43156bb618f4ebb1ba1e9742d0b", "score": "0.612017", "text": "def callback(params, returns, &block)\n Win32::API::Callback.new(params, returns, &block)\n end", "title": "" }, { "docid": "70d12ca03063c4fe8681222014fc0f41", "score": "0.6107836", "text": "def callback(result, error, details)\n self.queue.push(CallbackArgs.new(result, error, details))\n end", "title": "" }, { "docid": "8de8cc8f1917900cc16377a526437b25", "score": "0.6092142", "text": "def wait_for_completion( result )\n\n\tend", "title": "" }, { "docid": "ba82692bbcddf9a264eb680ac2609b3e", "score": "0.60660887", "text": "def finish\n @finished = true\n @callback.call(@response)\n end", "title": "" }, { "docid": "ba82692bbcddf9a264eb680ac2609b3e", "score": "0.60660887", "text": "def finish\n @finished = true\n @callback.call(@response)\n end", "title": "" }, { "docid": "a80409bc0a873144ef42a30f81b0113f", "score": "0.6065608", "text": "def on_complete(&block)\n @completion_callback = block\n end", "title": "" }, { "docid": "a80409bc0a873144ef42a30f81b0113f", "score": "0.6065608", "text": "def on_complete(&block)\n @completion_callback = block\n end", "title": "" }, { "docid": "a28f5692e41cbd34784c7b4082184d4d", "score": "0.6056187", "text": "def return_callback\n collected[:return_callback]\n end", "title": "" }, { "docid": "38a6fb9c1ca8c4351074fd47e65b865a", "score": "0.6053557", "text": "def done(&block)\n cb = Callback.new(block)\n fulfilled_callbacks << cb\n cb.call(*callback_response) if fulfilled?\n cb.promise\n end", "title": "" }, { "docid": "282decaa3fd3b564463fce317e983a56", "score": "0.6043312", "text": "def get_player_ranking_async(player,callback_success,callback_err )\n http = EventMachine::HttpRequest.new(\"http://#{@server}:#{@port}/getPlayerRanking\").get :query => {'playerNum' => player}\n http.errback { callback_err.call(http)}\n http.callback { callback_success.call(http)}\n end", "title": "" }, { "docid": "57c3bf879e31e8fd7cf856ef121c4bcb", "score": "0.6033696", "text": "def asyncHttpCall6\n Rho::AsyncHttp.post(\n :url => \"http://10.233.85.82:9097/rhodes/secure/asyncpost.php\",\n :body => \"data1=test&data2=test2\",\n :callback => url_for(:action => :httpget_callback),\n :authentication => {\n :type => :basic,\n :username => \"admin\",\n :password => \"admin\"\n },\n :callback_param => \"post=complete\"\n )\n render :action => :wait\n end", "title": "" }, { "docid": "c2b7caf903255c2bb3fc385e0f402780", "score": "0.6029298", "text": "def on_message(&block)\n @callback = block\n end", "title": "" }, { "docid": "358ccc3f4496f16538801f3d0f511f47", "score": "0.6016013", "text": "def deferred_callback(data)\n # We call close here, like on a regular response\n body = data[2]\n body.close if body.respond_to?(:close)\n @loop.next_tick do\n callback(data)\n end\n end", "title": "" }, { "docid": "78266de8a2361b30219ecadd76b799dc", "score": "0.60064435", "text": "def method_missing(method_name, *args, &block)\n callable = Callable.new(method_name)\n async_call = AsyncCall.new(context, callable, *args, &block)\n\n event_queue.start unless event_queue.running?\n context.event_queue << async_call\n end", "title": "" }, { "docid": "e8fb83cd92628da1c36b4e25cd800bb1", "score": "0.60023344", "text": "def method_missing(method_name, *args, &block)\n callable = Callable.new(method_name)\n async_call = AsyncCall.new(context, callable, *args, &block)\n\n event_queue << async_call\n end", "title": "" }, { "docid": "13c9edf1da1dc6b822b197bd1a71543d", "score": "0.6001917", "text": "def on_success(arg)\n end", "title": "" }, { "docid": "89fcf2d59bcc0d0d1f9a355417fc05e8", "score": "0.599329", "text": "def run_callbacks(kind); end", "title": "" }, { "docid": "c51abf53061f0937c2fdf74a75095534", "score": "0.5990481", "text": "def async(&payload)\n worker(payload, proc {})\n end", "title": "" }, { "docid": "178b27f67b675ac86e248ea8e1a9efee", "score": "0.5981053", "text": "def await; end", "title": "" }, { "docid": "797ef692cbc434e1b131ff4bb746bbfb", "score": "0.596635", "text": "def async(*arguments, parent: T.unsafe(nil), **options, &block); end", "title": "" }, { "docid": "5102bce968baa250c68fc6bfe4819fe4", "score": "0.596564", "text": "def callback\n return response if called\n self.response = k.inject(\n env.merge(RESPONSE_BODY => body ,\n RESPONSE_STATUS => status,\n RESPONSE_HEADERS => headers,\n RESPONSE_SOCKET => socket,\n FAIL => ((env[FAIL]||[]) + [error]).compact,\n LOG => env[LOG] ||[])){ |r, i| i.call(r) }\n self.called = true\n response\n end", "title": "" }, { "docid": "cc3344bf7c4318caed4c477bc0155d9f", "score": "0.59504455", "text": "def event_callbacks\n @callback_handler\n end", "title": "" }, { "docid": "6014768f760f628edb8546080e9ec540", "score": "0.59462106", "text": "def register_completion_callback(callback)\n @duty_completion_callback = callback\n end", "title": "" }, { "docid": "014e4ddbc6a4957749be5612fe1daa84", "score": "0.59437096", "text": "def callback &block\n super\n end", "title": "" }, { "docid": "014e4ddbc6a4957749be5612fe1daa84", "score": "0.59437096", "text": "def callback &block\n super\n end", "title": "" }, { "docid": "7afff2095dc668bc5b70c65e0e6c7017", "score": "0.59367573", "text": "def internal_await\n end", "title": "" }, { "docid": "14213b33ae4a93aa08db2ae3e66a9225", "score": "0.5936025", "text": "def register_request_callback; end", "title": "" }, { "docid": "5a3ee146f2a3041cdc8972a3b4fe2bb6", "score": "0.59352785", "text": "def call_with_async(method_name,user_callback,to_async_options,*args)\n p = proc do |object,error|\n async_object = object.to_async(Hash[:use => self].merge(to_async_options))\n if user_callback\n if user_callback.arity == 2\n user_callback.call(async_object,error)\n else\n user_callback.call(async_object)\n end\n else\n async_object\n end\n end\n if user_callback\n send(method_name,*args,&p)\n else\n async_object = send(method_name,*args)\n p.call async_object,nil\n end\n end", "title": "" }, { "docid": "4328524c4aac002cc37800ef4d29cfe9", "score": "0.593018", "text": "def event_callbacks\n @callback_handler\n end", "title": "" }, { "docid": "0c8bd28ef5b5e5f6e2dae384fc9d47bd", "score": "0.59294486", "text": "def set_callback(&block)\n @@callback = block\n end", "title": "" }, { "docid": "49ae7e6267da957f2568dab64961ec6c", "score": "0.59279466", "text": "def on_succeed; end", "title": "" }, { "docid": "126b456acfa348ef9d9bb55150d23861", "score": "0.59254783", "text": "def callback &block\n @close.callback(&block)\n self\n end", "title": "" }, { "docid": "0392c11c65fcf388520ddabc17a8628d", "score": "0.5918702", "text": "def call_back\n\n end", "title": "" }, { "docid": "3090264da5b0b6cdaca39fdd57b99155", "score": "0.5911049", "text": "def setCB(callback)\n @callbackfn = callback\n end", "title": "" }, { "docid": "3090264da5b0b6cdaca39fdd57b99155", "score": "0.5911049", "text": "def setCB(callback)\n @callbackfn = callback\n end", "title": "" }, { "docid": "3090264da5b0b6cdaca39fdd57b99155", "score": "0.5911049", "text": "def setCB(callback)\n @callbackfn = callback\n end", "title": "" }, { "docid": "8c88339d85b9a2f9f604a3aa4dff501d", "score": "0.58959156", "text": "def run(&action)\n raise \"Must override AsyncHandler#run\"\n end", "title": "" }, { "docid": "ea14bbcd99e1491324181c6c473e7ba6", "score": "0.58935577", "text": "def on_done(&block)\n @on_done = block\n end", "title": "" }, { "docid": "7cf8ccea48644f3abd1c5d9d02ca2dcf", "score": "0.5888484", "text": "def on_finish(&block)\n on_finish_callbacks << block\n end", "title": "" }, { "docid": "0c685e437761a1672bcdf86ba8cc1473", "score": "0.58872914", "text": "def request(type, *args, &callback); end", "title": "" }, { "docid": "406a1285d51b263da8aaaab017d22046", "score": "0.5881939", "text": "def receive(&block)\n if block_given?\n # define the callback\n @receive_callback = block\n elsif @receive_callback\n @receive_callback.call\n else\n raise GsaslError, \"The receive callback is not defined!\"\n end\n end", "title": "" }, { "docid": "278c10ed33b78202dcddb99335123a9c", "score": "0.5873362", "text": "def update_player_ranking_async(player,rank,type,callback_success ,callback_err )\n\n http = EventMachine::HttpRequest.new(\"http://#{@server}:#{@port}/updatePlayerRanking\").post :body => {'playerNum' => player,'type' => type,'rank'=>rank}\n http.errback { callback_err.call(http)}\n http.callback { callback_success.call(http)}\n end", "title": "" }, { "docid": "92b04efa848ee986c8886620c16fb9a5", "score": "0.58599085", "text": "def request_http(&on_complete)\n on_complete.call #call when something is done like Fetch().then()\nend", "title": "" }, { "docid": "96d6bf7d60d070d31bd9016f7bb11a25", "score": "0.584991", "text": "def async(&payload)\n worker(payload) { }\n end", "title": "" }, { "docid": "c54f2c6c2219d58b69d3288317f2516d", "score": "0.5849169", "text": "def handle_callback_response(authenticator, callback)\n @response = authenticator.send callback\n debug \"Callback received and return #{@response.inspect}\"\n end", "title": "" }, { "docid": "43b090028f3f3995121487ab658cc926", "score": "0.58441013", "text": "def on_response(&block)\n @response_callback = block\n end", "title": "" }, { "docid": "a8286904ff5f31497d921860206f2c57", "score": "0.5836807", "text": "def on_wait()\n end", "title": "" } ]
2a6b73fda784fbddcaa59a667e879014
Returns indent string multiplied by the depth
[ { "docid": "8cbbc488e839843f9f2d69f084e6b5aa", "score": "0.66055554", "text": "def indent(modifier = 0)\n \" \" * (@options.fetch(:log_depth, log_depth) * 2 + modifier)\n end", "title": "" } ]
[ { "docid": "faf3fedcb36f7106cb11200f764eeeee", "score": "0.81002563", "text": "def indent(depth)\n indent = \"#{depth}:\"\n depth.times do \n indent += \" .\"\n end\n indent\n end", "title": "" }, { "docid": "ae5ae7710678fa1c1d8c66cfab9f902b", "score": "0.79529536", "text": "def indentation(depth)\n \" \" * 4 * depth\nend", "title": "" }, { "docid": "44c688df7d178e58f9545b82cc605b9b", "score": "0.78341186", "text": "def indent_by(depth, string)\n string.gsub(/^(.+)$/, \"#{' ' * depth}\\\\1\")\n end", "title": "" }, { "docid": "411db20a75e16d093aa5424a27ae0c53", "score": "0.7785944", "text": "def indent\n self.depth ||= 0\n print ' ' * depth\n end", "title": "" }, { "docid": "41e89846710465c128b3c2e2400f095c", "score": "0.7687094", "text": "def indent_string(depth)\n indent_level = (depth + 1) * 2\n counter = indent_level\n indent = \"\"\n while counter != 0\n if counter % 2 == 1\n indent << \" \"\n else\n if indent == \"\" # we are still at the very left\n indent << \" \"\n else\n indent << \"|\"\n end\n end\n counter -= 1\n end\n indent\nend", "title": "" }, { "docid": "d21a40658fd1f7a805cfe9fde69261ed", "score": "0.7671244", "text": "def indent(str, depth=2)\n space = \" \"*depth\n str.split(\"\\n\").join(\"\\n#{space}\").gsub(/^ *$/, \"\")\n end", "title": "" }, { "docid": "797fa54b2880dd6c03bee7d1fb2adb3d", "score": "0.76174283", "text": "def get_indent(lvl, indent)\n \"#{' ' * indent}|\" * lvl\nend", "title": "" }, { "docid": "6ef592a83b18afc4fb49430800bc0313", "score": "0.73925173", "text": "def indent_cat_name(depth, name)\n out = \"<span style='padding-left: #{depth*15}px;'>#{name}</span>\"\n return out\n end", "title": "" }, { "docid": "d552ee386d30897cc3a973114d54aa1d", "score": "0.7162231", "text": "def indent(int = 1)\n nesting(int)\n TAB * @nesting\n end", "title": "" }, { "docid": "7edf24fd69f0fd33881838d145f024b8", "score": "0.7062394", "text": "def indentationString(level)\n return (\"\\t\" * (level >> 3)) + (' ' * (level & 7))\nend", "title": "" }, { "docid": "1aa4b56c2ebe6f531afdefc776b893be", "score": "0.7020802", "text": "def indent(modifier = 0)\n INDENT_STRING * (@depth + modifier)\n end", "title": "" }, { "docid": "1aa4b56c2ebe6f531afdefc776b893be", "score": "0.7020802", "text": "def indent(modifier = 0)\n INDENT_STRING * (@depth + modifier)\n end", "title": "" }, { "docid": "1aa4b56c2ebe6f531afdefc776b893be", "score": "0.7020802", "text": "def indent(modifier = 0)\n INDENT_STRING * (@depth + modifier)\n end", "title": "" }, { "docid": "9a854893cd2006225329af725c119ef9", "score": "0.700402", "text": "def indent\n return \" \"*get_indent_level\n end", "title": "" }, { "docid": "a2c7aa6fd81993fd806e8fd2cbf019c8", "score": "0.6952946", "text": "def at_depth(depth , lines)\n prefix = \" \" * 2 * depth\n strings = lines.split(\"\\n\")\n strings.collect{|str| prefix + str}.join(\"\\n\")\n end", "title": "" }, { "docid": "952aa21a9d92c9686bb4488b5e9fe9b6", "score": "0.68688715", "text": "def indent_directory(level)\n \"--| \" * level\nend", "title": "" }, { "docid": "d5ef8cda2ff06b1b74ee4444e024fa8e", "score": "0.6860061", "text": "def to_s(indent=false,depth=0)\n offset = indent ? (\"\\n \" + ' ' * depth) : ''\n if self.children.empty?\n if depth == 0\n offset + \"(#{self.content})\"\n else\n offset + self.content.to_s\n end\n else\n \"#{offset}(#{self.content} #{self.children.map{|c| c.to_s(indent,depth+1)}.join(' ')})\"\n end\n end", "title": "" }, { "docid": "cb361a20635e196967f06109b4e46b68", "score": "0.68516886", "text": "def indented_name(indent_string = ' ')\r\n indent = indent_string * depth\r\n indent + @name.to_s\r\n end", "title": "" }, { "docid": "df91399042776871444c9f245d92e86d", "score": "0.67789364", "text": "def indent(distance); end", "title": "" }, { "docid": "df91399042776871444c9f245d92e86d", "score": "0.67789364", "text": "def indent(distance); end", "title": "" }, { "docid": "6f0fcd520dc069445a429aa6a3d767e0", "score": "0.67573464", "text": "def render_indentation_classes(depth)\n styles = []\n (1..depth).each do |d|\n styles << \".segment_indent_level#{d} { display: inline-block; margin-left: #{(d-1)*20}px }\"\n end\n content_tag(\"style\", styles.join(' '))\n end", "title": "" }, { "docid": "71870b0b3d20251803439c6950e22f9e", "score": "0.6739197", "text": "def indentation\n return ' '*@indent_size*@indent_level\n end", "title": "" }, { "docid": "33a2e498d65a23db963b363dda734208", "score": "0.6693744", "text": "def indentation\n s = \"\"\n lv = method_stack.empty? ? 0 : method_stack.size-1 \n lv.times { s << (\" \" * space_count) }\n s\n end", "title": "" }, { "docid": "33a2e498d65a23db963b363dda734208", "score": "0.6693744", "text": "def indentation\n s = \"\"\n lv = method_stack.empty? ? 0 : method_stack.size-1 \n lv.times { s << (\" \" * space_count) }\n s\n end", "title": "" }, { "docid": "f2d84e20acb33395a5f864e3619d9823", "score": "0.66613585", "text": "def level_spaces(level = 0)\n return \" \"*2*level\n end", "title": "" }, { "docid": "54ec438731230eb660cb73e5b473b23f", "score": "0.6650057", "text": "def nest(_indent); end", "title": "" }, { "docid": "12acf445d5817ee2d45a08c56f94ce3c", "score": "0.66460633", "text": "def to_s\n prefix = \"#\" * (level + 1)\n \"#{prefix}\\n\" * (DEEPNESS - 1 - level) + prefix + \" \" + ([name] + children.map(&:to_s)).join(\"\\n\")\n end", "title": "" }, { "docid": "190870a9e162eaa212f05ad61e886e1a", "score": "0.65754145", "text": "def indent(level)\n ' ' * level\n end", "title": "" }, { "docid": "43b431be5b98badc65c3a5a8f92f17c9", "score": "0.6574734", "text": "def nest(indent); end", "title": "" }, { "docid": "3a7d512aa5e5ff5dcefb21371bb8786a", "score": "0.65380496", "text": "def to_tree_string(indent_level=0)\n indent = ->(s){ ' ' * indent_level + s }\n\n string = indent(self.class.name)\n\n instance_variables.each do |iv|\n value = instance_variable_get(iv)\n if value.is_a? ASTNode\n string += indent(\" #{iv.to_s[1..-1]}:\")\n string += indent(\" #{value.to_tree_string(indent_level + 1)}\")\n else\n string += indent(\" #{iv.to_s[1..-1]}: #{iv}\")\n end\n end\n end", "title": "" }, { "docid": "6429081d8f3bddf7306d73dde016f6da", "score": "0.65056705", "text": "def indent\n \" \" * $indent_level\nend", "title": "" }, { "docid": "54aec0dc30776f886bc4f31c2e81eb08", "score": "0.64958394", "text": "def prettyprint_text(s, depth)\n txt = s.to_s.inspect.gsub('\\n', \"\\n\")\n return txt unless txt.include?(\"\\n\")\n\n middle = indent(txt[1..-2], depth + 2)\n txt[0] + \"\\n\" + middle + \"\\n\" + \" \" * depth + txt[-1]\n end", "title": "" }, { "docid": "dfdd5462e680cc8d0858f6ee59f6ce00", "score": "0.6459932", "text": "def indent_text(depth, text)\n text.lines.reduce do |obj, line|\n obj << (line == \"\\n\" ? line : ' ' * depth + line)\n end\n end", "title": "" }, { "docid": "d57f9fe5fb1976614e51b15d97339ba9", "score": "0.6455952", "text": "def indent_new_line\n tab_width > 0 ? (\"\\n\" + (' ' * tab_width * depth)) : ''\n end", "title": "" }, { "docid": "d260264b7160dce4442ea62b229a63e2", "score": "0.6446082", "text": "def to_string(node,depth)\n result = \" \"*depth + (node ? \"#{node.value} (#{node.balance})\" : \"-\") + \"\\n\"\n return result unless node\n return result unless node.left || node.right\n result += to_string(node.left, depth+1)\n result += to_string(node.right, depth+1)\n end", "title": "" }, { "docid": "e19060d25061751a670b694ba1fa2635", "score": "0.64097154", "text": "def to_s(level=0)\n \"#{' ' * level}#{name}\\n\" + children.map {|c| c.to_s(level + 1)}.join\n end", "title": "" }, { "docid": "d0dd7bef010ce3bf14184261dd943406", "score": "0.6392402", "text": "def to_s\n return \" \" * @indent\n end", "title": "" }, { "docid": "27b6f56bf81f66e22ad33ea72865c71d", "score": "0.63525826", "text": "def indent(height)\n \" \" * (1...height).inject { |sum, n| sum + 2 ** (n-1) } rescue \"\"\n end", "title": "" }, { "docid": "2451463fc0bb75d76697159fe13b3081", "score": "0.6352507", "text": "def indent(n, c=' ')\n if n >= 0\n gsub(/^/, c * n)\n else\n gsub(/^#{Regexp.escape(c)}{0,#{-n}}/, \"\")\n end\n end", "title": "" }, { "docid": "6c34f12c0e8ac0e01c98e4103a16a0bb", "score": "0.6345663", "text": "def indent\n self.class.new(output, level+1)\n end", "title": "" }, { "docid": "e2489be33f2b562b77f1ff88aca86f7e", "score": "0.63270324", "text": "def printLinesLevel(baseWidth,stack,i)\n if i == 0\n return\n end\n dir = 1\n for j in 0..(( 2**i ) - 1)\n element = stack[j].to_s.length\n printSpace(baseWidth - 1) #imprimimos la separacion del nodo\n if dir > 0\n print \"/\"\n else\n print \"\\\\\"\n\n end\n printSpace(baseWidth) #Impresion de separacion de nodo a nodo\n dir *= -1\n end\n print \"\\n\"\n end", "title": "" }, { "docid": "72f245e5cd22b334d0bb95688e5019ac", "score": "0.6320132", "text": "def dedent_string(node, dedent_level); end", "title": "" }, { "docid": "25a200a70009c460bd46fe7000605b9b", "score": "0.6310478", "text": "def relativeIndent; end", "title": "" }, { "docid": "25a31fe00fb5d0906bfcdba08ad3471d", "score": "0.6305282", "text": "def relative_indent; end", "title": "" }, { "docid": "337a1c5dc9b91fe15796448ca748ad06", "score": "0.62856066", "text": "def indent(level)\n indents.find_index level\n end", "title": "" }, { "docid": "975d4d6fd558fb86f0bd354d7e6b1479", "score": "0.62746936", "text": "def indented_inspect(indent = 0)\n # Here there be dragons. In fact, there is one jusAAAAAAAARGH\n str = \"[\"\n\n sub = false\n i = 0\n lst = size - 1\n while i < size\n element = self[i]\n if Array === element\n estr = element.indented_inspect(indent + 2)\n if str.size > 30 or estr.size > 30\n if estr[0] != ?\\s\n estr = \"#{' ' * (indent + 2)}#{estr}\"\n end\n\n str << \"\\n#{estr}\"\n sub = true\n else\n str << estr\n end\n else\n str << element.inspect\n end\n\n str << \", \" unless i == lst\n i += 1\n end\n\n if sub\n str << \"\\n#{' ' * indent}]\"\n else\n str << \"]\"\n end\n\n if sub\n return \"#{' ' * indent}#{str}\"\n end\n\n return str\n end", "title": "" }, { "docid": "93f3b66614102998ddeccbec9eabc8ef", "score": "0.6225602", "text": "def indent(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end", "title": "" }, { "docid": "93f3b66614102998ddeccbec9eabc8ef", "score": "0.6225602", "text": "def indent(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end", "title": "" }, { "docid": "21125b9a738eeff614a081d8dc925a62", "score": "0.6214738", "text": "def indent(count = T.unsafe(nil)); end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "88f61dcf884b5f157622d491bd84c5f3", "score": "0.62091", "text": "def indent; end", "title": "" }, { "docid": "4ac5fd03e28bbd0d0b8aca8cec595d3b", "score": "0.61980444", "text": "def indented_line(level, token = \"\\t\", count = 1, string)\n\t\toutput_string = \"\"\n\t\tif string =~ /^\\n$/\n\t\t\toutput_string += \"\\n\"\n\t\telse\n\t\t\tindent = (token * count) * level\n\t\t\toutput_string += \"#{indent}#{string.lstrip}\"\n\t\tend\n\tend", "title": "" }, { "docid": "c81e8e43bba6e1bd061fffc0b1b44495", "score": "0.617074", "text": "def indent(string, num)\n num.times { |i| puts ' ' * i << string}\nend", "title": "" }, { "docid": "eebc03c78303bf32db6c8a341797fe3c", "score": "0.61628187", "text": "def indent(n)\n ind = \"\"\n n.times { ind += \" \" }\n ind\n end", "title": "" }, { "docid": "f497de6a4a51b27a544529eeb1d52484", "score": "0.6160315", "text": "def fetch_prefix_for_printing(level)\n prefix = ''\n if is_root?\n prefix << '*'\n else\n prefix << '|' unless parent.is_last_sibling?\n prefix << (' ' * (level - 1) * 4)\n prefix << (is_last_sibling? ? '+' : '|')\n prefix << '---'\n prefix << (has_children? ? '+' : '>')\n end\n prefix\n end", "title": "" }, { "docid": "cb85875d3eb2bde55603cabd7346d8a8", "score": "0.61601835", "text": "def indent!(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end", "title": "" }, { "docid": "cb85875d3eb2bde55603cabd7346d8a8", "score": "0.61601835", "text": "def indent!(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end", "title": "" }, { "docid": "06930d6e2f968b646657732094364eec", "score": "0.6158001", "text": "def indent( n )\n if n >= 0\n gsub( /^/, ' ' * n )\n else\n gsub( /^ {0,#{ -n }}/, \"\" )\n end\n end", "title": "" }, { "docid": "d03a3619994183c7c2cb31495c7f940b", "score": "0.612693", "text": "def indent_level\n @indent\n end", "title": "" }, { "docid": "67ccb056f7a6cb7abf5365f91157c700", "score": "0.6115276", "text": "def indentator; end", "title": "" }, { "docid": "67ccb056f7a6cb7abf5365f91157c700", "score": "0.6115276", "text": "def indentator; end", "title": "" }, { "docid": "8cc8dd756f0ee0230e9f4cf8828f2c23", "score": "0.6109628", "text": "def unindent(int = -1)\n out = \"\\n\" + TAB * (@nesting - 1)\n nesting(int)\n out\n end", "title": "" }, { "docid": "dbb357f220d65d2997c73619fc9ec529", "score": "0.6094604", "text": "def human_indentation(indentation); end", "title": "" }, { "docid": "5a80a823e80fbe4b12c7d8811d104cf6", "score": "0.6093539", "text": "def outdent( n )\n indent( -n )\n end", "title": "" }, { "docid": "7398f206ff6428f879322a688137938f", "score": "0.6086804", "text": "def indent(n)\n result = ''\n self.each_line do |line|\n result << (' ' * n) + line\n end\n result\n end", "title": "" }, { "docid": "d23736984cc8abbb17382b2235190c00", "score": "0.608234", "text": "def tree(level=0, indent=\" \")\n result = []\n dent = indent * level\n each do |key, val|\n result << dent+key.to_s\n result += val.tree(level+1) if val.any?\n end\n result\n end", "title": "" }, { "docid": "1b2267ac134447f1e719113b615e5f4d", "score": "0.60797316", "text": "def print_tree\n num = 9\n @all_levels.each do |arr|\n spaces = ' ' * num\n p arr.join(spaces).center(50)\n num -= 2\n end\n end", "title": "" }, { "docid": "06f24873208dcda3c271c3dc170af216", "score": "0.60733974", "text": "def depth(node)\n result = \"This node has a depth level of \"\n return unless contains?\n depth_level = 0\n current_node = @root\n until current_node == node\n node < current_node ? current_node = current_node.left_child : current_node.right_child\n depth_level += 1\n end\n result += depth_level.to_s\n result\n end", "title": "" }, { "docid": "5daabb61811cc45feffa6cfd759b5ab5", "score": "0.60691226", "text": "def draw_with_offset(n, o)\n if (n > 0)\n spaces = (\" \" * o)\n this_level = spaces + (\"* \" * (n - 1)) + \"*\\n\"\n\n return draw_with_offset(n - 1, o + 1) + this_level\n end\n\n return \"\"\n end", "title": "" }, { "docid": "6eabaa7a653b991116858d9bff27ce3f", "score": "0.6042998", "text": "def indent_string(string, number)\n number.times do |n|\n puts string.prepend(' ' * n)\n end\nend", "title": "" }, { "docid": "a607ce9699f371c898d0b62ffa14d121", "score": "0.60201514", "text": "def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end", "title": "" }, { "docid": "d9100d0a08d55599f6310795ad3b44dc", "score": "0.60142565", "text": "def ancestry\n indent = -1\n ancestors.map do |goal|\n indent += 1\n \"#{' ' * indent}#{goal.myid} -- #{goal.description} #{goal.variables.inspect}\"\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "1582a5365736f3a14bab71cd1e7c9b1c", "score": "0.5980812", "text": "def display_tree(indent = '')\n return indent + start.inspect if children.empty?\n [ indent + start.inspect,\n children.map { |c| c.display_tree(indent+' ') },\n ].join(\"\\n\")\n end", "title": "" }, { "docid": "37e566e65ad737c8e21875dd67830699", "score": "0.5972993", "text": "def pretty_print\n return 'INVALID TREE' unless valid?\n output = ''\n @root.traverse_dfs { |node, depth, _| output << \"#{' ' * depth}#{node}\\n\" }\n output\n end", "title": "" }, { "docid": "0cc460052f1f10fc9c85bb1f7219fa5b", "score": "0.59649223", "text": "def indent(txt, n = 2)\n \"#{' ' * n}#{txt}\"\n end", "title": "" }, { "docid": "e416aa8706091f15834669fca9943a31", "score": "0.59514993", "text": "def indent\n \" \" * indents\n end", "title": "" }, { "docid": "d371d09cfcebb3f627c9366c3c4b6606", "score": "0.5940534", "text": "def tree(level=0, indent=\" \")\n result = []\n dent = indent * level\n each do |key, val|\n result << dent+key\n result += val.tree(level+1) if val.any?\n end\n result\n end", "title": "" }, { "docid": "86ac962637741b2b968cf76d8c648ccc", "score": "0.5938872", "text": "def printLevel(baseWidth,stack,i)\n #print stack\n for j in 0..(( 2**i ) - 1)\n element = stack[j].to_s.length\n printSpace(baseWidth - element) #imprimimos la separacion del nodo\n if stack[j] != \"X\"\n print stack[j].getCode() #Impresion del contenido del nodo\n else\n print stack[j] #Impresion del contenido del nodo\n end\n\n printSpace(baseWidth) #Impresion de separacion de nodo a nodo\n end\n end", "title": "" }, { "docid": "5d81102f036ec5615978dca3d9326e4f", "score": "0.59363127", "text": "def postModifyIndent(currentLevel)\n\t return currentLevel + SPACES_PER_INDENT if !@isTagEnd\n\t return currentLevel\n\tend", "title": "" }, { "docid": "90e985c7428774c531b6deb229e9af0f", "score": "0.5936239", "text": "def indent\n @indent ||= 0\n end", "title": "" }, { "docid": "91a725ae5abfeae17640145037096218", "score": "0.59337354", "text": "def indent( multiple= 1 )\n \" \" * multiple\n end", "title": "" }, { "docid": "91a725ae5abfeae17640145037096218", "score": "0.59337354", "text": "def indent( multiple= 1 )\n \" \" * multiple\n end", "title": "" }, { "docid": "b135ef45dafe6de57bb07f814571f6e6", "score": "0.5931426", "text": "def indent s\n s.to_s.split(/\\n/).map{|line| @indent + line}.join(\"\\n\")\n end", "title": "" }, { "docid": "a5260bf902623a889884fe38096618b8", "score": "0.5920521", "text": "def prefix\n INDENT * level\n end", "title": "" }, { "docid": "d687398bbc6d30039133ddf0dbcb071c", "score": "0.59184676", "text": "def hierarchy(number, nbdigits: 3, tablevel: 4)\n levels = number.to_s.count('.')\n return \"[#{number}] \".rjust nbdigits + tablevel if levels.zero?\n (' ' * levels * tablevel) + \"└[#{number}] \" # When sub levels\n end", "title": "" }, { "docid": "4fd93eeabdd8748eea6918e7d8e9cbdb", "score": "0.5906495", "text": "def indent(level)\n level_str = case level\n when String then level\n when Fixnum then \" \" * level\n else raise ArgumentError, \"#{level.inspect} is not a valid indent level\"\n end\n lines = split(\"\\n\")\n tail = self[/\\n*\\Z/]\n lines.map { |line| \"#{level_str}#{line}\" }.join(\"\\n\") + tail\n end", "title": "" }, { "docid": "422ff009eb2a6a370d027cad969c84e8", "score": "0.59003633", "text": "def indent(input); end", "title": "" }, { "docid": "422ff009eb2a6a370d027cad969c84e8", "score": "0.59003633", "text": "def indent(input); end", "title": "" }, { "docid": "b9bd92c232f0c2dd2ad40be5c6a1417b", "score": "0.58727974", "text": "def printInfix(tree)\n result = \"\"\n depth = -1\n tree.set_fix_depth 0\n tree.transverseInOrder do |node|\n while(depth<node.fix_depth)\n result = result + \"(\"\n depth = depth + 1\n end\n while(depth>node.fix_depth)\n result = result + \")\"\n depth = depth - 1\n end\n result = result + node.details\n\n end\n for i in 0..depth\n result = result + \")\"\n end\n puts result\nend", "title": "" }, { "docid": "5f20745fd4723246c7df4b388b7095a3", "score": "0.5869101", "text": "def indent(offset, str=self)\n if offset >= 0\n str.gsub(/^/, ' ' * offset)\n else\n str.gsub(/^ {0,#{-offset}}/, \"\")\n end\n end", "title": "" }, { "docid": "824b6966119c159ea694e101475f5a64", "score": "0.58643854", "text": "def indent(s)\n s.to_s.split(/\\n/).map{|line| @indent_lvl + line}.join(LF)\n end", "title": "" }, { "docid": "289cb3711471fb12da8b6e1b40e83aac", "score": "0.58622485", "text": "def indent(n,spaces=2)\n (' ' * spaces) * n\n end", "title": "" }, { "docid": "6b99ca75bb2cd7e79289438e162b9a45", "score": "0.58614373", "text": "def indentation(padding)\n return unless padding.positive?\n\n ' ' * padding\n end", "title": "" }, { "docid": "0d85cca5bfc1e21555c5a1e044d989c5", "score": "0.58520055", "text": "def get_depth(p)\n if not p.node.xpath(\".//w:pStyle\").length > 0\n 0\n else\n levels = p.node.xpath(\".//w:ilvl\")\n # not a bullet\n if levels.length == 0\n 0\n else\n indent = levels.first.values.first.to_i\n indent + 1\n end\n end\nend", "title": "" }, { "docid": "be29db719dbf2a08cc9dc9cd252cbca4", "score": "0.58484447", "text": "def indentation_delta(tokens); end", "title": "" }, { "docid": "be29db719dbf2a08cc9dc9cd252cbca4", "score": "0.58484447", "text": "def indentation_delta(tokens); end", "title": "" } ]
58855e365f1a7640d6dfdd8d69971763
leveraging the approach used in the [fast JSON API gem](
[ { "docid": "4dcb0aea8cfc46b4df48efa9f1938fd3", "score": "0.0", "text": "def collection?(args, collection_option = nil)\n raise(ArgumentError, \"#{name}: Unknown collection option value: #{collection_option}\") unless [true, false, nil].include? collection_option\n\n return collection_option unless collection_option.nil?\n\n args.respond_to?(:size) && !args.respond_to?(:each_pair)\n end", "title": "" } ]
[ { "docid": "7255e465a5dc3057776289373a52af12", "score": "0.6519168", "text": "def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend", "title": "" }, { "docid": "38d1482c582291bd9075577544535b79", "score": "0.62644833", "text": "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "title": "" }, { "docid": "178088724458b0a9bd572f02fb14d6d6", "score": "0.6136359", "text": "def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend", "title": "" }, { "docid": "02f853780d3d576ab54ce4d84d62016c", "score": "0.6072035", "text": "def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend", "title": "" }, { "docid": "7527356f5b2c779b4b4260529705f56a", "score": "0.60445625", "text": "def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend", "title": "" }, { "docid": "a9f161414b0751917a588c85cdc1d877", "score": "0.59381396", "text": "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "title": "" }, { "docid": "0f9c4ede7b6696f34aa3ffcc48dadf08", "score": "0.59142005", "text": "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend", "title": "" }, { "docid": "d9f9a60cb27b73d9d62932be97bffd31", "score": "0.5914154", "text": "def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend", "title": "" }, { "docid": "2ffd01b08d3402c017b9bcb2fe764f86", "score": "0.5866131", "text": "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n film_urls = get_film_urls(character_hash, character)\n\n parse_character_movies(parse_films(film_urls))\nend", "title": "" }, { "docid": "401445537b3798ce7af1e597bc05d2b5", "score": "0.58657014", "text": "def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend", "title": "" }, { "docid": "0cb22603d84c30bf81c77070c5bdd583", "score": "0.5864874", "text": "def define_restful_api(model)\n get \"/#{model.resource}\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.all }\n end\n\n get \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors do\n result = model.find_by_id(params[:id])\n halt 404 if result.nil?\n json result\n end\n end\n\n post \"/#{model.resource}\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.create(@json_payload) }\n end\n\n patch \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.update(params[:id], @json_payload) }\n end\n\n delete \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { model.delete(params[:id]) }\n end\n\n private\n def catch_errors()\n begin\n yield\n rescue Exception => e\n logger.fatal(\"Exception: #{e}\")\n status 500\n json({'error' => e})\n end\n end\nend", "title": "" }, { "docid": "9e0de8e89dd37d47dab732ce85b8d77d", "score": "0.5859778", "text": "def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend", "title": "" }, { "docid": "c86c17f5e5afe74e2c31e9cf36d01998", "score": "0.5851778", "text": "def url2json(method, url, params)\n if method == :GET\n url << \"?\" + params.map{|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end\n\t\t\turl = URI.parse url\n\t\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\t\thttp.use_ssl = (url.scheme == 'https')\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\thttp.verify_depth = 5\n request = nil\n if method == :GET\n request = Net::HTTP::Get.new(url.request_uri)\n elsif method == :GET_DATA\n request = Net::HTTP::Get.new(url.request_uri)\n form_data = params.to_json\n request.content_type = 'application/json'\n request.body = form_data\n elsif method == :POST\n request = Net::HTTP::Post.new(url.request_uri)\n form_data = params.to_json\n request.content_type = 'application/json'\n request.body = form_data\n elsif method == :DELETE\n request = Net::HTTP::Delete.new(url.request_uri)\n form_data = params.to_json\n request.content_type = 'application/json'\n request.body = form_data\n elsif method == :HEAD\n request = Net::HTTP::Head.new(url.request_uri)\n request.set_form_data(params)\n elsif method == :PUT\n request = Net::HTTP::Put.new(url.request_uri)\n request.set_form_data(params)\n end\n request.basic_auth(@username, @apikey)\n request.add_field(\"User-Agent\", \"Ruby/#{RUBY_VERSION} passivetotal rubygem v#{PassiveTotal::VERSION}\")\n\t\t\tt1 = Time.now\n\t\t\tresponse = http.request(request)\n\t\t\tdelta = (Time.now - t1).to_f\n data = JSON.parse(response.body)\n\n obj = Transaction.new(\n Query.new(method, params['query'], params[method] || params['tag'], url, params),\n Response.new(response.body, response.code == '200', data),\n delta\n )\n\n case response.code\n when \"401\"\n raise InvalidAPIKeyError.new(obj)\n when \"429\"\n raise ExceededQuotaError.new(obj)\n else\n raise APIUsageError.new(obj)\n end\n\n return obj\n end", "title": "" }, { "docid": "a5ea3c24d584d9e893c0060364e8eabe", "score": "0.58268064", "text": "def api_get_json(url, page, o = {})\n u = absolute_url(url)\n\n options = {}.merge(o)\n options[:_page] = page if page.is_a? Integer\n resp = []\n\n time_taken = Benchmark.measure do\n while u\n json = get_json(u, options)\n result = json['result']\n\n resp.concat(result['items']) unless item_endpoint?(page)\n resp = result['primaryTopic'] if item_endpoint?(page)\n\n u = (fetch_all?(page) || fetch_more?(o, resp)) && more?(result)\n options.delete(:_page) if u\n end\n end\n\n Rails.logger.debug(\"Completed remote JSON LDA execution in: #{time_taken}\")\n resp\n end", "title": "" }, { "docid": "7a8881316e3c790cb31e8af057f09526", "score": "0.5776036", "text": "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend", "title": "" }, { "docid": "230d02bf92d493ae88e9bc6752b80019", "score": "0.57604784", "text": "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "title": "" }, { "docid": "98276f3616345161f49bec6ef4512804", "score": "0.571177", "text": "def json_ld; end", "title": "" }, { "docid": "ee0375dba3fe7fe6bbfa84ed2e36ae66", "score": "0.57110006", "text": "def jsonapi_deserialize(document)\n\n # Optional fields, if present, convert to snake/symbol\n # data - (if present, flatten it accordingly to jsonapi spec)\n # include\n # fields\n # filter\n # sort\n # page\n # platform\n\n # Duplicate document and convert to JSON\n # if document.is_a?(ActionController::Parameters)\n # primary_data = document.dup.as_json\n if document.respond_to?(:permit!)\n # Handle Rails params...\n primary_data = document.dup.require(:data).permit!.as_json\n elsif document.is_a?(Hash)\n primary_data = document.as_json.deep_dup\n else\n return {}\n end\n\n # This is the hash that is going to be returned\n parsed = {}\n parsed['include'] = primary_data['include'] if primary_data['include']\n parsed['fields'] = primary_data['fields'] if primary_data['fields']\n parsed['filter'] = primary_data['filter'] if primary_data['filter']\n parsed['sort'] = primary_data['sort'] if primary_data['sort']\n parsed['page'] = primary_data['page'] if primary_data['page']\n parsed['platform'] = primary_data['platform'] if primary_data['platform']\n\n # Convert primary_data to snake_case\n _primary_data = primary_data.deep_transform_keys(&:underscore)\n\n if _primary_data['data']\n relationships = _primary_data['data']['relationships'] || {}\n parsed['id'] = _primary_data['id'] if _primary_data['id']\n\n # Map _primary_data['data']['attributes'] to parsed hash\n if _primary_data['data']['attributes'].respond_to? :each\n _primary_data['data']['attributes'].each do |key, val|\n parsed[key] = val\n end\n end\n\n relationships.map do |assoc_name, assoc_data|\n assoc_data = (assoc_data || {})['data'] || {}\n rel_name = jsonapi_inflector.singularize(assoc_name)\n\n if assoc_data.is_a?(Array)\n parsed[\"#{rel_name}_ids\"] = assoc_data.map { |ri| ri['id'] }.compact\n next\n end\n\n parsed[\"#{rel_name}_id\"] = assoc_data['id']\n if (options['polymorphic'] || []).include?(assoc_name)\n rel_type = jsonapi_inflector.classify(assoc_data['type'].to_s)\n parsed[\"#{rel_name}_type\"] = rel_type\n end\n end\n end\n\n # Convert to symbols before returning to client\n parsed.deep_transform_keys!(&:to_sym)\n end", "title": "" }, { "docid": "255d4c4355d4ecc92dd190152d401a49", "score": "0.56970936", "text": "def processJSON(json)\n # \"Pretty Print\" the JSON response\n pp json\nend", "title": "" }, { "docid": "f10471f8369470c173e54848d90735ca", "score": "0.5667901", "text": "def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end", "title": "" }, { "docid": "5c842ebf1a10b07b930ed607bef4cd65", "score": "0.56550705", "text": "def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend", "title": "" }, { "docid": "627083e7377080970e42a8b6ab3ffce0", "score": "0.5650976", "text": "def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{\"metadata\":{\"foo\":\"ruby\"},\"request\":{\"time\":\"2019-01-09T04:45:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:45:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:46:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:46:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:47:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:47:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:48:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"metadata\":{\"bar\":\"ruby\"},\"response\":{\"time\":\"2019-01-09T04:48:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:49:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:49:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:50:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:50:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\"}]').map{|element|\n result = EventModel.from_hash(element)\n result.request.time = Time.now.utc.iso8601\n result.response.time = (Time.now.utc + 1).iso8601\n result\n }\n\n # Perform the API call through the SDK function\n self.class.controller.create_events_batch(body)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end", "title": "" }, { "docid": "e1c9ace8b172ab400aa5cbac81bb444c", "score": "0.5643061", "text": "def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend", "title": "" }, { "docid": "23d80419eb287104e09812550c491e14", "score": "0.56351066", "text": "def parse_json(api)\n specific_movie = RestClient.get(api)\n movie_detail_hash = JSON.parse(specific_movie)\nend", "title": "" }, { "docid": "dac28d4700ef1b4d17e5c525b0bc2651", "score": "0.56285995", "text": "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "title": "" }, { "docid": "70dbbdf418becce7b83601c85c8fd53b", "score": "0.5619868", "text": "def find_media_sorted_arrays(json)\n\nend", "title": "" }, { "docid": "acd74cde71b08a23e4856119b424896d", "score": "0.56174463", "text": "def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "title": "" }, { "docid": "d58ad236f3f4b1187bbd3655281fa631", "score": "0.56165135", "text": "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend", "title": "" }, { "docid": "5189d5e55095ee547c6d1c78e2906480", "score": "0.5614072", "text": "def test_multiple_json_callback\n json = %{{\"a\":1}\n[1,2][3,4]\n{\"b\":2}\n}\n results = []\n Oj.load(json, :mode => :strict) { |x, start, len| results << [x, start, len] }\n assert_equal([[{'a'=>1}, 0, 7], [[1, 2], 7, 6], [[3, 4], 13, 5], [{'b'=>2}, 18, 8]], results)\n end", "title": "" }, { "docid": "b3c1a1f7ab1b00a8b012b5e9f8ec5cd8", "score": "0.5612547", "text": "def api_call(payload); end", "title": "" }, { "docid": "610fbdc478dae21197fc3bba5cb0055c", "score": "0.5582867", "text": "def parse_json(json)\n case json[\"type\"]\n when \"track\"\n {\n title: json[\"name\"],\n artist: json[\"artists\"].map { |i| i[\"name\"] }.join(\", \"),\n album: json[\"album\"][\"name\"],\n thumbnail: json[\"album\"][\"images\"].sort_by { |i| i[\"height\"] }.last[\"url\"],\n length: json[\"duration_ms\"].to_i / 1000.0,\n preview_url: json[\"preview_url\"],\n }\n when \"album\"\n {\n\n }\n end\nend", "title": "" }, { "docid": "a65059f95a3a7ccfccb8818d6f83695d", "score": "0.55729175", "text": "def _api\n res = TinyURL.pack(request[:turl]) if request[:turl]\n res = TinyURL.unpack(request[:url].split('/').last) if request[:url]\n res = TinyURL.count(request[:hits].split('/').last).to_s if request[:hits]\n res ||= ''\n respond res\n end", "title": "" }, { "docid": "0a4533e8a1c8fa452d30907b07f9dbd5", "score": "0.5568296", "text": "def json_get(url)\n get url, :parse=>true\n end", "title": "" }, { "docid": "614c3e9cebc1f21339110d70a0b8c0bd", "score": "0.55611765", "text": "def json_fields\n\n mappings = {}\n\n json = self.record.json\n if !json\n return mappings\n end\n\n mappings['language'] = json['language']\n\n if json['notes']\n json['notes'].each do |note|\n if note['type'] == 'physloc' and !note['content'].blank?\n mappings['physical_location_note'] = note['content'].map { |cont| \"#{cont}\" }.join(\"; \")\n end\n end\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = json.fetch('instances', false)\n if !instances\n return mappings\n end\n\n mappings['requests'] = instances\n .select{ |instance| !instance['digital_object'] }\n .each_with_index\n .map { |instance, i|\n request = {}\n\n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n if container\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n if top_container\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n if top_container_resolved\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n end\n\n end\n end\n end\n\n request\n }\n\n return mappings\n end", "title": "" }, { "docid": "f8d79785fe6a8998052e67bdf26e2dee", "score": "0.55528736", "text": "def get_character_movies_from_api(character)\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n results = []\n still_searching = true\n\n while still_searching\n results << character_hash[\"results\"] # results pushed into results array on every loop iteration\n if character_hash[\"next\"]\n next_page = RestClient.get(character_hash[\"next\"])\n character_hash = JSON.parse(next_page)\n else\n still_searching = false\n end\n end\n\n results = results.flatten\n results = results.select {|chara| chara[\"name\"].downcase == character}\n # results is an array containing a hash\n\n if results.length > 0\n film_hash = results[0][\"films\"].map do |film_url|\n film = RestClient.get(film_url)\n film = JSON.parse(film)\n end\n end\nend", "title": "" }, { "docid": "350524aaa8ceb8655267d3a61ea86170", "score": "0.5538189", "text": "def get_objects(data,*moredata)\n parms = legacy_getparms(data,moredata)\n # def get_objects(objecttype, get, exactget, regexget, exclude, andget, includes=nil, login=nil, password_callback=PasswordCallback)\n objecttype = parms[:objecttype]\n get = parms[:get]\n exactget = parms[:exactget]\n regexget = parms[:regexget]\n exclude = parms[:exclude]\n andget = parms[:andget]\n includes = parms[:includes]\n login = parms[:login]\n password_callback = parms[:password_callback]\n # PS-704 - node_groups controller when format.xml, includes some custom model methods that create a lot of querying joins, so this is\n # a way to 'override' it on cli side - the server will look for that param to skip these def methods when it renders. webparams = {:nodefmeth => 1}\n webparams = parms[:webparams]\n #\n # Package up the search parameters in the format the server expects\n #\n metaget = []\n if get\n get.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exactget\n exactget.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"exact_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exact_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if regexget\n regexget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"regex_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"regex_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exclude\n exclude.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"exclude_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exclude_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if andget\n andget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"and_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"and_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if includes\n # includes = ['status', 'rack:datacenter']\n # maps to\n # include[status]=&include[rack]=datacenter\n includes.each do |inc|\n incstring = ''\n if inc.include?(':')\n incparts = inc.split(':')\n lastpart = incparts.pop\n incstring = 'include'\n incparts.each { |part| incstring << \"[#{part}]\" }\n incstring << \"=#{lastpart}\"\n else\n incstring = \"include[#{inc}]=\"\n end\n metaget << incstring\n end\n end\n if webparams && webparams.kind_of?(Hash)\n webparams.each_pair{|k,v| metaget << \"#{k}=#{v}\"}\n end\n\n querystring = metaget.join('&')\n\n #\n # Send the query to the server\n #\n\n if parms[:format] == 'json'\n if HAS_JSON_GEM\n uri = URI::join(@server, \"#{objecttype}.json?#{querystring}\")\n else\n warn \"Warning: Cannot use json format because json gem is not installed. Using xml format instead.\"\n parms[:format] = 'xml'\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n else\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n\n req = Net::HTTP::Get.new(uri.request_uri)\n warn \"GET URL: #{uri}\" if (@debug)\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Get.new(uri.request_uri)\n response = send_request(req, uri, login, password_callback)\n end\n if !response.kind_of?(Net::HTTPOK)\n puts response.body\n response.error!\n end\n\n if parms[:format] == 'json'\n results = JSON.parse(response.body)\n else\n #\n # Parse the XML data from the server\n # This tries to render the XML into the best possible representation\n # as a Perl hash. It may need to evolve over time.\n puts response.body if (@debug)\n results_xml = REXML::Document.new(response.body)\n results = {}\n if results_xml.root.elements[\"/#{objecttype}\"]\n results_xml.root.elements[\"/#{objecttype}\"].each do |elem|\n # For some reason Elements[] is returning things other than elements,\n # like text nodes\n next if elem.node_type != :element\n data = xml_to_ruby(elem)\n name = data['name'] || data['id']\n if !results[name].nil?\n warn \"Duplicate entries for #{name}. Only one will be shown.\"\n end\n results[name] = data\n end\n end\n end\n\n #puts results.inspect if (@debug)\n puts YAML.dump(results) if (@debug)\n results\n end", "title": "" }, { "docid": "a89d07fc4e738ac00cf1be13f99b3415", "score": "0.55319566", "text": "def post(endpoint, options)\n #Send request\n res = RestClient.post endpoint,\n options,\n content_type: :json\n\n #Process and return response\n return JSON.parse(res.body, object_class: OpenStruct)\nend", "title": "" }, { "docid": "0e438af1287247757be24d306b587bde", "score": "0.5525962", "text": "def pj(json)\n JSON.pretty_generate(json)\nend", "title": "" }, { "docid": "f622cd4588722a58a0814f55339393b2", "score": "0.55247307", "text": "def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.5524498", "text": "def api; end", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.5524498", "text": "def api; end", "title": "" }, { "docid": "2350cbe504662d9afb34ca2af21b29d8", "score": "0.5522224", "text": "def hash_for_json(*_arg0); end", "title": "" }, { "docid": "0b169d3ec97303ac4e2ad07cb101a806", "score": "0.55159694", "text": "def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend", "title": "" }, { "docid": "7293960157743437d66c95095dfff2ef", "score": "0.5509214", "text": "def as_json(opts={})\n json = {\n :id => id,\n :organization_id => organization_id,\n :account_id => account_id,\n :created_at => created_at.to_date.strftime(DISPLAY_DATE_FORMAT),\n :access => access,\n :page_count => page_count,\n :annotation_count => annotation_count || 0,\n :public_note_count => public_note_count,\n :title => title,\n :slug => slug,\n :source => source,\n :description => description,\n :organization_name => organization_name,\n :organization_slug => organization_slug,\n :organization_documents_url => organization_documents_url,\n :account_name => account_name,\n :account_slug => account_slug,\n :account_documents_url => account_documents_url,\n :related_article => related_article,\n :pdf_url => pdf_url,\n :thumbnail_url => thumbnail_url( { :cache_busting => opts[:cache_busting] } ),\n :full_text_url => full_text_url,\n :page_image_url => page_image_url_template( { :cache_busting => opts[:cache_busting] } ),\n :page_text_url => page_text_url_template( { :cache_busting => opts[:cache_busting] } ),\n :canonical_url => canonical_url(:html),\n :document_viewer_url => document_viewer_url,\n :document_viewer_js => canonical_url(:js),\n :reviewer_count => reviewer_count,\n :remote_url => remote_url,\n :detected_remote_url => detected_remote_url,\n :publish_at => publish_at.as_json,\n :hits => hits,\n :mentions => mentions,\n :total_mentions => total_mentions,\n :project_ids => project_ids,\n :char_count => char_count,\n :data => data,\n :language => language,\n :file_hash => file_hash\n }\n if opts[:annotations]\n json[:annotations_url] = annotations_url if commentable?(opts[:account])\n json[:annotations] = self.annotations_with_authors(opts[:account])\n end\n json\n end", "title": "" }, { "docid": "c7bca911663c8a72621b502cc363e0cf", "score": "0.55070925", "text": "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "title": "" }, { "docid": "c7bca911663c8a72621b502cc363e0cf", "score": "0.55070925", "text": "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "title": "" }, { "docid": "12800641a7efeb2da6bc74dc95bddc2b", "score": "0.5483722", "text": "def parse_api_request(url_endpoint)\n response = RestClient::Request.execute(\n :method => :get,\n :url => url_endpoint,\n :headers => {\"X-Mashape-Key\" => TEST_KEY,\n \"Accept\" => \"application/json\"\n })\n response_hash = JSON.parse(response)[\"api\"]\nend", "title": "" }, { "docid": "4092de31258c92643f18b6ead79e1afb", "score": "0.54805064", "text": "def get_from_mashable\n route = 'http://mashable.com/stories.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"hot\"].map do |story|\n story_hash = {\n title: story[\"title\"],\n score: story[\"shares\"][\"total\"],\n category: story[\"channel\"],\n author: story[\"author\"]\n }\n end\nend", "title": "" }, { "docid": "35d57537a20ef3b47f008bd54971da2f", "score": "0.54734075", "text": "def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n options['integers'] = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n options['models'] = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n options['strings'] = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "8dcf29879b6807719717545e57d6b67c", "score": "0.54667073", "text": "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend", "title": "" }, { "docid": "cf661e39e5efb9d4ebbc89f1f50a1825", "score": "0.5466056", "text": "def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend", "title": "" }, { "docid": "a768f7ab615996f6a6387fcc88d70db8", "score": "0.5464033", "text": "def api_request(data)\n params = {'id' => next_sequence_number!}\n params['sid'] = sid if sid\n json_data = [data].to_json\n\n response_body = get_api_response(params,json_data)\n parse_json_response(response_body)\n end", "title": "" }, { "docid": "0951707cf19908f0a6533e86d402c176", "score": "0.54630744", "text": "def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end", "title": "" }, { "docid": "a63974b22f867273ed33949d16d0bf21", "score": "0.54580635", "text": "def json_to_object(json)\n JSON(json)\nend", "title": "" }, { "docid": "49e10b3868b1fe67ec07cdc3df31676c", "score": "0.5457171", "text": "def jsonify(input); end", "title": "" }, { "docid": "8d3515d9e70ef2601ee115b866b66ffe", "score": "0.5454323", "text": "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "title": "" }, { "docid": "30b24f0a92c8a7f9dd1411b860d95ef4", "score": "0.5448017", "text": "def fetch; end", "title": "" }, { "docid": "30b24f0a92c8a7f9dd1411b860d95ef4", "score": "0.5448017", "text": "def fetch; end", "title": "" }, { "docid": "326f4c9a1ee80381ea505d9f427bc15e", "score": "0.5441329", "text": "def api(path,lastmodified = nil) #Returns the FRC API file for the specified path in JSON format.\n #Warning: api() returns an HTTP response while reqapi() returns a JSON string.\n begin\n \tputs \"I am accessing the API at path #{path}\"\n \toptions = { 'User-Agent' => \"https://github.com/2468scout/2468Scout-Ruby-Server\", #Dunno what this is but Isaac did it\n 'Authorization' => \"Basic #{$token}\", #Standard procedure outlined by their API\n 'accept' => \"application/json\" #We want JSON files, so we will ask for JSON\n \t}\n \t#FMS-OnlyModifiedSince will return just a 304\n \t#If-Modified-Since will return a 200 no matter what, for some reason\n \toptions['FMS-OnlyModifiedSince'] = lastmodified if lastmodified\n #puts options['If-Modified-Since']\n #open(\"#{$server}#{path}\", options).read\n toreturn = {}\n\n if $toggle_manual_input\n \tputs \"I want to access #{path}, but manual input is turned on! Please type the filename to use in its place.\"\n \tfilename = \"\"\n \twhile(!File.exists? filename)\n \t\tputs \"Try file name: \"\n \t\tfilename = gets\n \t\tputs \"Searching for the file #{filename}...\"\n \tend\n \tjsondata = retrieveJSON(filename)\n \ttoreturn = OpenStruct.new(:body => jsondata, :meta => {}, :staus => ['200', 'OK']) \n else\n\t open(\"#{$server}#{path}\", options) do |response|\n\t \tbody = \"\"\n\t \tresponse.each_line do |line|\n\t \t\tbody << line.to_s\n\t \tend\n\t \t#response.base_uri.to_s\n\t \ttoreturn = OpenStruct.new(:body => body, :meta => response.meta, :status => response.status)\n\t \t#must create a persistent object out of the response, as response is not accessible outside this method\n\t end\n\tend\n toreturn\n rescue => e\n \tputs \"Something went wrong #{e.class}, message is #{e.message}\"\n toreturn = '{}'\n if (e.message.include? '304') \n \ttoreturn = OpenStruct.new(:body => '{}', :status => ['304','Not Modified'])\n\tend\n\ttoreturn #If error, return empty JSON-ish, or 304 if 304\n end\nend", "title": "" }, { "docid": "f2f245f2d62c7fe44c5ee7e6653f64fc", "score": "0.5440444", "text": "def microservice_i(id)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{0}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\n\r\n if id == 4\r\n food_units = gets.strip.to_i\r\n buy_food(7,food_units)\r\n end\r\nend", "title": "" }, { "docid": "7e921075ba6c38c732a416ca0e61fd33", "score": "0.543577", "text": "def api_keys; rest_query(:api_key); end", "title": "" }, { "docid": "7e921075ba6c38c732a416ca0e61fd33", "score": "0.543577", "text": "def api_keys; rest_query(:api_key); end", "title": "" }, { "docid": "8f6945fcb933fb88fa550fe9d6794d85", "score": "0.5424549", "text": "def get_json\n return to_json()\nend", "title": "" }, { "docid": "c229c69a21f23fefd069d82c047969bc", "score": "0.54234785", "text": "def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end", "title": "" }, { "docid": "b5f5d6eea18089ab4ffe546410009f0a", "score": "0.542293", "text": "def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend", "title": "" }, { "docid": "ecbf204b584bacdb7f8e0ee23693fd11", "score": "0.5415392", "text": "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "title": "" }, { "docid": "4dcba794ae194192dccb5b14c965d5c3", "score": "0.541256", "text": "def serialize_json(o)\n API_CLIENT.object_to_http_body(o)\nend", "title": "" }, { "docid": "13cfbe50a73176f08b681f3684afe561", "score": "0.5391043", "text": "def apis; end", "title": "" }, { "docid": "485845d9e753911c74fff39226d1396b", "score": "0.5389887", "text": "def json_parse(url, header_type)\n\n raw_data = open(url)\n parsed = JSON.parse(raw_data.read)\n columns = parsed['meta']['view']['columns']\n if header_type == 1\n headers = columns.map{|column| column['name']}\n ########################\n # for potholes:\n elsif header_type == 2\n headers = [\"sid\",\"id\",\"position\",\"created_at\",\"created_meta\",\"updated_at\",\"updated_meta\",\"meta\",\"Creation Date\",\"Status\",\"Completion Date\",\"Service Request Number\",\"Type of Service Request\",\"CURRENT ACTIVITY\",\"MOST RECENT ACTION\",\"NUMBER OF POTHOLES FILLED ON BLOCK\",\"Street Address\",\"ZIP Code\",\"X COORDINATE\",\"Y COORDINATE\",\"Ward\",\"Police District\",\"Community Area\",\"SSA\",\"Latitude\",\"Longitude\", \"Location\"]\n end\n # binding.pry\n data = parsed['data']\n # sliced_hash_holder = []\n data.each do |row|\n data_hash = Hash[headers.zip(row)]\n slice_hash = data_hash.slice(\"Creation Date\", \"Status\", \"Completion Date\", \"Service Request Number\", \"Type of Service Request\",\n \"Street Address\", \"ZIP Code\", \"Latitude\", \"Longitude\", \"Location\")\n mappings = {\"Creation Date\" => :creation_date, \"Status\" => :status, \"Completion Date\" => :completion_date,\n \"Service Request Number\" => :service_request_number, \"Type of Service Request\" => :type_of_service_request,\n \"Street Address\" => :street_address, \"ZIP Code\" => :zip_code, \"Latitude\" => :latitude, \"Longitude\" => :longitude, \"Location\" => :location}\n # p slice_hash\n Request.create(Hash[slice_hash.map {|k, v| [mappings[k], v] }])\n #Request.create(slice_hash)\n # sliced_hash_holder << slice_hash\n # binding.pry\n end\n # 100.times do |i|\n # Request.create(sliced_hash_holder[i])\n # end\nend", "title": "" }, { "docid": "1a383c60780c54f5a1963696c1a1162a", "score": "0.5386724", "text": "def parse_api(link)\n movie_data ={}\n movie_url_link = RestClient.get(link)\n movie_data = JSON.parse(movie_url_link)\n # binding.pry\nend", "title": "" }, { "docid": "2091259c78baa4f8a05d7e72bb0c9e51", "score": "0.5379128", "text": "def fetchServerConfig()\n #Construct the URL for the request\n url = \"http://api.themoviedb.org/3/configuration?api_key=#{$apiKey}\"\n #Preform a restful reqeust for the data\n data = RestClient.get(url)\n #Parse the returned JSON and return it as a hash\n return JSON.parse(data)\nend", "title": "" }, { "docid": "5d63ea17f247ba9f7f076feaea8b7d6a", "score": "0.53779393", "text": "def fetchMovieData(movieID)\n puts \"HITTING THE NET\"\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}?api_key=#{$apiKey}\"\n #Preform a restful request to get the information\n #Uses the RestClient gem to preform the request\n data = RestClient.get(url)\n #Parse the JSON to get a simple hash (key value pairs) of info\n #Uses the JSON gem to avoid manual parsing\n data = JSON.parse(data)\n\n #Reformat some data to make it easier to work with later\n #2015-04 BN: added a translation step so that apostrophes, like \"he's\" willl get \n # passed correctly\n data[\"description\"] = data[\"overview\"][0..249]\n\n \n #Get the information that was not included in the first API call\n #Rating and date info\n ratingAndDate = fetchMovieRatingAndYear(movieID)\n #Add this data to the hash before returning it\n data[\"contentRating\"] = ratingAndDate[\"certification\"]\n data[\"year\"] = Date.parse(ratingAndDate[\"release_date\"]).year.to_s\n\n #Fetch the movie directors and actors and add them to the hash\n data[\"artist\"] = fetchMovieCast(movieID)\n data[\"directors\"] = fetchMovieDirectors(movieID)\n return data\nend", "title": "" }, { "docid": "d417168c7d61a0490a15133166f525d9", "score": "0.53701925", "text": "def get_character_movies_from_api(character)\n #make the web request\n page = 1\n # iterate over the character hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls,\n until page == 10\n all_characters = RestClient.get(\"https://swapi.co/api/people/?page=#{page}\")\n character_hash = JSON.parse(all_characters)\n\n character_hash[\"results\"].each do |value|\n if value[\"name\"] == character\n films_hash = value[\"films\"]\n end\n end\n page +=1\n end\n\nend", "title": "" }, { "docid": "716e3fe5255734817b9c89d79fe364b1", "score": "0.5369323", "text": "def API_RESPONSE(status, body)\n JSON.generate({:status => status, :body => body});\nend", "title": "" }, { "docid": "5016d8f41cc30cefeafebb09a9d3d7bf", "score": "0.5367767", "text": "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "title": "" }, { "docid": "113260b5ac755ad1e5fb52146114997a", "score": "0.5366764", "text": "def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end", "title": "" }, { "docid": "4701563ceadab6fc5a38a080ee2d591d", "score": "0.5362977", "text": "def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "title": "" }, { "docid": "c783ab216023e2c15466417d4b3d17fe", "score": "0.53622794", "text": "def to_api_json\n Jbuilder.encode do |json|\n json.albums do\n json.array! @albums do |album|\n json.call(album, :name, :uuid)\n json.set!(:artist, album.artist_name)\n json.set!(:artist_twitter_screen_name, twitter_screen_name(album))\n json.set!(:thumbnail_url, album.image || album.thumbnail)\n json.set!(:release_date, album.release_date.in_time_zone.to_i)\n json.set!(:release_date_string, album.release_date.to_s)\n json.set!(:age, album.anniversary.count)\n json.set!(:day_of_week, album.anniversary.current.strftime('%A'))\n json.set!(:anniversary, album.anniversary.current.in_time_zone.to_i)\n json.set!(:anniversary_string, album.anniversary.current.to_s)\n json.set!(:review_link, album.link)\n json.set!(:rating, album.rating)\n json.set!(:generated_fun_fact_description, album.generated_fun_fact_description)\n json.set!(:fun_fact_description, album.fun_fact_description)\n json.set!(:fun_fact_source, album.fun_fact_source)\n json.set!(:link, \"/albums/#{album.slug}\")\n json.set!(:update, \"/v1/admin/albums/#{album.id}\")\n end\n end\n end\n end", "title": "" }, { "docid": "8f4f802de6e2a964aab8fde9b5ad0a2e", "score": "0.5361555", "text": "def get_from_digg\n raw_response = RestClient.get('http://digg.com/api/news/popular.json')\n response = JSON.load(raw_response)\n\n response[\"data\"][\"feed\"].map do |story|\n story_hash = {\n title: story[\"content\"][\"title_alt\"],\n author: story[\"content\"][\"author\"],\n score: story[\"digg_score\"],\n category: story[\"content\"][\"tags\"].map {|tag| tag[\"display\"]}\n }\n end\n\n\nend", "title": "" }, { "docid": "0ef1ffc1fa550d7e2c8cb79d855bef6f", "score": "0.5356244", "text": "def http_accept_json(http_method, params, data=nil)\n url = URI.parse(\"http://localhost:7000/test/#{params}\")\n\n Net::HTTP.start(url.host, url.port) do |http|\n initheader = {'Accept:' => 'application/json'}\n response = case http_method\n when :GET\n http.get(url.path, initheader)\n when :PUT\n http.put(url.path, data, initheader)\n when :POST\n http.post(url.path, data, initheader)\n when :DELETE\n http.delete(url.path, initheader)\n end\n JSON.parse(response.body)\n end\nend", "title": "" }, { "docid": "2f3feb0a7773f7dfd370009058aba15b", "score": "0.53501004", "text": "def get_movies_data(character_data)\n if character_data\n character_films = character_data[\"films\"]\n movie_response_string = character_films.map {|film_url| RestClient.get(film_url)}\n movie_response_string.map {|response_string| JSON.parse(response_string)}\n else\n nil\n end\nend", "title": "" }, { "docid": "dcb3b2255dce7942edd3671442aad804", "score": "0.5335876", "text": "def get_character_movies_from_api(character)\n #make the web request\n link = \"http://www.swapi.co/api/people/\"\n character_hash = parse_json(link)\n link = character_hash[\"next\"]\n\n while link != nil\n character_hash[\"results\"] = character_hash[\"results\"].replace(parse_json(link)[\"results\"])\n break if check_for_character(character_hash[\"results\"], character)\n link = parse_json(link)[\"next\"]\n end\n\n char = get_character_info(character_hash, character)\n\nend", "title": "" }, { "docid": "a0624cdd40f5628f4155f58a8d00038c", "score": "0.5335606", "text": "def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend", "title": "" }, { "docid": "5e33e4c822a9867ac8c5dd08dd874f73", "score": "0.53351986", "text": "def http_call(payload); end", "title": "" }, { "docid": "767c717061654cc30232b60b59a5489f", "score": "0.53278506", "text": "def fetch_json(url, &block)\n require 'net/http'\n require 'json'\n\n resp = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(resp.body)\n\n return [] unless json.has_key?(KEY) \n return [] unless (jrs = json[KEY]).is_a?(Array)\n return [] if jrs.empty?\n\n results = []\n\n jrs.threaded_each do |jr|\n result = block_given? ? (yield jr) : jr\n results << Result.new(result) if result\n end\n\n results\n end", "title": "" }, { "docid": "1d1cfdbe951242f3dc8931949d2bc223", "score": "0.530848", "text": "def get_characters_from_api\n #establish initial url from api\n url = 'http://www.swapi.co/api/people/'\n #get all data from first page of API\n page_of_characters = JSON.parse(RestClient.get(url))\n all_characters = page_of_characters\n \n next_call = page_of_characters[\"next\"]\n\n while next_call do\n next_page = next_call\n next_page_of_characters = JSON.parse(RestClient.get(next_page))\n (all_characters[\"results\"] << next_page_of_characters[\"results\"])\n next_call = next_page_of_characters[\"next\"]\n end\n\n all_characters\nend", "title": "" }, { "docid": "34822ad4f503cb85240bc589bdf19def", "score": "0.53001916", "text": "def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend", "title": "" }, { "docid": "b75cf487e72eb144f961ba18b96d27c5", "score": "0.52878547", "text": "def omdb_pull(search_key, search_val)\n\n result = Typhoeus.get(\"http://www.omdbapi.com/\", :params => {search_key => search_val})\n result = JSON.parse(result.body)\n result\n\nend", "title": "" }, { "docid": "ecf9f90caaa29ec753bbc9722441239e", "score": "0.52848494", "text": "def json_parse (s)\n\n #defined?(ActiveSupport::JSON) ? ActiveSupport::JSON.decode(s) :\n #JSON.parse(s)\n OpenWFE::Json.decode( s )\nend", "title": "" }, { "docid": "0c311ea31068895d2f3c3af03077e969", "score": "0.52784723", "text": "def apply_json_trait(value); end", "title": "" }, { "docid": "d9409a6bb52842dd5ae643aaee4d723b", "score": "0.52784574", "text": "def fetch\n response = RestClient.get \"http://pokeapi.co/#{resource_uri}\"\n update(resource_data: JSON.parse(response))\n end", "title": "" }, { "docid": "a7f55b6ee8382014c8f5550ad9770958", "score": "0.52634823", "text": "def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end", "title": "" }, { "docid": "c0385d116953da397b215cd8a12c3ec3", "score": "0.5261362", "text": "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "title": "" }, { "docid": "4720f392e34c0741737524e49501fa5a", "score": "0.52470946", "text": "def make_api_call \n Artist.all.each do |artist|\n request = RestClient.get(\"https://api.songkick.com/api/3.0/artists/#{artist.song_kick_id}/calendar.json?apikey=zIDG2c72WHINjQ8Y\")\n artist_data = JSON.parse(request)\n create_event(artist_data, artist.id)\n end \n \nend", "title": "" }, { "docid": "ae94725fc7de99b46e482be3c269556f", "score": "0.52423733", "text": "def render_json\n end", "title": "" }, { "docid": "738236704a8c2ae1008330b929e3f204", "score": "0.52361494", "text": "def read_json(request_type)\n case request_type\n when :manga\n @json_key = \"unapproved_manga\".freeze\n @url_part = \"manga\".freeze\n else\n @json_key = \"unapproved_anime\".freeze\n @url_part = \"anime\".freeze\n end\n @parsed_json = $id_cache.get()\n @parsed_info = $info_cache.get()\n @ids = @parsed_json[@json_key].map(&:to_s)\n @info = @parsed_info[@json_key]\n @data = {}\n @ids.each do |i|\n @id_url = \"https://myanimelist.net/#{@url_part}/#{i}\".freeze\n @data[i] = if @info.key?(i)\n @info[i]\n else\n { \"name\".freeze => @id_url, \"type\".freeze => \"?\".freeze, \"nsfw\".freeze => false }\n end\n @data[i][\"url\".freeze] = @id_url\n end\n [@ids, @data]\nend", "title": "" }, { "docid": "154864bd82553c116e16dd1a46d4d6b4", "score": "0.5232529", "text": "def print_results(response)\n puts response.to_json\nend", "title": "" }, { "docid": "db1dc8b5f3eed81a63761550277df7d1", "score": "0.5226276", "text": "def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend", "title": "" }, { "docid": "6ad909a1e16d9e1d77ff114944a6f469", "score": "0.5225501", "text": "def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end", "title": "" }, { "docid": "c9f1a7881cd0392ba7b00ea607e6a06b", "score": "0.52229464", "text": "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "title": "" }, { "docid": "c9f1a7881cd0392ba7b00ea607e6a06b", "score": "0.52229464", "text": "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "title": "" } ]
dae5d33630d091be79d89bb237cbf075
GET /rams/new GET /rams/new.json
[ { "docid": "5cf465f92df4a0de2696682a1815ca76", "score": "0.761527", "text": "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "title": "" } ]
[ { "docid": "2962b76cb47b3467d7d55f533330c0bc", "score": "0.72938955", "text": "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", "title": "" }, { "docid": "1bb56472463277b8a1f4e54204d492b1", "score": "0.72909737", "text": "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", "title": "" }, { "docid": "8636dc9ee0d8588206c5f9177c03f7e8", "score": "0.72783023", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end", "title": "" }, { "docid": "f21b93a37ec98093c29dce4e86e8236d", "score": "0.72708744", "text": "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "title": "" }, { "docid": "170729bc60cbcd854eb48ee809081975", "score": "0.724733", "text": "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "title": "" }, { "docid": "5444a59dece822bdfeac9db3a2f3a631", "score": "0.7219516", "text": "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "title": "" }, { "docid": "a886b9c641cdfe2ba236efb3e2690398", "score": "0.720884", "text": "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "title": "" }, { "docid": "ba5783b3c710eec7cf26ff7361098356", "score": "0.7195907", "text": "def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end", "title": "" }, { "docid": "7dbac0b090063eb55edfcea3c1632755", "score": "0.7192078", "text": "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "title": "" }, { "docid": "09d9f63143f3f7b19ff30d622452b203", "score": "0.7190404", "text": "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end", "title": "" }, { "docid": "b6c00328c603b6f67c82ceb0ca824da1", "score": "0.71821463", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "b6c00328c603b6f67c82ceb0ca824da1", "score": "0.71821463", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "b6c00328c603b6f67c82ceb0ca824da1", "score": "0.71821463", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "b6c00328c603b6f67c82ceb0ca824da1", "score": "0.71821463", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "b6c00328c603b6f67c82ceb0ca824da1", "score": "0.71821463", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "bd1fc80f64bf1baf6506d0fb51b1cbf0", "score": "0.718059", "text": "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "title": "" }, { "docid": "c1b120b15f30669a0cac3ffd94e0b086", "score": "0.7179933", "text": "def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end", "title": "" }, { "docid": "1664ad03be960fd4fad11b817761039a", "score": "0.7177542", "text": "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "title": "" }, { "docid": "342f6517ffdfe3181f705296837841c6", "score": "0.71612674", "text": "def new\n @ramal = Ramal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ramal }\n end\n end", "title": "" }, { "docid": "8711d9621207be635347eb88912bd17f", "score": "0.7157706", "text": "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "title": "" }, { "docid": "89041de801f1c637564d4ef6dadc435e", "score": "0.7142051", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "title": "" }, { "docid": "d6bd53d1111450c48b1ae5dd6f19ae68", "score": "0.71171284", "text": "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "title": "" }, { "docid": "0eb1e08613a69bba99133087aeb7242c", "score": "0.7115566", "text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "title": "" }, { "docid": "0eb1e08613a69bba99133087aeb7242c", "score": "0.7115566", "text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "title": "" }, { "docid": "0eb1e08613a69bba99133087aeb7242c", "score": "0.7115566", "text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "title": "" }, { "docid": "d2cd63d14e53690a6bce286a428806cf", "score": "0.71098006", "text": "def new\n @lei = Lei.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lei }\n end\n end", "title": "" }, { "docid": "9ddb50df36ca85059a36fd79839de398", "score": "0.709749", "text": "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "title": "" }, { "docid": "13ee85b9013c8174d8adb74448111590", "score": "0.7094789", "text": "def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end", "title": "" }, { "docid": "35b501d2e2673f25cf0bc1b7da03d6e5", "score": "0.7086152", "text": "def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end", "title": "" }, { "docid": "d8ea39dde06ba20b6cef9fc8ea031748", "score": "0.70861214", "text": "def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end", "title": "" }, { "docid": "0c5f070141db45c8bb2080cba50f9e23", "score": "0.7075891", "text": "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", "title": "" }, { "docid": "f021d6d2c069c331189d4a2a721844a5", "score": "0.70734286", "text": "def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end", "title": "" }, { "docid": "16e8341e01a30007ab8aa8d0621afd6b", "score": "0.7071487", "text": "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "title": "" }, { "docid": "d8c444c632e799d81e2f335fc7616be8", "score": "0.7071105", "text": "def new\n @reel = Reel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reel }\n end\n end", "title": "" }, { "docid": "5f7a6fe657cf40e73691ef6259bb77b9", "score": "0.7070486", "text": "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", "title": "" }, { "docid": "ca503cf3e44ff55a99edffbab74c1ca6", "score": "0.7068006", "text": "def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end", "title": "" }, { "docid": "f2cb261ff522a20c073d6a4884961450", "score": "0.70655406", "text": "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "title": "" }, { "docid": "a8aa813e6c2ef4c3e867bc627519c6ce", "score": "0.7064876", "text": "def new\n @bl = Bl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bl }\n end\n end", "title": "" }, { "docid": "2a03c370ed7bae61fb071270d78f4efe", "score": "0.7060726", "text": "def new\n @ridol = Ridol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ridol }\n end\n end", "title": "" }, { "docid": "20a23bba59d0a9ed4e7d6f6fd305218a", "score": "0.70545334", "text": "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "title": "" }, { "docid": "0ce5f32cdc37e7ac6a7e11a7e2210b1e", "score": "0.70529705", "text": "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.70502406", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.70502406", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.70502406", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.70502406", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "b0b39c21a38fb69395ec844c42d5ef31", "score": "0.7046853", "text": "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "title": "" }, { "docid": "2afe85c45127d1db5af493430727fff4", "score": "0.7042482", "text": "def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end", "title": "" }, { "docid": "ff64b6038368bf6e2980c09811e6cd88", "score": "0.70423555", "text": "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", "title": "" }, { "docid": "ff64b6038368bf6e2980c09811e6cd88", "score": "0.70423555", "text": "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", "title": "" }, { "docid": "ff64b6038368bf6e2980c09811e6cd88", "score": "0.70423555", "text": "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", "title": "" }, { "docid": "eb8ed8d2e8397e7eb2f17ea7c2e8d34d", "score": "0.7039284", "text": "def new\n @tag = Tag.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "title": "" }, { "docid": "61586b66610502b764a155808444eee7", "score": "0.70375896", "text": "def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end", "title": "" }, { "docid": "cbe9314a8646480a8a0684067bb61c25", "score": "0.70351887", "text": "def new\n @name = Name.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end", "title": "" }, { "docid": "a2539d8f225c05f1e073f5036dd39fa0", "score": "0.70340586", "text": "def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end", "title": "" }, { "docid": "d751548fe2a26944a15060ac29172a03", "score": "0.7033919", "text": "def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end", "title": "" }, { "docid": "06595f5ab60d0236c58d64ab2f913bef", "score": "0.7033161", "text": "def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end", "title": "" }, { "docid": "2163cf41c080c5aba5e16641e0814cff", "score": "0.7032308", "text": "def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end", "title": "" }, { "docid": "dba396ec2b2f481deb8df610140ac413", "score": "0.70317113", "text": "def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end", "title": "" }, { "docid": "f6e024864529b1d71cf429b05828b33f", "score": "0.703091", "text": "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "title": "" }, { "docid": "4f3e3434a07eb2b43e81deae2c58d180", "score": "0.7030892", "text": "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "title": "" }, { "docid": "9d2a4bc975bc6eafffc95924bded58b2", "score": "0.70301116", "text": "def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end", "title": "" }, { "docid": "27f5bfa5fe3ee0cd0b0ab1d6481aeed4", "score": "0.70235", "text": "def new\n @name = Name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end", "title": "" }, { "docid": "5210fb604c38cbe2ab21ea55c068f4ad", "score": "0.70231926", "text": "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "title": "" }, { "docid": "afcfc8269e8222795f2bb9fe21dc838d", "score": "0.7021587", "text": "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "title": "" }, { "docid": "723467526d0f62079930b5f75e63d96c", "score": "0.70173544", "text": "def new\n @entry = Entry.new\n\n render json: @entry\n end", "title": "" }, { "docid": "343c0e3b6755535fbaf8149ea16c72a5", "score": "0.7015222", "text": "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "title": "" }, { "docid": "343c0e3b6755535fbaf8149ea16c72a5", "score": "0.7015222", "text": "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "title": "" }, { "docid": "343c0e3b6755535fbaf8149ea16c72a5", "score": "0.7015222", "text": "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "title": "" }, { "docid": "7756654be46293658c707587c0f4e603", "score": "0.7013981", "text": "def new\n @lugar = Lugar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lugar }\n end\n end", "title": "" }, { "docid": "b73721fe1b741f807e4487f5dd49e9be", "score": "0.7013182", "text": "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "title": "" }, { "docid": "cbb98b9c9f7126e0d85206f8cb8dcd8c", "score": "0.70113766", "text": "def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end", "title": "" }, { "docid": "da497668d1a1b0a51d73d9e67bd60b9a", "score": "0.700997", "text": "def new\n @kolegij = Kolegij.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegij }\n end\n end", "title": "" }, { "docid": "47346e85bc88772a6bddea6739c65931", "score": "0.7002162", "text": "def new\n @rua = Rua.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rua }\n end\n end", "title": "" }, { "docid": "5f9db4488195c1dd05da8ade5ce3feae", "score": "0.69995016", "text": "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "title": "" }, { "docid": "9c5c99ceeb78e6109aa245ea1690ca8a", "score": "0.6999193", "text": "def new\n @monel = Monel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monel }\n end\n end", "title": "" }, { "docid": "f6b400b5c946dfcc1157a5816da03146", "score": "0.6998672", "text": "def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end", "title": "" }, { "docid": "e6377e0102e5624e4719a78f8da45492", "score": "0.69982743", "text": "def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end", "title": "" }, { "docid": "d76bb0ea99146932dfaaed436399dc5a", "score": "0.6992429", "text": "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", "title": "" }, { "docid": "8ddfa8abbdc2d4cfbcc00fbad19df562", "score": "0.6986625", "text": "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "title": "" }, { "docid": "9b7ff55dcd07556de5a4b6f74d7d8b19", "score": "0.6985362", "text": "def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end", "title": "" }, { "docid": "10579c3d3cc989fec15a1ace9f9c505e", "score": "0.69832313", "text": "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "title": "" }, { "docid": "774457a5e42e09c0a2482e4f29c260ae", "score": "0.69798523", "text": "def new\n @human = Human.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end", "title": "" }, { "docid": "a915e5ab4c6160ad75667581021ceba3", "score": "0.69759756", "text": "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "title": "" }, { "docid": "16584278166786272aa8e0589c4add21", "score": "0.69746774", "text": "def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end", "title": "" }, { "docid": "323272146923d0690741a31d75423bd8", "score": "0.6974617", "text": "def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end", "title": "" }, { "docid": "e4d83253031320daee2c3de97a909e81", "score": "0.6973822", "text": "def new\n @rock = Rock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rock }\n end\n end", "title": "" }, { "docid": "32592d03d4c631984b5b7f6c996ac001", "score": "0.6973345", "text": "def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end", "title": "" }, { "docid": "615c1e1c8a1ddd10fae6d3c3e710813d", "score": "0.69729745", "text": "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "title": "" }, { "docid": "c2b3b7a5232c64396a0c9bae7948cf7c", "score": "0.6972972", "text": "def new\n @unp = Unp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unp }\n end\n end", "title": "" }, { "docid": "707229e3caa7442089775b50a426d018", "score": "0.6970019", "text": "def new\n @human = Human.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end", "title": "" }, { "docid": "c3a688e631c9475fc83e3e720fa09905", "score": "0.69687", "text": "def new\n @attribute = Attribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute }\n end\n end", "title": "" }, { "docid": "525a961ac4e9819706d8d97b32a10f8e", "score": "0.69671446", "text": "def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end", "title": "" }, { "docid": "6104385c1ed182a508e509629d7a16dd", "score": "0.6965797", "text": "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\n end\n end", "title": "" }, { "docid": "4063fa5f070167510d5c36a14ee0b4c5", "score": "0.6963637", "text": "def new\n @girltype = Girltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @girltype }\n end\n end", "title": "" }, { "docid": "7f36ca117d8960111dc0b5ceaf444813", "score": "0.6962379", "text": "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "bc84dc05a5664333c0b45ddbaaf84020", "score": "0.6960886", "text": "def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end", "title": "" }, { "docid": "a0cd85b7a3511225782812d928545ca6", "score": "0.6960095", "text": "def new\n @key = Key.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key }\n end\n end", "title": "" }, { "docid": "78ea9c946226cc4c01815d4f9388ebaa", "score": "0.695932", "text": "def new\n @idiom = Idiom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idiom }\n end\n end", "title": "" }, { "docid": "7a1921b560da3a8857a97207fea77a3c", "score": "0.6958403", "text": "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tag }\n end\n end", "title": "" }, { "docid": "7a1921b560da3a8857a97207fea77a3c", "score": "0.6958403", "text": "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tag }\n end\n end", "title": "" } ]
13d74d6f678f3724e4afa91e9002256a
POST /designation_types POST /designation_types.json
[ { "docid": "647af211c15d84820181e7a8e4d02e12", "score": "0.702297", "text": "def create\n @designation_type = DesignationType.new(designation_type_params)\n\n respond_to do |format|\n if @designation_type.save\n format.html { redirect_to @designation_type, notice: 'Designation type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @designation_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @designation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "d4c85346d0562cdee0a1c0fb5a1a86cf", "score": "0.7114481", "text": "def designation_type_params\n params.require(:designation_type).permit(:name)\n end", "title": "" }, { "docid": "768e3a33785f8f05cbf8d2d8b51374f1", "score": "0.6555928", "text": "def index\n @designation_types = DesignationType.all\n end", "title": "" }, { "docid": "798813fdc8e30a1f60cdf1775dcbd906", "score": "0.6263589", "text": "def set_designation_type\n @designation_type = DesignationType.find(params[:id])\n end", "title": "" }, { "docid": "472cd25f89913bdb10df3e3d1b334234", "score": "0.6051748", "text": "def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end", "title": "" }, { "docid": "d9e28858ca62f64b082a7356556c1067", "score": "0.605024", "text": "def create\n @designation = Designation.new(params[:designation])\n\n respond_to do |format|\n if @designation.save\n format.html { redirect_to designations_path, notice: 'Designation was successfully created.' }\n format.json { render json: @designation, status: :created, location: @designation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @designation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4edd19c42e7b32aaf30aa50f261f5af2", "score": "0.6001208", "text": "def create_types\n\t\t[]\n\tend", "title": "" }, { "docid": "4edd19c42e7b32aaf30aa50f261f5af2", "score": "0.6001208", "text": "def create_types\n\t\t[]\n\tend", "title": "" }, { "docid": "2627206ad5b362b322e4a06c8fa451b1", "score": "0.59934485", "text": "def create_types\n\t[]\nend", "title": "" }, { "docid": "2627206ad5b362b322e4a06c8fa451b1", "score": "0.59934485", "text": "def create_types\n\t[]\nend", "title": "" }, { "docid": "10bdc9b53ee3f35bf8a8a3cbd0e844f5", "score": "0.5914076", "text": "def destroy\n @designation_type.destroy\n respond_to do |format|\n format.html { redirect_to designation_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e4dc31051044fc57fb53eaa8cf6479d", "score": "0.5890375", "text": "def create\n # @donation_type = DonationType.new(params[:donation_type])\n\n respond_to do |format|\n if @donation_type.save\n format.html { redirect_to @donation_type, notice: 'Donation type was successfully created.' }\n format.json { render json: @donation_type, status: :created, location: @donation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @donation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4190280766033f0b1b4c4aa131772161", "score": "0.5889353", "text": "def create\n @defect_type = DefectType.new(defect_type_params)\n\n respond_to do |format|\n if @defect_type.save\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully created.' }\n format.json { render :show, status: :created, location: @defect_type }\n else\n format.html { render :new }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d1a814644609d84966bc83ac63e02dc", "score": "0.58496135", "text": "def create\n @intervention_type = InterventionType.new(intervention_type_params)\n\n respond_to do |format|\n if @intervention_type.save\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi criado.' }\n format.json { render :show, status: :created, location: @intervention_type }\n else\n format.html { render :new }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7319d0fc688f4bbbfe61ffbb416c70aa", "score": "0.58385307", "text": "def foundation_type_params\n params.require(:foundation_type).permit(:name, :description, :active)\n end", "title": "" }, { "docid": "d2d7877ac346af141e1cf351fcfbc8f9", "score": "0.5802709", "text": "def departuretype_params\n params.require(:departuretype).permit(:departureTypes)\n end", "title": "" }, { "docid": "9a2e592726d926799ed9f2698e6c752e", "score": "0.5760426", "text": "def create\n @discipline_type = DisciplineType.new(params[:discipline_type])\n\n respond_to do |format|\n if @discipline_type.save\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina criado com sucesso.' }\n format.json { render :json => @discipline_type, :status => :created, :location => @discipline_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @discipline_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fd0fdb7bad2355a05c959a98331b6ad", "score": "0.5724546", "text": "def create\n @competence_type = CompetenceType.new(competence_type_params)\n respond_to do |format|\n if @competence_type.save\n format.json { render :show, status: :created, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c4e2fe9f25e830a2c51ef21230d2bfb", "score": "0.5720746", "text": "def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end", "title": "" }, { "docid": "bafc7d165d1f1ddd71bc32f94b3aeb72", "score": "0.5706622", "text": "def competence_type_params\n params.require(:competence_type).permit(:code, :name, :type, :required, :details)\n end", "title": "" }, { "docid": "cdb56094d2773a34eb59abd1e03f6cdb", "score": "0.5704945", "text": "def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "43064885779abe2d554a4870be299cb9", "score": "0.56869024", "text": "def encounters_type_params\n params.require(:encounters_type).permit(:name, :description, :creator, :date_created, :retired, :retired_by, :date_retired, :retire_reason, :uuid)\n end", "title": "" }, { "docid": "ef66a2138ec463f73ee8685378bbe4b9", "score": "0.5685634", "text": "def doc_type_params\n params.require(:doc_type).permit(:name)\n end", "title": "" }, { "docid": "cd9d50a7b87bc48f28d384e0abd63f50", "score": "0.56494504", "text": "def create\n @type_identification = TypeIdentification.new(type_identification_params)\n\n respond_to do |format|\n if @type_identification.save\n format.html { redirect_to @type_identification, notice: 'Type identification was successfully created.' }\n format.json { render :show, status: :created, location: @type_identification }\n else\n format.html { render :new }\n format.json { render json: @type_identification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fd9962dc8537858255a5c3c05fdd62c", "score": "0.56488943", "text": "def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43a9790e05d06b19ab8f734451b3dae4", "score": "0.56475633", "text": "def create\n @admin_expense_type = Admin::ExpenseType.new(params[:admin_expense_type])\n\n respond_to do |format|\n if @admin_expense_type.save\n format.html { redirect_to admin_expense_types_url }\n format.json { render json: @admin_expense_type, status: :created, location: @admin_expense_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcc04398f8f36587833d5e1d11c9c199", "score": "0.5644081", "text": "def designation_params\n params.require(:designation).permit(:name, :department_id)\n end", "title": "" }, { "docid": "22a06eef4c7b4f6c634553314d9da19c", "score": "0.56429297", "text": "def create_types\n\t[Domain]\nend", "title": "" }, { "docid": "df24ad6dd4ccc0ba83699257ed54a82d", "score": "0.56407523", "text": "def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9427d6187e13f1bfbe583256cca93254", "score": "0.5639336", "text": "def create\n @document_type = @enterprise.document_types.new(document_type_params)\n\n respond_to do |format|\n if @document_type.save\n format.html { redirect_to edit_document_type_path(@document_type), notice: 'El tipo de documento ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @document_type }\n else\n format.html { render :new }\n format.json { render json: @document_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7554fb4bc4b6ead1d62d5b61212c077", "score": "0.56382424", "text": "def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end", "title": "" }, { "docid": "ea8b9950cc73beddbd9e6f33818f3a2a", "score": "0.5632973", "text": "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "title": "" }, { "docid": "56360abf4aa7e0a6360ad3a600f3e946", "score": "0.5630769", "text": "def index\n # @donation_types = DonationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_types }\n end\n end", "title": "" }, { "docid": "93b40385678e2346d634588d5794e15b", "score": "0.56248957", "text": "def donation_type_params\n params.require(:donation_type).permit(:name, :non_monetary, :inactive)\n end", "title": "" }, { "docid": "9ce75411c57c85fddff212b6f22c2e4a", "score": "0.5616306", "text": "def create\n @practitioner_type = PractitionerType.new(params[:practitioner_type])\n\n respond_to do |format|\n if @practitioner_type.save\n format.html { redirect_to @practitioner_type, :notice => 'Practitioner type was successfully created.' }\n format.json { render :json => @practitioner_type, :status => :created, :location => @practitioner_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @practitioner_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "196a9ed5d3f0136ecf3322aeef34433b", "score": "0.5615511", "text": "def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b08281537c69c7f8932fc5469f9db1f7", "score": "0.5611687", "text": "def create\n @date_type = DateType.new(date_type_params)\n\n respond_to do |format|\n if @date_type.save\n format.html { redirect_to @date_type, notice: 'Date type was successfully created.' }\n format.json { render :show, status: :created, location: @date_type }\n else\n format.html { render :new }\n format.json { render json: @date_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b896a97d40516ffbbd668b995a30203e", "score": "0.5598587", "text": "def create\n standard_create(DonationType, donation_type_params)\n end", "title": "" }, { "docid": "033bc93ae83da8f73ecea4d9065f1744", "score": "0.5590766", "text": "def devicetype_params\n params.require(:devicetype).permit(:type)\n end", "title": "" }, { "docid": "b04871096e3b7da2a7beeec12b7b3c1d", "score": "0.5555899", "text": "def create\n @divition_type = DivitionType.new(divition_type_params)\n\n respond_to do |format|\n if @divition_type.save\n format.html { redirect_to divition_types_path, notice: 'Divition type was successfully created.' }\n format.json { render :show, status: :created, location: @divition_type }\n else\n format.html { render :new }\n format.json { render json: @divition_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0aa5d26ecbe92a8d82c73dac4eb85fc0", "score": "0.5555117", "text": "def create\n @maintenance_type = MaintenanceType.new(maintenance_type_params)\n\n respond_to do |format|\n if @maintenance_type.save\n format.html { redirect_to @maintenance_type, notice: 'Maintenance type was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance_type }\n else\n format.html { render :new }\n format.json { render json: @maintenance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "827361a18f6901edd5b503fbe636337e", "score": "0.55548406", "text": "def create\n @foundation_type = FoundationType.new(foundation_type_params)\n\n respond_to do |format|\n if @foundation_type.save\n format.html { redirect_to @foundation_type, notice: 'Foundation type was successfully created.' }\n format.json { render :show, status: :created, location: @foundation_type }\n else\n format.html { render :new }\n format.json { render json: @foundation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7443a406deb8f47fcb041fd334aee2c5", "score": "0.5552438", "text": "def deposittypedef_params\n params.require(:deposittypedef).permit(:depostitype)\n end", "title": "" }, { "docid": "f98281f8d45a6e2391aeab1bcd4f2555", "score": "0.5541028", "text": "def interview_type_params\n params.require(:interview_type).permit(:type)\n end", "title": "" }, { "docid": "5460d99e7847ee703fb15dd5ae2c3314", "score": "0.55402553", "text": "def departure_type_params\n params.require(:departure_type).permit(:name)\n end", "title": "" }, { "docid": "8417040b3535b9d6aebfc2c3243fada8", "score": "0.55324256", "text": "def shipment_type_params\n params.require(:shipment_type).permit(:shipment_type_id, :type_name)\n end", "title": "" }, { "docid": "2198e52b17ae4c03014e117b8384da44", "score": "0.55234015", "text": "def create\n @drug_test = DrugTest.new(params[:drug_test])\n @test_types = params[:test_types]\n @test_types_all = []\n @test_types.each do |id| \n @test_types_all +=[TestType.find_by_id(id)]\n end\n @drug_test.test_types=@test_types_all\n respond_to do |format|\n \n if @drug_test.save\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi criado com sucesso.' }\n format.json { render json: @drug_test, status: :created, location: @drug_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "beecef87de04973afd99bcf3e446b668", "score": "0.552266", "text": "def create\n @investment_type = InvestmentType.new(params[:investment_type])\n\n respond_to do |format|\n if @investment_type.save\n format.html { redirect_to investment_types_path, notice: 'Investment type was successfully created.' }\n format.json { render json: @investment_type, status: :created, location: @investment_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a66564217e86b6db2f5f5aec392e26b5", "score": "0.55190223", "text": "def create\n @identification_type = IdentificationType.new(identification_type_params)\n\n respond_to do |format|\n if @identification_type.save\n format.html { redirect_to @identification_type, notice: 'Identification type was successfully created.' }\n format.json { render :show, status: :created, location: @identification_type }\n else\n format.html { render :new }\n format.json { render json: @identification_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d24be4e13179926b4ed7d950fbfa732", "score": "0.55147576", "text": "def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end", "title": "" }, { "docid": "4b3257f9d08de12dd30cbbcc2b37b1a7", "score": "0.5508138", "text": "def create\n @interview_type = InterviewType.new(interview_type_params)\n\n respond_to do |format|\n if @interview_type.save\n format.html { redirect_to @interview_type, notice: 'Interview type was successfully created.' }\n format.json { render :show, status: :created, location: @interview_type }\n else\n format.html { render :new }\n format.json { render json: @interview_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71aadaf8ae7121a5946c5d342a8474c6", "score": "0.55033755", "text": "def create\n @devicetype = Devicetype.new(devicetype_params)\n\n respond_to do |format|\n if @devicetype.save\n format.html { redirect_to @devicetype, notice: 'Devicetype was successfully created.' }\n format.json { render :show, status: :created, location: @devicetype }\n else\n format.html { render :new }\n format.json { render json: @devicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b0b2114dade1ea25ce543450bdb41153", "score": "0.55016375", "text": "def create\n @typeconge = Typeconge.new(typeconge_params)\n\n respond_to do |format|\n if @typeconge.save\n format.html { redirect_to @typeconge, notice: 'Typeconge was successfully created.' }\n format.json { render :show, status: :created, location: @typeconge }\n else\n format.html { render :new }\n format.json { render json: @typeconge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4442b08b0ff1d3d0d952f674626923b6", "score": "0.54982394", "text": "def create\n @affected_type = AffectedType.new(affected_type_params)\n\n respond_to do |format|\n if @affected_type.save\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully created.' }\n format.json { render :show, status: :created, location: @affected_type }\n else\n format.html { render :new }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6933382511724495828c8305df9241e", "score": "0.5493845", "text": "def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7f312d54c58b2ea62f2729a58778c77", "score": "0.5490499", "text": "def create\n @ref_hospitalization_type = Ref::HospitalizationType.new(params[:ref_hospitalization_type])\n\n respond_to do |format|\n if @ref_hospitalization_type.save\n format.html { redirect_to ref_hospitalization_types_path, notic: I18n.t(:record_created)}\n format.json { render json: @ref_hospitalization_type, status: :created, location: @ref_hospitalization_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_hospitalization_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16978e4ad89ff63ee2538129939d613a", "score": "0.54893625", "text": "def create\n @survey_data_type = SurveyDataType.new(survey_data_type_params)\n\n respond_to do |format|\n if @survey_data_type.save\n format.html { redirect_to @survey_data_type, notice: 'Survey data type was successfully created.' }\n format.json { render :show, status: :created, location: @survey_data_type }\n else\n format.html { render :new }\n format.json { render json: @survey_data_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81ef039e96c1e11ca701b9d68e249a97", "score": "0.54736066", "text": "def device_type_params\n params.require(:device_type).permit(:classification, :description)\n end", "title": "" }, { "docid": "d1afc0cf69e2915393dd104a3ba7a28d", "score": "0.5467122", "text": "def create\n @production_type = ProductionType.new(production_type_params)\n\n respond_to do |format|\n if @production_type.save\n format.html { redirect_to @production_type, notice: 'Production type was successfully created.' }\n format.json { render :show, status: :created, location: @production_type }\n else\n format.html { render :new }\n format.json { render json: @production_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46e070c962f0efed41a10d5c620189d5", "score": "0.5465418", "text": "def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end", "title": "" }, { "docid": "04f09fded54019c559e784d7fb8e9ced", "score": "0.5451989", "text": "def diet_type_params\n params.require(:diet_type).permit(:name)\n end", "title": "" }, { "docid": "50f59bebf0c6decf71e6e4494692bbff", "score": "0.54490185", "text": "def defect_type_params\n params.require(:defect_type).permit(:name, :sbuxid)\n end", "title": "" }, { "docid": "4eab605ee036ea93dc1eded834ba3ad9", "score": "0.54453397", "text": "def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9002bf80d05688da04a74f8d99a843d", "score": "0.54440534", "text": "def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a54d23288d0241ee844f17b6a2e8b888", "score": "0.5442539", "text": "def create\n @wedding = Wedding.new(params[:wedding])\n if (!params[:wedding][:service_type_ids])\n params[:wedding][:service_type_ids] = params[:wedding][:service_type_ids].split(';')\n end\n params[:wedding][:service_type_ids] ||= []\n ServiceType.all.each do |service_type|\n @wedding.service_types_weddings << ServiceTypesWedding.create(:service_type_id => service_type.id, \n :wedding_id => @wedding.id,\n :activated => params[:wedding][:service_type_ids].include?(service_type.id.to_s))\n end\n\n respond_to do |format|\n if @wedding.save\n format.html { redirect_to @wedding, notice: 'Wedding was successfully created.' }\n format.json { render json: @wedding, status: :created, location: @wedding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wedding.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86d7fcdf02bb22915d5cff9073bbe09e", "score": "0.5424907", "text": "def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9ba47eea2410e3edb44b205909c3476", "score": "0.54178554", "text": "def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5499dba968beee7feff0f4ca7a968e2", "score": "0.5415643", "text": "def new\n @designation = Designation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @designation }\n end\n end", "title": "" }, { "docid": "28aa90621e32fc502c18f91afc128967", "score": "0.5413381", "text": "def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end", "title": "" }, { "docid": "26346a90aa7ec9892e0afc5f5e21ac66", "score": "0.54104924", "text": "def facility_type_params\n params.require(:facility_type).permit(:code, :name)\n end", "title": "" }, { "docid": "b5d2af4b41e9c9e01dd9fb849de9991c", "score": "0.54084575", "text": "def create\n @data_set_type = DataSetType.new(data_set_type_params)\n\n respond_to do |format|\n if @data_set_type.save\n format.html { redirect_to @data_set_type, notice: 'Data set type was successfully created.' }\n format.json { render :show, status: :created, location: @data_set_type }\n else\n format.html { render :new }\n format.json { render json: @data_set_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0df248963ef6ea283f2092b1e8e3e320", "score": "0.5405719", "text": "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "title": "" }, { "docid": "d5340e22e314b57aeca45881c2f12d14", "score": "0.5403965", "text": "def types(types); end", "title": "" }, { "docid": "65763e3ab4ac81aa283fa8f184ebee1f", "score": "0.5403829", "text": "def create\n @comm_type = CommType.new(comm_type_params)\n\n respond_to do |format|\n if @comm_type.save\n format.html { redirect_to @comm_type, notice: 'Comm type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comm_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @comm_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c444eae0ae40d800eb0ec1f36f8e6ed", "score": "0.5396804", "text": "def type_params\n params.require(:type).permit( :name)\n end", "title": "" }, { "docid": "b4b457ff76553895012ed0cae9986f5c", "score": "0.5393636", "text": "def create\n @persont_type = PersontType.new(persont_type_params)\n\n respond_to do |format|\n if @persont_type.save\n format.html { redirect_to @persont_type, notice: 'Persont type was successfully created.' }\n format.json { render :show, status: :created, location: @persont_type }\n else\n format.html { render :new }\n format.json { render json: @persont_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd5b6b9b237163d9c1e371c08cead0c3", "score": "0.53897434", "text": "def create\n @document_type = DocumentType.new(document_type_params)\n\n if @document_type.save\n render :show, status: :created\n else\n render json: @document_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "bac30b57670764750499fa3f400e6c67", "score": "0.5385354", "text": "def update\n respond_to do |format|\n if @designation_type.update(designation_type_params)\n format.html { redirect_to @designation_type, notice: 'Designation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @designation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7245786b8c723af2f732d18d9007f18e", "score": "0.53849673", "text": "def create\n @designation = Designation.new(designation_params)\n\n if @designation.save\n flash[:success] = \"Designation successfully created\"\n redirect_to action: \"index\"\n else\n @designations = Designation.all\n\n render :new, locals: {designation: @designation,designations: @designations} \n end\n end", "title": "" }, { "docid": "e0415812b1e62a7edeefc987582aeaac", "score": "0.5382922", "text": "def create\n @hr_config_discipline_type = Hr::Config::DisciplineType.new(hr_config_discipline_type_params)\n\n respond_to do |format|\n if @hr_config_discipline_type.save\n format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully created.' }\n format.json { render :show, status: :created, location: @hr_config_discipline_type }\n else\n format.html { render :new }\n format.json { render json: @hr_config_discipline_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9c75124c5b8cb22eb4eb692bf10f38d", "score": "0.5381364", "text": "def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "429bda36dbb0007dc983a36f2271aeea", "score": "0.5381349", "text": "def create_types_effectivenesses\n @types.each do |type|\n I18n.locale = :en\n type_record = Type.find_by(name: type['name_en'])\n create_type_effectivenesses(type, type_record) if type_record\n end\n end", "title": "" }, { "docid": "0d92f81ace073872c0af6d482d53b39e", "score": "0.5377517", "text": "def production_type_params\n params.require(:production_type).permit(:production_type_id, :name, :super_type)\n end", "title": "" }, { "docid": "a289f24df3ef433007e267539bce21e9", "score": "0.537716", "text": "def create\n @drum_type = DrumType.new(drum_type_params)\n\n respond_to do |format|\n if @drum_type.save\n format.html { redirect_to @drum_type, notice: 'Drum type was successfully created.' }\n format.json { render :show, status: :created, location: @drum_type }\n else\n format.html { render :new }\n format.json { render json: @drum_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a54df475d566ddc4eca40cf30f3f1e8c", "score": "0.53738636", "text": "def diary_entry_type_params\n params.require(:diary_entry_type).permit(:code, :name, :description, :positive, :negative)\n end", "title": "" }, { "docid": "660fcacd5ebd1cde35748f79be37ee38", "score": "0.537094", "text": "def create\n @studytype = Studytype.new(studytype_params)\n\n respond_to do |format|\n if @studytype.save\n format.html { redirect_to moderator_studytypes_path, notice: 'Studytype was successfully created.' }\n format.json { render :show, status: :created, location: @studytype }\n else\n format.html { render :new }\n format.json { render json: @studytype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd2b6ff398910c7f205e3875b4757d51", "score": "0.5370772", "text": "def method_type_params\n params.require(:method_type).permit(:description, :macroscopy, :diagnosis)\n end", "title": "" }, { "docid": "085f0e67cef8fa42be9931cae9d87155", "score": "0.5367816", "text": "def enter_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n prep_fieldsets_for_test_data([fieldset(Org::ORG_RECORD_TYPES.name)], test_types)\n\n test_types.each_with_index do |test_type, index|\n wait_for_options_and_select(org_record_type_input(index), org_record_type_options(index), test_type[Org::ORG_RECORD_TYPE.name])\n end\n end", "title": "" }, { "docid": "aff148143a7c310aeb1074ea78947c29", "score": "0.53659374", "text": "def create\n @expense_type = ExpenseType.new(expense_type_params)\n\n respond_to do |format|\n if @expense_type.save\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc91276b02cb8b785ef6c4a09e86139c", "score": "0.5365642", "text": "def create\n @treatment_type = TreatmentType.new(params[:treatment_type])\n\n respond_to do |format|\n if @treatment_type.save\n flash[:success] = \"Тип успешно добавлен.\"\n format.html { redirect_to @treatment_type }\n format.json { render json: @treatment_type, status: :created, location: @treatment_type }\n else\n flash.now[:error] = \"Тип с таким названием не может быть добавлен!\"\n format.html { render action: \"new\" }\n format.json { render json: @treatment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1be6d3badb98ed145221514614e6c0c8", "score": "0.53636694", "text": "def create\n @doi_type = DoiType.new(doi_type_params)\n\n respond_to do |format|\n if @doi_type.save\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se creó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { render :show, status: :created, location: @doi_type }\n else\n format.html { render :new }\n format.json { render json: @doi_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5b63c05ba17c61ede1f5e37cc50e59b", "score": "0.53604746", "text": "def data_set_type_params\n params.require(:data_set_type).permit(:name)\n end", "title": "" }, { "docid": "d4a3a9a93ccfe50e6692d119f7202250", "score": "0.5358447", "text": "def create\n @sw_dev_type = SwDevType.new(sw_dev_type_params)\n\n respond_to do |format|\n if @sw_dev_type.save\n format.html { redirect_to @sw_dev_type, notice: 'Sw dev type was successfully created.' }\n format.json { render :show, status: :created, location: @sw_dev_type }\n else\n format.html { render :new }\n format.json { render json: @sw_dev_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02c7fff3e8ca81d8c0313aba6450a0c9", "score": "0.5355332", "text": "def create\n @resource_type = ResourceType.new(params[:resource_type])\n respond_to do |format|\n if @resource_type.save\n if params[:fields]\n params[:fields].each do |param|\n @field = Field.new(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => @resource_type.id, \n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n param[:validator_ids].each do |index|\n @field.field_validations.build(validator_id: index)\n end\n @field.save\n end\n end\n format.html { redirect_to @resource_type, notice: 'Resource type was successfully created.' }\n format.json { render json: @resource_type, status: :created, location: @resource_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1424ebf4c6728a0ea40d546d79115b8a", "score": "0.53551644", "text": "def create\n @document_type = DocumentType.new(params[:document_type])\n\n respond_to do |format|\n if @document_type.save\n format.html { redirect_to @document_type, notice: 'Document type was successfully created.' }\n format.json { render json: @document_type, status: :created, location: @document_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12824b91f9027e992feafd6823bd3dfc", "score": "0.53532046", "text": "def trait_type_params\n params.require(:trait_type).permit(:name, :display, :description)\n end", "title": "" }, { "docid": "e04fdc92eb9361e1b4d133c9ed54c2d6", "score": "0.53498065", "text": "def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end", "title": "" }, { "docid": "c9212b76ecd3bffe100c9b1dd2743d37", "score": "0.5349789", "text": "def create\n @dept_type = DeptType.new(params[:dept_type])\n\n respond_to do |format|\n if @dept_type.save\n format.html { redirect_to @dept_type, :notice => 'Tipo de Departamento criado com sucesso.' }\n format.json { render :json => @dept_type, :status => :created, :location => @dept_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @dept_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17c877dfb03d5310165174d0163fc110", "score": "0.53491044", "text": "def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n @documents = Document.all\n @procedure_type.name= @procedure_type.name.upcase\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to procedure_types_path, notice: 'Tipo de tramite registrado exitosamente' }\n format.json { render :show, status: :created, location: @procedure_type }\n else\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3a7f82382762c0241d65ebbab6f33ce", "score": "0.5347075", "text": "def school_type_params\n params.require(:school_type).permit(:name, :description)\n end", "title": "" }, { "docid": "c7075d76961810aab1dee4b5d57bcddb", "score": "0.53451025", "text": "def create\n @statement_type = StatementType.new(statement_type_params)\n\n respond_to do |format|\n if @statement_type.save\n format.html { redirect_to @statement_type, notice: 'Statement type was successfully created.' }\n format.json { render :show, status: :created, location: @statement_type }\n else\n format.html { render :new }\n format.json { render json: @statement_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
7e5e3298265e7bd073660cfef9c50350
Calculates the basic Inverse Document Frequency of each token contained in a corpus of documents.
[ { "docid": "4ed5c43883021aeef4fc0452ba0b4239", "score": "0.69755477", "text": "def calculate\n _df = document_frequency\n _idf = Hash.new\n\n\n _df.each do |word, freq|\n _idf[word] = Math.log(@corpus.size/freq)\n end\n return _idf\n end", "title": "" } ]
[ { "docid": "dac7c01c9775c261356508ab7e5d1273", "score": "0.7855475", "text": "def calculate_inverse_document_frequency\n STDERR.puts \"Calculating IDF...\"\n results = Hash.new {|h, k| h[k] = 0 }\n\n terms.each do |term|\n results[term] += 1\n end\n\n log_total_count = Math.log10(total_documents)\n results.each_pair do |term, count|\n results[term] = log_total_count - Math.log10(count)\n end\n\n results.default = nil\n STDERR.puts \"end calculating IDF.\"\n results\n end", "title": "" }, { "docid": "b93a2bf283811b3a690782feadeb7f57", "score": "0.7422464", "text": "def inverse_document_frequency(term)\n df = @model.document_count(term)\n 1 + log(documents.size / (df + 1.0))\n end", "title": "" }, { "docid": "19c21a18d559eeeaad47544480139340", "score": "0.73120224", "text": "def probabilistic_inverse_document_frequency(term)\n count = document_counts[term].to_f\n Math.log (documents.size - count) / count\n end", "title": "" }, { "docid": "d4ffdbe8dfa436022469bd3b72469d9d", "score": "0.71092975", "text": "def probabilistic_inverse_document_frequency(term)\n count = @model.document_count(term).to_f\n log((documents.size - count) / count)\n end", "title": "" }, { "docid": "0a7476814848bf601b8c3199e1d6fcb9", "score": "0.70279646", "text": "def document_frequency\n _df = Hash.new\n\n @corpus.each do |doc|\n _words = doc.bag_of_words.keys\n\n _words.each do |word|\n if (_df.has_key?(word))\n _df[word] = _df[word]+1.0\n else\n _df[word] = 1.0\n end\n end\n end\n return _df\n end", "title": "" }, { "docid": "fb050ef9b9bd2ea07200a8f5f1847ce7", "score": "0.6982357", "text": "def tf(docs)\n doc_freq = Hash.new(0) #this gets cleared for each doc\n #puts docs\n docs.each do |doc|\n doc.each do |word|\n @term_freqs[word] += 1 #calculate term frequencies\n doc_freq[word] += 1\n end\n \n #count how many documents contain just *one* instance of any given word\n doc_freq.each do |word, freq|\n @doc_freqs[word] += 1\n end\n \n #reset for the next iteration\n doc_freq.clear\n end\n end", "title": "" }, { "docid": "ced5b45c9850cd130593df7e97fa5717", "score": "0.69591457", "text": "def calculate\n @tfidf = Hash.new\n\n if (@idf==nil)\n @idf = InverseDocumentFrequency.new(@corpus)\n end\n\n if (@tf==nil)\n _tokenizer = BasicTokenizer.new\n @tf = NormalizedTermFrequency.new(_tokenizer)\n end\n\n @idf_weights = @idf.calculate\n\n @corpus.each {\n |doc|\n\n _termfreq = @tf.calculate(doc.contents)\n\n _tfidf_weights = Hash.new\n\n _termfreq.each do |term, tf|\n _weight = tf * @idf_weights[term]\n _tfidf_weights[term] = _weight\n end\n\n @tfidf[doc.id] = _tfidf_weights\n }\n return @tfidf\n end", "title": "" }, { "docid": "1791b0d5514aa358c4c88e5c2abeadf8", "score": "0.6929467", "text": "def calculate_term_frequencies\n STDERR.puts \"Calculating TF...\"\n results = []\n \n @data.each_with_index do |document,index|\n STDERR.puts \" document #{index}\" if index > 0 && index % 10000 == 0\n document_result = Hash.new {|h, k| h[k] = 0 }\n document_size = @sparse ? document.values.inject(&:+).to_f : document.size.to_f\n\n if @sparse\n document_result = document\n else\n document.each do |term|\n document_result[term] += 1\n end\n end\n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document_size\n end\n \n results << document_result\n end\n STDERR.puts \"end calculating TF.\"\n \n results\n end", "title": "" }, { "docid": "796f5f34fd3ff381f804723eb752f18a", "score": "0.68092465", "text": "def calculate_frequency(files)\n files.each do |file|\n frequency = word_frequency_in_file(file)\n @count = @count + frequency[:count]\n @documents << calculate_tf(frequency)\n end\n end", "title": "" }, { "docid": "e9924dab68eb40682f35dbe17847c43a", "score": "0.67330545", "text": "def normed_vect(tokens)\n \n counts = Hash.new(0)\n tokens.each do |tok|\n counts[tok] += 1\n end\n vect = Hash.new(0)\n counts.each do |term, count|\n vect[term] = self._term_tf_idf(term, count)\n end\n \n mag = Math.sqrt(vect.map{|term, count| count*count}.reduce(:+))\n \n vect.each {|t, c| vect[t] = c/mag}\n end", "title": "" }, { "docid": "3f28ecf961ac5588d111f40b38312dd7", "score": "0.6582405", "text": "def calculate_idf(word)\n Math.log(@documents.count) / ( 1 + n_containing(word))\n end", "title": "" }, { "docid": "7fd9ae7685db43a2e91c9e020c1f4be1", "score": "0.6475753", "text": "def find_stem_freq(stem_tokens)\n freq_words = {}\n stem_tokens.each do |token|\n if freq_words.has_key?(token)\n freq_words[token] += 1\n else\n freq_words[token] = 1\n end\n end\n return freq_words\nend", "title": "" }, { "docid": "37d5b826b307ab9c7141e2a208e40839", "score": "0.64726955", "text": "def calculate_doc_vectors\n self.processing_not_used\n #TRANS_LOC.gsub(\"pony\", params[:pony])\n lines_input = File.read(TRANS_LOC).unpack('C*').pack('U*').downcase.split(\"\\n\")\n \n @doc_freq = Hash.new(0) #The number of docs each term is in\n @lines = Hash.new #Keep track of all the lines\n @index = Hash.new{|h, k| h[k] = []} #Keeps track of what lines have what tokens\n @term_idf = Hash.new(-1)\n \n line_id = 1 #Make an id for each line\n \n lines_input.each do |line_string|\n #Not sure why this might be blank, but just putting\n #a bandaid on it for now and just skipping the line\n if line_string == \"\"\n puts \"Skip line for being empty which is weird.\"\n next\n end\n line_arr = line_string.split(\" \", 2)\n line = Hash.new\n text = line_arr[1]\n \n line[\"id\"] = line_id\n line[\"pony\"] = line_arr[0]\n line[\"text\"] = text\n line[\"tokens\"] = self.tokenize(text)\n \n #Tokenizing might remove all of the words\n if line[\"tokens\"].length == 0\n next\n end\n \n line[\"tokens\"].each do |tok|\n @doc_freq[tok] += 1\n @index[tok].push(line_id)\n end\n \n @lines[line_id] = line\n line_id += 1\n end\n \n #Used to output term frequencies\n if DOC_OUT_BOOL\n str = \"\"\n \n rev = @doc_freq.sort_by{|term, sim| sim}.reverse\n rev.each do |arr|\n if str != \"\"\n str += \"\\n\"\n end\n str += arr[0] + \"\\t\" + arr[1].to_s\n end\n \n File.open(DOC_OUT, 'w') {|f| f.write(str) }\n end\n \n @doc_freq.each do |term, count|\n @term_idf[term] = Math.log(@lines.length / count, 2)\n end\n @lines.each do |id, line|\n line[\"vect\"] = self.normed_vect(line[\"tokens\"])\n end\n \n #File.open(\"#{Rails.root}/app/assets/idf_2.json\", 'w') {|f| f.write(@term_idf.sort_by{|term, sim| term}.reverse.to_json) }\n end", "title": "" }, { "docid": "9a096a89683795b8aca528e8ed750500", "score": "0.6451579", "text": "def term_frequency(document, term)\n if @model.average_document_size.zero?\n Float::NAN\n else\n tf = document.term_count(term)\n (tf * 2.2) / (tf + 0.3 + 0.9 * document.size / @model.average_document_size)\n end\n end", "title": "" }, { "docid": "ac2d78c9e2b27279ca9f2f043aa2d1cf", "score": "0.6425557", "text": "def idf(term, documents)\n number_of_documents = documents.length\n number_of_documents_with_term = documents.count { |d| tf(term, d) > 0 }\n return 0 if number_of_documents_with_term == 0\n\n Math.log(number_of_documents.to_f / number_of_documents_with_term.to_f)\nend", "title": "" }, { "docid": "f335f228b31fdaa99bd657114b3a18bf", "score": "0.6423264", "text": "def tfidf(term, document, documents)\n tf(term, document) * idf(term, documents)\nend", "title": "" }, { "docid": "f335f228b31fdaa99bd657114b3a18bf", "score": "0.6423264", "text": "def tfidf(term, document, documents)\n tf(term, document) * idf(term, documents)\nend", "title": "" }, { "docid": "f335f228b31fdaa99bd657114b3a18bf", "score": "0.6423264", "text": "def tfidf(term, document, documents)\n tf(term, document) * idf(term, documents)\nend", "title": "" }, { "docid": "a381ff37fd918c32100d69df7048f379", "score": "0.6410563", "text": "def idf(term, documents)\n number_of_documents = documents.length\n number_of_documents_with_term = documents.count { |d| tf(term, d) > 0 }\n\n Math.log(number_of_documents.to_f / number_of_documents_with_term)\nend", "title": "" }, { "docid": "06def1db7f07da0ce8538c43bb86b5ca", "score": "0.6385322", "text": "def tfidf(term, document, documents)\n tf(term, document)\n idf(term, documents)\n (tf(term, document) * idf(term, documents)).round(1)\nend", "title": "" }, { "docid": "52398a623baff3fdfd9acda6e97e40f0", "score": "0.6381616", "text": "def idf(term, documents)\n count = documents.count { |d| tf(term, d).nonzero? }\n count = 1 if count.zero?\n Math.log documents.size.fdiv(count)\nend", "title": "" }, { "docid": "db22f8f522648d84b7b7de0279a52e0a", "score": "0.6381568", "text": "def idf(term, documents)\n number_of_documents = documents.length\n number_of_documents_with_term = documents.count { |d| tf(term, d) > 0 }\n\n Math.log(number_of_documents.fdiv(number_of_documents_with_term))\nend", "title": "" }, { "docid": "db22f8f522648d84b7b7de0279a52e0a", "score": "0.6381568", "text": "def idf(term, documents)\n number_of_documents = documents.length\n number_of_documents_with_term = documents.count { |d| tf(term, d) > 0 }\n\n Math.log(number_of_documents.fdiv(number_of_documents_with_term))\nend", "title": "" }, { "docid": "a11b54e51b2808cd62517663900eb156", "score": "0.6363933", "text": "def term_frequency(document, term)\n tf = document.term_count(term)\n sqrt(tf)\n end", "title": "" }, { "docid": "8cb406d266ba9bc76483eb042467e263", "score": "0.6260306", "text": "def index_frequency(text)\n cfi = clean_stemmed_filtered_index(text)\n cni = clean_filtered_index(text)\n cfi.merge(cni)\n end", "title": "" }, { "docid": "71dceb117058a7c86fb6e5b005d82f3f", "score": "0.6240235", "text": "def get_idf_hash\r\n\t\t# Tokenize every document in the collection\r\n\t\t@sub_docs = tokenize_documents\r\n\t\t@quantity = @collection.length\r\n\t\t@tf_hash.each do |term, tf|\r\n\t\t\t@sub_docs.each do |doc|\r\n\t\t\t\tif doc.include?(term)\r\n\t\t\t\t\t# Increment document frequency.\r\n\t\t\t\t\t@idf_hash[term] += 1.0\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\treturn @idf_hash\r\n\tend", "title": "" }, { "docid": "2061bb1b41f5c78efe7d9edbc9c08546", "score": "0.62338734", "text": "def corpus_information\n -Math::log10(self.word_forms.inject(0.0){|s,f| s + (f && f.corpus_probability || 0)})\n end", "title": "" }, { "docid": "6184d1b596723b38e641a5fbb0ecf021", "score": "0.620539", "text": "def idf(term, documents)\n number_of_documents = documents.length.to_f\n number_of_documents_with_term = documents.count { |d| tf(term, d) > 0 }.to_f\n # puts \"num_docs = #{number_of_documents}, docs_with_term = #{number_of_documents_with_term}\"\n return 0.0 if number_of_documents_with_term == 0\n Math.log(number_of_documents / number_of_documents_with_term)\nend", "title": "" }, { "docid": "91f566d99164cbf373054293861bfb44", "score": "0.62026197", "text": "def idf_hash\r\n\t\tsub_docs = tokenize_documents\r\n\t\t@tf_hash.each do |term, tf|\r\n\t\t\tsub_docs.each do |doc|\r\n\t\t\t\tif doc.include?(term)\r\n\t\t\t\t\t# Increment document frequency.\r\n\t\t\t\t\t@idf_hash[term] += 1.0\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\t@idf_hash\r\n\tend", "title": "" }, { "docid": "2c085e9b2be1c839102676cfe91eb3d3", "score": "0.61930746", "text": "def calculateIDF\n\t\tdocCount = 0\n\t\t\n\t\[email protected] do |name|\n\t\t\t\n\t\t\tdocCount = @parsedData[name].length\n\t\t\t\n\t\t\t@parsedData[name].each do |article|\n\t\t\t\ttitle_tokens = article[\"title\"].split(/\\s+/)\n\t\t\t\tcontent_tokens = article[\"content\"].split(/\\s+/)\n\t\t\t\t\n\t\t\t\t#here we also add all 2-tuples to the word bag, bit hacky\n\t\t\t\t#and I am somewhat ashamed\n\t\t\t\ttitle_tuples = article[\"title\"].scan(/\\w+\\s\\w+/)\n\t\t\t\tcontent_tuples = article[\"content\"].scan(/\\w+\\s\\w+/)\n\t\t\t\tarticle[\"title\"].gsub!(/^\\w+\\s+/, '')\n\t\t\t\tarticle[\"content\"].gsub!(/^\\w+\\s+/, '')\n\t\t\t\ttitle_tuples_shifted = article[\"title\"].scan(/\\w+\\s\\w+/)\n\t\t\t\tcontent_tuples_shifted = article[\"content\"].scan(/\\w+\\s\\w+/)\n\t\t\t\t\n\t\t\t\tunique_list = (title_tokens + content_tokens + title_tuples + content_tuples+ title_tuples_shifted + content_tuples_shifted).uniq\n\t\t\t\t\n\t\t\t\t#pp unique_list\n\t\t\t\t\n\t\t\t\tunique_list.each do |word|\n\t\t\t\t\t#catch any blank word that the text processing may have \n\t\t\t\t\t#generated and drop any 1 or 2 letter words\n\t\t\t\t\tif word.length <= 1\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif @hBagOWords.has_key?(word)\n\t\t\t\t\t\t@hBagOWords[word]+=1\n\t\t\t\t\telse\n\t\t\t\t\t\t@hBagOWords[word]=1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\tend\n\t\t\n\t\t#replace counts with idf\n\t\t#taking the log here, although may not be necessary with such a small\n\t\t#corpus\n\t\[email protected] do |word|\n\t\t\tcount = @hBagOWords[word]\n\t\t\t@hBagOWords[word] = Math.log(docCount/count)\n\t\tend\n\t\t#pp @parsedData\n\tend", "title": "" }, { "docid": "aaac741474fb3fad0b4b6edc3b844537", "score": "0.6193012", "text": "def idf term\n total_docs = @index_meta[:number_of_documents]\n return 0 if @dictionary[term].nil?\n document_frequency = @dictionary[term][:count]\n return Math.log10(total_docs / document_frequency)\n end", "title": "" }, { "docid": "d8c37a6deec9a6cfa873838f3a031148", "score": "0.6162517", "text": "def tfidf_classify(desc, sector_code)\n #get the collections\n @coll = get_connection[\"words_index\"]\n @count_coll = get_connection[\"document_count\"]\n @max_count = get_connection[\"max_count\"]\n\n # split description into array of words\n words = desc.split /\\s/\n\n final_words = []\n\nputs(\"1\")\n # TODO print words before and after to see what it strips out.\n # TODO try stripping out.\n FFI::Hunspell.dict do |dict|\n desc.split(/\\s/).each do |word|\n if PASSABLE_WORDS.include? word\n final_words << word\n next\n end\n\n next unless Stopwords.valid? word\n\n if dict.check? word\n stems = dict.stem word\n final_words << (dict.stem word).last\n end\n end\n end\n\n words = final_words\n\tputs words\n\n # store aggregated tf-idf scores for each code here\n master_index = {}\n\n i = 0\n\n\tb = Hash.new(0)\n\twords.each do |v|\n\t b[v] += 1\n\tend\n\n\tb.each do |k,v|\n\t puts \"#{k} appears #{v} times\"\n end\n\n # Calculate important words using tf-idfs\n\ttfidfs = Hash.new(0)\n words.each do |word|\n i = i+1\n word_entry = @coll.find_one('word' => word)\n next if word_entry.nil?\n word_row = word_entry[\"codes\"]\n next if word_row.empty?\n\n #Calculate Inverse Document frequency\n count_entry = @count_coll.find_one('word' => word)\n count = count_entry[\"count\"]\n\n quotient = TOTAL_COUNT.to_f / count.to_f + 1\n idf = Math.log(quotient)\n\n\t num = b[word]\n\t #puts words.length\n\t tf = 0.5 + ((0.5 * num)/ words.length)\n\t tfidf = tf * idf\n\t puts word\n\t puts tfidf\n\t tfidfs[word] = tfidf\n end\n\n\ttfidfs = tfidfs.sort_by {|k,v| -v}\n\n # get array of important words\n\timportant_words = tfidfs\n\n #Aggregate across words the weight for the different codes\n aggregate_code_scores = Hash.new(0)\n important_words.each do |word,score|\n word_entry = @coll.find_one('word' => word)\n next if word_entry.nil?\n word_codes = word_entry[\"codes\"]\n next if word_codes.empty?\n\n word_codes.each do |code, num|\n aggregate_code_scores[code] += (num*score) #increase weight of important words by multiplying by score\n end\n end\n\n #sort aggregate codes\n aggregate_code_scores = aggregate_code_scores.sort_by {|k,v| -v}\n\n puts 'important words'\n puts aggregate_code_scores[0..3].inspect\n puts '=============='\n\n\ttf_index = aggregate_code_scores[0..30]\n\n#TODO to print size of tf_index\n\n #fix code name formatting\n results = tf_index[0..10].map do |x|\n code_name = x[0].dup\n code_name.gsub!(/code_/,'')\n code_name.insert(5, '.') if code_name.length == 7\n x[0] = code_name\n x\n end\n\n # give just the results\n pruned_results(results.map {|r| r[0]}, sector_code)\n end", "title": "" }, { "docid": "c2f106dc603aff165dba71a28511d2f8", "score": "0.61498666", "text": "def augmented_normalized_term_frequency(document, term)\n 0.5 + 0.5 * normalized_term_frequency(document, term)\n end", "title": "" }, { "docid": "95b6a8869667fdc1a2b7486f55949a07", "score": "0.61170816", "text": "def combine_frequency\n final_result = Hash.new(0)\n @documents.each do |doc|\n frequency = doc[:frequency]\n tf = doc[:tf]\n # key is a word\n frequency.keys.sort.each do |key|\n # idf_value = calculate_idf(key).round(5)\n # tf_idf = (tf[key] * idf_value).round(5)\n final_result[key] = final_result[key] + tf[key]\n end\n end \n final_result\n end", "title": "" }, { "docid": "9360fd03a3647d5e3f37f2307bad8a71", "score": "0.61128783", "text": "def idf(term)\n if self.stopwords.include?(term)\n return 0\n end\n \n if self.term_num_docs[term].nil?\n return self.idf_default\n end\n\n return Math.log((1 + self.num_docs).to_f / \n (1 + self.term_num_docs[term]))\n end", "title": "" }, { "docid": "e7349cb02b2a6e69586a39100bbe4194", "score": "0.61064506", "text": "def cal_tfidf(clean_query, hit_list, invindex, docindex)\n tfidf_hash = Hash.new\n total_tfidf = 0 \n if hit_list.size != 0 \n for page in hit_list\n for query in clean_query\n total_tfidf += single_tfidf(query, page, invindex, docindex)\n end\n tfidf_hash[page] = total_tfidf\n total_tfidf = 0\n end\n end\n\n return tfidf_hash\nend", "title": "" }, { "docid": "dea2b1a967c048ffbbce89cc32c1079e", "score": "0.60567105", "text": "def frequencies\n\n for w in $words\n keys = $word_freqs.map { |wd| wd[0] }\n if keys.include? w\n $word_freqs[keys.index(w)][1] += 1\n else\n $word_freqs.append([w, 1])\n end\n end\nend", "title": "" }, { "docid": "108bb2fd5d286677e094b4cebdca7ff5", "score": "0.5998432", "text": "def count_word\n @indexed = \"\" \n self.getIndexedTerms\n ndocs = @all_files.size - 1\n\n# @terms = @terms[1..200]\n nterms = @terms.size - 1\n for i in 0..nterms\n puts \"[\"+(i+1).to_s+\"]\\tword: \"+@terms[i]\n re = Regexp.new(@terms[i])\n total_count = 0\n for j in 0..ndocs\n \n file = File.open('Docs/'+@all_files[j], 'r')\n content = file.read\n file.close\n\n content.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n file_count = content.scan(re).size\n total_count += file_count\n content = \"\"\n #insertion\n if file_count > 0\n self.insertDocumentValue(@terms[i], @all_files[j].gsub(/.txt/, \"\"), file_count)\n end\n end\n #update value terms\n self.updateTermValue(@terms[i], total_count)\n end\n end", "title": "" }, { "docid": "6c733dcde02883b94c86a09bf6194df0", "score": "0.5993796", "text": "def token_frequency\n tokens.each_with_object(Hash.new(0)) { |token, hash| hash[token] += 1 }.sort_by_value_desc\n end", "title": "" }, { "docid": "64504e457570f4d15880b14c789dad67", "score": "0.59367126", "text": "def find_tfidf(query, page, invindex, doc_index)\n tf = 0\n tfidf = 0\n if invindex.has_key?(query) == true \n tf = invindex[query][1][page]\n df = invindex[query][0] \n doc_length = doc_index[page][\"length\"] \n ntf = tf * 1.0 / doc_length\n idf = 1/(1+ Math.log(df))\n tfidf = ntf * idf\n end \n return tfidf\nend", "title": "" }, { "docid": "64504e457570f4d15880b14c789dad67", "score": "0.59367126", "text": "def find_tfidf(query, page, invindex, doc_index)\n tf = 0\n tfidf = 0\n if invindex.has_key?(query) == true \n tf = invindex[query][1][page]\n df = invindex[query][0] \n doc_length = doc_index[page][\"length\"] \n ntf = tf * 1.0 / doc_length\n idf = 1/(1+ Math.log(df))\n tfidf = ntf * idf\n end \n return tfidf\nend", "title": "" }, { "docid": "fdd3224637dd69a5c8d5a59fa5dd932d", "score": "0.59239596", "text": "def idf(document_freq, n_documents, feature)\n Math.log( (1+n_documents).to_f / (1+document_freq[feature]) );\nend", "title": "" }, { "docid": "06680fb493c8d9fecf0946fbedb7492f", "score": "0.5920908", "text": "def idf\n word_n_count= []\n @file.each do |hash|\n hash[:value]\n word_n_count << hash[:value]\n val = []\n my_arr = []\n word_n_count.flat_map(&:entries).group_by(&:first).map{|k,v|\n val << [k, v.map(&:last)]\n values = Hash[val]\n values.each do |key, value| # gets the key and value in the hash\n @key = key\n value = value.inject {|sum,n| sum + n} # add all the count values together\n @idf = 1 + Math.log10(@doc_num/value+1.0) # IDF formula\n end\n my_arr << @key << @idf # push key and idf values to arr\n @idf = Hash[*my_arr] # turns array to a hash table\n }\n end\n @idf\n end", "title": "" }, { "docid": "b93d2bba37e4559f437f8d8bb0cb1a63", "score": "0.59169513", "text": "def binary_term_frequency(document, term)\n count = document.term_count(term)\n if count > 0\n 1\n else\n 0\n end\n end", "title": "" }, { "docid": "f5c119be7255669cc589529e01c5b419", "score": "0.591516", "text": "def doc_keywords(curr_doc)\n tfidf = {}\n\n tokens = self.get_tokens(curr_doc)\n token_set = tokens.uniq\n token_set_sz = token_set.count\n \n token_set.each do |term|\n mytf = tokens.count(term).to_f / token_set_sz\n myidf = self.idf(term)\n tfidf[term] = mytf * myidf\n end\n\n sort_by_tfidf(tfidf)\n end", "title": "" }, { "docid": "3fe3e8b148ab364bc1e0148d320ddbae", "score": "0.5848962", "text": "def initialize_word_frequency\n # Check if we've cached our training corpus, from which we'll count word\n # frequencies.\n if(File.exists?(@@CORPUS_FILE))\n # Read the text from the file\n print \"Reading corpus from disk...\"\n STDOUT.flush\n text = File.read(@@CORPUS_FILE)\n puts \"done\"\n else\n # Read the text from the web and cache to our file on disk\n print \"Reading corpus from web and caching to disk...\"\n STDOUT.flush\n text = Net::HTTP.get(URI.parse(@@CORPUS_URL))\n file = File.new(@@CORPUS_FILE, 'w')\n file.write(text)\n file.close\n puts \"done\"\n end\n\n # Count each word, and the total number of valid words\n print \"Counting unique words...\"\n STDOUT.flush\n @word_counts = Hash.new(0)\n @total_words = 0\n \n text.split(/\\s|--/).each do |x|\n x.downcase!\n # Make sure it's a word, and strip out punctuation\n if(x =~ /([a-zA-Z-]+)/)\n x = $1\n if(is_correct?(x))\n @word_counts[$1.downcase] += 1\n @total_words += 1\n end\n end\n end\n puts \"done (#{@word_counts.size} found)\"\n end", "title": "" }, { "docid": "1f3f0eddd4f8970b29254f4a9bc9743b", "score": "0.58324295", "text": "def plain_term_frequency(term)\n term_counts[term]\n end", "title": "" }, { "docid": "5eaec0950dfa0cbcbd47a854d52d3f88", "score": "0.5811404", "text": "def test_words_in_corpus_frequency\n assert_equal @dictionary11 , {\n 'кот' => 2,'собак' => 1,'лаб' => 1,'контрольн' => 3,\n 'семинар' => 1,'экзамен' => 1, 'сесс' => 2 }\n\n assert_equal @dictionary12 , {}\n\n assert_equal @dictionary13 , {\n 'стол' => 2,'диван' => 2,'дирижабл' => 1 }\n\n assert_equal @dictionary14 , {\n 'Иркутск' => 2,'кино' => 2,'ИркутскИркутск' => 1,\n 'алтарь' => 1, 'молодость' => 1}\n\n assert_equal @dictionary15, {\"ехал\"=>1, \"Грека\"=>3, \"через\"=>1, \"реку\"=>3,\n \"видит\"=>1, \"в\"=>3, \"реке\"=>1, \"рак\"=>2, \"сунул\"=>1,\n \"руку\"=>2, \"за\"=>1, \"Греку\"=>1}\n end", "title": "" }, { "docid": "e792e4dc6ca93a668f74c318c761deb2", "score": "0.5805761", "text": "def calculate_freqs cardinality\n # for each symbols\n (0..self.length - 1).each { |s|\n self[s].symbol_card += 1 if cardinality[s] > 0\n }\n\n self.map { |f| f.freq = f.symbol_card.to_f / @documents_count.to_f }\n end", "title": "" }, { "docid": "6d811ade9b1ab844fbc2a216de5448d5", "score": "0.5796731", "text": "def word_frequencies words\nend", "title": "" }, { "docid": "d85bc456aae60b22b621fb0545a5a6ab", "score": "0.57837903", "text": "def mtf_freq; end", "title": "" }, { "docid": "d62f9a78f939e8a979c9bd978825f8f6", "score": "0.57738954", "text": "def tf\n tf_arr = []\n @file.each do |hash|\n @word_n_count= []\n @doc_name = hash[:key]\n hash = hash[:value] # :key => document1.pdf, :value=>{\"los\"=>1, \"angeles\"=>1, \"times\"=>1}\n hash.each do |counts|\n @keys = counts[0]\n @tf = Math.log(counts[1]).round(3)+1.0 # Normalized TF weight formula\n @word_n_count << @keys << @tf # puts term keys and TF values\n end\n tf_arr << @doc_name << Hash[*@word_n_count]\n @tf = Hash[*tf_arr] # turn @tf_arr to a hash table\n end\n @tf\n end", "title": "" }, { "docid": "a7175369767efca33a0e5d6f0c667680", "score": "0.5761589", "text": "def tf_idf\n STDERR.puts \"Calculating TF_IDF...\"\n tf_idf = tf.map(&:clone)\n \n tf.each_with_index do |document, index|\n STDERR.puts \" document #{index}\" if index > 0 && index % 10000 == 0\n document.each_pair do |term, tf_score|\n tf_idf[index][term] = tf_score * idf[term]\n end\n end\n \n STDERR.puts \"end Calculating TF_IDF.\"\n tf_idf\n end", "title": "" }, { "docid": "4d2af958eec00966361d0bed4e92c3eb", "score": "0.5743173", "text": "def tf_score\n count_store = []\n d = Documents.new(@documents)\n d.documents_hash.each do |document|\n @words.each do |word|\n count_store << [word] + [document[word]] + [document[:filename]]\n end\n end\n return count_store.sort\n end", "title": "" }, { "docid": "6b4f551c8932b321e051dbc6e86d5d1d", "score": "0.5726728", "text": "def tf(term)\n document.term_count(term) / document.size.to_f\n end", "title": "" }, { "docid": "6afa103427efc2d3fb005ced807bc8d3", "score": "0.5720145", "text": "def single_tfidf(query, page, invindex, docindex)\n if invindex[query] and invindex[query][1][page]\n tf = invindex[query][1][page]\n doc_length = docindex[page][0]\n ntf = tf * 1.0 /doc_length\n df = invindex[query][1].length\n idf = 1.0 / (1 + Math.log(df))\n tfidf = ntf / idf\n else\n tfidf = 0\n end\n return tfidf\nend", "title": "" }, { "docid": "741f542941a7ca603b823292d846ada4", "score": "0.56826067", "text": "def document_freq_of_terms(terms)\n df = {}\n terms.uniq.each do |t|\n term = Term.find_by_word(t)\n if term.nil?\n df[t] = 0\n else\n df[t] = term.doc_freq\n end\n end\n return df\n end", "title": "" }, { "docid": "2d0cd7210069f978e3ade030d02c6d23", "score": "0.5677779", "text": "def uids_to_term_counts(uids)\n ret = {}\n total = uids.size\n\n uids.each_with_index do |(key, arr), i|\n ret[key] = 0\n\n arr.each do |uid|\n doc = Document.find(uid, term_vectors: true)\n vec = doc.term_vectors[@term]\n\n ret[key] += vec[:tf] if vec\n end\n\n @progress.call(50 + (i.to_f / total.to_f * 50.0).to_i) if @progress\n end\n\n @progress.call(100) if @progress\n\n ret\n end", "title": "" }, { "docid": "b261a1508a0395368e99b826e562b84f", "score": "0.5676531", "text": "def index_documents(pages_dir, index_file, stop_file, invindex_path, docindex_path)\n docindex = {}\n invindex = {}\n\n # read in list of stopwords from file\n stopwords = load_stopwords_file(stop_file)\n\n # get the list of files in the specified directory\n file_list = list_files(pages_dir)\n\n # create hash data structures to store inverted index and document index\n # the inverted index, and the outgoing links\n index = import_index(index_file)\n\n # scan through the documents one-by-one\n for file in file_list\n #the file name without pages/ on the front\n filename = file.gsub(/\\A.*\\//, \"\")\n\n print \"Parsing HTML document: #{file} \\n\";\n\n stats = DocumentStats.new\n\n tokens = find_tokens(file)\n tokens = remove_stop_tokens(tokens, stopwords)\n tokens = stem_tokens(tokens)\n\n stats.length = tokens.size\n stats.title = get_title(file)\n \n puts filename\n index_array = index[filename]\n stats.uRL = index_array[1]\n stats.canonicalURLS = find_links_from_html(File.read(file), stats.uRL)\n stats.spamScore = index[filename][0]\n\n #stats_list = [stats.length, stats.title, stats.canonicalURLS, stats.uRL, stats.spamScore]\n\n # docindex[file] = stats_list\n docindex[file] = stats\n\n for token in tokens\n if invindex[token]\n frequency_hash = invindex[token]\n if frequency_hash[file]\n frequency_hash[file] = frequency_hash[file] + 1\n else\n frequency_hash[file] = 1\n end\n else\n invindex[token] = {file => 1}\n end\n end\n end\n\n # save the hashes to the correct files\n write_data(invindex_path, invindex)\n write_docindex(docindex_path, docindex)\nend", "title": "" }, { "docid": "499568366282e35274c250f726ecba0f", "score": "0.5667001", "text": "def calculate_word_frequency()\n # create a word frequenct hash table with default value = 0\n word_frequency = Hash.new(0)\n\n # Update frequency for each word (with forcedly convert to lower case)\n @content.split.each do | singleWord |\n word_frequency[singleWord.downcase] +=1\n end\n\n #highest_freq_pair = word_frequency.select{ |key,value| value == word_frequency.values.max }\n\n # get the highest frequency from different words\n @highest_wf_count = word_frequency.values.max\n\n # push those words with highest frequency into highest_wf_words ( array of words )\n word_frequency.each do | key, value |\n\n if value == @highest_wf_count\n @highest_wf_words << key\n end\n\n end\n\n end", "title": "" }, { "docid": "7a666ef39089a55cadc1dd72ac240554", "score": "0.56633836", "text": "def na_tfidf_document_term_matrix(documents, debug = false)\n # Creates model\n printf(\"\\rCreating similarity model...\") if debug\n model = TfIdfSimilarity::TfIdfModel.new(documents, library: :narray)\n printf(\"\\rCreating similarity model... Done!\\n\") if debug\n # Creates similarity matrix\n printf(\"\\rCreating similarity matrix...\") if debug\n model.similarity_matrix\n printf(\"\\rCreating similarity matrix... Done!\\n\") if debug\nend", "title": "" }, { "docid": "a5bb307ccaf5a046d41dff761cacbf3b", "score": "0.5636116", "text": "def normalized_log_term_frequency(document, term)\n count = document.term_count(term)\n if count > 0\n (1 + log(count)) / (1 + log(document.average_term_count))\n else\n 0\n end\n end", "title": "" }, { "docid": "cbceb66ad089f20996ec27e3a38ffdd7", "score": "0.5610794", "text": "def calculate_word_frequency\n word_freq = Hash.new(0)\n @content.split.each { |word| word_freq[word.downcase] += 1 }\n @highest_wf_count = word_freq.values.max\n @highest_wf_words = word_freq.reject { |w,c| c < @highest_wf_count }.keys\n end", "title": "" }, { "docid": "769dc5015d833de07b78cb7d5baba79e", "score": "0.5607909", "text": "def calculate_word_frequency ()\n @word_frequency = Hash.new(0)\n @content.split.each do |word|\n @word_frequency[word.downcase] += 1\n if @highest_wf_count < @word_frequency[word.downcase]\n @highest_wf_count = @word_frequency[word.downcase]\n end\n end\n end", "title": "" }, { "docid": "63185f7c26c3272a934e65c99ffa9b67", "score": "0.55991834", "text": "def compute_tf_and_idf(data, samples)\n iter = 1\n\n data.each do |row|\n next unless row[14]\n\n sample = {\n id: row[1].to_i,\n author: row[0]\n }\n\n unless $author_ids.has_key?(row[0])\n $last_id += 1\n $author_ids[row[0]] = $last_id\n end\n\n print \"#{iter} TF and IDF: ##{sample[:id]} #{sample[:author]}: \"\n text = row[14].stem\n words = text.downcase.gsub(/,|\\.|\\'|\\\"/, '').gsub(/[^a-zA-Z]+/, ' ').split(/\\s+/)\n num_words = words.length\n print \"#{num_words} words\\n\"\n\n tf = words.inject(Hash.new(0)) do |h, w|\n unless w.length < 2 || STOP_WORDS.include?(w)\n h[w] += 1.0 / num_words\n end\n\n h\n end\n\n tf.keys.each do |w|\n if $idf.has_key?(w)\n y = $num_samples / (10**$idf[w]) + 1\n $idf[w] = Math.log10($num_samples / y)\n else\n $idf[w] = Math.log10($num_samples)\n end\n end\n\n sample[:tf] = tf\n sample[:num_words] = num_words\n sample[:text] = text\n samples.push sample\n iter += 1\n end\nend", "title": "" }, { "docid": "392e605953d5fa32f1c19d09cfe328e1", "score": "0.55964035", "text": "def compute_tf_idf(samples)\n iter = 1\n\n samples.each do |s|\n tfidf = Hash.new(0)\n puts \"#{iter} TF-IDF: ##{s[:id]} #{s[:author]}\"\n\n s[:tf].each do |word, tf|\n tfidf[word] = tf * $idf[word]\n $tfidf_totals[word] += tfidf[word]\n end\n\n s[:tfidf] = tfidf\n iter += 1\n end\nend", "title": "" }, { "docid": "667c42fbed34c5eb3262b2b41b39a627", "score": "0.5577202", "text": "def words_frequencies\n word_count = {}\n clean_up_text.each do |word|\n if word_count[word]\n word_count[word] += 1\n else word_count[word] = 1\n end\n end\n\n return word_count\n end", "title": "" }, { "docid": "6c9f692d28b30eef4b50a32c2aba304f", "score": "0.5561364", "text": "def calculate_tfidf_weights_of_new_document(new_doc)\n _termfreq = @tf.calculate(new_doc.contents)\n\n _tfidf_weights = Hash.new\n\n _termfreq.each do |term, tf|\n if (@idf_weights.has_key? term)\n _weight = tf * @idf_weights[term]\n else\n _weight = tf * @idf.maxIDF\n end\n _tfidf_weights[term] = _weight\n end\n @tfidf[new_doc.id] = _tfidf_weights\n return @tfidf\n end", "title": "" }, { "docid": "69602e96a0e18d9a81941a914abe055e", "score": "0.5558201", "text": "def features_count(document)\r\n features_frequency = Hash.new\r\n document.each do |features|\r\n feature = features['feature']\r\n count = features['occurrence']\r\n features_frequency[feature] = count.to_i\r\n end\r\n return features_frequency\r\n end", "title": "" }, { "docid": "94f283e9f7da5ddfea088d2ada2045d0", "score": "0.5555505", "text": "def std_tfidf_document_term_matrix(documents, debug = false)\n # Creates model\n printf(\"\\rCreating similarity model...\") if debug\n model = TfIdfSimilarity::TfIdfModel.new(documents)\n printf(\"\\rCreating similarity model... Done!\\n\") if debug\n # Creates similarity matrix\n printf(\"\\rCreating similarity matrix...\") if debug\n model.similarity_matrix\n printf(\"\\rCreating similarity matrix... Done!\\n\") if debug\nend", "title": "" }, { "docid": "26f2428ae8a14ddb479aaf4b594ad0ce", "score": "0.55479187", "text": "def build_term_frequencies\n\n\t\t\t# create empty term_frequencies\n\t\t\tterm_frequencies = {}\n\n\t\t\t# common english words are hard-coded as an array - is there a more efficient way to do this?\n\t\t\tstopwords = %w{i a a's able about above according accordingly across actually after\n\t\t\tafterwards again against ain't all allow allows almost alone along already also although\n\t\t\talways am among amongst an and another any anybody anyhow anyone anything anyway anyways\n\t\t\tanywhere apart appear appreciate appropriate are aren't around as aside ask asking associated\n\t\t\tat available away awfully b be became because become becomes becoming been before beforehand\n\t\t\tbehind being believe below beside besides best better between beyond both brief but by c c'mon\n\t\t\tc's came can can't cannot cant cause causes certain certainly changes clearly co com come comes\n\t\t\tconcerning consequently consider considering contain containing contains corresponding could couldn't\n\t\t\tcourse currently d definitely described despite did didn't different do does doesn't doing don't\n\t\t\tdone down downwards during e each edu eg eight either else elsewhere enough entirely especially et\n\t\t\tetc even ever every everybody everyone everything everywhere ex exactly example except f far few\n\t\t\tfifth first five followed following follows for former formerly forth four from further furthermore\n\t\t\tg get gets getting given gives go goes going gone got gotten greetings h had hadn't happens hardly\n\t\t\thas hasn't have haven't having he he's hello help hence her here here's hereafter hereby herein\n\t\t\thereupon hers herself hi him himself his hither hopefully how howbeit however i i'd i'll i'm\n\t\t\ti've ie if ignored immediate in inasmuch inc indeed indicate indicated indicates inner insofar\n\t\t\tinstead into inward is isn't it it'd it'll it's its itself j just k keep keeps kept know knows known\n\t\t\tl last lately later latter latterly least less lest let let's like liked likely little look looking\n\t\t\tlooks ltd m mainly many may maybe me mean meanwhile merely might more moreover most mostly much must\n\t\t\tmy myself n name namely nd near nearly necessary need needs neither never nevertheless new next nine\n\t\t\tno nobody non none noone nor normally not nothing novel now nowhere o obviously of off often oh ok\n\t\t\tokay old on once one ones only onto or other others otherwise ought our ours ourselves out outside\n\t\t\tover overall own p particular particularly per perhaps placed please plus possible presumably probably\n\t\t\tprovides q que quite qv r rather rd re really reasonably regarding regardless regards relatively\n\t\t\trespectively right s said same saw say saying says second secondly see seeing seem seemed seeming\n\t\t\tseems seen self selves sensible sent serious seriously seven several shall she should shouldn't since\n\t\t\tsix so some somebody somehow someone something sometime sometimes somewhat somewhere soon sorry specified\n\t\t\tspecify specifying still sub such sup sure t t's take taken tell tends th than thank thanks thanx that\n\t\t\tthat's thats the their theirs them themselves then thence there there's thereafter thereby therefore therein\n\t\t\ttheres thereupon these they they'd they'll they're they've think third this thorough thoroughly those\n\t\t\tthough three through throughout thru thus to together too took toward towards tried tries truly try\n\t\t\ttrying twice two u un under unfortunately unless unlikely until unto up upon us use used useful uses using\n\t\t\tusually uucp v value various very via viz vs w want wants was wasn't way we we'd we'll we're we've welcome\n\t\t\twell went were weren't what what's whatever when whence whenever where where's whereafter whereas whereby\n\t\t\twherein whereupon wherever whether which while whither who who's whoever whole whom whose why will willing wish\n\t\t\twith within without won't wonder would would wouldn't x y yes yet yo you you'd you'll you're you've your yours\n\t\t\tyourself yourselves z zero}\n\n\t\t\t# clean the text of the status message\n\t\t\tmessage_text = @message.gsub(/[^a-z ]/i, '').downcase\n\t\t\tmessage_text = message_text.gsub(/\\s\\s+/,' ')\n\t\t\twords = message_text.split(\" \")\n\n\t\t\t#filter for english stopwords\n\t\t\twords = words - stopwords\n\n\t\t\t#get word stems\n\t\t\tword_stems = get_word_stems words\n\n\t\t\t#create term_frequencies\n\t\t\tword_stems.each do |stem|\n\t\t\t\tterm_frequencies[stem] = word_stems.count(stem)\n\t\t\tend\n\n\t\t\t#return term frequency matrix\n\t\t\tterm_frequencies\n\t\tend", "title": "" }, { "docid": "8f1b1ebd15f5074b9a21f6e70150e078", "score": "0.55402744", "text": "def calculate_word_frequency\n word_frequency = Hash.new(0)\n self.content.split.each do |word|\n word_frequency[word.downcase] +=1\n end\n self.highest_wf_count = word_frequency.values.max\n self.highest_wf_words = word_frequency.select {|k, v| v== highest_wf_count}.keys\n \n end", "title": "" }, { "docid": "a42dcb0686f105edeb3284323ad0aeb3", "score": "0.55343765", "text": "def calculate(text)\n return rawFrequency(text)\n end", "title": "" }, { "docid": "307174ace5d698a114f8bcc7ad3653e2", "score": "0.5530496", "text": "def calculate_word_frequency()\n word_frequency = Hash.new(0)\n @content.split.each do |word|\n word_frequency[word.downcase] += 1\n end\n\n word_frequency.each do |word, frequency|\n if frequency > @highest_wf_count\n @highest_wf_count = frequency\n @highest_wf_words = [ word ]\n elsif frequency == @highest_wf_count\n @highest_wf_words.push word\n end\n end\n end", "title": "" }, { "docid": "111ffa6d9f341ed441a58de928f02b3f", "score": "0.5526338", "text": "def tokenize_documents\r\n\t\t# An array to store all tokenized documents\r\n\t\t@documents = Array.new\r\n\t\[email protected] do |document|\r\n\t\t\t# An object of the sub-document in the collection\r\n\t\t\t@document = TfIdf::Document.new(document)\r\n\t\t\t# Add each document to the documents array\r\n\t\t\[email protected](@document.tokens)\r\n\t\tend\r\n\t\treturn @documents\r\n\tend", "title": "" }, { "docid": "4639869b6cfe81b3aae1fa17fe38527d", "score": "0.54978037", "text": "def save_tf (hash_freq)\n all_words = FreqTermInDoc.where(:doc_id => self.id)\n \n hash_freq.each_pair {| term, freq |\n temp = all_words.where(:word => term).first\n word = Term.find_by_word(term)\n if !temp.nil?\n if temp.freq != freq\n term_freq = word.doc_freq - temp.freq + freq \n word.update_attributes(:doc_freq => term_freq)\n temp.update_attributes(:freq => freq)\n end\n else\n FreqTermInDoc.create(:doc_id => self.id, :word => term, :freq => freq.to_f)\n if word.nil?\n Term.create(:word => term, :doc_freq => 1)\n else\n word.update_attributes(:doc_freq => word.doc_freq+1)\n end\n end\n }\n end", "title": "" }, { "docid": "738b7c8306510a15b5ee5ae1362e8ea5", "score": "0.5486093", "text": "def get_tf(word)\n term_frequency = (words_frequencies[word].to_f)/total_words\n\n return term_frequency\n end", "title": "" }, { "docid": "a3b546eb2abcf752c85a43a5f360abab", "score": "0.5479959", "text": "def _term_tf_idf(term, count)\n \n return_val = 0\n #Default value of @term_idf is -1\n if count != 0 && @term_idf[term] != -1\n return_val = (1+Math.log(count,2))*@term_idf[term]\n end\n \n return_val\n end", "title": "" }, { "docid": "bba70b389094a0b67ffe4662e8a1a7fd", "score": "0.5479261", "text": "def vectorized_docs(classification)\n # hardwired to binary representation\n @documents_for_class[classification].map do |features| \n vectorize_doc(features)\n #@feature_dictionary.map { |dict_feature| features.include?(dict_feature) ? 1 : 0}\n end\n end", "title": "" }, { "docid": "c3f134fc65bfcb87c249c5e8c7452e92", "score": "0.54641086", "text": "def create_document(docs, urf_doc, f1tree)\n\n vec = DocVector.new(@freqitem_count, 0)\n\n urf_doc.words.each do |word|\n index = f1tree.is_node(word)\n\n # the word is in the freqitem tree\n vec[index] += 1 if index != -1\n end\n\n docs << Document.new(vec, urf_doc.name, urf_doc.link)\n end", "title": "" }, { "docid": "447ea5ec623f88051b846b878026a6cc", "score": "0.54547304", "text": "def calculate(text)\n rawFrequency(text)\n end", "title": "" }, { "docid": "22fda213a4c3d862cb562a16d82c9897", "score": "0.5450418", "text": "def term_weighted_ngrams \n ngrams.map{ |n| [ n, @@token_freqs[self] ] } \n end", "title": "" }, { "docid": "3cfc025571234b7f76f54a5a470aee29", "score": "0.54462785", "text": "def complex_word_count\n @complex_word_count ||= Syllable::FleschIndex.new(*tokenized_words).process.delete_if {|word, s_count| s_count < 3}.size.to_f\n end", "title": "" }, { "docid": "8daccbb8937a64f155eeef588f7aa5c5", "score": "0.543124", "text": "def ordenar_por_frecuencia(documentos)\n # @hash_o almacena la frecuencia de cada termino\n # ocurrente en un documento a partir de las 4 frecuencias (titulo,contenido,resumen,palabras_clave)\n # {doc_id => [tf(termino1), ..., tf(termino n)] } \n # y generar @hash_terminos {doc_id => [termino_id1,...,termino_idn]}\n # \n @hash_o = Hash.new 0\n termino_o = []\n @hash_terminos = Hash.new 0\n documentos.each do |doc_index, doc_data|\n @hash_terminos[doc_index] = [] \n doc_data.each do |data|\n termino_o = termino_o + [ calcular_tf([data[4],data[5],data[6],data[7]]) ]\n @hash_terminos[doc_index] = @hash_terminos[doc_index] + [data[8]]\n end#do\n @hash_o[doc_index] = termino_o\n termino_o = []\n end#do\n\n # Con @hash_terminos se calcula el itf\n # @hash_terminos.each do |documento,termino_ids|\n # @hash_terminos[documento] = calcular_itf(termino_ids)\n # end#do\n\n # A partir de @hash_o calcular @hash_f\n # {doc_id => frecuencia_de_termino}\n #\n @hash_f = Hash.new 0\n @hash_o.each do |doc_id,ocurrencias|\n @hash_f[doc_id] = 0\n ocurrencias.each do |ocurrencia|\n @hash_f[doc_id] = @hash_f[doc_id] + ocurrencia\n end#do\n end#do\n\n documentos.each do |doc_index,doc_data|\n doc_data[0].push(@hash_f[doc_index])\n end#do\n documentos = documentos.sort_by { |doc_id,doc| doc.first[8] }\n end", "title": "" }, { "docid": "fbaafc9e447a21742e2a3c121444c7fd", "score": "0.5423207", "text": "def frequencey_count_optimized\n sanitized_text = sanitize_text(@text.downcase)\n\n current_sentence_num = 1\n current_word = ''\n words_count = {}\n words_in_sentences = {}\n current_index = 0\n\n sanitized_text.each_char do |char|\n next if char == ' ' && current_word == ''\n next if char == '.' && current_word == ''\n\n # process the previouse saved word\n if char == ' ' || current_index == sanitized_text.size - 1\n words_count[current_word] ||= 0\n words_count[current_word] += 1\n\n words_in_sentences[current_word] ||= []\n words_in_sentences[current_word] << current_sentence_num\n current_word = ''\n elsif char != '.'\n current_word += char\n elsif char == '.'\n words_count[current_word] ||= 0\n words_count[current_word] += 1\n\n words_in_sentences[current_word] ||= []\n words_in_sentences[current_word] << current_sentence_num\n current_word = ''\n\n current_sentence_num += 1\n end\n\n current_index += 1\n end\n\n {\n number_of_sentence: current_sentence_num,\n words_count: words_count,\n words_in_sentences: words_in_sentences\n }\n end", "title": "" }, { "docid": "0efdf099f5c7adca4624a45c9189783a", "score": "0.54167676", "text": "def word_count(document)\n words = document.gsub(/[^\\w\\s]/,\"\").split\n d = Hash.new\n words.each do |word|\n #word.downcase! \n #key = word.stem\n key = word\n\n # common words are already removed in Entry\n # unless COMMON_WORDS.include?(word.downcase) # remove common words\n d[key] ||= 0\n d[key] += 1\n #end\n end\n return d\n end", "title": "" }, { "docid": "d1fef03bd12f798d6111455679a632cd", "score": "0.54142565", "text": "def freq_count(arr)\n arr.inject(Hash.new(0)) { |freqs, word| freqs[word] += 1; freqs }\n end", "title": "" }, { "docid": "22d857cf3523d435837178541db34707", "score": "0.54103684", "text": "def word_counter\n\t# Lists words, their frequency, and location based on sentence # from given text doc.\n\t# The way the file is read, it could freeze the host if file given is too big.\n\t# Will not work with languages other than English\n\t#\n\t# Started 9/16/2015\n\t# Updated 2/14/2016\n\t# Author: Christopher Gabriel Manna\n\t# find a way to turn this into a class\n\t\n\t# setting new values\n\th = Hash.new(0)\n\ti = 0\n\talph = \"a\".ord\n\tpot_sentences = []\n\twords = []\n\t\n\n\tfile_name = ARGV[0]\n\tif (File.extname(file_name).to_s == \".txt\" && File.exist?(file_name))\n\t\t# https://github.com/diasks2/pragmatic_segmenter\n\t\t# GitHub UN: diasks2\n\t\ttxt = File.open(file_name, \"r+\")\n\t\tps = PragmaticSegmenter::Segmenter.new(text: txt.read)\n\t\tpot_sentences = ps.segment\n\t\ttxt.close\n\t\t# pot_sentences\n\t\t# adjust here so that File Open closes automatically\n\telse\n\t\tputs \"Something is wrong, please retry.\"\n\t\tputs \"Exitting Program.\"\n\t\texit(0)\n\tend\n\n\n\t# replacing everything that is not a word with nothing\n\tpot_sentences.map! { |elmt| elmt.downcase.gsub!(/[^\\w\\s]/, '') }\n\t# rewrite this\n\n\t# finding word without gramatical interruption and sorting vals\n\t# finding frequency for each word that appears and storing in hash\n\tpot_sentences.join(\" \").scan(/[\\w']+/).sort.each { |elmt| words << elmt }\n\t\n\tposs_words = words.uniq\n\tposs_words.each do |word|\n\t\tfreq = 0 \n\t\tloc = []\n\t\tpot_sentences.each_with_index do |sentence, i|\n\t\t\tif sentence.include?(word)\n\t\t\t\tfreq += 1\n\t\t\t\tloc << i.to_i + 1\n\t\t\tend\n\t\tend\n\t\th[word] = [freq, loc.join(\", \")]\n\tend\n\t\t\n\t# setting indent length for table formatting based on the longest word length\n\t# in the hash that has all the word keys.\n\tval = (h.keys.max_by(&:length)).length + 30 + (h.size / 26)\n\t\t\n\t# title of printed table, \n\tprintf \"%-#{val + 1}s %s\\n\",\"Word List\",\"Frequency & Locations\"\n\n\th.each do |k, v| \n\t\tstr = \"\" # resetting alpha value so as not to include previous\n\t\t\n\t\t((i / 26)+1).times {str += (alph + (i % 26)).chr}\n\t\t\t# dynamically increase list alphabetically and roll over at end of alpha\n\t\t\n\t\tprintf(\"%s. %-#{val - str.length}s{%s:%s}\\n\", str,k,v[0],v[1]) \n\t\t\t# dynamically create output table\n\t\ti += 1\n\t\t\t# increment through alpha\n\tend\nend", "title": "" }, { "docid": "b5fa463f944cce65cd309b6e7bcc9496", "score": "0.54087293", "text": "def tokenize_documents\r\n\t\tdocuments = []\r\n\t\[email protected] do |document|\r\n\t\t\tdocument = TfIdf::Document.new(document)\r\n\t\t\tdocuments.push(document.tokens)\r\n\t\tend\r\n\t\treturn documents\r\n\tend", "title": "" }, { "docid": "6db863a56b8a0a5a283c636968bd7c4a", "score": "0.54019326", "text": "def em_algorithm\n n = @english_sentences.size\n @counts = Hash.new(0)\n \n raise \"ASDFAKSJDFA\" unless @english_sentences.size == @german_sentences.size\n \n # delta = {}\n n.times do |k| \n eng = @english_sentences[k]\n ger = @german_sentences[k]\n \n #lines for figuring out time\n \n ger.each_with_index do |f, i|\n eng.each_with_index do |e, j|\n \n sum = 0.0\n eng.each do |e_word|\n sum += @t[e_word][f]\n end\n # raise \"#{sum}, #{f}, #{eng}\"\n \n raise \"#{e}, #{f} #{@t[e][f]}, #{counts[e]}\" if sum == 0.0\n \n \n\n # key_kij = k.to_s + ' ' + i.to_s + ' ' + j.to_s\n # delta[ key_kij ]\n delta = @t[e][f].to_f / sum\n \n key_ef = e + ' ' + f\n @counts[ key_ef ] += delta#[ key_kij ]\n @counts[ e ] += delta#[ key_kij ]\n # @counts[key_jilm] += delta\n # @counts[\"#{i} #{l} #{m}\"] += delta\n \n # @t[e][f] = @counts[key_ef] / @counts[e]\n \n raise \"#{sum}\" if @t[e][f].nan?\n end\n end\n \n end\n \n @t.keys.each do |e|\n @t[e].keys.each do |f|\n @t[e][f] = @counts[e+' '+f] / @counts[e]\n end\n end\n end", "title": "" }, { "docid": "f2e65b091acb3d0301f4b783ef0487f2", "score": "0.5397991", "text": "def augmented_normalized_term_frequency(term)\n 0.5 + 0.5 * normalized_term_frequency(term)\n end", "title": "" }, { "docid": "d31d21a7e989363e230f51976fe6e753", "score": "0.5394874", "text": "def count_words_in_corpus_and_most_freq_word(dictionary_frequency,quantity_words_in_corpus,max_freq_quantity_of_word)\n dictionary_frequency.each{\n |hash,value|\n quantity_words_in_corpus = quantity_words_in_corpus + value\n if value > max_freq_quantity_of_word\n max_freq_quantity_of_word = value\n end\n }\n res=[quantity_words_in_corpus,max_freq_quantity_of_word]\n #return 2 values\n res\n end", "title": "" }, { "docid": "a5f54d56300f481c75967d46b945b071", "score": "0.53946483", "text": "def transform_doc(text)\n raise Xi::ML::Error::ConfigError, 'Input data is not a String object' \\\n unless text.is_a?(String)\n\n # compute known word frequencies: word_id => word_frequency\n freq = {}\n freq.default = 0\n\n text.split.each do |word|\n freq[@dictionary[word]] += 1 if @dictionary.key?(word)\n end\n\n return [] if freq.empty?\n\n # list of word ids\n ids = freq.keys\n\n # compute and normalize TF-IDF features\n tfidf_weights = Numo::DFloat[*freq.values] * @tfidf_params.slice(ids)\n tfidf_weights /= Math.sqrt((tfidf_weights**2).sum)\n\n # recover LSI weights for current document\n lsi_weights = @lsi_params.slice(ids, (0..-1))\n\n # compute LSI features\n (tfidf_weights.dot(lsi_weights)).to_a\n end", "title": "" }, { "docid": "c923cea15ccec32d8f68f2ce2f378816", "score": "0.5386125", "text": "def frequency_of_word word\n word_frequency[word]\n end", "title": "" }, { "docid": "8e75151bb83649eb37e47e03883d50ba", "score": "0.53850865", "text": "def compute_df_tf\n self.tf_in_dataset = {}\n self.df_in_dataset = {}\n self.df_in_corpus = {}\n\n total = documents.size.to_f\n\n documents.each_with_index do |d, i|\n d.term_vectors.each do |k, v|\n tf_in_dataset[k] ||= 0\n tf_in_dataset[k] += v[:tf]\n\n df_in_dataset[k] ||= 0\n df_in_dataset[k] += 1\n\n df_in_corpus[k] = v[:df] if !df_in_corpus[k] && v[:df].positive?\n end\n\n # Call the progress function appropriately\n next unless progress\n p = i.to_f / total\n p *= split_across ? 90.0 : 40.0\n progress.call(p.to_i)\n end\n\n self.num_dataset_types = tf_in_dataset.size\n self.num_dataset_tokens = tf_in_dataset.values.reduce(:+)\n\n progress&.call(split_across ? 90 : 40)\n end", "title": "" }, { "docid": "8d1228ffe6c7daa270dd74f8e2259ca4", "score": "0.53843594", "text": "def calculate_word_frequency\n\n frequency = Hash.new(0) #create a new hash\n wf_words = Hash.new(0)\n #split each word and do block which takes a word and counts it.\n @content.split.each do |word| frequency[word.downcase] += 1 end\n @highest_wf_count = frequency.values.max #find max value among frequencies\n wf_words = frequency.select {|k,v| v==@highest_wf_count} #find word with max frequency\n @highest_wf_words = wf_words.keys\n end", "title": "" }, { "docid": "42c081e1a54b6e529128764e72928ea7", "score": "0.53606194", "text": "def freq(key, word)\n main_counter[key][word] || 0\n end", "title": "" }, { "docid": "55206fe9eb9228745541b237b07292c0", "score": "0.5357363", "text": "def calculate_word_frequency()\n word_frequency = Hash.new(0)\n @highest_wf_count ||= 0;\n self.content.split.each do |word| \n word_frequency[word.downcase] += 1\n if @highest_wf_count <= word_frequency[word.downcase]\n @highest_wf_count = word_frequency[word.downcase]\n end\n end\n if @highest_wf_count != 0\n @highest_wf_words = []\n word_frequency.select { |key,value| value == @highest_wf_count}\n .each_pair do |key,value|\n @highest_wf_words.push(key)\n end\n end\n end", "title": "" }, { "docid": "6dda024e05c3d02de86b3d55223f8815", "score": "0.5345933", "text": "def index\n @word_frequencies = WordFrequency.all\n end", "title": "" }, { "docid": "319f481c17c1cee388e5533797c5fbdc", "score": "0.5344387", "text": "def find_frequency(sentence, word)\nend", "title": "" } ]
24ebf98f3568afe7ec56d7de1fb16668
cdepman first even occurence Time complexity: O(n^2)
[ { "docid": "4b80c691730e8d7cca44920b296cb3c3", "score": "0.58984023", "text": "def first_even_occurrence_readable(array)\n array.each{|item| return item if array.count(item) % 2 == 0}\n nil\nend", "title": "" } ]
[ { "docid": "8fe54649e694afdf0c20c9aa8005f587", "score": "0.638569", "text": "def first_even_occurrence_efficient(array)\n hash = {};\n array.each do |item|\n hash[item] = !hash[item]\n end\n array.each do |item|\n return item if !hash[item]\n end\n nil\nend", "title": "" }, { "docid": "fdb34bc702df299baa0776ca0f0c2217", "score": "0.61670405", "text": "def find_it(seq)\n # count = Hash.new(0)\n # seq.each {|el| count[el] += 1}\n # count.select {|el, count| count.odd?}.keys[0]\n seq.find { |n| seq.count(n).odd? }\n #seq.reduce(:^)\nend", "title": "" }, { "docid": "7e7778392980e7c3e2dedf03eab8b3ff", "score": "0.6105615", "text": "def detectCycle lst\n\n elements = Hash.new()\n \n (0...lst.length).each do |i|\n if elements.has_key?(lst[i])\n starts = elements[lst[i]]\n starts.each do |s|\n longCycle = i - s\n c1 = lst[s, longCycle]\n c2 = lst[i, longCycle]\n if c1 == c2 then return c1 end\n end\n elements[lst[i]].push(i)\n else\n elements[lst[i]] = [i] \n end\n end\n puts \"Cycle not found\"\n return []\nend", "title": "" }, { "docid": "c0b77db1ad8a10b5d91335d7f3852f09", "score": "0.60285336", "text": "def fast_leader(n)\n n.sort!\n length = n.size\n leader = -1\n freq = 0\n candidate = n[length / 2]\n n.each do |num|\n freq += 1 if num == candidate\n leader = candidate if freq > length / 2\n end\n leader\nend", "title": "" }, { "docid": "dfb95a82ce275406c0458f1ae8e1e2af", "score": "0.5974783", "text": "def find_it(seq)\n if seq.length == 1\n return seq.first # return immediatly if only one entry in array\n else\n seq.each do |num| # otherwise look over objects in array\n instances = seq.count(num) # if it appears an odd number of times - return it\n if instances % 2 == 1\n return num\n end\n end\n end\nend", "title": "" }, { "docid": "47ffb8f3cea4d419b61b5e7563804635", "score": "0.5943568", "text": "def find_it(seq)\n # my sol @2019.12.19\n # seq.uniq.reduce([]){|x,i| x << ( seq.count(i).odd? ? i : [] )}.join.to_i\n \n # # best sol1\n # seq.detect { |n| seq.count(n).odd? }\n\n # # best sol2\n seq.reduce(:^)\n\nend", "title": "" }, { "docid": "2fd43cb60d05754f20a5488fb7025792", "score": "0.59250176", "text": "def find_first_non_repeated_letter(str)\narray=str.split\"\"\narray_triples=[]\nmoving_on_array=[]\n if array[0]!=array[1]\n array[0]\n else\n array[1..-1].each_cons(3) { |a| array_triples << a }\n moving_on_array=array_triples.select {|x| x[0]!=x[1] && x[1]!=x[2]}\n if moving_on_array.empty? == false\n moving_on_array[0][1]\n elsif array[-2]!=array[-1]\n array[-1]\n end\n end\nend", "title": "" }, { "docid": "2d1f5ffbab8c86bc000cce7ee42c2003", "score": "0.592109", "text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend", "title": "" }, { "docid": "5fa31432c898a629d0fe43ee49b8c8d0", "score": "0.5881502", "text": "def solution(a)\n length = a.length\n i = 0\n a = a.sort\n smalest = 1\n while(i < length-1) do\n current_val = a[i]\n if current_val < 0\n i+=1\n next\n end\n next_val = a[i+1]\n if next_val - current_val > 1\n smalest = current_val + 1\n break\n elsif i == length-2\n smalest = next_val + 1\n break\n end\n i+= 1\n end\n smalest\nend", "title": "" }, { "docid": "1c370915b933c23f2596973ce97cdc04", "score": "0.5877495", "text": "def largest_continugous_second(list)\n max = list[0]\n list.each_with_index do |el, idx|\n list[(idx)..-1].each_with_index do |second_el, jdx|\n value = list[idx..idx + jdx].inject(:+)\n if value > max\n max = value\n end\n end\n end\n puts \"largest continugous with O(n) time is:\"\n puts max\nend", "title": "" }, { "docid": "ddc874e9bdd4a42c5cda39199dde64ce", "score": "0.5851865", "text": "def find_it(seq)\n appearances = seq.each_with_object(Hash.new(0)) { |number, counts| counts[number] += 1 }\n answer = appearances.select { |k, v| v % 2 != 0 }\n answer.keys[0]\nend", "title": "" }, { "docid": "af5213168e0ee82b120bec44b2735af5", "score": "0.5851653", "text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n leader_indices = []\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n end\n leader_indices << count\n end\n\n if count > (a.length/2)\n leader = candidate\n end\n\n leaders_count = 0\n\n if(leader != -1)\n (0..(a.length-1)).each do |i|\n a_1 = a[0..i]\n a_2 = a[(i+1)..(a.length-1)]\n\n count_2 = leader_indices[i]\n\n # puts \"count_2 #{count_2} , count #{a_1.length/2}\"\n # puts \"count_2 #{count_2} , (count-count_2) #{(count-count_2)}, count #{(a_2.length/2)}\"\n\n if count_2 > (a_1.length/2) && (count-count_2) > (a_2.length/2)\n leaders_count = leaders_count + 1\n end\n\n # puts leaders_count\n # puts\n end\n end\n\n leaders_count\nend", "title": "" }, { "docid": "9eff199747db6970dad069aff14f6af5", "score": "0.5824657", "text": "def solution(a)\n # write your code in Ruby 2.2\n h = a.reduce(Hash.new(0)) do |counts, n|\n counts[n] += 1\n counts\n end\n\n h.select do |k, v|\n v.odd?\n end.first.first\nend", "title": "" }, { "docid": "4a21fd90da81a02895a7e32078bf0946", "score": "0.580712", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend", "title": "" }, { "docid": "76627cb9c1891d7bf95625a22251135f", "score": "0.5800744", "text": "def lcs1(arr)\n best_arr = [arr[0]]\n curr_arr = []\n arr.each do |ele|\n curr_arr = curr_arr.push(ele)\n if curr_arr.sum > best_arr.sum\n best_arr = curr_arr.dup\n end\n if curr_arr.sum < 0\n curr_arr = []\n end\n end\n return best_arr.sum\nend", "title": "" }, { "docid": "354acc44d23902170d18ef50bb27f5b1", "score": "0.5785023", "text": "def dynamic_programming(sorted)\n acc = { sorted.length - 1 => 1 }\n result = 1\n (2..sorted.length).each do |offset|\n (sorted.length - offset + 2...sorted.length).each do |index|\n break unless sorted[index] - sorted[sorted.length - offset] <= 3\n\n result += acc[index]\n end\n acc[sorted.length - offset] = result\n end\n result\nend", "title": "" }, { "docid": "8c9b381b303d5ea5868a4e89e37ccb8f", "score": "0.5782247", "text": "def migratoryBirds(n, ar)\n # Complete this function\n hash = Hash.new(0)\n\n ar.each { |el| hash[el] += 1 }\n\n\n common = 0\n most_freq = hash[ar[0]]\n\n (1...n).each do |i|\n if hash[ar[i]] > most_freq\n most_freq = hash[ar[i]]\n common = i\n end\n end\n\n ar[common]\nend", "title": "" }, { "docid": "2aae31c810683bcd7904ee0a08306de1", "score": "0.57774293", "text": "def SecondGreatLow(arr)\n arr.sort!\n i = 1\n j = arr.length - 2\n \n i += 1 while i < arr.length && arr[0] == arr[i]\n j -= 1 while j >= 0 && arr[j] == arr[arr.length - 1]\n \n return \"#{arr[0]} #{arr[0]}\" if j < 0\n \n return \"#{arr[i]} #{arr[j]}\" \nend", "title": "" }, { "docid": "cbae4c1508d3e608a257c7786afdfa1e", "score": "0.5748285", "text": "def z_algorithm(s)\n n = s.size\n return [] if n == 0\n \n z = [0]*n\n z[0] = n\n i, j = 1, 0\n while i < n\n j += 1 while i+j<n && s[j]==s[i+j]\n z[i] = j\n if j == 0 then\n i += 1\n next\n end\n k = 1\n while i+k<n && k+z[k]<j\n z[i+k] = z[k]\n k += 1\n end\n i += k\n j -= k\n end\n return z\nend", "title": "" }, { "docid": "9a2d3582e0e96e0115f2f68a4474dc12", "score": "0.57448566", "text": "def rec2c(a,n)\n\tif n==0 then return 0\n\telse\n\t\ta.size.times{|i|\n\t\t\tif n>=a[i] && a.find{|e|(n-a[i])%e==0}\n\t\t\t\tr=rec2c(a,n-a[i])\n\t\t\t\tif r>=0 then return r+9-i end\n\t\t\tend\n\t\t}\n\tend\n\treturn nil\nend", "title": "" }, { "docid": "154b18efa590236ccab9df5c6b355bd4", "score": "0.57348603", "text": "def solution(a)\n a\n .reduce({}) { |h, i| h[i] ? h[i] += 1 : h[i] = 1; h }\n .find { |i| i[1] % 2 == 1 }[0]\nend", "title": "" }, { "docid": "67b9ef53ec11d2afb99c8f85cfeb3a19", "score": "0.5723924", "text": "def lcs(array) #O(n^3)\r\n subs = []\r\n (0...array.length).each do |i|\r\n (i+1...array.length).each do |j|\r\n subs << array[i..j]\r\n end\r\n end\r\n\r\n subs.map(&:sum).max\r\nend", "title": "" }, { "docid": "cc1375cb86f967173461bdf08e8f7789", "score": "0.57180256", "text": "def solve_b(arr)\n res = arr[0]\n count = 0\n\n arr.each do |x|\n if count == 0\n res = x\n end\n\n if x == res\n count += 1\n else\n count -= 1\n end\n end\n\n arr.count { |x| x == res } >= (arr.size / 2 + 1) ? res : -1\n end", "title": "" }, { "docid": "9e882c12119391e131e9e6423a398d48", "score": "0.5710163", "text": "def solution(n)\n # write your code in Ruby 2.2\n\n found_first_one = false\n start_count = false\n current_count = 0\n max_count = 0\n\n # loop over n\n while (n != 0) do\n digit = n%2\n n = n/2\n\n if digit == 1\n # check maximum count if not first one appearing\n if(found_first_one == true && current_count > max_count)\n max_count = current_count\n end\n # reset counts to count again starting from it\n found_first_one = true\n start_count = true\n current_count = 0\n else # zeros\n current_count = current_count + 1\n end\n end\n\n max_count\nend", "title": "" }, { "docid": "f8d6f83f62af9a478013525c882dbe32", "score": "0.57049674", "text": "def lcs1(list)\n subs = []\n greatest_sum = 0\n\n list.each_with_index do |el1, idx1|\n list.each_with_index do |el2, idx2|\n next if idx1 >= idx2\n\n subs << list[idx1..idx2] unless list[idx1..idx2].empty?\n end\n end\n p subs\n subs.each do |slice|\n current_sum = slice.inject(:+)\n if current_sum > greatest_sum\n greatest_sum = current_sum\n end\n end\n\n greatest_sum\nend", "title": "" }, { "docid": "c6c6fb771ba3f64b279bf8d1dd4d1736", "score": "0.57046026", "text": "def fairRations(b)\n i = 0\n counter = 0\n while i < b.length\n\n return 'NO' if b[i + 1].nil? && b[i].odd?\n\n if b[i].odd? && !b[i + 1].nil?\n b[i] += 1\n b[i + 1] += 1\n counter += 2\n end\n\n i += 1\n end\n\n counter\nend", "title": "" }, { "docid": "a264a1f22ee2b202482c5633bd7a0a12", "score": "0.5702005", "text": "def array_seg_with_order(array)\n puts \"given array is:\"\n p array\n seg_array = []\n array.each do |i|\n if i%2 == 1\n seg_array.push(i)\n end\n end\n array.each do |i|\n if i%2 == 0\n seg_array.push(i)\n end\n end\n puts \"segrated array with odds infront of evens and retaining order\"\n p seg_array\nend", "title": "" }, { "docid": "64b02c9a3fe6b1e42cd2975cf8c3098b", "score": "0.5699167", "text": "def beautifulTriplets(d, arr)\n n = arr.size \n i = 0 \n j = 1 \n res = 0\n count = 0\n for i in 0..(n-d) do\n count = 0\n for j in (i+1)..(n-1) do \n if (arr[j] - arr[i]) == d\n count =1\n elsif arr[j] - arr[i] == (2*d) and count == 1\n count =2\n res+= 1\n break \n end\n end\n end\n res\nend", "title": "" }, { "docid": "da52d5c42e0250883938004f54849860", "score": "0.5681143", "text": "def find_it(seq)\n seq.find{|c| seq.count(c).odd? }\nend", "title": "" }, { "docid": "b126ccdd541b61cb43a9040e71c8d52d", "score": "0.5680682", "text": "def fast_solution(m, a)\n multiples = 0 # number of #'s in freq that occur >= 2 times\n\n back = distinct = 0\n freq = Hash.new(0)\n a.each_with_index do |elem, front|\n puts \"back: #{back}, front: #{front}, elem: #{elem}, a[#{back}..#{front}]: #{a[back..front]}\"\n\n freq[elem] += 1\n multiples += 1 if freq[elem] > 1\n\n puts \"freq: #{freq}, multiples: #{multiples}\"\n while multiples > 0\n # Move back index forward 1 step. \n # Have we gotten rid of the element that gave us multiple > 1?\n # Does our (back, front) slice still have multiples?\n freq[a[back]] -= 1\n multiples -= 1 if freq[a[back]] == 1\n back += 1\n\n puts \"freq: #{freq}, multiples: #{multiples}, back: #{back}, front: #{front}, a[#{back}..#{front}]: #{a[back..front]}\"\n end\n distinct += front - back + 1\n puts \"distinct: #{distinct}\"\n end\n [distinct, MAX_SLICES].min\nend", "title": "" }, { "docid": "739c8257e3b26c4d651fdd5dd712c849", "score": "0.566702", "text": "def find_dissappeared_numbers(nums)\n nums.each_with_index do |num, i|\n nums[num - 1] += 1_000_000 if nums[num - 1] < 1_000_000\n end\n\n res = []\n nums.each_with_index do |num, i|\n if num < 1_000_000\n res << (i + 1)\n end\n end\n\n nums.each_with_index do |num, i|\n if num > 1_000_000\n nums[i] -= 1_000_000\n end\n end\n\n res\nend", "title": "" }, { "docid": "49552ab2769a4e7e83c75ae7c3fe0900", "score": "0.56632024", "text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend", "title": "" }, { "docid": "2a2274ca99b20fce42c2f70fcb175324", "score": "0.56590706", "text": "def day_one_part_two(input)\n sum = 0\n repeat = 1\n freq_res = Hash.new(0)\n while repeat != 0 do\n freq_array = structure_input(input).each do |i|\n sum+=i\n x = freq_res[sum]+=1\n if (x == 2)\n repeat = 0\n puts \"returning now\"\n break\n end\n end\n end\n return sum\nend", "title": "" }, { "docid": "2f2578632ba9ee3c1b0d7ad78f3ce946", "score": "0.56532824", "text": "def part2(input)\n current_freq = 0\n seen_frequencies = {0 => true}\n\n while true\n input.each do |shift|\n current_freq += shift\n if seen_frequencies[current_freq]\n # If we've seen this before, we're done.\n return current_freq\n end\n\n seen_frequencies[current_freq] = true\n end\n end\nend", "title": "" }, { "docid": "6ff90e9ae955540a937868eb3287cace", "score": "0.56528825", "text": "def goldbach_conjecture\r\n (2..Float::INFINITY).lazy.each do |n|\r\n next if Prime.prime?(n) || n.even?\r\n\r\n found = false\r\n Prime.each(n) do |p|\r\n k = Math.sqrt((n-p)/2).to_i\r\n if n == p + 2*k**2\r\n found = true\r\n break\r\n end\r\n end\r\n\r\n return n unless found\r\n end\r\nend", "title": "" }, { "docid": "acbebb5b33f0957604a4206455455999", "score": "0.5642848", "text": "def solution(array)\n array.sort!\n current = 1\n (0..array.size).step(1) do |n|\n return current unless array[n] == current\n\n current += 1\n end\nend", "title": "" }, { "docid": "de29d15f79535b97a79dbf6586f433ad", "score": "0.56392175", "text": "def lcs(arr)\n result = []\n # n!\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n result << arr[i..j]\n end\n end\n # n\n sum = result.shift.reduce(:+)\n result.each do |arr|\n sum = arr.reduce(:+) if sum < arr.reduce(:+)\n end\n sum\nend", "title": "" }, { "docid": "60cee10d04570e3b69fae1c7251e684a", "score": "0.56385636", "text": "def cats_in_hats\n arr = Array.new(101) { false }\n visit = 1\n\n while visit <= 100\n i = 0\n while i <= 100\n arr[i] = !arr[i]\n i += visit\n end\n visit += 1\n end\n\n result = []\n i = 0\n while i < arr.length\n result << i if arr[i]\n i += 1\n end\n\n result\nend", "title": "" }, { "docid": "99381b73be250fc4462fe7844950b127", "score": "0.5637442", "text": "def icecreamParlor(m, arr)\n arr.each.with_index do |element1, index1|\n arr.each.with_index do |element2, index2|\n if((element1 + element2) == m && (index1 != index2))\n return [index1+1, index2+1]\n end\n end\n end\n\nend", "title": "" }, { "docid": "637b839a53a6a678726104beefff6852", "score": "0.56331086", "text": "def find_it(seq)\n seq.uniq.each do |el|\n return el if seq.count(el) % 2 == 1\n end\nend", "title": "" }, { "docid": "edad059e7b3df254add1153176b0ddcc", "score": "0.5630848", "text": "def solution(a)\n events = []\n a.each_with_index do |v, i|\n events << [i - v, +1]\n events << [i + v, -1]\n end\n # [[-1, 1], [1, -1], [-4, 1], [6, -1], [0, 1], [4, -1], [2, 1], [4, -1],\n # [0, 1], [8, -1], [5, 1], [5, -1]]\n\n events.sort_by! { |coordinate, event| [coordinate, -event] }\n # [[-4, 1], [-1, 1], [0, 1], [0, 1], [1, -1], [2, 1], [4, -1], [4, -1],\n # [5, 1], [5, -1], [6, -1], [8, -1]]\n\n events.map!(&:last)\n # [1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1]\n\n intersections = 0\n active_discs = 0\n events.each do |event|\n intersections += active_discs if event == 1\n active_discs += event\n return -1 if intersections > 10_000_000\n end\n intersections\nend", "title": "" }, { "docid": "578a4c2088c4d8ec64fbe2465745ad9e", "score": "0.5629342", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #0 -east\r\n #1 - west\r\n \r\n\r\n\r\n arr=[]\r\n n=0\r\n a.each_with_index{|el,i|\r\n \r\n if(el==0)\r\n j=i\r\n loop do\r\n if (a[j] == 1)\r\n n+=1\r\n end\r\n \r\n j+=1 \r\n break if j==a.count \r\n end\r\n \r\n end\r\n \r\n }\r\n \r\n n\r\nend", "title": "" }, { "docid": "c8ce5d9a552a3df8cc94f2e2e70d7a3c", "score": "0.5627382", "text": "def find_celebrity(persons)\n possible_candidate = persons[0]\n for i in 1..persons.size-1\n result = knows?(persons[i], possible_candidate) #persons[i] knows poss candidate?\n possible_candidate = persons[i] unless result\n end\n #make sure possible candidate is a celebrity\n for i in 0..persons.size-1\n return nil if persons[i] != possible_candidate && (knows?(possible_candidate, persons[i]) || !knows?(persons[i], possible_candidate))\n end\n possible_candidate\nend", "title": "" }, { "docid": "302d384889e964d1dff3844b55451f5a", "score": "0.56241584", "text": "def find_cycle seq\n seen = {}\n\n seq.each_with_index do |x,i|\n return seq[seen[x]..i-1] if seen.has_key? x\n seen[x] = i\n end\n nil\nend", "title": "" }, { "docid": "b03da38241229c4fb79a6fd50999d19c", "score": "0.5617818", "text": "def problem5\n n = 20\n divs = (1..n).to_a\n lcms = Array.new\n\n 2.upto(20) do |z|\n divs.combination(z).to_a.each do |a|\n prod = 1\n a.each do |b|\n prod*=b\n end\n found = true\n 1.upto(20) do |z|\n if prod % z != 0\n found = false\n break\n end\n end\n if found\n lcms << prod\n break\n end\n end\n end\n\n puts lcms.uniq.sort[0]\nend", "title": "" }, { "docid": "4adcd8ce1f663221c3c23c720e9dae18", "score": "0.56070334", "text": "def solution(n)\n counter_array = Array.new(n.size+1, 0)\n n.each do |v|\n counter_array[v-1] = 1\n end\n counter_array.find_index(0) + 1\nend", "title": "" }, { "docid": "d0f7bf740429705af91cc2c46fdb7e7b", "score": "0.5607", "text": "def fairRations(b)\n count = 0\n b.each_with_index do |v,i|\n break if i == b.length-1\n if v.odd?\n b[i] += 1\n b[i+1] += 1\n count += 2\n end\n end\n b.all? {|i| i.even?} ? count : 'NO'\nend", "title": "" }, { "docid": "2b3f26afadec8d70457b71db884f319f", "score": "0.5606127", "text": "def find_it(seq)\n seq.select { |n| seq.count(n).odd? }[0]\nend", "title": "" }, { "docid": "818cae45422279cc1378c197b2cf9a7a", "score": "0.56058913", "text": "def fairRations(array)\n count = 0\n 0.upto(array.length - 1) do |i|\n if array[i].odd? && array[i+1]\n array[i+1] += 1 \n array[i] += 1\n count += 2\n end\n end \n if array.any? {|el| el.odd?}\n count = 'NO'\n end\n \n return count\n \nend", "title": "" }, { "docid": "aa01f7eeb281f5993289951a8476332a", "score": "0.5604602", "text": "def solution(a)\n\n occurrences = {}\n leader = nil\n max_occurrences = 0\n a.each do |e|\n occurrences[e] = occurrences[e] || 0\n occurrences[e] += 1\n if occurrences[e] >= max_occurrences\n max_occurrences = occurrences[e]\n leader = e\n end\n end\n \n return -1 if max_occurrences <= a.length / 2\n \n a.each_with_index do |e, i|\n return i if e == leader\n end\n\nend", "title": "" }, { "docid": "89305d494b9799219b633e285a97b7d2", "score": "0.5593472", "text": "def make_cf(n)\r\n omega0 = sqrt(n)\r\n l = 0\r\n p = 1\r\n \r\n loop do\r\n a = \r\n end\r\nend\r\n\r\n\r\n first_int = m.floor\r\n first_dec = m - first_int\r\n if first_dec == 0\r\n return [first_int,[]]\r\n end\r\n m = 1/first_dec\r\n cir = []\r\n loop do\r\n int = m.floor\r\n cir.push(int)\r\n dec = m - int\r\n break if int == first_int*2\r\n m = 1/dec\r\n end\r\n return [first_int,cir]\r\nend", "title": "" }, { "docid": "a2ba808e6ff0401483e3cb8c3d9eac49", "score": "0.5582053", "text": "def my_min_phase2(list)\n min = list.first \n list.each do |el1| #O(n)\n if el1 < min\n min = el1\n end\n end\n min\nend", "title": "" }, { "docid": "b0de521364dbee8e60f5931b2728698e", "score": "0.5575931", "text": "def over_the_road(numero_de_casa, longitud_calle)\n casas_izquierda = []\n casas_derecha = []\n\n c = 1\n while true\n if c.even?\n casas_derecha << c\n else\n casas_izquierda << c\n end\n break if casas_derecha.length == longitud_calle && casas_izquierda.length == longitud_calle\n\n c += 1\n end\n casas_derecha.reverse!\n\n if numero_de_casa.even?\n indice = casas_derecha.index(numero_de_casa)\n puts casas_izquierda[indice]\n else\n indice = casas_izquierda.index(numero_de_casa)\n puts casas_derecha[indice]\n end\nend", "title": "" }, { "docid": "855a55b7301e7286dd66d3d26709d17e", "score": "0.55757225", "text": "def problem_94\n py = lambda do |m,n|\n [m*m-n*n,2*n*m,m*m+n*n]\n end\n\n m,n,used = 2,1,0\n t,tt,r = 0,0,nil\n loop do\n r = py.call(m,n).sort\n if (r[2] - r[0]*2).abs == 1\n tt = r[2]*2 + r[0]*2\n puts \"#{m} #{n} #{r.inspect} circ=#{tt}\"\n used += 1\n if used == 2\n n = m\n used = 0\n end\n t += tt\n return(t-tt) if t > 1_000_000_000\n end\n m += 1\n end\nend", "title": "" }, { "docid": "bd4f0da77013be8660571334947dc582", "score": "0.55753213", "text": "def lcs_two(arr)\n current = arr.first\n max = arr.first\n arr[1...arr.length].each do |el|\n current = 0 if current < 0\n current += el\n max = current if current > max\n end\n max\nend", "title": "" }, { "docid": "6c75c688a8c9abcf195476c507e9ea45", "score": "0.5573428", "text": "def solution(a)\n leader, count = array_leader(a)\n return 0 unless leader\n\n n = a.size\n head_count = 0\n total_equis = 0\n a.each_with_index do |e, i|\n head_count += 1 if e == leader\n tail_count = count - head_count\n\n if (head_count > (i + 1)/2) && (tail_count > (n - 1 - i)/2)\n total_equis += 1\n end\n end\n\n total_equis\nend", "title": "" }, { "docid": "f696936a09c6a18ac024ef4ad34932f7", "score": "0.5572233", "text": "def find_first_non_repeated_letter(str)\n chars_ary = str.chars\n ct1 = 0\n chars_ary.each do |elem1|\n ct1 = ct1.next\n ct2 = 0\n var1 = 0\n chars_ary.each do |elem2|\n ct2 = ct2.next\n if elem1 == elem2\n if ct2 == ct1.next\n var1 = var1.next\n elsif ct1 == ct2.next\n var1 = var1.next\n end\n end\n end\n if var1 < 1\n return elem1\n end\n end\n return nil\nend", "title": "" }, { "docid": "0434e0735f8feeb67d8ad24a622b5fce", "score": "0.5571084", "text": "def solution(a)\n a.sort!\n (0..(a.length)).step(2).each do |index|\n return a[index] if a[index] != a[index+1]\n end\nend", "title": "" }, { "docid": "72bb3b989efb9ec765190d8962bff157", "score": "0.5570266", "text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend", "title": "" }, { "docid": "dca62e6bd2f38301bee1cc6466ccd0c0", "score": "0.5565942", "text": "def lcs2(arr) \r\n i = 0\r\n\r\n large_sum = 0\r\n current_sum = arr[i]\r\n\r\n until i == arr.length - 1 # cs = 2\r\n # add to current sum the next value\r\n current_sum += arr[i] # cs \r\n \r\n if current_sum < 0\r\n current_sum = 0\r\n end\r\n\r\n # compare and replace large_num if current_sum is greater\r\n if large_sum < current_sum\r\n large_sum = current_sum\r\n end\r\n\r\n i += 1\r\n end\r\n\r\n large_sum\r\nend", "title": "" }, { "docid": "2a640b622e3de57cb19c71185008a355", "score": "0.55651027", "text": "def solution(a)\n a.group_by(&:itself).detect {|k, v| v.size.odd?}[0]\nend", "title": "" }, { "docid": "56e2f4c229d68e9d667cf5f5fe1d2177", "score": "0.55430937", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend", "title": "" }, { "docid": "573b24a4256d95404dabe54b8aec48eb", "score": "0.55380124", "text": "def single_in_sorted(arr)\n # O(n) size will always\n # mid_idx = arr.length / 2\n # return arr[mid_idx] if ((arr[mid_idx - 1] != arr[mid_idx]) && (arr[mid_idx + 1] != arr[mid_idx]))\n # return arr[0] if arr.length == 1\n #\n # if arr[mid_idx] == arr[mid_idx - 1]\n # if (mid_idx - 2 )> 0 && (mid_idx - 2 ) % 2 == 0\n # single_in_sorted(arr[0..mid_idx - 2])\n # else\n # single_in_sorted(arr[mid_idx + 1.. -1])\n # end\n # else\n # if mid_idx + 2 < arr.length && (arr.length - mid_idx + 2) % 2 != 0\n # single_in_sorted(arr[mid_idx + 1..-1])\n # else\n # single_in_sorted(arr[0..mid_idx-1])\n # end\n # end\n\n lo = 0\n hi = arr.length - 1\n\n while lo < hi\n mid = (hi + lo) / 2\n if arr[mid] != arr[mid -1] && arr[mid] != arr[mid+1]\n return arr[mid]\n elsif (arr[mid] == arr[mid -1] && mid.odd?) ||(arr[mid] == arr[mid+1] && mid.even?)\n lo = mid + 1\n else\n hi = mid - 1\n end\n end\n arr[lo]\nend", "title": "" }, { "docid": "b31b8fcedeb16ce292d34cae773004ec", "score": "0.55221784", "text": "def find_it(seq)\n arr = []\n seq.map { |int| seq.count(int) % 2 != 0 ? arr << int : int}\n arr.uniq.join.to_i\nend", "title": "" }, { "docid": "c3a6c4ddb76579e45e3cbe80fba426be", "score": "0.5516088", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend", "title": "" }, { "docid": "7c341432fa7294e71154b72e87bcc162", "score": "0.5513258", "text": "def problem_75\n p3 = lambda do |m,n|\n raise \"bad value\" if m == n\n m,n = n,m if m < n\n mm = m*m\n nn = n*n\n [mm - nn, 2*m*n, mm + nn]\n end\n\n max = 1_500_000\n upto = Math.sqrt(max/2).to_i\n# upto = max\n hits = Hash.new\n\n (1..upto).each do |x|\n hit = 0\n y = x + 1\n ((x+1)..(upto+1)).each do |y|\n next unless (x+y).odd?\n a,b,c = p3.call(x,y).sort\n d = a+b+c\n if d <= max\n k = 1\n begin\n hits[d*k] ||= {}\n hits[d*k][[a*k,b*k,c*k].sort.join(\"-\")] = true\n hit += 1\n k += 1\n end while d*k <= max\n else\n break\n end\n end\n puts \"for x = #{x}, #{hit} hits\"\n end\n puts hits.length\n h = hits.select {|k,v| v.length == 1}\n h.length\nend", "title": "" }, { "docid": "e17e041a8e6c4ac13bbfd0992cf90839", "score": "0.551083", "text": "def lcs2(array)\n now = array.first\n max = array.first\n i = 1\n while i < array.length\n if now < 0\n now = 0\n end\n now += array[i]\n max = now if now > max\n i += 1\n end\n max\nend", "title": "" }, { "docid": "db0249d085352ac43e1e3dac3f7b8d02", "score": "0.5509053", "text": "def slow_leader(n)\n length = n.size\n leader = -1\n n.each do |candidate|\n count = 0\n n.each do |num|\n count += 1 if num == candidate\n end\n leader = candidate if count > length/2\n end\n leader\nend", "title": "" }, { "docid": "351abeaec179167a7c5c9c8d18480ce9", "score": "0.55069625", "text": "def SimpleMode(arr)\n frequent = 0\n count = 0\n\n arr.each do |i|\n if arr.count(i) > count\n count = arr.count(i)\n frequent = i\n end\n end\n\n count > 1 ? frequent : -1\nend", "title": "" }, { "docid": "d6282dff096ebb4b472c1c22faa86908", "score": "0.55066633", "text": "def find_it(seq)\n seq.each do |num|\n if seq.count(num).odd?\n return num\n end\n end\nend", "title": "" }, { "docid": "f7ba6a1e1b43698036b6f4ac923c59bd", "score": "0.5501449", "text": "def solve( n = 4 )\n cur = 2\n arr = Array.new( n, 1 )\n\n while arr[0] != arr[-1] - n + 1\n begin\n cur += 1\n end while n != cur.prime_factors.uniq.length\n \n arr << cur\n arr.shift\n end\n\n arr[0]\n end", "title": "" }, { "docid": "6db35f28ac256da23f066177e015ad67", "score": "0.5501193", "text": "def sequental_search\n found = []\n by_position = 1\n array.each do |i|\n unless by_position == i\n found << by_position\n break if found.size == 2\n by_position += 1\n end\n by_position += 1\n end\n found\n end", "title": "" }, { "docid": "73b316e355eb7a5307801f330e57c26d", "score": "0.55005556", "text": "def elimination(arr)\n arr.each { |num| return num if arr.count(num) == 2 }\n return nil\nend", "title": "" }, { "docid": "16e7f3e86ca1b80a4510adc0c3e23306", "score": "0.54838973", "text": "def majority_element2(array)\n candidate = nil\n count = 0\n array.each do |x|\n if x != candidate\n count -= 1\n else\n count += 1\n end\n if count <= 0 \n candidate = x\n count = 1\n end\n end\n candidate\nend", "title": "" }, { "docid": "8de424cfaddcc7fb40cdc399fe7f346a", "score": "0.5482977", "text": "def fairRations(b)\n c=0\n for i in 0...b.length\n if b[i] % 2 != 0\n b[i]+=1\n b[i+1]+=1 if i+1<b.length\n c += 2\n return \"NO\" if i+1>=b.length\n i=0\n else\n i+=1\n end\n end\n c\nend", "title": "" }, { "docid": "6e6637d318e56479ef239287377d7001", "score": "0.5476576", "text": "def nsquared(arr)\n best = arr[0]\n arr.each do |first_fish|\n arr.each do |second_fish|\n bigger_than_sec = first_fish.length > second_fish.length\n if bigger_than_sec && first_fish.length > best.length\n best = first_fish\n end\n end\n end\n best\nend", "title": "" }, { "docid": "3ba870edaddd71e5aac94df121778597", "score": "0.54742724", "text": "def solution(n, a)\n # write your code in Ruby 2.2\n\n max_counter = 0\n max_applied_counter = 0\n\n # initialize\n counters = []\n (0..n-1).each do |i|\n counters[i] = 0\n end\n\n a.each do |a_i|\n if(a_i == n+1)\n max_applied_counter = max_counter\n else\n if counters[a_i-1] < max_applied_counter\n counters[a_i-1] = max_applied_counter\n end\n counters[a_i-1] = counters[a_i-1] + 1\n\n if(counters[a_i-1] > max_counter)\n max_counter = counters[a_i-1]\n end\n end\n end\n\n (0..n-1).each do |i|\n if(counters[i] < max_applied_counter)\n counters[i] = max_applied_counter\n end\n end\n counters\nend", "title": "" }, { "docid": "cc714a7f00ea81e0f8aa1e1685d0e700", "score": "0.54724634", "text": "def find_it(seq)\n seq.select {|x| seq.count(x) % 2 != 0}[0]\nend", "title": "" }, { "docid": "6231cd38ceb9ae565d4d34617d5c6e65", "score": "0.5471688", "text": "def slow_find(fish)\n sorted_fish = fish.dup\n \n sorted = false\n until sorted do\n sorted = true\n i = 0\n while i < fish.length - 1 do\n fish_1, fish_2 = sorted_fish[i..i+1]\n if fish_1.length > fish_2.length\n sorted_fish[i+1] = fish_1\n sorted_fish[i] = fish_2\n sorted = false\n end\n i += 1\n end\n end\n sorted_fish.last\nend", "title": "" }, { "docid": "3ea83a143859363b494db1f040b11272", "score": "0.5465965", "text": "def find_first_occurance(array, size, x)\n start = 0\n finish = size-1\n result = -1\n while start <= finish\n mid_index = (start+finish)/2\n if array[mid_index] == x\n # return mid_index => we don't return here since a duplicate of it could be before it\n result = mid_index\n finish = mid_index-1\n elsif x < array[mid_index]\n finish = mid_index - 1\n else\n start = mid_index + 1\n end\n end\n return result\nend", "title": "" }, { "docid": "498e68dc8c78fbdeb07ceabb155f1c42", "score": "0.5457695", "text": "def solve(numbers)\n dominants = []\n\n numbers.each_with_index do |dominant, index|\n rest = numbers[index + 1..-1]\n if rest.select { |n| n > dominant }.size == 0\n dominants << dominant\n end\n end\n dominants.uniq\nend", "title": "" }, { "docid": "bbf29212de7993cdcc08406972f1f4b2", "score": "0.54564136", "text": "def my_min_phase_ii(array)\n smallest_el = array[0]\n\n array.drop(1).each do |el1|\n smallest_el = el1 if el1 < smallest_el\n end\n\n smallest_el\nend", "title": "" }, { "docid": "c6cd70ef18606e1d166740b4974d2d74", "score": "0.54536915", "text": "def buddy(start, nd)\n # your code\n x = start\n key_arr = []\n val_arr = []\n result = []\n\n loop do \n \n \n temp_sum = calc(x)\n\n if key_arr.include?(temp_sum + 1)\n ind = key_arr.index(temp_sum + 1)\n\n if val_arr[ind] + 1 == x \n result = [key_arr[ind], x]\n return result\n end\n end \n\n key_arr << x \n val_arr << temp_sum\n \n x += 1\n end\n\nend", "title": "" }, { "docid": "55422178e3335c3356501658625a737f", "score": "0.54466814", "text": "def find_it(seq)\n seq.detect { |n| seq.count(n).odd? } # <- check out the detect method\nend", "title": "" }, { "docid": "94b952c4eec254dafeaf15d164f67032", "score": "0.5446302", "text": "def slow_solution(m, a)\n n = a.size\n return 1 if n == 1\n distinct = 0\n n.times do |back|\n (back..n - 1).each do |front|\n if a[back..front] == a[back..front].uniq\n distinct += 1\n else\n break\n end\n end\n end\n distinct\nend", "title": "" }, { "docid": "71fd1808d85251637ab0427cb637b0f9", "score": "0.54421896", "text": "def smallest_free_id2(array)\n array.sort.each_with_index do |value, index|\n return index unless index == value\n end\n array.count\nend", "title": "" }, { "docid": "fd65d1f145815f32f434c3a3931d3c93", "score": "0.54365146", "text": "def solution(a)\n a1 = []\n a2 = []\n len = a.length\n count = 0\n \n a.each_with_index do |el, i|\n a1 << i-el\n a2 << i+el\n end\n \n a1.sort\n a2.sort\n \n (len-1).downto(0) do |i|\n position = a2.find_index(a1[i])\n if position && position >= 0\n while ((position < len) && (a2[position] == a1[i])) do\n position += 1\n end\n count += position \n else\n insertion_point = -(position+1)\n count += insertion_point\n end\n end\n \n sub = len*((len+1)/2)\n \n return -1 if (count > 10000000)\n \n count\nend", "title": "" }, { "docid": "9bfaea331eedce3072d8464bb5cccee1", "score": "0.5436324", "text": "def fast_two_sum?(arr)\n # O(n) in time and space\n result = []\n complements = {}\n\n arr.each_with_index do |el, i|\n if complements[el]\n result.push([complements[el], i])\n else\n complements[-el] = i\n end\n end\n result\n #result.sort\nend", "title": "" }, { "docid": "5b14ef4483db2cee7d6f9a1d8d218cd8", "score": "0.543545", "text": "def largest_contiguous_subsum_phase_2(list)\n # debugger\n max_sub_sum = list.first\n current = list.first\n\n (1...list.length).each do |i|\n current = 0 if current < 0\n current += list[i]\n max_sub_sum = current if current > max_sub_sum \n end\n \n max_sub_sum\nend", "title": "" }, { "docid": "870bee58adf91c5f92aa1b338a611cd5", "score": "0.5432217", "text": "def find_it(seq)\n seq.find { |i| seq.count(i).odd? }\nend", "title": "" }, { "docid": "b588a9712ad0aea7636e46312d5b2e6c", "score": "0.54321337", "text": "def solution(a)\n a.sort!\n (0...a.count - 2).each { |i| \n return 1 if a[i] + a[i + 1] > a[i + 2]\n }\n return 0\nend", "title": "" }, { "docid": "9e4a5166559db47037eb3219164c650f", "score": "0.5431508", "text": "def smallestNumEvenlyDivisibleFromNToM(n, m)\n numbers = [];\n for i in n..m do \n numbers.push(i)\n end\n numbers = filterFactorsFromArray(numbers)\n p numbers\n i = 1\n while i > 0\n if evenlyDivisibleByArray(i, numbers) \n p i\n return i\n else i += 1\n end\n end\nend", "title": "" }, { "docid": "876b1577ae1ba612137db52a7a2ae711", "score": "0.5429541", "text": "def dec2FactString(nb)\n facts = []\n current = 1\n while nb > (fact = fact(current)) do # QUESTION: is this O(logn) or O(n)?\n facts << fact\n current += 1\n end\n\n result = []\n facts.reverse_each do |factorial|\n multiple = (nb/factorial).floor\n nb -= multiple*factorial\n result << code(multiple)\n end\n result.push(0).join\nend", "title": "" }, { "docid": "9f2fe6220d542de9588418daa66c722f", "score": "0.54287565", "text": "def solution(a)\n n=a.length\n #Check if number of occurences of any character is more than once\n hash=Hash.new(0)\n a.each do |element|\n hash[element]+=1\n if (hash[element]) > 1\n return 0\n end\n end\n sum_of_first_n_nos=n*(n+1)/2\n sum_of_nos_in_array=a.reduce(:+)\n return (sum_of_nos_in_array==sum_of_first_n_nos)?1:0\nend", "title": "" }, { "docid": "7f9322af5957d263077b6edc9690593a", "score": "0.54278487", "text": "def frog_cross_river(d,leap,arr)\n leaf_pos = Set.new\n current = 0\n\n arr.each_with_index do |pos, index|\n leaf_pos.<<(pos)\n\n step = 1\n while step <= leap\n if leaf_pos.include?(current + step)\n current = current + step\n step = 1\n next\n end\n step += 1\n end\n return index if current + leap >= d\n\n end\n return false\nend", "title": "" }, { "docid": "d72ccae3f326a4e3222492869096fb16", "score": "0.5426991", "text": "def day_one_part_one(input)\n n = input.strip.split('')\n\n\n # ------- SOL 1 ------\n # puts \"n is #{n}\"\n # puts \"n.rotate(1) is #{n.rotate(1)}\"\n # puts \"n.zip(n.rotate(1)) is #{n.zip(n.rotate(1))}\"\n puts n.zip(n.rotate(1))\n .select { |x, y| x == y }\n .map(&:first)\n .map(&:to_i)\n .inject(:+)\n # ------- SOL 2 ------\n # puts \"n.each_cons(2).to_a is #{n.each_cons(2).to_a}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y } is #{n.each_cons(2).to_a.select { |x, y| x == y }}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first)}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i)}\"\n # n << n.first\n # puts n.each_cons(2).to_a\n # .select { |x, y| x == y }\n # .map(&:first)\n # .map(&:to_i)\n # .inject(:+)\n #\n # ------- SOL 3 ------\n # sum = 0\n # digits = input.strip.split('')\n # digits.each_index do |i|\n # if i == digits.size - 1\n # sum += digits.last.to_i if digits.last == digits.first\n # elsif digits[i] == digits[i + 1]\n # sum += digits[i].to_i\n # end\n # end\n # puts sum\nend", "title": "" }, { "docid": "1a9a92e3d00f3a59aca87b6310a548dc", "score": "0.54194874", "text": "def find_it(seq)\n myHash=Hash.new\n findodd = Proc.new {|key,value|\n if value%2 == 1\n return key\n end\n }\n seq.each do |x|\n if myHash.key?(x)\n myHash[x]+= 1\n else\n myHash[x]=1\n end\n end\n myHash.select(&findodd)\nend", "title": "" }, { "docid": "4f2dfee0ae712e4f1af3bba446b20598", "score": "0.5418363", "text": "def even_occurrence(num_array)\n # Your Code here!\n mycount = 0\n for i in num_array\n \tmycount = num_array.count(i)\n \tif mycount % 2== 0\n \t\treturn i\n \tend \n end\n return nill\nend", "title": "" }, { "docid": "bfa3c6b2590482054eb310f4122b20e6", "score": "0.5412766", "text": "def find_single_sorted(array)\n # array.sort! Add if not sorted (adds n log n time)\n \n i = 0\n length = array.length\n \n while i < length\n if array[i] != array[i+1]\n return array[i]\n else\n i += 2\n end\n end\nend", "title": "" }, { "docid": "554ba15bb2c03ef0f3f8d4262066ba23", "score": "0.5411173", "text": "def abundant(n)\n abundant_list = []\n \n 1.upto(n) do |i|\n if proper_divisors(i).inject(:+) > i\n abundant_list << i\n end\n end\n\n abundant_list\nend", "title": "" } ]
4a6d9123b698aa257b2a88f19087f80a
Write the element for a rich string.
[ { "docid": "214706173a396ed86948546c49890448", "score": "0.0", "text": "def write_title_formula(title, is_y_axis = nil, axis = nil, layout = nil, overlay = nil) # :nodoc:\n @writer.tag_elements('c:title') do\n # Write the c:tx element.\n write_tx_formula(title.formula, axis ? axis.data_id : title.data_id)\n # Write the c:layout element.\n write_layout(layout, 'text')\n # Write the c:overlay element.\n write_overlay if overlay\n # Write the c:txPr element.\n write_tx_pr(axis ? axis.name_font : title.name_font, is_y_axis)\n end\n end", "title": "" } ]
[ { "docid": "db11fc6a69234a8c7ad27b97417819e8", "score": "0.67191106", "text": "def write string\n end", "title": "" }, { "docid": "11357a16d1e9edcbbc553e785d3cf85e", "score": "0.64585257", "text": "def write_elem(tag, value)\n @io << \"<#{tag}>#{text(value)}</#{tag}>\"\n end", "title": "" }, { "docid": "a81cdeaf272a0b198b469a89bfb6a4c2", "score": "0.64195144", "text": "def si_rich_element(data)\n io_write(\"<si>#{data}</si>\")\n end", "title": "" }, { "docid": "fcf6ff8a92c813e280b3c76453d5ca2e", "score": "0.6292919", "text": "def xml_str # :nodoc:\n @writer.string\n end", "title": "" }, { "docid": "30a1134346b9a0ae8dfaee1683bfaca4", "score": "0.62775576", "text": "def write(str)\n puts self.writings(str)\n end", "title": "" }, { "docid": "30a1134346b9a0ae8dfaee1683bfaca4", "score": "0.62775576", "text": "def write(str)\n puts self.writings(str)\n end", "title": "" }, { "docid": "dbb5b7f28b963f3f9ff19cafc6bd6273", "score": "0.6237678", "text": "def write(string)\n self << string\n end", "title": "" }, { "docid": "6fe23f98a8237476d38c2c78b93b2128", "score": "0.61817425", "text": "def text(obj, width=nil)\n @output << obj\n end", "title": "" }, { "docid": "7cfe3a9ce785bcc8e165f0eae37881d6", "score": "0.6071235", "text": "def write_to_string\n # javax.xml.bind.Marshaller\n marshaller = @jaxb_context.createMarshaller\n marshaller.setProperty(Marshaller::JAXB_FORMATTED_OUTPUT, true)\n\n writer = StringWriter.new()\n marshaller.marshal(@jaxb_element, writer)\n writer.toString()\n end", "title": "" }, { "docid": "0fd0a7286e08f134f0f919bfcec62656", "score": "0.59767723", "text": "def render_text(text)\n @out << text\n end", "title": "" }, { "docid": "51afed03018909bb5dc7a208ce2f37ee", "score": "0.5913934", "text": "def write(str)\n writing { write0 str }\n end", "title": "" }, { "docid": "7e855aa703a49b4861c98678e88cccad", "score": "0.5850009", "text": "def write(str)\n\t return if str.nil? || str.empty?\n\t finishStartTag() if @inStartTag\n\t @io << NQXML.encode(str)\n\tend", "title": "" }, { "docid": "9b0316b227208d172bcc08934387b5d2", "score": "0.5720531", "text": "def end_element(name)\n @text << \" \" if name == 'String'\n @text << \"\\n\" if name == 'TextBlock'\n @text << \"\\n\" if name == 'TextLine'\n end", "title": "" }, { "docid": "2eb387370857a155cf71bfca0b524f54", "score": "0.5698052", "text": "def write(str)\n STDOUT.write str\n end", "title": "" }, { "docid": "7b84b902b6fff439488ac62c811296d0", "score": "0.56941295", "text": "def add_to_doc(str)\n @out_doc << str\n end", "title": "" }, { "docid": "1bb13f547c77286d110c1d86eacc1c05", "score": "0.5667372", "text": "def write(string)\n @handle.write(string)\n end", "title": "" }, { "docid": "3d6ffcf65cf02eb618ca63f4bf408f44", "score": "0.5656173", "text": "def <<(string)\n\t\t\t\twrite(string)\n\t\t\t\t\n\t\t\t\treturn self\n\t\t\tend", "title": "" }, { "docid": "096092124a424c19a4b8a154bc092e59", "score": "0.56420153", "text": "def write_xhtml_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "096092124a424c19a4b8a154bc092e59", "score": "0.56420153", "text": "def write_xhtml_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "3343e7261373b6d0b92798c8e062155a", "score": "0.5617645", "text": "def write(text)\n content.send @opts[:write], text\n end", "title": "" }, { "docid": "aa3b4d2a1b26a28a3a91f99f6175671e", "score": "0.5614989", "text": "def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end", "title": "" }, { "docid": "0b476cd123f1ce8bcc5ee1a10562abd7", "score": "0.5584057", "text": "def write\n Vedeu::Output.render(rendered)\n end", "title": "" }, { "docid": "237afcfe8fa9bd67546f962cc98b9af7", "score": "0.5579215", "text": "def xml_serialize(writer)\n writer.start_element('{http://sabredav.org/ns}elem1')\n writer.write_string('hiiii!')\n writer.end_element\n end", "title": "" }, { "docid": "35a9a9553b8f29b3a660cea5077271b0", "score": "0.5563741", "text": "def text(string)\n @builder << string.to_s\n nil\n end", "title": "" }, { "docid": "eb2f04803d0250f27da37d1f4252fc4e", "score": "0.55548364", "text": "def print(str)\n @io << str\n end", "title": "" }, { "docid": "eb2f04803d0250f27da37d1f4252fc4e", "score": "0.55548364", "text": "def print(str)\n @io << str\n end", "title": "" }, { "docid": "f1e84c31f0dd6e7956cf0c41a6c423e7", "score": "0.5543315", "text": "def render\n sb = StringIO.new\n append_to_string_builder(sb)\n sb.string\n end", "title": "" }, { "docid": "1043f21f240c73d9bb69f87a6bb590d4", "score": "0.5533132", "text": "def write(string)\n @buffer << string\n self\n end", "title": "" }, { "docid": "c0bd44419d1702a846d36e1a756df08d", "score": "0.5511514", "text": "def write_string(*text); end", "title": "" }, { "docid": "6e5af69641c7e2b71f0630bc3079f89b", "score": "0.5494706", "text": "def text(string)\n target << string\n end", "title": "" }, { "docid": "7a051a14967de6307ffec28dbf729c8b", "score": "0.54859966", "text": "def write_tag(tag,value)\n @io << \"<value><#{tag}>#{text(value)}</#{tag}></value>\"\n end", "title": "" }, { "docid": "3cb348557b2e6aefc4df3f88c0c05b59", "score": "0.5472327", "text": "def w texte\n STDOUT.write \"<p>#{texte}</p>\"\nend", "title": "" }, { "docid": "e74cd77f3e9d02183888259ecc9791d1", "score": "0.54383093", "text": "def write(text)\n @writer.print(text)\n end", "title": "" }, { "docid": "63a041f25f946c54041a15c0cd5f16a0", "score": "0.5433185", "text": "def stringOutput\n\t\tend", "title": "" }, { "docid": "63a041f25f946c54041a15c0cd5f16a0", "score": "0.5433185", "text": "def stringOutput\n\t\tend", "title": "" }, { "docid": "208b670b483253671c7af55a46edd42d", "score": "0.54321754", "text": "def read_text( element )\n result = \"\"\n\n element.each_child do |child|\n if child.text?\n result << child.to_s\n elsif child.elem?\n case child.name\n when 'span'\n child.classes.each do |c|\n case c\n when 'red'\n result << \"\\\\textcolor{red}{\" << read_text( child ) << \"}\"\n when 'spoken'\n result << \"\\\\textsl{\" << read_text( child ) << \"}\"\n else\n result << \"{\" << read_text( child ) << \"}\"\n end\n end\n when 'em'\n result << \"\\\\emph{\" << read_text( child ) << \"}\"\n when 'strong'\n result << \"\\\\textbf{\" << read_text( child ) << \"}\"\n end\n else\n # write out\n end\n end\n\n result\n end", "title": "" }, { "docid": "a48c1d54c36235b0ecbc3698b9823672", "score": "0.5431603", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_guid_value(\"id\", @id)\n writer.write_boolean_value(\"isEnabled\", @is_enabled)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_string_value(\"value\", @value)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "d6abea337c20dc2219e4d37608876dc9", "score": "0.5419274", "text": "def write!( string )\n @stream << string\n end", "title": "" }, { "docid": "8fd8d72db7d983f8a18d10a819c5ce82", "score": "0.5417664", "text": "def write(string, *smth)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "54e8636fd25271d6abdd67268fd86103", "score": "0.5408642", "text": "def to_html\n %(<span class=\"ricsvn_string\" >#{self}</span>)\n end", "title": "" }, { "docid": "14c9f1ae2624f14592f99962a2f6d4e7", "score": "0.5400725", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"attribution\", @attribution)\n writer.write_string_value(\"backgroundColor\", @background_color)\n writer.write_object_value(\"content\", @content)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayText\", @display_text)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "0dd4c0957818c328186d77bbb5fc6bf6", "score": "0.5397969", "text": "def doc(str)\n @doc << str\n end", "title": "" }, { "docid": "d7ab24758a79a9010a5ad9920b4945e8", "score": "0.5377801", "text": "def outo( str )\n outi nil, str\n end", "title": "" }, { "docid": "2eca5a306cd77115b9f01fcc2da4d31f", "score": "0.53752655", "text": "def write(text)\n shell.write(text)\n end", "title": "" }, { "docid": "9537a97464be92d80e985c036f7f0e5a", "score": "0.53733057", "text": "def write_string(string)\n\t\twrite_byte(2)\n\t\twrite_utf(string.to_s)\n\tend", "title": "" }, { "docid": "a9bebad8b7ed9de2665bc3afe5e0720c", "score": "0.5370932", "text": "def write(what)\n @body = \"\" if !@body\n @body += what.to_s if what && what.class\n end", "title": "" }, { "docid": "ac48dcd670a08f84fe05298622f43547", "score": "0.53683645", "text": "def write_str(line,column,text)\n\t\tif text == nil\n\t\t\treturn\n\t\tend\n\t\tCurses.setpos(line,column)\n\t\tCurses.addstr(text)\n\tend", "title": "" }, { "docid": "4825cbd0e78af67aa00dedb7ada41262", "score": "0.5344253", "text": "def string\n element().to_s\n end", "title": "" }, { "docid": "5e99f08453f7d056a19342dbd90004bc", "score": "0.5333774", "text": "def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )\n #indent( output, indent ) unless transitive\n\t\t\toutput << START\n\t\t\toutput << @string\n\t\t\toutput << STOP\n\t\tend", "title": "" }, { "docid": "a949ad79a3f7a532967ee93d82fa5ae4", "score": "0.5321712", "text": "def write_custom_label_str(label)\n value = label[:value]\n font = label[:font]\n is_y_axis = 0\n has_formatting = has_fill_formatting(label)\n\n # Write the c:layout element.\n write_layout\n\n @writer.tag_elements('c:tx') do\n # Write the c:rich element.\n write_rich(value, font, is_y_axis, !has_formatting)\n end\n\n # Write the c:cpPr element.\n write_sp_pr(label)\n end", "title": "" }, { "docid": "2bc1c33f58e858204d0bf9af9824ce82", "score": "0.531817", "text": "def nice_text(elem)\n return '' if elem.nil?\n elem.native.text.strip_heredoc.strip.\n gsub(/\\n\\s*\\n(\\s*\\n)+/, \"\\n\\n\").\n gsub(/[ \\t]+\\n/, \"\\n\") + \"\\n\"\n end", "title": "" }, { "docid": "3acca4ef055bb26472b9c3131f03b260", "score": "0.5298003", "text": "def sprintf(indent = \"\")\n s = indent + \"<\" + @name\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n if(@children.size() > 0)\n s = s + \"\\n\"\n end\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.sprintf(indent + \"\\t\")\n end\n @content = NaElement::escapeHTML(@content)\n s = s + @content.to_s\n if(@children.size() > 0)\n s = s + indent\n end\n s = s + \"</\" + @name + \">\\n\"\n s\n end", "title": "" }, { "docid": "24f85bfb80ca4c0894cff9b4ecbe91f9", "score": "0.5288817", "text": "def write_output(string)\n @output << string\n end", "title": "" }, { "docid": "458443c595acf06ab93ed95db3055833", "score": "0.5287826", "text": "def put(text)\n ostream << text\n ostream.flush\n end", "title": "" }, { "docid": "8c200d11bb85011f7b6f0105e389ecbf", "score": "0.52838534", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isAvailable\", @is_available)\n end", "title": "" }, { "docid": "b23b56710d53977bd39167b02792fc99", "score": "0.52759117", "text": "def render_result(str)\n @contents << str\n end", "title": "" }, { "docid": "4701144a2e74f9a7ec320084afe94254", "score": "0.5274996", "text": "def writeline(str)\n writing { write0 str + \"\\r\\n\" }\n end", "title": "" }, { "docid": "3aa60d4fba491d4b174810ea13f55bd9", "score": "0.5271566", "text": "def write(instance, title, string, &block)\n framework = instance.configuration.framework\n example = framework.current_example\n\n node_keys = get_titles_for(\n framework,\n example\n )\n\n framework.write(\n instance,\n example,\n node_keys,\n title,\n string,\n &block\n )\n end", "title": "" }, { "docid": "9e8b4611a22b14bb639d928e28040c8a", "score": "0.5263906", "text": "def puts(str)\n @contents << str << \"\\n\"\n end", "title": "" }, { "docid": "8efda772eccb3afa0217d674b0440724", "score": "0.52441406", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_boolean_value(\"allowMultipleLines\", @allow_multiple_lines)\n writer.write_boolean_value(\"appendChangesToExistingText\", @append_changes_to_existing_text)\n writer.write_number_value(\"linesForEditing\", @lines_for_editing)\n writer.write_number_value(\"maxLength\", @max_length)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_string_value(\"textType\", @text_type)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "973c5a2cbd4249ba45d97276316a1f7a", "score": "0.5237036", "text": "def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n \n return str \n end", "title": "" }, { "docid": "679dacb7dc24ac042211c3c38649f9fd", "score": "0.5231881", "text": "def write s\n raise RuntimeError, \"No socket\" unless @socket\n @socket.puts s += \"\\r\\n\"\n puts \"WROTE: #{s.inspect}\" if config[:debug]\n end", "title": "" }, { "docid": "5be7953add2ac358bf1fcb5f0ab5dd1b", "score": "0.5210776", "text": "def _append_element(type, param, noparse=false, str='')\n\t\tif(\n\t\t\t@contents[@content_index += 1] = SifterElement.new(\n\t\t\t\tself, type, param, \n\t\t\t\t((type == 'EMBED' )? param.to_int: @embed_flag ), \n\t\t\t\t((type == 'NOBREAK')? 1 : @nobreak_flag)\n\t\t\t)\n\t\t)\n\t\t\tif(!noparse)\n\t\t\t\tif(!@contents[@content_index]._parse())\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@contents[@content_index]._append_text(str) if(str && str != '')\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend", "title": "" }, { "docid": "12fb02ecc2fa6761e78ca690b7724b6f", "score": "0.5204503", "text": "def write\n filename = \"#{@directory}/label.html\"\n File.open(filename, 'w') do |fp|\n fp.puts(self.to_s)\n end\n puts \"Wrote #{filename}\"\n end", "title": "" }, { "docid": "c31fbb1a6a74764b03973f4cce69c12b", "score": "0.5202036", "text": "def puts(str = '')\n @io << str << \"<br/>\\n\"\n end", "title": "" }, { "docid": "c7565e048f861f30033beb7662d685cb", "score": "0.5199526", "text": "def nO_element(element, attributes = {})\n s = nOE_element(element, attributes)\n if block_given?\n s << yield.to_s\n s << \"</#{element.upcase}>\"\n end\n s\n end", "title": "" }, { "docid": "106d3a8cae479011f871fd133c9e0f0a", "score": "0.51980513", "text": "def render_io(writer)\n StringIO.new.tap do |io|\n writer.write(io)\n end.string\n end", "title": "" }, { "docid": "7c29cc8caa3380064c57bb762ca7dda4", "score": "0.519235", "text": "def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n\n return str \n end", "title": "" }, { "docid": "d59e46151bb86535d8ea4f4f8a4b23f1", "score": "0.51821107", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"locale\", @locale)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "86a2b3905ff3cf4d473a0448742449a2", "score": "0.5180848", "text": "def to_s(attributes = nil)\r\n assert_exists\r\n hash_properties = {\"text\"=>\"innerHTML\"}\r\n hash_properties.update(attributes) if attributes != nil\r\n r = super(hash_properties)\r\n #r = string_creator\r\n #r += span_div_string_creator\r\n return r.join(\"\\n\")\r\n end", "title": "" }, { "docid": "1d466e9751b51e2c77c2f2b57592d12c", "score": "0.5176838", "text": "def write_xml(xml_string)\n\t\twrite_byte(AMF_XML)\n\t\twrite_long_utf(xml_string.to_s)\n\tend", "title": "" }, { "docid": "d49da0f77bef191a4738772c635a7965", "score": "0.5174889", "text": "def syswrite(string)\n raise NotImplementedError\n end", "title": "" }, { "docid": "c860ad49b828cde1aec0b3d88babe79d", "score": "0.5165069", "text": "def content(text)\n @out << text.to_s\n nil\n end", "title": "" }, { "docid": "acbb9bee1645ab5bf363e2b0029c45d5", "score": "0.51602894", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isBuiltIn\", @is_built_in)\n writer.write_collection_of_object_values(\"roleAssignments\", @role_assignments)\n writer.write_collection_of_object_values(\"rolePermissions\", @role_permissions)\n end", "title": "" }, { "docid": "463c4eb8b4411be30f5e7f476a7b5cc9", "score": "0.5157549", "text": "def write(io = $stdout)\n #Require and spawn StringIO in the subprocess.\n @subproc.static(:Object, :require, \"stringio\")\n string_io = @subproc.new(\"StringIO\")\n \n #We want a human-readable print.\n writer = @subproc.new(\"REXML::Formatters::Pretty\", 5)\n writer.write(@doc, string_io)\n \n #Prepare printing by rewinding StringIO to read from beginning.\n string_io.rewind\n \n #Print out the result in bits to avoid raping the memory (subprocess is already raped - no question there...).\n string_io.each(4096) do |str|\n io.print(str)\n end\n end", "title": "" }, { "docid": "678279f05b463dc35d2587d781f07dd1", "score": "0.51560557", "text": "def text(str)\n @serial.write(\"#{str}\\r\")\n end", "title": "" }, { "docid": "0cd26940b7ce95f0ba8a6e5826fafe49", "score": "0.51532775", "text": "def write(whatever)\n @IRCsocket.write(\"#{whatever}\\n\")\n end", "title": "" }, { "docid": "dfb1d57080637e1d0fc61230b4f4499f", "score": "0.5150693", "text": "def printstr(pad, r,c,string, color, att = Ncurses::A_NORMAL)\n\n #att = bold ? Ncurses::A_BLINK|Ncurses::A_BOLD : Ncurses::A_NORMAL\n # att = bold ? Ncurses::A_BOLD : Ncurses::A_NORMAL\n pad.attrset(Ncurses.COLOR_PAIR(color) | att)\n #pad.mvprintw(r, c, \"%s\", string);\n pad.mvaddstr(r, c, \"%s\" % string);\n pad.attroff(Ncurses.COLOR_PAIR(color) | att)\nend", "title": "" }, { "docid": "02f4ef6ccd91ce6e4496f7e069e678c4", "score": "0.51432925", "text": "def write ch\n @rbc_form.handle_key ch\n @widgets[@index].update_text\n end", "title": "" }, { "docid": "12fdfba64c69818de5103ddced790b10", "score": "0.51428455", "text": "def write(record)\n @writer.write(MARC::XMLWriter.encode(record), @fh)\n @fh.write(\"\\n\")\n end", "title": "" }, { "docid": "12fdfba64c69818de5103ddced790b10", "score": "0.51428455", "text": "def write(record)\n @writer.write(MARC::XMLWriter.encode(record), @fh)\n @fh.write(\"\\n\")\n end", "title": "" }, { "docid": "f1fc9de02cc8fcad57e88907192c2e6b", "score": "0.5139691", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"self\", @self_escaped)\n end", "title": "" }, { "docid": "72598065e1cdf47e74b7fbc3b79d2563", "score": "0.51323766", "text": "def to_html\n child_type = element_type\n type_string = ''\n type_string = \"type=\\\"#{@type}\\\"\" if @type\n\n element_string = \"<#{child_type} id=\\\"#{@id}\\\" #{type_string}></#{child_type}>\"\n end", "title": "" }, { "docid": "81eb556617ad47b5389ca90f612cd763", "score": "0.51097465", "text": "def write_tex_on(op, value_hash)\n esc = proc do |str|\n str.\n gsub(/&lt;/, '<').\n gsub(/&gt;/, '>').\n gsub(/&amp;/) { '\\\\&' }.\n gsub(/([$&%\\#{}_])/) { \"\\\\#$1\" }.\n gsub(/>/, '$>$').\n gsub(/</, '$<$')\n end\n str = \"\"\n \n str << write_common(value_hash, esc)\n $stderr.puts str.inspect\n op << str\n end", "title": "" }, { "docid": "bd754001c7e30c4a210c9b7c1055cca3", "score": "0.5105217", "text": "def print(string, width = self.width)\n w = width == 0? Ncurses.COLS : width\n waddnstr(string.to_s, w) # changed 2011 dts \n end", "title": "" }, { "docid": "cba934f452c028da3015892db8c2fc79", "score": "0.5104597", "text": "def esc_ht str\n\t\treturn Escape.html str\n\tend", "title": "" }, { "docid": "170a213b258b547c694fe2192b488420", "score": "0.51000357", "text": "def content text\n @xml << text.to_s\n nil\n end", "title": "" }, { "docid": "d43b8fc5061dbebb401f2f05587c07c9", "score": "0.5094712", "text": "def printstring_formatted(r,c,content, color, att = Ncurses::A_NORMAL)\n att = get_attrib att unless att.is_a? Integer\n chunkline = convert_to_chunk(content, color, att)\n printstring_or_chunks r,c, chunkline, color, att\n end", "title": "" }, { "docid": "6dd5c6f0e03ac60cab8427ba8ac1b304", "score": "0.50939673", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_primitive_values(\"resourceScopes\", @resource_scopes)\n writer.write_object_value(\"roleDefinition\", @role_definition)\n end", "title": "" }, { "docid": "feaab16c87e6d216e41c8c6ee1856153", "score": "0.5090748", "text": "def content(text)\n@out << text.to_s\nnil\nend", "title": "" }, { "docid": "386e920661e564995ac996943975f4d2", "score": "0.50903374", "text": "def characters(string)\n @elem.add_child(Nokogiri::XML::Text.new(string, @doc))\n end", "title": "" }, { "docid": "d929d553322ba4d7a73496811f23dc0b", "score": "0.5085418", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"newText\", @new_text)\n writer.write_object_value(\"numBytes\", @num_bytes)\n writer.write_object_value(\"oldText\", @old_text)\n writer.write_object_value(\"startNum\", @start_num)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "cce02e86a3534e9634893c65a31b058a", "score": "0.50790507", "text": "def textilize(input)\n RedCloth.new(input).to_html\n end", "title": "" }, { "docid": "9d99549225f8568bb50a3f940e39678d", "score": "0.5078169", "text": "def write text=\"\"\n\t\[email protected] = @msg = text.to_s\n\tend", "title": "" }, { "docid": "325e8f0b1c063eb456236fdcdbb1a876", "score": "0.5076324", "text": "def <<\n puts @str\n end", "title": "" }, { "docid": "cb0cb012639520fb3cb5255793071617", "score": "0.50761724", "text": "def << string\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "cb0cb012639520fb3cb5255793071617", "score": "0.50761724", "text": "def << string\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "e21ca63e405e7f16e8cee9c935fff63a", "score": "0.5075867", "text": "def test_string_arg\n\tstr = ''\n\tw = NQXML::Writer.new(str)\n\n\tw.write('data')\n\tassert_equals('data', str)\n\n\tw.comment('foo')\n\tassert_equals('data<!--foo-->', str)\n end", "title": "" }, { "docid": "9a7c3005edff356db16734476a4c8564", "score": "0.50752664", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appId\", @app_id)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"objectId\", @object_id_escaped)\n writer.write_string_value(\"publisher\", @publisher)\n end", "title": "" }, { "docid": "88bd0572658b6f3f735e0363e2b879ba", "score": "0.507205", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"entityType\", @entity_type)\n writer.write_string_value(\"mailNickname\", @mail_nickname)\n writer.write_guid_value(\"onBehalfOfUserId\", @on_behalf_of_user_id)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "11d9458830fad45fc5e754e9c852925a", "score": "0.5058093", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end", "title": "" } ]
07bf4dc593dd648f025def0bbd23b351
Get all cellphone senders Returns all cellphone senders
[ { "docid": "c82a10413719f732f32be0ee9939ccf9", "score": "0.81439173", "text": "def get_all_cellphone_senders(opts = {})\n data, _status_code, _headers = get_all_cellphone_senders_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "d054e47768ac86eb628b30c5d817f54e", "score": "0.745669", "text": "def get_senders\n @gateway.request(\"/get/senders.php\")\n end", "title": "" }, { "docid": "be85879be9346fa41c13b937af998df5", "score": "0.7343665", "text": "def get_all_phone_senders(opts = {})\n data, _status_code, _headers = get_all_phone_senders_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "e33f2c908ac36c2a063eaf255067e655", "score": "0.7314359", "text": "def senders()\n _params = {}\n return @master.call 'users/senders', _params\n end", "title": "" }, { "docid": "f72aa8190ce31b3162c0f87241f667e7", "score": "0.7138591", "text": "def list()\n _params = {}\n return @master.call 'senders/list', _params\n end", "title": "" }, { "docid": "a548654f4bb078523cd6ee207ca35fd2", "score": "0.707767", "text": "def list()\n _params = {}\n return @master.call 'senders/list', _params\n end", "title": "" }, { "docid": "753a554331b5badaee14bd27fbc374d7", "score": "0.64994866", "text": "def get_senders(opts = {})\n data, _status_code, _headers = get_senders_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "41994680795d418a95d7b25dac762381", "score": "0.6318216", "text": "def index\n @senders = Sender.all\n end", "title": "" }, { "docid": "c193dcf06bd12be6b49083c7abf4e773", "score": "0.63123536", "text": "def get_all_email_senders(opts = {})\n data, _status_code, _headers = get_all_email_senders_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "5bd2e7f215c61232c97e9323005eff0d", "score": "0.62806994", "text": "def unique_senders\n return @unique_senders\n end", "title": "" }, { "docid": "3f2e56b1e3f634863b4c64393288d7b7", "score": "0.611603", "text": "def index\n @senders = current_user.client.senders.active\n end", "title": "" }, { "docid": "763f2720fa01c511fabdceda3cacd99f", "score": "0.6079409", "text": "def sendall\n $emails = User.all.pluck(:email)\n end", "title": "" }, { "docid": "a0dbbe452fe58cde67d7b4b9c6de69c4", "score": "0.60425097", "text": "def get_all_senders(accept)\r\n # Prepare query url.\r\n _path_url = '/sender'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'Accept' => accept\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Response2001.from_hash(element) }\r\n end", "title": "" }, { "docid": "285225dbd8be5faa0df175bb9896981f", "score": "0.6026595", "text": "def getting_all_your_senders(format, apikey, opts = {})\n data, _status_code, _headers = getting_all_your_senders_with_http_info(format, apikey, opts)\n return data\n end", "title": "" }, { "docid": "337b958655f237929aa68a7bb43346c7", "score": "0.5982069", "text": "def all_related_users\n recipients = []\n recipients += users\n recipients += watchers\n recipients = recipients.uniq.compact\n\n return recipients\n end", "title": "" }, { "docid": "276d6f4540bbcca8eac859d561b48e4c", "score": "0.59199876", "text": "def sent_all\n list_all(type: :sent)\n end", "title": "" }, { "docid": "3f0d81be172e401b75341fcd75971a93", "score": "0.5897083", "text": "def users()\n if(@users.nil?)\n @users = self.recipients.clone\n @users << self.originator unless @users.include?(self.originator) \n end\n return @users\n end", "title": "" }, { "docid": "bad80884b07acb5db3dbc29dabfb7df8", "score": "0.5794831", "text": "def cell_phones\n phones = []\n self.phones.each do |phone|\n if phone.type.name == \"Cell\"\n phones << phone\n end\n end\n return phones\n end", "title": "" }, { "docid": "82cdb9a0812a7c5b4d567ebda3913126", "score": "0.5780142", "text": "def receivers\n return @receivers\n end", "title": "" }, { "docid": "75d49a74c72cb7e104fd4591127b176b", "score": "0.5760603", "text": "def accepted_senders\n return @accepted_senders\n end", "title": "" }, { "docid": "a9870213f588f4208063eef5ac0bcd0c", "score": "0.5740922", "text": "def invisible_senders\n senders - visible_senders\n rescue\n nil\n end", "title": "" }, { "docid": "9cb77ee3ad2b49db804fb3bf17f8bec1", "score": "0.57095253", "text": "def sent_messages\n\t\tMessage.where(sender: self)\n\tend", "title": "" }, { "docid": "498e786707593a1289bd7c0f1c276d6c", "score": "0.56409514", "text": "def get_all_cellphone_senders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SendersApi.get_all_cellphone_senders ...'\n end\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SendersApi.get_all_cellphone_senders, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SendersApi.get_all_cellphone_senders, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SendersApi.get_all_cellphone_senders, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"active\", \"moderation\", \"rejected\"]\n if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/senders/cellphone'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CellphoneSenderCollection'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"SendersApi.get_all_cellphone_senders\",\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: SendersApi#get_all_cellphone_senders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7166c8c69d8d481382196c13113e1be0", "score": "0.5636541", "text": "def sent_messages\n self.senders.where(\"deleted_by_sender = ? OR deleted_by_sender is ?\", false, nil).order(\"created_at DESC\")\n end", "title": "" }, { "docid": "bbe7f43fb07eb785ebfb14f99a2322cf", "score": "0.56201744", "text": "def fetch_all_recipients\n response = @http.get(\n ENV['RECIPIENTS_URL'],\n content_type: 'application/json',\n authorization: \"Bearer #{@token}\"\n )\n incoming = JSON.parse(response.body)['recipients'].map { |json| Recipient.new(json) }\n @recipients = incoming\n end", "title": "" }, { "docid": "37039fde42ff2ef0d475dfc56718f491", "score": "0.5619595", "text": "def users\n bot.users\n end", "title": "" }, { "docid": "bbb14cd127f8ec4661124032c217cbea", "score": "0.5612291", "text": "def send_invitations_to_all_partners\n receiver = []\n partners_id =[]\n x3user = User.find(self.id) \n x3user.partners.all.each do |p|\n send_invitation_to_partner(p.email)\n end\n \n self.mark_all_mobileapps_as_reported(x3user)\n end", "title": "" }, { "docid": "d75ff6294ab473cc96a4e4085458711d", "score": "0.5600148", "text": "def list\n @client.call(method: :get, path: 'sending-domains')\n end", "title": "" }, { "docid": "6907ca1544d52ffe586f282352f4f337", "score": "0.55752105", "text": "def unique_senders=(value)\n @unique_senders = value\n end", "title": "" }, { "docid": "f8ac8b56b2350ac857b6babed6186611", "score": "0.5569074", "text": "def index\n @receivers = current_user.client.receivers.active\n end", "title": "" }, { "docid": "6a281ec5ffc88ce6d3cc49a5802d04f8", "score": "0.5564839", "text": "def index\n @tellers = Teller.all\n end", "title": "" }, { "docid": "39dedbbce58469c80daaf94d9b8aae5d", "score": "0.55364734", "text": "def index\n @usermailers = Usermailer.all\n end", "title": "" }, { "docid": "7843558e7a658285ded641a31cb29073", "score": "0.55293894", "text": "def index\n @my_mailers = MyMailer.get_mailers\n end", "title": "" }, { "docid": "622675d0ec2b8a188a93f68fb648e7ea", "score": "0.5502535", "text": "def get_all_devices\n @devices.search(\"device\")\n end", "title": "" }, { "docid": "91a8bbd5a984afc57fc7089359e0785c", "score": "0.5487372", "text": "def all_emails\r\n self.users_emailed + self.users_emailed_by\r\n end", "title": "" }, { "docid": "7ce75d8a157a95deeb7257e955d2fde5", "score": "0.5479701", "text": "def get_blocked_sender()\n\t\t\t\tif [email protected]?\n\t\t\t\t\tif @result.has_key?(:messagesblocked)\n\t\t\t\t\t\tif @result[:messagesblocked].length > 0\n\t\t\t\t\t\t\tsenders = Array.new\n\t\t\t\t\t\t\t@result[:messagesblocked].each do |elem|\n\t\t\t\t\t\t\t\tsenders.push(elem[:sender]) unless elem[:sender].length == 0\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\treturn senders if senders.length > 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "32c6db4d2b686a149018ae2e7f33fbaa", "score": "0.5472477", "text": "def participants\n\t return recipients\n\tend", "title": "" }, { "docid": "e7e14c793404ec33529a937a33348c09", "score": "0.5469915", "text": "def others\n users = self.dup\n users.delete_if do |user|\n user.nick == Wheaties::Connection.nick ||\n user.nick == sender.nick\n end\n users\n end", "title": "" }, { "docid": "f9dc93123a618e2d2a3025aef2e0441a", "score": "0.5449635", "text": "def recipients\n result = Array.new\n JobOffer.where(job: self).each do |jo|\n result << jo.member\n end\n result\n end", "title": "" }, { "docid": "3bfd1b970d212c1205ac2bb158e2b664", "score": "0.54442835", "text": "def contacts\n bot.contacts\n end", "title": "" }, { "docid": "1771d1f150adc7d18ddea94d62cfa991", "score": "0.54425573", "text": "def addresses\n @sender.addresses\n end", "title": "" }, { "docid": "7ca51f95617cbffedfd3a8d3f529e5e2", "score": "0.5396921", "text": "def filtered_receivers\n @receivers\n end", "title": "" }, { "docid": "a3ed8a98812106e540bcfca7df88f62c", "score": "0.5391238", "text": "def receivers\n []\n end", "title": "" }, { "docid": "9885d130581d23226030040642153b60", "score": "0.53837335", "text": "def list\n perform_request(Entities::SenderAddress, 'newsletter/identity/list.json')\n end", "title": "" }, { "docid": "3caf03d37bae49a9799f4d1e324f53be", "score": "0.53805757", "text": "def subscribed_to_contacts\n @roster.select {|c| c.subscribed_to? }\n end", "title": "" }, { "docid": "3caf03d37bae49a9799f4d1e324f53be", "score": "0.537991", "text": "def subscribed_to_contacts\n @roster.select {|c| c.subscribed_to? }\n end", "title": "" }, { "docid": "cb3d11f0dc85c0a438678b125baab0e4", "score": "0.5375483", "text": "def show\n @email = Email.find(params[:id])\n @senders = EmailSender.where(id: @email.sender_ids)\n end", "title": "" }, { "docid": "c18a5df1f4cc943381b96d86f1ad56b8", "score": "0.5375057", "text": "def registered_devices\n return @registered_devices\n end", "title": "" }, { "docid": "53a6c9fb6091fe31dda3b8facfd23325", "score": "0.5361712", "text": "def index\n @request_receivers = RequestReceiver.all\n end", "title": "" }, { "docid": "813f124f00b0a0237d54e6441110b475", "score": "0.53571934", "text": "def users\r\n self.allergens.map do |a|\r\n a.user\r\n end\r\n end", "title": "" }, { "docid": "82c8babd85907501cee05a09344d06a6", "score": "0.53562343", "text": "def available_subscribers\n subscribed = @user.subscribed_from_contacts.map {|c| c.jid }\n router.available_resources(subscribed)\n end", "title": "" }, { "docid": "54d1abe194a3c82a55ec8839a65e5bb1", "score": "0.5355749", "text": "def available_subscribers\n subscribed = @user.subscribed_from_contacts.map {|c| c.jid }\n router.available_resources(subscribed, @user.jid)\n end", "title": "" }, { "docid": "a74c4643c758058b4ffb009fb69ca556", "score": "0.5350797", "text": "def subscribed_from_contacts\n @roster.select {|c| c.subscribed_from? }\n end", "title": "" }, { "docid": "a74c4643c758058b4ffb009fb69ca556", "score": "0.5350797", "text": "def subscribed_from_contacts\n @roster.select {|c| c.subscribed_from? }\n end", "title": "" }, { "docid": "50f082b63114a67b8de6f3a7665367df", "score": "0.53507304", "text": "def phones\n return @phones\n end", "title": "" }, { "docid": "50f082b63114a67b8de6f3a7665367df", "score": "0.53507304", "text": "def phones\n return @phones\n end", "title": "" }, { "docid": "50f082b63114a67b8de6f3a7665367df", "score": "0.53507304", "text": "def phones\n return @phones\n end", "title": "" }, { "docid": "50f082b63114a67b8de6f3a7665367df", "score": "0.53507304", "text": "def phones\n return @phones\n end", "title": "" }, { "docid": "415b0af0cbeccb2dbea66e388730f117", "score": "0.5348778", "text": "def participants\n return recipients\n end", "title": "" }, { "docid": "2229a4701d08cc913af6c3618242fd47", "score": "0.5339368", "text": "def users\n return (@users.values + bots).uniq\n end", "title": "" }, { "docid": "4a617db005f1f0c6b97a883373e66dd4", "score": "0.5333583", "text": "def send_all\n self.shop_owner.customers.each do |customer|\n send_to(customer)\n end\n self.update(sent_time: Time.zone.now)\n end", "title": "" }, { "docid": "8ba63b9ab609db4cb46e66ae319701c4", "score": "0.5331456", "text": "def index\n @sender_emails = SenderEmail.where(company_id: current_user.client_id)\n end", "title": "" }, { "docid": "3a44abfdd6da86e403dbc1bdc3139f71", "score": "0.53231335", "text": "def clients()\n self.trainers().map { | trainer | trainer.clients() }.flatten().uniq\n end", "title": "" }, { "docid": "068074629da6b14f1bdaa6aa6572ef8d", "score": "0.53213775", "text": "def recipients\n all_users.map(&:mail).flatten.sort.uniq\n end", "title": "" }, { "docid": "ba6e734fed5dc1f94302760a45a94056", "score": "0.53189886", "text": "def invites_sent\n\t\t#query to get list of Users that you have invited\n\t\tself.friends.where(:friendships => {:status => 0})\n\tend", "title": "" }, { "docid": "743eb37fab891ffbd848b8a21714ae09", "score": "0.5294074", "text": "def recievers\n R.smembers(Message.receivers_for(self.id))\n end", "title": "" }, { "docid": "a50ee9cce7bc085d69153da3b8b23bf8", "score": "0.52875", "text": "def recipients\n return @recipients\n end", "title": "" }, { "docid": "c7cafb89cb83b43f0ddcc438dd50d0f5", "score": "0.52857804", "text": "def index\n @phone_numbers = client.incoming_phone_numbers.list\n end", "title": "" }, { "docid": "873f2c26f04fd053be2d4c082de159dd", "score": "0.5278027", "text": "def all\n response = api_request(:get, \"/subscribers.xml\")\n return [] unless response.has_key?(\"subscribers\")\n response[\"subscribers\"].collect{|data| Subscriber.new(data)}\n end", "title": "" }, { "docid": "1a8639b8461fdb8183486cd3294470eb", "score": "0.5277972", "text": "def sent\n @messages = Message.all\n @users = User.all\n end", "title": "" }, { "docid": "2acf6dc517d6def5a5e30ee1bfd978f3", "score": "0.5271139", "text": "def partners\n return @partners\n end", "title": "" }, { "docid": "fd881fd932363b14fc4f71697e4f26d6", "score": "0.5267912", "text": "def sent_messages\n sent_messages_mailbox.messages\n end", "title": "" }, { "docid": "7823484cc30fc520cdf5f80e2a7707a0", "score": "0.52667993", "text": "def recipients\n self.conversation.participants(self.from_id)\n end", "title": "" }, { "docid": "a53fb7c7f4febcf26f94750b1ab1c5e6", "score": "0.52651393", "text": "def receivers\n self\n end", "title": "" }, { "docid": "ecde10931a4b1be90aa89d7beba50ecd", "score": "0.52636206", "text": "def index\n @cell_phones = CellPhone.all\n end", "title": "" }, { "docid": "ac72214afadc332475b2f4d42df0c249", "score": "0.5261885", "text": "def all\n @@contacts\n end", "title": "" }, { "docid": "30f2349785ccd933a37b390ee22c3dc4", "score": "0.52519965", "text": "def devices\n @socket.send(search_message, 0, MULTICAST_ADDR, MULTICAST_PORT)\n listen_for_responses(first)\n end", "title": "" }, { "docid": "30f2349785ccd933a37b390ee22c3dc4", "score": "0.5251555", "text": "def devices\n @socket.send(search_message, 0, MULTICAST_ADDR, MULTICAST_PORT)\n listen_for_responses(first)\n end", "title": "" }, { "docid": "8cf5705d3305a0b6370810ab30780d42", "score": "0.5249552", "text": "def index\n @mailers = Mailer.all\n end", "title": "" }, { "docid": "58e827eed61adc46c1bf3dafd5d67249", "score": "0.52458966", "text": "def bots\n @bots\n end", "title": "" }, { "docid": "b79dcefc103b0320ba87f0d52f6ff4fc", "score": "0.52452016", "text": "def retrieve_messengers()\n start.uri('/api/messenger')\n .get()\n .go()\n end", "title": "" }, { "docid": "28170786fb9b63844897880b854e6d55", "score": "0.52438176", "text": "def emails()\n @emails\n end", "title": "" }, { "docid": "3ad261d57bf1e9f6c44955dc151414c8", "score": "0.52435917", "text": "def users\n [User.find(self.last_message.receiver_id), User.find(self.last_message.sender_id)]\n end", "title": "" }, { "docid": "309cfedd5f04a176ca2bed9dba16aad5", "score": "0.52297163", "text": "def get_contacts\n broadcast('@type' => 'getContacts')\n end", "title": "" }, { "docid": "cc72915bca5dd1646a16efc99608191f", "score": "0.52295285", "text": "def index\n @cellphones = Cellphone.all\n end", "title": "" }, { "docid": "cc72915bca5dd1646a16efc99608191f", "score": "0.52295285", "text": "def index\n @cellphones = Cellphone.all\n end", "title": "" }, { "docid": "947bf9fb6bbb27aa33f6ffbf3e3e1a0b", "score": "0.5224612", "text": "def registered_users\n return @registered_users\n end", "title": "" }, { "docid": "c26a739010dc28c1d3c03dec5aecbe94", "score": "0.5221177", "text": "def recipients\n Array.wrap(::User.find_by_user_key(@work.depositor))\n end", "title": "" }, { "docid": "cfd3f8fae750235f2fe968cf0233efd6", "score": "0.52209425", "text": "def get_recipients(obj)\n @store.get_recipients(obj)\n end", "title": "" }, { "docid": "f41ef1d31ab8a6f453125dd69b0ca07f", "score": "0.52149826", "text": "def mobiles\r\n return @rooms.map { |room| room.mobiles }.flatten\r\n end", "title": "" }, { "docid": "1653b455b0aeea6e43da9558ca034c79", "score": "0.5211826", "text": "def clients()\n Client.all().select() { | client | client.trainer == self }\n end", "title": "" }, { "docid": "bafdfbceb0fba826e47f93fbcb3c5791", "score": "0.52088416", "text": "def emails\n @guests.map do |guest|\n guest.email\n end\n end", "title": "" }, { "docid": "fff82d63664e174fa32c1318e84f0b8a", "score": "0.52022386", "text": "def index\n @sender_addresses = current_user.sender_addresses\n end", "title": "" }, { "docid": "c79f06e07d4b047987add493651d6d25", "score": "0.51998276", "text": "def get_connected_websites\n broadcast('@type' => 'getConnectedWebsites')\n end", "title": "" }, { "docid": "ab68885677c731b133a1a6faff7c636c", "score": "0.5194073", "text": "def participants\n recipients\n end", "title": "" }, { "docid": "3d95a87cd5c749215b67e1b8c3ba0506", "score": "0.5189669", "text": "def send_invitations\n self.internal_and_external_invitations.pending.each {|s| s.send_invitation! }\n end", "title": "" }, { "docid": "a14c93fab0fba23db4218ea127ace828", "score": "0.5188349", "text": "def recipients\n return @recipients\n end", "title": "" }, { "docid": "f0166d1f2417fafc15056eea0c086135", "score": "0.5185752", "text": "def domains()\n _params = {}\n return @master.call 'senders/domains', _params\n end", "title": "" }, { "docid": "3a85b445c1d42aaccb036cb3ac305f19", "score": "0.51837844", "text": "def requesters\n @requesters_arr = []\n current_user= User.where(id: self.id)\n requesters = current_user[0].friendship_requests\n requesters.each do |r|\n @requesters_arr.push(r.friendee)\n end\n\n @requesters_arr\n \n\n end", "title": "" }, { "docid": "501cb61b1bd269ff860452112de7d99b", "score": "0.51816344", "text": "def get_all_players\n\t$client.query(\"Players\").tap do |q|\n\t\tq.limit = 1000\n\tend.get\nend", "title": "" }, { "docid": "49a9666431eed938b87e748adbb4ca2f", "score": "0.5176069", "text": "def index\n @beacon_receivers = BeaconReceiver.all\n end", "title": "" } ]
69f219549f0cc986add0f1e408880d32
===return String The Transaction ID
[ { "docid": "b3802b2402ce0d459063ae8df565aadd", "score": "0.8363221", "text": "def gettransactionid()\r\n return getvalue(SVTags::TRANSACTION_ID)\r\n end", "title": "" } ]
[ { "docid": "db1a239001ed427f8b7d6d22040be16e", "score": "0.862981", "text": "def transaction_id\n read('transaction_id')\n end", "title": "" }, { "docid": "858b66615da6f9aefc8947419da4feb8", "score": "0.8243702", "text": "def transaction_id\n @data[:transaction_id]\n end", "title": "" }, { "docid": "ce88474f8769eb8366ea27a11ee2af6e", "score": "0.8156684", "text": "def transaction_id\n @transaction_id ||= \"#{order.id}-#{Time.now.to_i}\"\n end", "title": "" }, { "docid": "bfe27b5797053859ef8d933eeb9b2eb3", "score": "0.7963901", "text": "def transaction_id\n @gapi.statistics.transaction_info&.transaction_id\n end", "title": "" }, { "docid": "7907815d0a2e3ceafab1a41e9ec98182", "score": "0.78984356", "text": "def transaction_id\n @ipn['txn_id']\n end", "title": "" }, { "docid": "164e7927ec464d45ec26c9db7adaa1e0", "score": "0.7888561", "text": "def transaction_id\n ret = @transaction_id ||= 0\n @transaction_id = @transaction_id.succ\n ret\n end", "title": "" }, { "docid": "44e332f395fdedf432ce0ae52a9ab93a", "score": "0.7848477", "text": "def transaction_id\n params['x_trans_id']\n end", "title": "" }, { "docid": "c8db07f3f97b7d717e971962b9354cbd", "score": "0.7820975", "text": "def transaction_id\n params['x_trans_id']\n end", "title": "" }, { "docid": "7c0885cb60de1612cd17d343ace40038", "score": "0.78048766", "text": "def cs_transaction_uuid\n \"mbs_\" + id\n end", "title": "" }, { "docid": "b4f2fce289cc9ad9d6d8301d559820aa", "score": "0.77844644", "text": "def transaction_id\n params['transaction_id']\n end", "title": "" }, { "docid": "115eff1d9d1a3d2386ddb82655986a0e", "score": "0.77555066", "text": "def original_transaction_id\n read('original_transaction_id')\n end", "title": "" }, { "docid": "c278ce8bf408bf2018f890f248a1e335", "score": "0.77417076", "text": "def txn_id\n authorization\n end", "title": "" }, { "docid": "cfc6e63a1d67d0c4837e951467318aca", "score": "0.7696562", "text": "def id\r\n @ole.txn_id\r\n end", "title": "" }, { "docid": "14164f00c18716566ddec0a5b4b7dd84", "score": "0.76873904", "text": "def transaction_id\n response_code\n end", "title": "" }, { "docid": "5ff22b9f3bc72a92707e09428f8bf855", "score": "0.76861537", "text": "def transaction_id\n\tparams['txn_id']\n end", "title": "" }, { "docid": "b4d1c4989234df631d1017c3f1988c84", "score": "0.7596778", "text": "def transaction_id\n [to_param, billing_name.to_s.parameterize.first(20).presence, Time.zone.now.to_i, rand(1000..9999)].compact.join('-')\n end", "title": "" }, { "docid": "4337b98bb59714b7f691bec29957d72c", "score": "0.75876874", "text": "def transaction_id\n params['pgTxnNo']\n end", "title": "" }, { "docid": "49cfa3d07b12d2e40ec8d1b8538f8327", "score": "0.75664675", "text": "def transaction\n params[\"TransId\"]\n end", "title": "" }, { "docid": "57a3ec25b9b3fce3585da3db7e75b774", "score": "0.74625885", "text": "def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end", "title": "" }, { "docid": "0519bfc47279456e99deea21f0201ee3", "score": "0.7451859", "text": "def transaction_id\n return nil if grpc.nil?\n grpc.id\n end", "title": "" }, { "docid": "cb47fa29bafcfd06303d056253fa00d3", "score": "0.73266995", "text": "def transaction_uuid\n @transaction_uuid ||= SecureRandom.uuid\n end", "title": "" }, { "docid": "60432d52944caf3d5240a8144b9dcec2", "score": "0.7203985", "text": "def transaction_id\r\n params['PayRef'] \r\n end", "title": "" }, { "docid": "37712fa397b32a532aa787dc6739b7e8", "score": "0.7156199", "text": "def transaction_id\n params['PNREF']\n end", "title": "" }, { "docid": "feb961ad9d6ccdd214d6869e36364bf3", "score": "0.7147127", "text": "def transaction_id\n params['txn_id'] || params['masspay_txn_id']\n end", "title": "" }, { "docid": "21e869272fec2231fba178c69a992e27", "score": "0.71447605", "text": "def transaction_id\n params['mihpayid']\n end", "title": "" }, { "docid": "c1690512a7949e45cb1359ce545048e0", "score": "0.7137794", "text": "def transaction_id\n params['p24_order_id']\n end", "title": "" }, { "docid": "b9f72a78e5f7e1a8267e5c7b9433ed58", "score": "0.7102578", "text": "def transaction_id\n params['mihpayid']\n end", "title": "" }, { "docid": "41e4838a66062d9ef197e040c7a6fd63", "score": "0.69766563", "text": "def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend", "title": "" }, { "docid": "41e4838a66062d9ef197e040c7a6fd63", "score": "0.69766563", "text": "def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend", "title": "" }, { "docid": "808d2efb07fee99584f9105ee21ccaf9", "score": "0.69661516", "text": "def return_id\n\t\treturn @idStr\n\tend", "title": "" }, { "docid": "15840a634ee06e6b131b1b705b8f4c72", "score": "0.68509644", "text": "def transaction_id\n params['subscr_id']\n end", "title": "" }, { "docid": "ecd518b33cf48c47fddf94a575644197", "score": "0.68313485", "text": "def transaction_id\n params['pf_payment_id']\n end", "title": "" }, { "docid": "7ffe30fb56aafa6ce7af5f2bf54f2a10", "score": "0.6779611", "text": "def auth_id\n params['TxAuthNo']\n end", "title": "" }, { "docid": "e42bf554296f9936ee7522176b6d607a", "score": "0.6759462", "text": "def id\n record.id.to_s\n end", "title": "" }, { "docid": "2cc1b7e9f5603251a03ac0a0c72745c4", "score": "0.67092127", "text": "def order_id\n @row[\"売上ID\"].to_s\n end", "title": "" }, { "docid": "de6df0332939a22fc9f43954b63c0ce3", "score": "0.66315556", "text": "def id\n self._id.to_s if self._id\n end", "title": "" }, { "docid": "94bd6c85c1abfce1943dc21550efef59", "score": "0.65995294", "text": "def get_id()\n return @id\n end", "title": "" }, { "docid": "83b5e0cea84b9025676e35a5315e369e", "score": "0.65746605", "text": "def to_s\n self.request_id.to_s\n end", "title": "" }, { "docid": "e0c79e717075be8ff1c5150d45ea011d", "score": "0.6573794", "text": "def generate_webpay_trx_id\n Digest::MD5.hexdigest(\"#{self.order.number}#{self.order.payments.count}\")\n end", "title": "" }, { "docid": "bfd0d9f3dc8e4a1d4e45d12606ad71b1", "score": "0.6554956", "text": "def sequence_id\n object.sequence._id.to_s\n end", "title": "" }, { "docid": "c4eea99066669b58e711bc7b9566b55f", "score": "0.6553205", "text": "def id\n @grit_commit.id\n end", "title": "" }, { "docid": "8691273868eb6312614cb4b76bd82fb9", "score": "0.6527556", "text": "def operation_unique_id(payment)\n \"#{payment.number}-#{random_suffix}\"\n end", "title": "" }, { "docid": "95fd6ac0094d603deb30e0d66ff0a4c2", "score": "0.65239364", "text": "def quoted_id\n id\n end", "title": "" }, { "docid": "04e85dd493b9d6ca5a0bc8878d6c0f8c", "score": "0.6498535", "text": "def commitid\n \"#{@project[:id]}-#{currentbranch}-#{currentcommit}\"\n end", "title": "" }, { "docid": "5dc1f50271faa3c1ee967b2256f6ac3d", "score": "0.6497034", "text": "def customer_id\n @row[\"購入者 顧客ID\"].to_s\n end", "title": "" }, { "docid": "6b9998a217291d6214dbcb6e905fa014", "score": "0.64946127", "text": "def unique_transaction_number\n chars = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n string = (0...10).map{ chars[rand(chars.length)] }.join + Time.now.to_i.to_s\n end", "title": "" }, { "docid": "b98fda6ce47ea4ddc64b8ef1af3bed16", "score": "0.64885545", "text": "def to_s\n id_for(sha1)\n end", "title": "" }, { "docid": "bb522e40fdd8ebad55f0fe02a3fa951e", "score": "0.64877385", "text": "def to_s\n id\n end", "title": "" }, { "docid": "86887ed01421ca834f306218fa63e557", "score": "0.648679", "text": "def format_identifier\n self.identifier.to_s\n end", "title": "" }, { "docid": "9d6c630f3f806627864a2bbf85d8da3e", "score": "0.6482715", "text": "def to_s\n id\n end", "title": "" }, { "docid": "20e21fd10d408a0877465504f71422fb", "score": "0.64813375", "text": "def unique_id\n \"#{@table.name}-#{@id}\"\n end", "title": "" }, { "docid": "9fa2b7805613a250b77c66e53509b6c8", "score": "0.64713156", "text": "def to_s\r\n id\r\n end", "title": "" }, { "docid": "bbbdafdb142c6bcac598230d0f89b37f", "score": "0.64678305", "text": "def get_transaction_name # THREAD_LOCAL_ACCESS\n record_api_supportability_metric(:get_transaction_name)\n\n txn = Transaction.tl_current\n if txn\n namer = Instrumentation::ControllerInstrumentation::TransactionNamer\n txn.best_name.sub(Regexp.new(\"\\\\A#{Regexp.escape(namer.prefix_for_category(txn))}\"), '')\n end\n end", "title": "" }, { "docid": "e472a720a52b4f7f71c5c614dfdda495", "score": "0.6463753", "text": "def to_s\n @id\n end", "title": "" }, { "docid": "39036e8d5582d9a6382b1d9ec47fd938", "score": "0.64415723", "text": "def trainer_id_text\n return sprintf(\"%05d\", self.trainer_id)\n end", "title": "" }, { "docid": "0c8cf8e0d48a422725375d149b61a5c3", "score": "0.6421476", "text": "def unique_id\n object_id.abs.to_s(16)\n end", "title": "" }, { "docid": "70df30b54bffeabc0516bde61940db55", "score": "0.64173335", "text": "def to_s\n id.to_s\n end", "title": "" }, { "docid": "d4a293608aeaaac642a99c6e5854236d", "score": "0.64092016", "text": "def id\n @grit_commit.id\n end", "title": "" }, { "docid": "ad554ccc91c6d4e82e3011d40c361a85", "score": "0.6387329", "text": "def id\n to_s\n end", "title": "" }, { "docid": "8641c7016d1b9ea439ef8f85e9866894", "score": "0.6387126", "text": "def to_s\n iid\n end", "title": "" }, { "docid": "49ef54a0a686263bfaeea3c7cfcacc92", "score": "0.6370232", "text": "def id\n object.id.to_s\n end", "title": "" }, { "docid": "edbc5c4885495f751f6826917b8860a9", "score": "0.6359324", "text": "def id_to_s\n self._id.to_s\n end", "title": "" }, { "docid": "5550c9688d9eca6c1eea2c0df8b42e20", "score": "0.6346422", "text": "def record_identifier(record)\n record.id\n end", "title": "" }, { "docid": "1202802859b216bb248cfac66d5362f7", "score": "0.6299832", "text": "def get_id()\n return @id\n end", "title": "" }, { "docid": "abe3ca735a5cb5f3159359869ed17da0", "score": "0.62539494", "text": "def identifier\n \"#{user_id}:#{namespace_id}:#{journal_id}\"\n end", "title": "" }, { "docid": "5e524d673120986f074c05279e6f0bf7", "score": "0.62518346", "text": "def get_identifier\n return @task_arn\n end", "title": "" }, { "docid": "130f99ef85ae5a74fc030df6f370b5a5", "score": "0.62375414", "text": "def invoice\n params['TxId']\n end", "title": "" }, { "docid": "efe4a52a4e01c1fc755c88b7aed12438", "score": "0.62303543", "text": "def get_id()\n @id\n end", "title": "" }, { "docid": "efe4a52a4e01c1fc755c88b7aed12438", "score": "0.62303543", "text": "def get_id()\n @id\n end", "title": "" }, { "docid": "8d3cea70d68ca42af0741fbd13375646", "score": "0.6165774", "text": "def orient_id\n getId().to_s\n end", "title": "" }, { "docid": "1440f9ed04c1541205433c48d6d55c4f", "score": "0.6159967", "text": "def get_id\n\t\treturn id\n\tend", "title": "" }, { "docid": "239c348a9226d2303c5cd4b4d2c58f59", "score": "0.6159712", "text": "def gettransaction(txid)\n coind.gettransaction txid\n end", "title": "" }, { "docid": "80f0a615f53da376d6efd625bc71638d", "score": "0.6158196", "text": "def item_id\n params['VendorTxCode']\n end", "title": "" }, { "docid": "47821bb18d76e717ea814c067d11feff", "score": "0.6157193", "text": "def id\n wallet_token\n end", "title": "" }, { "docid": "d0d2560015e6375d05bf9405ac870c19", "score": "0.6145214", "text": "def gettransactiontype\r\n @transactiontype\r\n end", "title": "" }, { "docid": "20997fa612414c434c7779be10fa558a", "score": "0.61395174", "text": "def get_identifier\n identifier = get_project_name\n fail(\n ActiveRecord::RecordNotFound,\n \"Project identifier not specified\"\n ) if identifier.nil?\n identifier.to_s\n end", "title": "" }, { "docid": "ffea79b4e566ec041da9d28fc5057065", "score": "0.61385316", "text": "def to_s\n \"#{identifier} in #{organization_id}\"\n end", "title": "" }, { "docid": "0796845c6dd89101c9aec21f907d5e94", "score": "0.6124565", "text": "def ctid\n\t\tif tmp = vzlist('--no-header', '-a','-N',resource[:name]).split(\" \")[0]\n\t\t\tid = tmp\n\t\telsif !id = resource[:id]\n\t\t\tout = vzlist('--no-header', '-a', '-o','ctid')\n\t\t\ttmp = out.empty? ? 100 : Integer(out.split.last)\n\t\t\tid = tmp <= 100 ? 101 : tmp + 1\n\t\tend\n\t\tif id\n\t\t\treturn id\n\t\telse\n\t\t\tfail \"CTID not specified\"\n\t\tend\n\tend", "title": "" }, { "docid": "cb48037be948e3e5a9aae620d2d8ea06", "score": "0.61222965", "text": "def gen_id(i_cal_evt)\n return Base32.encode(i_cal_evt.uid.to_s + i_cal_evt.recurrence_id.to_s + i_cal_evt.sequence.to_s)\n end", "title": "" }, { "docid": "638a19139e6639f9344305b9d4ff5020", "score": "0.6120264", "text": "def id\n model.id.to_s\n end", "title": "" }, { "docid": "cf87f371b60fadaf97c54ba9d3254735", "score": "0.6107463", "text": "def generate_temporary_id\n (Time.now.to_f*1000).to_i.to_s\n end", "title": "" }, { "docid": "ace0dc067dafc3aa90f1861222af44e1", "score": "0.6105058", "text": "def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end", "title": "" }, { "docid": "d698bf6ba549bc5fa794721b58d45ba8", "score": "0.6098612", "text": "def get_id()\n return @doc_name\n end", "title": "" }, { "docid": "f13b66ca5566be8143e35751e074ff00", "score": "0.6096093", "text": "def get_account_id\n num = rand(111111111..999999999)\n id = sprintf(\"%09d\", num)\n id.to_s\n end", "title": "" }, { "docid": "0dc25d8a6624d3121f36664b11197fa4", "score": "0.6076369", "text": "def recipient_id\n @row[\"配送先ID\"].to_s\n end", "title": "" }, { "docid": "13dac3d90443030682c767c6b23a1446", "score": "0.60703945", "text": "def trace_id\n if Datadog.configuration.tracing.trace_id_128_bit_logging_enabled &&\n !Tracing::Utils::TraceId.to_high_order(@trace_id).zero?\n Kernel.format('%032x', @trace_id)\n else\n Tracing::Utils::TraceId.to_low_order(@trace_id)\n end\n end", "title": "" }, { "docid": "1d4d966a88139293fe1713936e2a651f", "score": "0.6065786", "text": "def unique_name(id)\n id.to_s\n end", "title": "" }, { "docid": "175893c8bcf070dad36e6d23019fb6ee", "score": "0.6053865", "text": "def set_TransactionID(value)\n set_input(\"TransactionID\", value)\n end", "title": "" }, { "docid": "175893c8bcf070dad36e6d23019fb6ee", "score": "0.60534596", "text": "def set_TransactionID(value)\n set_input(\"TransactionID\", value)\n end", "title": "" }, { "docid": "c50780efd533cd2b0737cc5d1d33a2e2", "score": "0.6049948", "text": "def set_TransactionID(value)\n set_input(\"TransactionID\", value)\n end", "title": "" }, { "docid": "c50780efd533cd2b0737cc5d1d33a2e2", "score": "0.6049948", "text": "def set_TransactionID(value)\n set_input(\"TransactionID\", value)\n end", "title": "" }, { "docid": "c50780efd533cd2b0737cc5d1d33a2e2", "score": "0.6049948", "text": "def set_TransactionID(value)\n set_input(\"TransactionID\", value)\n end", "title": "" }, { "docid": "6b2af2e3eebdfad5d9f72913bb7bd5c9", "score": "0.6044225", "text": "def error_id\n Apartment::Tenant.current.to_s + \"/\" + id.to_s\n end", "title": "" }, { "docid": "eccd5b6af80af80f3f2e6a5cb6ade514", "score": "0.6043022", "text": "def chain_id\n if eip_155_signed_transaction?\n # retrieve chain_id from v, see EIP-155\n (v - 35) / 2\n end\n end", "title": "" }, { "docid": "ccf877c41f000b3aa4db1cf76d83e602", "score": "0.6030881", "text": "def polish_taxpayer_identification_number; end", "title": "" }, { "docid": "52134e7a799aa6c4a52bb5255f348a9a", "score": "0.6029309", "text": "def getId()\n\t\t\treturn @_id\n\t\tend", "title": "" }, { "docid": "cb579f21347d6767599f961c1851f3dd", "score": "0.6027683", "text": "def order_number\n if (not self.id)\n return \"save to allocate number\"\n end\n base = Time.new().strftime(\"%Y\")\n return base + \"_\" + self.id.to_s\n end", "title": "" }, { "docid": "4c3c6e21518a491bd76f0c1753a70d3e", "score": "0.6025969", "text": "def to_i\n @id\n end", "title": "" }, { "docid": "4c3c6e21518a491bd76f0c1753a70d3e", "score": "0.6025969", "text": "def to_i\n @id\n end", "title": "" }, { "docid": "4c3c6e21518a491bd76f0c1753a70d3e", "score": "0.6025969", "text": "def to_i\n @id\n end", "title": "" } ]
a3c4b5098bbc79498238d83a5c993f47
SCHEDULE UPDATED EMAIL Sent to players/parents/followers of all teams when schedule update is triggered Generic Schedule Updated Template
[ { "docid": "db5d9890281c9a4f18e42360f714fcfc", "score": "0.69583476", "text": "def member_schedule_updated(recipient_id, tenant_id, data, render_parent=false)\n @tenant = Tenant.find(tenant_id)\n valid_data, @recipient, @team, @league, @events, @team_invite_token = process_schedule_data(recipient_id, data)\n return if !valid_data\n\n @juniors = nil\n if render_parent\n valid_parent_data, @juniors = process_parent_data(data)\n return if !valid_parent_data\n end\n\n from, to = get_mail_from_to_data(@team, @recipient)\n subject = subject_for_event_schedule_update(@team, @juniors)\n mail(:from => from, :to => to, :subject => subject, :template_name => 'member_schedule_updated')\n end", "title": "" } ]
[ { "docid": "ed0f82381ea78afe6967a0043bfcdb6a", "score": "0.7217589", "text": "def workflow_updated\n @data[:owner_name] = @project_owner.try(:full_name)\n @data[:project_title] = @project.try(:title)\n @data[:workflow_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{@project.id}/workflow\"\n @receiver = @project_owner\n @template_name = APOSTLE_MAIL_TEMPLATE_SLUG[:workflow_updated]\n set_mail_object\n end", "title": "" }, { "docid": "9dfdf0189911f6bfa624db99228ac3f2", "score": "0.6642223", "text": "def email_on_update\n EpisodeMailerMailer.email_on_update\n end", "title": "" }, { "docid": "cdb38b2015f2599a67d013619f57fa5c", "score": "0.6617281", "text": "def email_schedule_change\n notifier = ScheduleNotifier.new\n notifier.user = user\n notifier.send_notification\n end", "title": "" }, { "docid": "013a839e62b70c75bfa8cec8d69b9171", "score": "0.65410364", "text": "def send_updates\n if status == 1\n UserMailer.with(appt: self).ride_updated_email.deliver\n UserMailer.with(appt: self).ride_assigned_email.deliver\n end\n end", "title": "" }, { "docid": "13904961c1f95e54dfc2dc6ad5b6ee76", "score": "0.6529688", "text": "def send_updates\n UserMailer.with(appt: self).ride_updated_email.deliver if status.assigned?\n end", "title": "" }, { "docid": "f641642d7ee20603d4376eaa74350f98", "score": "0.6522425", "text": "def send_update_email\n self.shift_users.each do |shift_user|\n BasicMailer.shift_mail(shift_user,\"update\").deliver_later\n message = \"Shift has been updated.\"\n TwilioTextMessenger.new(message,shift_user.user.mobile_number).call\n end\n end", "title": "" }, { "docid": "30286349984705450e668289b6f7c319", "score": "0.64597875", "text": "def audit_team_updates(updated_by,\n audit,\n team_update_lists)\n\n\n to_list = []\n team_update_lists.each do |key, list|\n team_update_lists[key] = list.sort_by { |t| t[:teammate].section.position }\n to_list += list.collect { |teammate| teammate[:teammate].user.email }\n end\n \n audit_team_lists = { 'self' => [], 'peer' => [] }\n audit.audit_teammates.each do |member|\n key = member.self? ? 'self' : 'peer'\n audit_team_lists[key] << member\n end\n\n audit_team_lists.each do |key, list|\n\n audit_team_lists[key] = list.sort_by { |t| t.section.position }\n\n #for teammate in list\n # recipients.push(teammate.user.email)\n #end\n to_list += list.collect { |teammate| teammate.user.email }\n \n end\n\n cc_list = ([updated_by.email] + \n Role.add_role_members(['Manager', 'PCB Input Gate']) -\n to_list).uniq\n \n subject = MailerMethods.subject_prefix(audit.design) + \"The audit team has been updated\"\n\n @updated_by = updated_by\n @audit = audit\n @updates = team_update_lists\n @audit_team = audit_team_lists\n\n mail( :to => to_list.uniq,\n :subject => subject,\n :cc => cc_list\n )\n\n end", "title": "" }, { "docid": "18bd3750850039519ff4b8dd44add270", "score": "0.64118934", "text": "def event_schedule(parent_id, team_id, junior_ids, organiser_id, event_ids, team_invite_token)\n @organiser = User.find(organiser_id)\n @parent = User.find(parent_id)\n @juniors = User.find(junior_ids)\n @team = Team.find(team_id)\n @tenant = LandLord.new(@team).tenant\n \n # order events as per ids\n @events = Event.find(event_ids, :order => \"field(id, #{event_ids.join(',')})\")\n @team_invite_token = team_invite_token\n\n from = determine_mail_from_for_team(@team, @organiser)\n subject = subject_for_event_schedule(@team)\n to = format_email_to_user(@parent)\n \n mail(:from => from, :to => to, :subject => subject)\n end", "title": "" }, { "docid": "ac6257860413b2664e7315f5da4604f6", "score": "0.6298329", "text": "def update\n @event.match\n @event.users.each{|user| MatchMailer.match_email(user).deliver_now}\nend", "title": "" }, { "docid": "21fc04e98eeb5444cbabadb83d8daea9", "score": "0.61967593", "text": "def event_upcoming_reminder(teamsheet_entry)\n return unless teamsheet_entry.user.should_send_email? #push logic up chain?\n deliver(:event_upcoming_reminder, teamsheet_entry.user, teamsheet_entry.event.id, event.organiser.id)\n end", "title": "" }, { "docid": "b82450bd58e26c4e196fef8e3db90d3e", "score": "0.61885524", "text": "def schedule(user_id, schedule_id)\n @user = User.find(user_id)\n @schedule = Schedule.find(schedule_id)\n\n school = School.find(@user.school.id)\n school.emails_sent = school.emails_sent + 1\n school.save!\n\n roadie_mail to: @user.email, subject: \"Your Schedule From ScheduleGW\"\n end", "title": "" }, { "docid": "88bceb75acf89a9506da52023ed1b261", "score": "0.6149592", "text": "def weekly_update\n UserMailer.weekly_update\n end", "title": "" }, { "docid": "bd131837148d9b989718712d045bcac1", "score": "0.6145542", "text": "def send_tne_status_update_mail(user, obj)\n if user.id.to_i != obj.performer.id.to_i\n #Updated by Milind to send email to all matter related lawyers\n unless obj.matter.nil?\n email_to = obj.matter.matter_peoples.client.map {|cl| [cl.get_email] unless cl.get_role==\"Lead Lawyer\" }\n email_to = email_to - [nil]\n email_to.uniq!\n email_to = email_to.join(',')\n else\n email_to = obj.performer.email\n end \n LiviaMailConfig::email_settings(user.company)\n mail = Mail.new()\n mail.from = get_from_email_for_notification_alerts\n if obj.matter.nil? && obj.contact.nil?\n sub = ''\n msg = ''\n elsif obj.matter.nil?\n sub = \"#{obj.contact.try(:full_name)}'s\"\n msg = \"Contact: #{sub}'s\"\n else\n sub = \"#{obj.matter.name}'s\"\n msg = \"Matter: #{obj.matter.name}'s <br></br> Contact: #{obj.contact.try(:full_name)}'s\"\n end \n mail.subject = \"#{sub} Time and expense status has been modified\"\n str = \"Hi #{obj.performer.first_name} #{obj.performer.last_name},\"\n str +=\"<br></br> <br></br> Time and expense status has been modified to #{obj.status} on #{Time.now} <br></br>\"\n str +=\"by #{user.first_name} #{user.last_name} on #{Time.zone.now}<br></br>\"\n str +=\"User:#{obj.performer.full_name}<br></br>\"\n str +=\"#{msg}\"\n str +=\"Date:#{obj.class.name =='Physical::Timeandexpenses::TimeEntry' ? obj.time_entry_date : obj.expense_entry_date}<br></br>\"\n str +=\"Activity:#{obj.company.company_activity_types.find(obj.activity_type).alvalue}<br></br>\"\n str +=\"Description:#{obj.description}<br></br>\"\n str +=\"Amount:#{obj.class.name =='Physical::Timeandexpenses::TimeEntry' ? obj.final_billed_amount : obj.final_expense_amount }<br></br>\"\n \n str +=\"Regards,<br></br></br>\"\n str +=\"LIVIA Admin\" \n mail.body = str\n mail.content_type= 'text/html; charset=UTF-8'\n\n mail.to = obj.performer.email\n mail.deliver\n end\n \n end", "title": "" }, { "docid": "969e9f2a62e5eade87c416787682cba2", "score": "0.6102103", "text": "def daily_update(user)\n @user = user\n @recently_completed = @user.list.items.recently_completed\n @uncompleted = @user.list.items.uncompleted\n\n mail to: user.email, subject: \"Your Happy Fun Daily Tasks Update\", content_type: \"text/html\"\n end", "title": "" }, { "docid": "ba501a36d14c356fb0803d6a7877f4ae", "score": "0.6092386", "text": "def schedule_updates\n end", "title": "" }, { "docid": "070ad0894b5fd5ff8b719f107a8b7aa4", "score": "0.60725987", "text": "def send_email\n if event.send_attendance_emails? && rsvp_changed?\n if rsvp?\n RsvpMailer.rsvp(self).deliver\n else\n RsvpMailer.cancel(self).deliver\n end\n end\n end", "title": "" }, { "docid": "c3ae93bbbe092e1a269985e6c17f5f38", "score": "0.6002256", "text": "def oi_task_update(assignment, originator, completed, reset)\n \n subject = MailerMethods.subject_prefix(assignment.oi_instruction.design) +\n 'Work Assignment Update'\n subject += completed ? \" - Completed\" : (reset ? \" - Reopened\" : '')\n\n cc_list = []\n # If the user making the update is the designer assigned to perform the\n # task\n if assignment.user_id == originator.id\n # The recipient is the designer who made the original assignment \n to_list = [assignment.oi_instruction.user.email, ]\n # If the designer has been changed since the assignment was created,\n # add the new designer to the recipient list.\n if originator.id != assignment.oi_instruction.design.designer_id\n to_list << assignment.oi_instruction.design.designer.email\n end\n else\n # The recipient is the designer assigned to perform the task\n to_list = [assignment.user.email]\n # If the designer has been changed since the assignment was created,\n # add the new designer to the recipient list.\n if originator.id != assignment.oi_instruction.design.designer_id\n cc_list << assignment.oi_instruction.design.designer.email\n end\n end\n\n cc_list += Role.add_role_members(['PCB Input Gate', 'Manager', 'HCL Manager']) +\n [assignment.oi_instruction.user.email, originator.email]\n if assignment.cc_hw_engineer?\n cc_list += assignment.oi_instruction.design.get_role_reviewers('HWENG').map { |u| u.email }\n end\n \n # Remove duplicates from the CC list.\n cc_list = (cc_list - to_list).uniq\n\n @assignment = assignment\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n ) \n \n end", "title": "" }, { "docid": "fdf601c51c26dd7b06ed3ce805804f3f", "score": "0.600188", "text": "def notify_recipients\n self.send_at(scheduled_at, :send_email_notification_to_each_employee)\n end", "title": "" }, { "docid": "c86af48a3fae2ab9cf4501e5ac88a4ce", "score": "0.600001", "text": "def homes_update\n NotificationMailer.homes_update(Home.all, User.all)\n end", "title": "" }, { "docid": "d83f35775e506f0ace946120c8afe5a3", "score": "0.5984448", "text": "def send_out_emails(team_name, team_segment_id, author_name, title, content, picture_urls)\n team_name.nil? ? name = 'IRIS General Update' : name = team_name; segment_id = team_segment_id\n picture_urls.count > 3 ? num_pictures = 3 : num_pictures = picture_urls.count\n ac = ActionController::Base.new\n html = ac.render_to_string(\n :template => \"email_templates/#{ num_pictures }_picture\",\n :layout => false,\n :locals => {:title => title, :content => content, :team_name => name, :author_name => author_name, :picture_urls => picture_urls}\n )\n\n data = {\n :type => \"regular\",\n :options => {\n :list_id => MAILING_LIST_ID,\n :subject => \"Update from #{name}\",\n :from_email => '[email protected]',\n :from_name => 'IRIS Updates',\n :to_name => \"*|TITLE:FNAME|*\"\n },\n :content => {\n :html => html\n }\n }\n if !team_name.nil?\n data[:segment_opts] = {\n :match => \"any\",\n :conditions => [\n {\n :field => \"static_segment\",\n :op => \"eq\",\n :value => segment_id\n }\n ]\n }\n end\n\n response = @gb.campaigns.create(data)\n cid = response[\"id\"]\n @gb.campaigns.send({:cid => cid})\n end", "title": "" }, { "docid": "64735e8243b2c0c7fb0b043e6162a9b4", "score": "0.5982556", "text": "def send_update_notifications\n logger.info(\"in send_update_notifications, @need_update = #{@need_update}\")\n \n send_update = !in_past? && (\n @need_update || \n location_changed? || \n location_url_changed? || \n site_id_changed? || \n occurrences.any? { |o| o.changed? }\n )\n \n yield\n\n if send_update\n instructors.each do |instructor|\n ReservationMailer.update_notice_instructor( self, instructor ).deliver_later\n end\n confirmed_reservations.each do |reservation|\n ReservationMailer.update_notice( self, reservation.user ).deliver_later\n end\n end\n\n @need_update = false\n\n end", "title": "" }, { "docid": "d73dbf7900d6be894e1ffe4453973e85", "score": "0.59614795", "text": "def reminder_send_grid(user,course,tenant,admin,learner)\n begin\n url = user.crypted_password.nil? ? \"https://#{tenant.custom_url}.#{SITE_URL}/activate/#{user.activation_code}\" : \"https://#{tenant.custom_url}.#{SITE_URL}\"\n from_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email\n ]\n\n subject_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[course_name]\" => course.course_name,\n \"[course_description]\" => course.description,\n\n \"[course_start_schedule]\" => course.start_time,\n \"[course_end_schedule]\" => course.end_time,\n \"[course_duration_hour]\" => course.duration_hour,\n \"[course_duration_min]\" => course.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n body_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[course_name]\" => course.course_name,\n \"[course_description]\" => course.description,\n\n \"[course_start_schedule]\" => course.start_time,\n \"[course_end_schedule]\" => course.end_time,\n \"[course_duration_hour]\" => course.duration_hour,\n \"[course_duration_min]\" => course.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n UserMailer.send_mail(user,'reminder',tenant.id,from_replacements,subject_replacements,body_replacements).deliver\n return \"success\"\n #catch if any errors or exceptions and return that exception\n rescue Net::SMTPFatalError => exception\n return exception\n rescue Net::SMTPSyntaxError => exception\n return exception\n end\n end", "title": "" }, { "docid": "c09c60541751810b3cbbe1d1510c6cc6", "score": "0.5949764", "text": "def workflow_assigned\n @data[:owner_name] = @project_owner.try(:full_name)\n @data[:project_title] = @project.try(:title)\n \t@data[:workflow_name] = @workflow.workflow_template.try(:name)\n @data[:document_list] = @workflow.project.documents.map(&:title).join(\", \")\n \t@data[:workflow_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{@project.id}/workflow\"\n @receiver = @project_owner\n @template_name = APOSTLE_MAIL_TEMPLATE_SLUG[:workflow_assigned]\n set_mail_object\n end", "title": "" }, { "docid": "8861cd4067021ed441ff40b33ea6e264", "score": "0.5932067", "text": "def information_send\n AttendanceMailer.new_guest_email(self.attended_event.host).deliver_now\n end", "title": "" }, { "docid": "b27f59be1b87dddb6567068556a3a021", "score": "0.5913931", "text": "def generated\n mail to: User.all.map(&:email),\n subject: 'Your timesheet is now ready'\n end", "title": "" }, { "docid": "60aed6a2e95fa907f948b1a0aa917f35", "score": "0.5889883", "text": "def daily_update\n MessagesMailer.daily_update\n end", "title": "" }, { "docid": "72a2f88258e70967a9b85da0cc614988", "score": "0.5881916", "text": "def send_email\n admin_emails_for_notification = GlobalConstant::Admin.get_all_admin_emails_for(\n @client_id,\n GlobalConstant::Admin.contract_address_update_notification_type\n )\n\n admin_emails_for_notification.each do |admin_email|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: GlobalConstant::PepoCampaigns.contract_address_update_template,\n template_vars: {client_name: @client.name, contract_type: 'Deposit'}\n ).perform\n\n end\n end", "title": "" }, { "docid": "5d5468073fbd3221e26f8844c90d1761", "score": "0.5879113", "text": "def schedule_update\n ScheduleManager.schedule_first_update self.id\n end", "title": "" }, { "docid": "3a8180d5de1f395e606a511edd9c6923", "score": "0.58726156", "text": "def member_schedule_created(recipient_id, tenant_id, data, render_parent=false)\n @tenant = Tenant.find(tenant_id)\n valid_data, @recipient, @team, @league, @events, @team_invite_token = process_schedule_data(recipient_id, data)\n return if !valid_data\n\n if render_parent\n valid_parent_data, @juniors = process_parent_data(data)\n return if !valid_parent_data\n end\n\n from, to = get_mail_from_to_data(@team, @recipient)\n subject = subject_for_event_schedule(@team)\n mail(:from => from, :to => to, :subject => subject, :template_name => 'member_schedule_created')\n end", "title": "" }, { "docid": "ffe9806efd61f6c325dafd02943c090d", "score": "0.5848785", "text": "def update\n status_changed = detect_confirmation_status_changed(@schedule, schedule_params)\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html {\n redirect_to schedules_path,\n notice: 'O agendamento foi alterado com sucesso.'\n }\n format.json { render :show, status: :ok, location: @schedule }\n\n if ((@schedule.visit_datetime > Time.now) && status_changed)\n ClientMailer.update_schedule_confirmation_status(@schedule).deliver_later\n end\n\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f2ad6fd7cfe32322b71c0cc08d539f1b", "score": "0.58375067", "text": "def reminder_assessment_send_grid(user,assessment,learner,tenant,admin)\n begin\n url = user.crypted_password.nil? ? \"https://#{tenant.custom_url}.#{SITE_URL}/activate/#{user.activation_code}\" : \"https://#{tenant.custom_url}.#{SITE_URL}\"\n from_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email\n ]\n\n subject_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[assessment_name]\" => assessment.name,\n \"[assessment_description]\" => assessment.description,\n\n \"[assessment_start_schedule]\" => assessment.start_time,\n \"[assessment_end_schedule]\" => assessment.end_time,\n \"[assessment_duration_hour]\" => assessment.duration_hour,\n \"[assessment_duration_min]\" => assessment.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n body_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[assessment_name]\" => assessment.name,\n \"[assessment_description]\" => assessment.description,\n\n \"[assessment_start_schedule]\" => assessment.start_time,\n \"[assessment_end_schedule]\" => assessment.end_time,\n \"[assessment_duration_hour]\" => assessment.duration_hour,\n \"[assessment_duration_min]\" => assessment.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n UserMailer.send_mail(user,'reminder_assessment',tenant.id,from_replacements,subject_replacements,body_replacements).deliver\n return \"success\"\n #catch if any errors or exceptions and return that exception\n rescue Net::SMTPFatalError => exception\n return exception\n rescue Net::SMTPSyntaxError => exception\n return exception\n end\n end", "title": "" }, { "docid": "cc191ff9a2700c0df52c7e69c381c7b8", "score": "0.58320946", "text": "def weekly_update(user)\n @user = user\n\n mail to: user.email\n end", "title": "" }, { "docid": "19b8ca1a4647c59fbceb0b6e49b664ae", "score": "0.5830693", "text": "def update\n respond_to do |format|\n if @interview_schedule.update(interview_schedule_params)\n #InterviewScheduleMailer.sample_email(@interview_schedule).deliver_now\n format.html { redirect_to @interview_schedule, notice: 'Interview schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview_schedule }\n else\n format.html { render :edit }\n format.json { render json: @interview_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45365297ebb28a77c967cacdda735abd", "score": "0.5827827", "text": "def monthly_reminder(admin, candidate_mailer_text)\n setup_message_info(candidate_mailer_text)\n\n candidate_email = candidate_mailer_text.candidate.candidate_sheet.candidate_email\n parentemail1 = candidate_mailer_text.candidate.candidate_sheet.parent_email_1\n parentemail2 = candidate_mailer_text.candidate.candidate_sheet.parent_email_2\n mail(to: \"#{candidate_email}, #{parentemail1}, #{parentemail2}\",\n subject: candidate_mailer_text.subject.text,\n from: admin.email,\n reply_to: admin.email) do |format|\n format.html\n end\n end", "title": "" }, { "docid": "d081803788f9adf02f4f0378ecb6bd88", "score": "0.5819704", "text": "def send_email\n admin_emails_for_notification = GlobalConstant::Admin.get_all_admin_emails_for(\n @client_id,\n GlobalConstant::Admin.contract_address_update_notification_type\n )\n\n admin_emails_for_notification.each do |admin_email|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: GlobalConstant::PepoCampaigns.contract_address_update_template,\n template_vars: {client_name: @client.name, contract_type: 'Whitelist'}\n ).perform\n\n end\n end", "title": "" }, { "docid": "fc41eb1d08ac6711872b226156148b0b", "score": "0.58168525", "text": "def send_schedule_notification(entries, start_date)\n if entries.present?\n ScheduleMailer.inform_schedule(user.account, user, entries, start_date).deliver\n end\n end", "title": "" }, { "docid": "fd7d78480c777e0d7eff896338d48939", "score": "0.58102775", "text": "def vehicle_update\n UserMailer.vehicle_update\n end", "title": "" }, { "docid": "fd7d78480c777e0d7eff896338d48939", "score": "0.58102775", "text": "def vehicle_update\n UserMailer.vehicle_update\n end", "title": "" }, { "docid": "779fb5084403593dcfea517d90323bf2", "score": "0.58047366", "text": "def change(attendance)\n @attendance = attendance\n\n if Rails.env.production?\n mail :to => attendance.member.user.email, \n :cc => '[email protected]', \n :subject => attendance.event.title + ' RSVP Change Received'\n else\n mail :to => attendance.member.user.email, \n :subject => attendance.event.title + ' RSVP Change Received' \n end\n end", "title": "" }, { "docid": "ea739b785bfd74f76d7b7abe2a817d35", "score": "0.5803961", "text": "def collect_team_info\n values = { \n \"form_target\" => url(:handle_update),\n \"cancel_target\" => url(:handle_display)\n\n }\n\n teams = TeamList.for_membership(@data.mem.mem_id)\n\n @data.team.add_to_hash(values, teams)\n\n @data.mgr_list.add_to_hash(values,\n @context,\n type, \n :remove_team_manager,\n :alter_team_manager)\n\n unless !values[\"existing_names\"]\n values['email_warning'] = %{If a team manager has given you a new\n e-mail address and that new address is not shown here, then get them\n to change their DION profile. Their new address will then\n appear here automatically.}\n end\n\n standard_page(\"Edit Team\", values, EDIT_TEAM)\n end", "title": "" }, { "docid": "a3c82237d84ffdacd290d3b9911bf118", "score": "0.580325", "text": "def sendmail_change(employee)\n @employee = employee\n @leader = Employee.where(:department_id => employee.department_id, :leader => true).first \n mail(:to => @leader.email, :subject => 'Status Update')\n#debugger # <<< app/mailers/update_mailer.rb def sendmail_change\n # @greeting = \"Hi\"\n\n # mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "d1906f35ea60a45462597d8b7af1a06f", "score": "0.58000314", "text": "def aggregated_team_roles(team_id, organiser_id, removed_organisers, removed_players, created_organisers, invited_players)\n @organiser = User.find(organiser_id)\n @team = Team.find(team_id)\n @tenant = LandLord.new(@team).tenant\n\n @removed_organisers = removed_organisers\n @removed_players = removed_players\n @created_organisers = created_organisers\n @invited_players = invited_players\n\n from = \"Mitoo\" + \"<[email protected]>\"\n to = \"<#{@organiser.email}>\"\n subject = \"Team member changes - #{@team.name}\"\n \n mail(:from => from, :to => to, :subject => subject)\n end", "title": "" }, { "docid": "96f4a5970209acf9d1f94be412c7104e", "score": "0.5794886", "text": "def send_one_email(options)\n mailer_options = {}\n mailer_options[:update] = self\n mailer_options[:is_draft] = true if options[:is_draft]\n\n # optionally turn IDs into objects\n if options[:person]\n mailer_options[:person] = options[:person]\n elsif options[:person_id]\n mailer_options[:person] = Person.active.where(id: options[:person_id]).first\n elsif options[:linked_account]\n mailer_options[:linked_account] = options[:linked_account]\n elsif options[:linked_account_id]\n mailer_options[:linked_account] = LinkedAccount::Github::User.find(options[:linked_account_id])\n end\n\n if mailer_options[:person]\n mailer_options[:person].deliver_email(:team_update_created, mailer_options)\n elsif mailer_options[:linked_account]\n # sync with github to get latest email address\n mailer_options[:linked_account].sync_basic_data(oauth_token: options[:oauth_token])\n return if mailer_options[:linked_account].email.blank?\n\n # compute stargazer relations\n tracker_ids = team.owned_trackers.not_deleted.pluck(:id)\n stargazers = GithubStargazer.where(tracker_id: tracker_ids).joins(:linked_account).where('linked_accounts.person_id' => nil, 'linked_accounts.id' => mailer_options[:linked_account].id)\n mailer_options[:stargazer_relations] = stargazers.map { |sg| [('a stargazer' if sg.stargazer?), ('a watcher' if sg.subscriber?), ('a forker' if sg.forker?)] }.flatten.compact.uniq\n\n Mailer.team_update_created(mailer_options).deliver\n end\n end", "title": "" }, { "docid": "6ecf0860b578f4a626e8c539a9c8912b", "score": "0.5790321", "text": "def partner_joined_update\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "4a3178ad2983774f318ed40b87001d0d", "score": "0.5788738", "text": "def send_appointed_email_to_team\n team_members.each { |person| person.delay.send_email(:proposal_appointed_to_team, proposal: self) }\n end", "title": "" }, { "docid": "1593b7258430966392f8fbe6e428aad3", "score": "0.5776962", "text": "def event_update_email(user, event, changes)\n @user = user\n @event = event\n @changes = changes\n @date_format = \"%b. %d, %Y %l:%M %p\"\n mail(to: @user.email, subject: \"\\\"#{@event.name}\\\" Has Been Updated\")\n end", "title": "" }, { "docid": "ffdcaf4712e3d443eebde449dc38e8c3", "score": "0.5774757", "text": "def schedule_meeting\n end", "title": "" }, { "docid": "b9c173d45e4797d07b35f2b213ba5ff6", "score": "0.5752661", "text": "def receivemails_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in receivemails receivemails_update\"\n begin\n params.permit!\n if params[\"sync_setting\"][\"schedule\"]==\"Manual\"\n params[\"email1\"]=params[\"sync_setting\"][\"email1\"]\n params[\"password1\"]=params[\"sync_setting\"][\"password1\"]\n params[\"email2\"]=params[\"sync_setting\"][\"email2\"]\n params[\"password2\"]=params[\"sync_setting\"][\"password2\"]\n \n params[\"path_setting\"]=params[\"sync_setting\"][\"path_setting\"]\n end\n schedule_time = (params[\"sync_setting\"][\"schedule_time\"] == nil)? [] : params[\"sync_setting\"][\"schedule_time\"]\n data= ReceiveMail.first.update(job_name: params[\"sync_setting\"][\"job_name\"], schedule: params[\"sync_setting\"][\"schedule\"], schedule_period: params[\"sync_setting\"][\"schedule_period\"],schedule_time: schedule_time, last_sync: params[\"sync_setting\"][\"last_sync\"],email1:params[\"email1\"],password1: params[\"password1\"],email2:params[\"email2\"],password2:params[\"password2\"])\n render json: data\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} receivemails_controller receivemails_update method\" }\n end \n end", "title": "" }, { "docid": "015139794c21fd1213e7c8a5a4ed716f", "score": "0.5750764", "text": "def send_update_email(lesson)\n @lesson = lesson\n @students = @lesson.course.users(is_admin: false)\n list = []\n @students.find_each do |student|\n list << student.email\n \n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end", "title": "" }, { "docid": "d25557a1b5725bacf830fa58ec0940d6", "score": "0.57456195", "text": "def groupinv_changed\n GroupinvMailer.groupinv_changed\n end", "title": "" }, { "docid": "59f8a7b1c53b9f03a536a3902c7b4e76", "score": "0.573192", "text": "def after_create_event(event)\n @event = event\n \n mail to: event.players.map { |p| p.email}\n\n end", "title": "" }, { "docid": "d906a8a8c443579849f8bf70f4d22906", "score": "0.572335", "text": "def email_dmp_saved\n\n #[:dmp_owners_and_co][:vis_change] -- A DMP's visibility has changed\n if !self.changes[\"visibility\"].nil?\n if self.changes[\"visibility\"][0] != self.changes[\"visibility\"][1]\n # mail all owners and co-owners\n users = self.users\n users.delete_if {|u| !u[:prefs][:dmp_owners_and_co][:vis_change]}\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP Visibility Changed: #{self.name}\",\n \"dmp_owners_and_co_vis_change\",\n {user: user, \n plan: self,\n contact_us_url: APP_CONFIG['contact_us_url'] } ).deliver\n end\n end\n end\n\n\n # if the current_plan_state hasn't changed value then return now and don't mess with any of the rest\n return if self.changes[\"current_plan_state_id\"].nil?\n if self.changes[\"current_plan_state_id\"][0].nil?\n earlier_state = PlanState.new\n else\n earlier_state = PlanState.find(self.changes[\"current_plan_state_id\"][0])\n end\n current_state = self.current_state\n\n return if earlier_state.state == current_state.state\n\n # [:dmp_owners_and_co][:committed] -- A DMP is completed (activated)\n if current_state.state == :committed\n users = self.users\n users.delete_if {|u| !u[:prefs][:dmp_owners_and_co][:committed]}\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"PLAN COMPLETED: #{self.name}\",\n \"dmp_owners_and_co_committed\",\n {user: user, \n plan: self,\n contact_us_url: APP_CONFIG['contact_us_url'] } ).deliver\n end\n\n # [:dmp_owners_and_co][:submitted] -- A submitted DMP is approved or rejected\n # [:institutional_reviewers][:approved_rejected] -- An Institutional DMP is approved or rejected\n elsif current_state.state == :approved || current_state.state == :rejected || current_state.state == :reviewed\n users = self.users\n users.delete_if {|u| !u[:prefs][:dmp_owners_and_co][:submitted]}\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP #{current_state.state}: #{self.name}\",\n \"dmp_owners_and_co_submitted\",\n { user: user, \n plan: self, \n state: current_state,\n contact_us_url: APP_CONFIG['contact_us_url'] } ).deliver\n end\n\n institution = self.owner.institution\n users = institution.users_in_and_above_inst_in_role(Role::INSTITUTIONAL_REVIEWER)\n users.delete_if {|u| !u[:prefs][:institutional_reviewers][:approved_rejected] }\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP #{current_state.state}: #{self.name}\",\n \"institutional_reviewers_approved_rejected\",\n { user: user, \n plan: self, \n state: current_state, \n contact_us_url: APP_CONFIG['contact_us_url'] } ).deliver\n end\n\n # [:institutional_reviewers][:submitted] -- An Institutional DMP is submitted for review\n elsif current_state.state == :submitted\n institution = self.owner.institution\n \n # Send the owner and coowners a confirmation message\n users = self.users\n users.delete_if {|u| !u[:prefs][:dmp_owners_and_co][:submitted]}\n users.each do |user|\n UsersMailer.notification(\n user.email,\n (institution.submission_mailer_subject.blank? ? build_email_message(APP_CONFIG['mailer_submission_default']['subject'], {}) : build_email_message(institution.submission_mailer_subject, {})),\n \"dmp_owners_and_co_submitted\",\n {user: user, \n plan: self, \n body: (institution.submission_mailer_body.blank? ? build_email_message(APP_CONFIG['mailer_submission_default']['body'], {user: user, plan: self}) : build_email_message(institution.submission_mailer_body, {user: user, plan: self})), \n state: current_state,\n contact_us_url: APP_CONFIG['contact_us_url']} \n ).deliver\n end\n \n # Send the reviewers a notification\n users = institution.users_in_and_above_inst_in_role(Role::INSTITUTIONAL_REVIEWER)\n users.delete_if {|u| !u[:prefs][:institutional_reviewers][:submitted] }\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP #{current_state.state}: #{self.name}\",\n \"institutional_reviewers_submitted\",\n {user: user, \n plan: self, \n state: current_state,\n contact_us_url: APP_CONFIG['contact_us_url']} \n ).deliver\n end\n end\n end", "title": "" }, { "docid": "c0d37966f3deccb0d0c05d844cbb4177", "score": "0.57206666", "text": "def handle_update\n values = Hash.new(\"\")\n\n t = @data.team\n\n t.add_to_hash(values)\n @cgi.keys.each {|k| \n if k =~ /^tm_/\n values[k] = @cgi.values(k)\n else\n values[k] = @cgi[k]\n end\n }\n\n t.from_hash(values)\n @data.mgr_list.from_hash(values)\n\n errors = t.error_list + @data.mgr_list.error_list\n\n if errors.empty?\n \n if @data.mgr_list.needs_filling_in?\n @session.push(type, :finish_update)\n @session.dispatch(NameGetter, \n :handle_getting_names_for,\n [@data.mgr_list, \"Team Manager\"])\n return\n end\n\n finish_update\n else\n error_list(errors)\n collect_team_info\n end\n end", "title": "" }, { "docid": "c0f0c802f92c905ed4a44839d0e08f3e", "score": "0.571949", "text": "def email_update\n self.donors.each do |donor|\n donor.send_update(self)\n end\n end", "title": "" }, { "docid": "dd3fcb53a90d6f61adaf5e8fc2955c87", "score": "0.571833", "text": "def update_regular_event(args = {})\n @regular_event ||= args[:regular_event]\n @receiver ||= args[:receiver]\n @user = @receiver\n @link_url = notification_redirector_url(\n link: \"/regular_events/#{@regular_event.id}\",\n kind: Notification.kinds[:regular_event_updated]\n )\n\n subject = \"[FBC] 定期イベント【#{@regular_event.title}】が更新されました。\"\n message = mail to: @user.email, subject: subject\n message.perform_deliveries = @user.mail_notification? && [email protected]?\n\n message\n end", "title": "" }, { "docid": "2baf39027d77cd65c5dbd182c4ad55e1", "score": "0.571701", "text": "def shipment_updated\n adjustment = InventoryAdjustment.where(type: \"shipment\").first\n previous_data = { \n units: 250, \n comment: \"here are the old comments\", \n ship_date: DateTime.now - 3.days,\n update_date: DateTime.now,\n associated_requests: adjustment.associated_requests,\n associated_received_shipments: adjustment.associated_received_shipments\n }\n InventoryAdjustmentMailer.send_notice(\n adjustment: adjustment, \n type: \"shipment_updated\", \n previous_data: previous_data,\n email: \"[email protected]\", # send to brand\n subject: \"#{adjustment.product.brand.company_name} has updated an inventory shipment\",\n title: \"Inventory Shipment Updated\"\n )\n end", "title": "" }, { "docid": "aa4ab5e204576e01346a736da49854f1", "score": "0.57161576", "text": "def update\n respond_to do |format|\n\n this_schedule_params = schedule_params()\n\n for day in [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\"]\n if this_schedule_params[day + \"_times\"].nil?\n this_schedule_params[day + \"_times\"] = []\n end\n if this_schedule_params[day + \"_var_times\"].nil?\n this_schedule_params[day + \"_var_times\"] = []\n end\n end\n\n if @schedule.update(this_schedule_params)\n format.html { redirect_to user_schedule_path, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c199f517f76e25ac278d3e0d5aab396", "score": "0.57106996", "text": "def approval_update\n UserMailer.approval_update(approver)\n end", "title": "" }, { "docid": "490f3cacdb978b507b530199eb04cf69", "score": "0.5704265", "text": "def perform\n ScheduleManager.fix_scheduled_updates\n end", "title": "" }, { "docid": "f860657ef8010087e7c76c1a6190a8d6", "score": "0.569809", "text": "def send_reminder_to_approvers\n # NOT USED YET\n # todo: need to add a param for getting the return_url\n @timesheet = Timesheet.find(params[:timesheet_id])\n @timesheet.note << \"\\r[\" + Time.now.to_formatted_s(:uk_date_time_24) +\"] Reminder send to approvers.]\\r\";\n @timesheet.save(false)\n render :action => 'view_timesheet'\n end", "title": "" }, { "docid": "c8d78056d1720acb9490f5f32203b69d", "score": "0.56977147", "text": "def update_email(player, subject, body)\n @body = body\n @player = player\n email_with_name = \"#{@player.name} <#{@player.email}>\"\n mail(to: email_with_name, subject: subject)\n end", "title": "" }, { "docid": "fbd2f644aa3fc60b2965388eef3020c7", "score": "0.5694402", "text": "def update_and_send_task_list\n create_file\n enter_tasks\n create_html_body\n send_email\nend", "title": "" }, { "docid": "2655b015fb8b10e307a022f0eac893d1", "score": "0.5683687", "text": "def new_players(manager, new_players, old_players, changed_club)\n @new_players = new_players\n @old_players = old_players\n @changed_club = changed_club\n mail to: manager.email, subject: 'Fantasy League Player changes'\n end", "title": "" }, { "docid": "9269ee92c6d941bc3dc0e2b36d1a5f1d", "score": "0.5682763", "text": "def run_schedule\n scheduler = Scheduler.new(@user, @task)\n results = scheduler.schedule\n #results[0] = week, [1] = couldnt schedule, [2] = past_due\n update_tasks(results[0])\n end", "title": "" }, { "docid": "7f4579aa6b809d4928be6dd8b647d755", "score": "0.568065", "text": "def sub_taken_notification(owner, new_shift, dept)\n @owner = owner\n @new_shift = new_shift\n mail(to: @owner.email, \n from: dept.department_config.mailer_address, \n cc: new_shift.user.email,\n subject: \"[Sub Request] #{new_shift.user.name} took your sub!\", \n date: Time.now)\n end", "title": "" }, { "docid": "8a11a66b03924bc1f3ecf11c0db79cb9", "score": "0.5674427", "text": "def snack_queue_update_mail(data)\n\n mandrill_mail :template => 'update_queue',\n :subject => \"Snack Queue Updated\",\n :to => {\n :email => data[:email],\n :name => data[:fname]+ \" \"+ data[:lname]\n },\n :vars => {\n 'FNAME' => data[:fname],\n 'LNAME' => data[:lname],\n 'DELIVERY_DATE' => data[:delivery_date],\n 'LINE_ITEM_ROWS' => data[:line_item_rows]\n\n },\n :important => true,\n :inline_css => true\n\n end", "title": "" }, { "docid": "e49ff53b7512e156e64dd413b6e2c243", "score": "0.56588674", "text": "def vehicle_update\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "0f70b7198ffb8b0c2470951742441fa6", "score": "0.56500745", "text": "def notify_recipients\n self.send_at(scheduled_at, :send_email_notification) if employment.prefers_receive_email_notifications # For employment basis email sending \n end", "title": "" }, { "docid": "8f1a63e162a8efc4bb7b02ffaf576163", "score": "0.5649917", "text": "def set_scheduled_email\n @scheduled_email = scheduled_emails\n end", "title": "" }, { "docid": "dc47d3f34058c450495cfe8952c1f693", "score": "0.5646657", "text": "def send_coach_reminders_job\n \n Challenge.active.each do |c|\n tomorrow = Time.current.to_date + 1.day\n \n Rails.logger.debug \"Today: \" + Time.current.to_date.to_s\n Rails.logger.debug \"Tomorrow: \" + tomorrow.to_s\n \n if c.get_active_workouts_for_day(tomorrow).size == 0\n puts (\"Sending NoWorkoutScheduled Reminder for \" + c.title) \n UserMailer.no_workout_scheduled_reminder(c.owner,c).deliver_now \n end\n end\n \n end", "title": "" }, { "docid": "54e711757e194fa571fa89ec74845a4f", "score": "0.56445885", "text": "def published(app_event)\n\t\t\tdiv = app_event.obj\n\n\t\t\tdatum = \"player_schedule_updated\"\n\n\t\t\tmeta_data = app_event.meta_data.clone\n\t\t\tmeta_data[:league_id] = div.league.id\n\t\t\tmeta_data[:parent_app_event_id] = app_event.id\n\n\t\t\tdiv.teams.each do |team|\n\t\t\t\tnext unless team.schedule_updates?\n\t\t\t\tAppEventService.create(team, app_event.subj, \"schedule_updated\", meta_data)\n\t\t\tend\n\n\t\t\t[] # we don't send no ting directly... all via AEs we create.\n\t\tend", "title": "" }, { "docid": "f1de4a44358add24500a5cd324bfc07c", "score": "0.5641111", "text": "def resubmit_message(timesheet)\n setup_email\n subject \"Please resubmit your timesheet for the week #{timesheet.startDate.to_formatted_s(:uk_date)} - #{(timesheet.startDate + 6).to_formatted_s(:uk_date)}\"\n recipients timesheet.contract.contractor_user.email\n body[:timesheet] = timesheet\n body[:user] = timesheet.contract.contractor_user\n end", "title": "" }, { "docid": "d83b372bfffc8533c496499d52762526", "score": "0.56405056", "text": "def send_secondary_reminder_email\n UserMailer.secondary_reminder_email(self).deliver_now\n end", "title": "" }, { "docid": "6f081f54690152c86111df6234d35654", "score": "0.5636268", "text": "def notice_admins_update\n if !current_user.admin?\n AdminMailer.with(subject: 'Reserva de turno', text: \"#{@reserva.user.nombre_completo} ha actualizado su reserva del Club.\", link: reserva_url(@reserva)).email_notificacion.deliver_later\n elsif @por_aprobar && @reserva.aprobado\n AdminMailer.with(to: @reserva.user.email, subject: 'Turno aprobado', text: \"#{current_user.nombre_completo} ha aprobado tu reserva en el Club.\", link: reserva_url(@reserva)).email_notificacion.deliver_later\n end\n end", "title": "" }, { "docid": "f9dd773ad2b68be1f355c433c0e15732", "score": "0.56311697", "text": "def process_schedules(team)\n # @completedGames = Game.all.map{|g| g.boxscore_id}\n # return unless @completedGames.empty?\n print \"-- #{team.name} Games...\"\n SEASON_TYPES.each { |season_type| # Process configured season types\n # Skip already populated data\n if(Game.where(\"team_id = ? AND season_type = ?\", team.id, season_type).size == 0)\n t_schedule = HoopScrape.schedule(team.abbr, season: season_type, format: :to_hashes, year: YEAR)\n fl_a = Game.refreshSchedule(team, t_schedule, season_type)\n @file.puts \"Game.create(#{fl_a})\" if SAVE_TO_FILE && !fl_a.empty? # Save Crate command\n end\n }\n puts \"%i...Done.\" % [Game.where(\"team_id = ?\", team.id).size] # Confirm Game count\n end", "title": "" }, { "docid": "ae4c25ab9bde6ba61df0c8afdd0a47e2", "score": "0.56234384", "text": "def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end", "title": "" }, { "docid": "27f966301081a5d4d8483aa729e90a49", "score": "0.56213015", "text": "def daily_report\n @greeting = \"Hi, this is the daily override report!\"\n @overrides = Event.override\n\n\n\n mail( :to => \"[email protected]\",\n :subject => \"Daily Override Report\")\n\n end", "title": "" }, { "docid": "70e5bef995647f1e8e4dfc7cf77b7570", "score": "0.5621076", "text": "def weekly_schedule(events, group, user)\n timezone user\n\n @events_day_of_week = events_day_of_week(events)\n @group = group\n @user = user\n\n @view_action = {\n url: url_for(\n controller: 'groups', action: 'show', id: @group.id,\n only_path: false\n ),\n action: 'View Tickets',\n description: 'See available tickets.'\n }\n\n mail(\n to: \"#{user.display_name} <#{@user.email}>\",\n subject: \"The week ahead for #{@group.group_name}\"\n )\n\n headers['X-Mailgun-Tag'] = 'WeeklyReminder'\n headers['X-Mailgun-Dkim'] = 'yes'\n headers['X-Mailgun-Track'] = 'yes'\n headers['X-Mailgun-Track-Clicks'] = 'yes'\n headers['X-Mailgun-Track-Opens'] = 'yes'\n end", "title": "" }, { "docid": "5f6cdc3594784ef0faacc1dcbca7dbba", "score": "0.56196064", "text": "def update\n @survey = Survey.find(params[:id])\n random_string = SecureRandom.hex\n app = Rpush::Apnsp8::App.new\n app.name = random_string\n file = File.join(Rails.root, 'app', 'AuthKey_U4TBQWBRJD.p8')\n app.apn_key = File.read(file)\n app.environment = \"development\" # APNs environment.\n app.apn_key_id = \"U4TBQWBRJD\"\n app.team_id = \"5KBWP959TD\"\n app.bundle_id = \"com.expertservices.Sentiment-Bot\"\n app.connections = 1\n app.save!\n\n time = params[:time]\n new_schedule = params[:schedule]\n #string_date = params[:start_date]\n start_date = Date.today\n team_members = @survey.team.users\n\n team_members.each do |team_member|\n if team_member.device_token != \"\"\n notification = Rpush::Apns::Notification.new\n notification.app = Rpush::Apnsp8::App.find_by_name(random_string)\n notification.device_token = team_member.device_token\n notification.data = { aps: { \"content-available\": 1 }, schedule: new_schedule, time: time, feelings: @survey.feelings, surveyId: @survey.id }\n notification.save!\n Rpush.push\n end\n end\n\n @survey.schedule = new_schedule\n @survey.time = time\n @survey.start_date = start_date\n #@survey.start_date = start_date\n if @survey.schedule != \"Now\"\n if @survey.save\n render \"api/surveys/show\", status: :ok\n else\n @errors = @survey.errors.full_messages\n render json: { message: @errors }, status: :unprocessable_entity\n end\n else\n render \"api/surveys/show\", status: :ok\n end\n end", "title": "" }, { "docid": "441c4a4c26bb724365347bfb7bbd0b88", "score": "0.5617303", "text": "def email_template_saved\n\n # [:requirement_editors][:deactived] - An institutional DMP template is deactivated\n if self.active == false && !self.changes[\"active\"].nil? && self.changes[\"active\"][0] == true\n institution = self.institution\n users = institution.users_in_and_above_inst_in_role(Role::TEMPLATE_EDITOR)\n users += institution.users_in_and_above_inst_in_role(Role::INSTITUTIONAL_ADMIN)\n users.uniq! #only the unique users, so each user is only listed once\n users.delete_if {|u| !u[:prefs][:requirement_editors][:deactived] }\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP Template Deactivated: #{self.name}\",\n \"requirement_editors_deactived\",\n {:user => user, :template => self} ).deliver\n end\n\n # [:requirement_editors][:committed] - An institutional DMP template is activated (committed)\n # [:resource_editors][:associated_committed] - A DMP Template associated with a customization is activated\n elsif self.active == true && !self.changes[\"active\"].nil? && self.changes[\"active\"][0] == false\n # this is for requirement editors\n institution = self.institution\n users = institution.users_in_and_above_inst_in_role(Role::TEMPLATE_EDITOR)\n users += institution.users_in_and_above_inst_in_role(Role::INSTITUTIONAL_ADMIN)\n users.uniq! #only the unique users, so each user is only listed once\n users.delete_if {|u| !u[:prefs][:requirement_editors][:committed] }\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP Template Activated: #{self.name}\",\n \"requirement_editors_committed\",\n {:user => user, :template => self} ).deliver\n end\n\n #this is for customizations and resource editors associated them that use this template\n # customization type 'Container - Institution',\n # inst: set, req_temp: set, req: not set, resource: not set\n customizations = ResourceContext.where(\"institution_id IS NOT NULL AND requirement_id IS NULL AND resource_id IS NULL\").\n where(requirements_template_id: self.id)\n\n #for each customization that uses this resource template that has been made active notify resource editors\n customizations.each do |customization|\n institution = customization.institution\n users = institution.users_in_and_above_inst_in_role(Role::RESOURCE_EDITOR)\n users += institution.users_in_and_above_inst_in_role(Role::INSTITUTIONAL_ADMIN)\n users.uniq! #only the unique users, so each user is only listed once\n users.delete_if {|u| !u[:prefs][:resource_editors][:associated_committed] }\n users.each do |user|\n UsersMailer.notification(\n user.email,\n \"DMP Template Activated: #{self.name}\",\n \"resource_editors_associated_committed\",\n {:user => user, :template => self, :customization => customization} ).deliver\n end\n\n end\n\n end\n end", "title": "" }, { "docid": "449a7e0f4ea9c64468e55ed93af93525", "score": "0.5610338", "text": "def weekly_report_email(admin)\n @user = admin\n @recruiters = User.where(role: \"recruiter\")\n\n mail(to: @user.email, subject: 'CardinalTalent: Weekly Activity By Sourcer')\n end", "title": "" }, { "docid": "4b0040b60332a91657b15c9fbc0820e2", "score": "0.5609703", "text": "def send_update_booking\n booking = Booking.first\n # binding.pry\n TravelerBookingMailer.send_update_booking(booking)\n end", "title": "" }, { "docid": "dfbbc3ea2d8b2f5b9ea60e82516657d6", "score": "0.56088585", "text": "def updated_task(todo)\n @greeting = \"Hi\"\n\n mail(to: todo.email) do |format|\n format.text\n end\n end", "title": "" }, { "docid": "f18368e4a042e7e252cbaeda78c4df60", "score": "0.56071424", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n event \"create\", :team, @team.id, description: \"#{current_player.name} created team #{@team.name}\"\n current_player.team = @team\n current_player.save!\n\n admins = Team.where(name: 'Game Control').first.players\n admins.each do |admin|\n mailer = TeamMailer.notify_team_created current_player, @team, admin\n mailer.deliver!\n end\n\n format.html { redirect_to @team, flash: { success: 'Team was successfully created.' } }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fbf4c11c37b5114b4fab6b051e24e40", "score": "0.5603936", "text": "def send_mails\n\t\tReminder.where(time: Time.now..(Time.now + 1.day), reminded: false).each do |r|\n\t\t\tUser.all.each do |u|\n\t\t\t\tsend_safe_mail(:to => u.email, :subject => r.title, :html_body => \"<p>Hi #{u.display_name.html_safe},</p><p>Just a quick reminder... Don't forget about this event, planned the #{ApplicationHelper.datetime_to_s(r.time)}:</p><h4>#{r.title}</h4><p>#{r.description}</p>Yours truly,<br>The BeOI Training team.\")\n\t\t\tend\n\t\t\tr.update(reminded: true)\n\t\tend\n\tend", "title": "" }, { "docid": "d16c9bc5dbd5d538665780a39d448c44", "score": "0.56035924", "text": "def sub_taken_watch(user, owner, new_shift, email_start, email_end, dept, disp)\n @owner = owner\n @new_shift = new_shift\n @email_start = email_start\n @email_end = email_end\n mail(to: \"#{user.name} <#{user.email}>\", from: owner.email,\n subject: \"Re: [Sub Request] Sub needed for \" + disp, date: Time.now)\n end", "title": "" }, { "docid": "2db40a1ed4da34e73124e877ebcf8eac", "score": "0.56024426", "text": "def update\n @client = Client.where('disable IS NULL').order(:name => :asc)\n\n @project_data = project_params\n @tasks = project_params['tasks_attributes']\n @feedbacks = project_params['feedbacks_attributes']\n if @project_data['project_type'] == \"creaother\" && @project_data['progression'] == \"finishedcrea\"\n @project_data['progression'] = :outsource\n end\n @filmings = ListItem.where(list_id: 2)\n @shapings = ListItem.where(list_id: 1)\n @paperstocks = Paperstock.all\n @various_stocks = VariousStock.all\n @client = Client.where('disable IS NULL')\n if [email protected]?\n @tasks.each do |t, value|\n if !value['id'].nil?\n task = Task.find(value['id'])\n value.delete('_destroy') \n if task.update(value)\n else\n flash[:danger] = 'Mise à jour de la tâche impossible'\n end\n else\n value['worker_id'] = current_user.id\n end \n @project_data['tasks_attributes'] = @tasks\n end\n end\n if [email protected]?\n @feedbacks.each do |t, value|\n if !value['id'].nil?\n feedback = Feedback.find(value['id'])\n value.delete('_destroy')\n if feedback.update(value)\n else\n flash[:danger] = 'Mise à jour du retour impossible'\n end\n else\n value['worker_id'] = current_user.id\n end\n @project_data['feedbacks_attributes'] = @feedbacks\n end\n end\n respond_to do |format|\n if @project.update_attributes(@project_data)\n if (@project.create_email == true && @project_data['create_email'] == \"1\")\n begin\n WelcomeMailer.creation_email(@project).deliver\n flash[:notice] = 'Email de création envoyé'\n rescue Net::SMTPAuthenticationError, Net::SMTPServerBusy, Net::SMTPSyntaxError, Net::SMTPFatalError, Net::SMTPUnknownError => e\n logger.error e\n @project.create_email = false\n @project.save\n flash[:notice] = 'Email de création non envoyé ' + e.to_s\n end\n end\n if (@project.tracking_email? && !@project_data['tracking_email'].nil?)\n begin\n WelcomeMailer.track_email(@project).deliver\n flash[:notice] = 'Email de suivi envoyé'\n rescue Net::SMTPAuthenticationError, Net::SMTPServerBusy, Net::SMTPSyntaxError, Net::SMTPFatalError, Net::SMTPUnknownError => e\n logger.error e\n @project.create_email = false\n @project.save\n flash[:notice] = 'Email de suivi non envoyé ' + e.to_s\n end\n end\n flash[:success] = 'Projet mis à jour avec succès'\n format.html { redirect_to @project}\n format.json { render :show, status: :ok, location: @project }\n else\n flash[:danger] = 'Mise à jour du projet impossible'\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e662ed93ca0c5863eca3518d3aa59d72", "score": "0.5598957", "text": "def email_reminder(assignment)\n @assignment = assignment\n\n tag :scheduler, :reminders, :email_reminder\n mail to: format_address(assignment.person), subject: shift_subject\n end", "title": "" }, { "docid": "adddbf6deaac59743911b750f950c62b", "score": "0.5594398", "text": "def update\n @schedule = current_user.schedule\n days = [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ]\n\n if(@schedule.nil?) then #create new schedule if it doesn't exist\n @schedule = Schedule.new\n @schedule.user_id = current_user.id\n @schedule.save\n end\n\n new_blocks = []\n \n #Get rid of the old guys.\n @schedule.time_blocks.delete_all\n \n if(params['time_blocks']) then\n params['time_blocks'].each do |i, param_block|\n @schedule.transaction do\n new_blocks << @schedule.time_blocks.create(\n day: days.index(param_block[:day]),\n hour: param_block[:hour],\n minute: param_block[:minute]\n )\n end\n end\n end\n \n respond_to do |format|\n if @schedule.touch\n format.html { redirect_to :profile_edit_schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a48c6c8228825f72c62097940011a46a", "score": "0.5592431", "text": "def updated_hours_and_location\n HoursAndLocationsMailer.updated_hours_and_locations(HoursAndLocation.new(content: \"Hello\"))\n end", "title": "" }, { "docid": "ecfacb43ca8583726d299a956db625f1", "score": "0.55914783", "text": "def profile_updated_notification\n AdminMailer.investor_update_profile(self, 'Profile was updated').deliver_now\n end", "title": "" }, { "docid": "08669754bd1812ee5547e56627ed9302", "score": "0.5591261", "text": "def notification_team_evaluated_email(user,course,assignment,team)\n @user = user\n @course = course\n @assignment = assignment\n @team = team\n @url = 'http://foobli.com/login'\n # course_assignment_teams_path(course.id, assignment.id, team.id)\n mail(from:\"[email protected]\", to: user.email, subject: 'Team: ' + team.name.to_s + ' Evaluated ' + course.course_id + ' - ' + assignment.name) do |format|\n format.html { render 'notification_team_evaluated_email' }\n end\n end", "title": "" }, { "docid": "74a63200ae8b62a8b6716bb42aad21f5", "score": "0.5586481", "text": "def schedule\n @subject_schedules = psc.schedules(@participant)\n end", "title": "" }, { "docid": "52760331f1bfdfb0a1473c818c6bc923", "score": "0.55827", "text": "def datechange_request_email(previous, new)\n @url = \"http://www.helpmegoout.co.uk/request/#{new.id}/edit\"\n @previous = previous\n @new = new\n mail(:to => previous.volunteer.email, :subject => \"The dates have changed for your baby sitting\")\n end", "title": "" }, { "docid": "eeeeddca7c3ee42d818fe8ee5f201ae3", "score": "0.5580925", "text": "def email_stats (missed_shifts, late_shifts, left_early_shifts, dept)\n subject \"Shift Statistics for #{dept.name}:\" + (Time.now - 86400).strftime('%m/%d/%y') #this assumes that the email is sent the day after the shifts (ex. after midnight) so that the email captures all of the shifts\n recipients dept.department_config.stats_mailer_address \n from dept.department_config.mailer_address\n sent_on Time.now\n body :missed_shifts => missed_shifts, :late_shifts => late_shifts, :left_early_shifts => left_early_shifts\n end", "title": "" }, { "docid": "0a49793efd84d13636b02c2ebede0d3a", "score": "0.557244", "text": "def update\n if (params[:deliverable][:name].nil?) or (params[:deliverable][:name] == \"\")\n flash[:alert] = \"Deliverable must have a name\"\n redirect_to edit_deliverable_path\n else \n project_id = (Deliverable.find params[:id]).project_id\n #puts \"The project ID is #{project_id}\"\n @project = Project.find_by_id(project_id)\n\n helpers.add_members(@members, @deliverable.id)\n #puts @project\n respond_to do |format|\n if @deliverable.update(deliverable_params)\n\n @assignments = Assignment.where(deliverable_id: @deliverable.id).pluck(:user_id)\n @users = User.where(id: @assignments)\n\n @users.each do |user|\n puts user.username \n helpers.mail_deliverable_complete(user, @deliverable, params['status'])\n end\n\n @deliverable.remove_files! if !deliverable_params['files']\n @deliverable.save()\n format.html { redirect_to @deliverable, notice: \"Deliverable was successfully updated.\" }\n format.json { render :show, status: :ok, location: @deliverable }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @deliverable.errors, status: :unprocessable_entity }\n end\n @deliverable.create_activity :update, owner: current_user, group: group_id\n end\n end\n end", "title": "" }, { "docid": "5d2dd3e4d3211f3807059aaca58cbece", "score": "0.5560033", "text": "def email(defn, _participant, assignment)\n defn[:body][:type] = 'Teammate Review'\n participant = AssignmentParticipant.find(reviewee_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end", "title": "" }, { "docid": "2f0fa094585ecd1eae7b4319e709586f", "score": "0.55580944", "text": "def new_entrant(sortie, host) # double-dates: send 2 emails from here or iterate in model?\n @greeting = \"Hi\"\n \n # temporary fix here\n @action_path = date_entries_url(sortie.id)\n @sortie = sortie # pass as :locals?\n @host = host\n @waitlist = sortie.entries.waiting\n \n \n # add conditional formating: first user or other user waiting\n mail :to => host.email\n end", "title": "" }, { "docid": "9ab523db7113647490e5a335a09d3bed", "score": "0.5553969", "text": "def update_email_campaign_schedule(access_token, campaign, schedule)\n\t\t\tcampaign_id = get_argument_id(campaign, 'Campaign')\n\t\t\tServices::CampaignScheduleService.update_schedule(access_token, campaign_id, schedule)\n\t\tend", "title": "" }, { "docid": "74aac7260f4b1d19d6b14ca0ae4cff61", "score": "0.5551559", "text": "def data_update_notification\n @greeting = \"Oi Pepper Luncher\"\n\n mail to: \"[email protected]\"\n\n end", "title": "" } ]
92449354e7f1a50b8d7301120cd750a9
For now all apps are shared with everyone
[ { "docid": "ab29901e24bcc8c5edec7b0a0b621906", "score": "0.0", "text": "def apps\n Application.all\n end", "title": "" } ]
[ { "docid": "7c3560ca56839221256b843f348f281e", "score": "0.67514634", "text": "def shared_user_app_data_allowed\n return @shared_user_app_data_allowed\n end", "title": "" }, { "docid": "c46458b6e70a26be039bcb70f4fc0f84", "score": "0.6468681", "text": "def shared_user_app_data_allowed=(value)\n @shared_user_app_data_allowed = value\n end", "title": "" }, { "docid": "3cee3eaae1bd887222218f2bdfd47a38", "score": "0.644027", "text": "def sharing \n end", "title": "" }, { "docid": "fa0541452af25de634bf26fea660339f", "score": "0.6391743", "text": "def share_folders(folders)\n end", "title": "" }, { "docid": "7410f226eabc4f8212edce58666f9509", "score": "0.6367171", "text": "def sync_shared_items\n return unless @deployment_settings.include? 'shared'\n\n Log.info \"#@deployment_name: Synchronizing shared items...\"\n\n @deployment_settings['shared'].each do |item|\n remote_shared_item_path = \"#{@deployment_settings['deployment_path']}/shared/#{item.gsub '.example', ''}\"\n remote_cache_item_path = \"#{@deployment_settings['deployment_path']}/cache/#{item}\"\n\n unless path_exists? remote_shared_item_path\n if item.include? '.example'\n create_base_folder_for_shared item\n copy remote_cache_item_path, remote_shared_item_path\n else\n raise(Exceptions::DeployerError, \"Non-example shared item #{item} is git-tracked, and cannot be sym-linked.\") if path_exists?(remote_cache_item_path)\n create_base_folder_for_shared item\n create_shared_item remote_shared_item_path\n end\n\n chmod 'g+w', remote_shared_item_path\n end\n end\n end", "title": "" }, { "docid": "965ec38e98e8a60e69e18cb7ddd07fbf", "score": "0.63412166", "text": "def share\r\n return unless validate_format\r\n return unless validate_signin\r\n app = App.find(:first, :conditions => [\"package=? and signature=? and version_code >=?\", params[:package], params[:signature], params[:version_code]])\r\n if app\r\n AppLocale.addUnlessNone(params[:lang], params[:country], app, params[\"name\"], params[\"version_code\"]) if params[\"name\"]\r\n Share.add(@current_user, app)\r\n else\r\n app = App.new(:package => params[:package], :signature => params[:signature])\r\n end\r\n api_response app.facade(@current_user, :lang => session[:lang]), \"app\"\r\n end", "title": "" }, { "docid": "603e7d1423b4bbe950442c4d8439b19a", "score": "0.63018984", "text": "def shareable\n @shareable\n end", "title": "" }, { "docid": "603e7d1423b4bbe950442c4d8439b19a", "score": "0.6299472", "text": "def shareable\n @shareable\n end", "title": "" }, { "docid": "4fc42415fd675e0641de2682bd412e63", "score": "0.6296599", "text": "def sharing; end", "title": "" }, { "docid": "0c055d044118a09cc3c49bf4daf5ef56", "score": "0.6294879", "text": "def shared_files\n if current_user.shared_files\n @assets = list_shared_assets\n end\n end", "title": "" }, { "docid": "9a50f82658cdde595a4ecfbf78bd68c2", "score": "0.62947387", "text": "def room_shared_with_user\n shared_access_allowed ? @room.shared_with?(current_user) : false\n end", "title": "" }, { "docid": "03ae2a3dcb2bee2553f3101d8a00ddfe", "score": "0.62865126", "text": "def shared_path\n \"/data/#{app_name}/shared\"\n end", "title": "" }, { "docid": "a8f2dc10e3e8a420fb2703a8c062b7ec", "score": "0.6246941", "text": "def items_shared_with_me\n url = base_api_url + \"/me/drive/sharedWithMe\"\n @shared_items = JSON.parse(HTTParty.get(url,headers: set_headers).body)\n end", "title": "" }, { "docid": "eafd02dd9ee345d99afe5bb4b5b25152", "score": "0.621408", "text": "def update_shared\n return if @update_shared.nil?\n \n users = @update_shared.split($/).collect do |ln|\n email = ln.strip\n if !email.empty?\n user = User.find(:first, :conditions => {'email' => email})\n \n if user.nil?\n # Make the user\n User.make_shared(email, page)\n else\n user\n end\n else\n nil\n end\n end.compact\n \n updated = false\n new_users = []\n self.shared_users.each do |user|\n if !user.member_of_owner? and !users.include?(user)\n # Don't include, make sure user is deleted if neccesary\n user.remove_shared\n updated = true\n else\n # Add this user\n new_users << user\n users.delete(user)\n end\n end\n \n # Add remaining users\n users.each { |user| \n new_users << user\n updated = true\n user.send_page_share_info(self) unless user.member_of_owner? \n }\n \n self.shared_users = new_users.uniq if updated\n end", "title": "" }, { "docid": "f49d452b51f01869b8836fdd9f8ac10d", "score": "0.61972266", "text": "def shares\n end", "title": "" }, { "docid": "df4b9ea7df17f744cf71dd3013781dda", "score": "0.61966455", "text": "def shared_path\n \"#{user_home_path}/shared\"\n end", "title": "" }, { "docid": "33291a2ec9d10cb915ee8d048caac9fa", "score": "0.61756915", "text": "def mobileapps\n end", "title": "" }, { "docid": "86198b7f67a936fb06e79867e070c7e8", "score": "0.617162", "text": "def index\n @users = Todoapp::User.all_user_except_one(current_user)\n @shares = Todoapp::Share.select_user_id.shared_users(params[:id])\n end", "title": "" }, { "docid": "59643aeaa73f3f7cf016a609e7a88db6", "score": "0.6165915", "text": "def share\n nil\n end", "title": "" }, { "docid": "d891cb51c018ff7258afc328f20e4e2d", "score": "0.6158047", "text": "def shared?\n !self.shared_folders.empty?\n end", "title": "" }, { "docid": "0afa46b6402e7848ee3f57708480e163", "score": "0.61544585", "text": "def user_apps\n Application.with_user(session['user_id'])\n end", "title": "" }, { "docid": "8d37461ca495757eeb7f5cb8293baa60", "score": "0.6128021", "text": "def share\n @other_users = User.where.not(id: current_user.id)\n @my_files = Document.where(user_id: current_user.id)\n @shared_document = SharedDocument.new\n end", "title": "" }, { "docid": "80965eb85c1fb34d51d3c528b81c08ca", "score": "0.61246544", "text": "def show\n # Finds all users that the asset is shared with\n set_shared_assets\n end", "title": "" }, { "docid": "f14d77140452f27aa48089cfb4939f7c", "score": "0.6102939", "text": "def users_for_shared_access\n errors.add(:access, :share_contact) if self[:access] == \"Shared\" && !permissions.any?\n end", "title": "" }, { "docid": "90c783870bc7c9ecb3e93481441c8065", "score": "0.61025524", "text": "def users_for_shared_access\n errors.add(:access, :share_account) if self[:access] == \"Shared\" && !permissions.any?\n end", "title": "" }, { "docid": "7f3d1753aef8b7e02420e520437e1ee1", "score": "0.6072726", "text": "def shared_with\n project_users = Shareable.get_results(:all, [\"select * from #{share_domain} where #{item_id_name} = ?\", self.id])\n user_ids = []\n options_hash = {}\n project_users.each do |puhash|\n puhash.each_pair do |k, v|\n puhash[k] = v[0]\n end\n puts 'puhash=' + puhash.inspect\n user_ids << puhash[\"user_id\"]\n options_hash[puhash[\"user_id\"]] = puhash\n end\n ret = ::User.find(:all, :conditions=>[\"id in ('#{user_ids.join(\"','\")}')\"]).collect do |u|\n def u.share_options=(options=nil)\n instance_variable_set(:@share_options, options)\n end\n\n def u.share_options\n instance_variable_get(:@share_options)\n end\n\n u.share_options=options_hash[u.id]\n u\n end\n ret\n end", "title": "" }, { "docid": "2f13c08d0daa1241552a37f918d81b50", "score": "0.6064891", "text": "def sharedfolders\n\t\t@folders = current_user.folders unless current_user.nil?\n\t\t@shared_folders = []\n\t\tSharefolder.where(:shared_owner => current_user.id).each do |sharedfolder|\n\t\t\t@shared_folders << Folder.find(sharedfolder.folder_id)\n\t\tend\n\tend", "title": "" }, { "docid": "9a2db8ba9cc93077c985a5dd16f7873f", "score": "0.60641056", "text": "def share\n @project = Project.find(params[:id])\n temp_projects = Project.where(owner_id: current_developer.id)\n if !temp_projects.include?(@project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to project_path\n return\n end\n gamers_ids = Developer.pluck(:gamer_id)\n @usernames_and_emails = Gamer.where(:id => gamers_ids).map{|gamer|gamer.username + \" \" + gamer.email}\n end", "title": "" }, { "docid": "3a0315b0d2026eae11d28f05a2970923", "score": "0.60632896", "text": "def machine_shares(machine)\n @config['shares'].each do |src, dst|\n machine.vm.synced_folder(\n src,\n dst,\n create: true,\n type: share_type,\n SharedFoldersEnableSymlinksCreate: false\n )\n end\n end", "title": "" }, { "docid": "218093ea2354d7a9ee4d8b52cfd40d75", "score": "0.6038721", "text": "def for_share\n lock_style(:share)\n end", "title": "" }, { "docid": "e5072440b7cf118950f67e4caa7134e6", "score": "0.59823924", "text": "def shared_users\n shares = Share.where(owner_id: self.user_id, medium_id: self.id)\n return User.find(shares.map(&:guest_id))\n end", "title": "" }, { "docid": "88386756f6d174e8963505985e6d95b1", "score": "0.596901", "text": "def shares_programme?(other_item)\n (programmes & other_item.programmes).any?\n end", "title": "" }, { "docid": "244ac0a5b43ddad0e9a38b47cae43824", "score": "0.59648854", "text": "def index\n @user_shareds = UserShared.all\n end", "title": "" }, { "docid": "dcd48505913fb71decb7a3ebae152557", "score": "0.5958227", "text": "def shared_to_me(user)\n\t\tif !group_id.nil?\n\t\t\treturn group.user_permissions[:administrator]\n\t\tend\n\n\t\t@school= School.find(self.school)\n\t\t@shared= SharedUsers.where(:user_id => user.id).first\n\t\tif @school != nil && @shared != nil\n\t\t\tif user.is_limited == false\n\t\t\t\tif @shared.owned_by == @school.owned_by\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif SharedSchool.where(:user_id => user.id, :school_id => @school.id).first.nil?\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "39aa52bddcca638b767373ed739d8630", "score": "0.5955", "text": "def copy_shared\n Dir.glob(File.join(app_dir, '..', 'shared', '**', '*')) do |path|\n shortened_path = path.match(/shared\\/(.+)/)[1]\n if File.directory?(path)\n run \"mkdir -p #{app_dir}/#{shortened_path}\"\n else\n run \"cp #{path} #{app_dir}/#{shortened_path}\"\n end\n end\nend", "title": "" }, { "docid": "326bea16d5d8839b53c7fd4bf706bfcb", "score": "0.5951948", "text": "def apps; end", "title": "" }, { "docid": "326bea16d5d8839b53c7fd4bf706bfcb", "score": "0.5951948", "text": "def apps; end", "title": "" }, { "docid": "326bea16d5d8839b53c7fd4bf706bfcb", "score": "0.5951948", "text": "def apps; end", "title": "" }, { "docid": "ac9d8dfe608ab58c1d0f1ca4cf985183", "score": "0.59477603", "text": "def add_to_shared_list_or_folder?\n true\n end", "title": "" }, { "docid": "9a96f7e8da9ba34d0869f548f179382d", "score": "0.5944651", "text": "def shared_with_me\n hash = Hash.new\n Notification.where(receiver_id: self._id, type: Notification::TYPE_SHARE).each do |n|\n share = Share.find(n.object_id_type)\n if share\n if hash.has_key? share.item\n hash[share.item] << share\n else\n hash[share.item] = [share]\n end\n end\n end\n\n return hash\n end", "title": "" }, { "docid": "19655d2f36004b2d9ceed3de4f4e57a6", "score": "0.5939748", "text": "def share(activity)\n self.act(activity, :share)\n end", "title": "" }, { "docid": "9456f4a4b24f14a45f396fcdefc7cd90", "score": "0.59348", "text": "def shared_url\n end", "title": "" }, { "docid": "51441cdceb7901730a77f08a690529e8", "score": "0.5929491", "text": "def index\n @apps = current_user.apps\n end", "title": "" }, { "docid": "9a6e5f2183849d40d55da29958bce474", "score": "0.591375", "text": "def myapps\n @applications = Application.where(publisher_email: current_user.email)\n end", "title": "" }, { "docid": "c400d93b0ed3486985779458507462d4", "score": "0.5883422", "text": "def shareable?\r\n shares.unshared.any?\r\n end", "title": "" }, { "docid": "378785887289306c1b54fc0ea648e7e0", "score": "0.5863357", "text": "def index\n @user = User.find_by(name: session[:user])\n @shareds = Shared.where(user_id: @user.id)\n end", "title": "" }, { "docid": "2052a60162c4b7733621f345476a1a22", "score": "0.5860441", "text": "def get_shared\n call(\"get-shared\")\n end", "title": "" }, { "docid": "2b8b5f38012b3399da385a7f68bc5e67", "score": "0.5842874", "text": "def get_clone_apps()\n # PYSIBLE_CLONE_APPS=/Users/yorrick/work/django_async\n if ENV.has_key?('PYSIBLE_CLONE_APPS')\n apps = ENV['PYSIBLE_CLONE_APPS'].split(',').to_set\n return Hash[apps.map { |host_app_path| [host_app_path.split(\"/\").last, host_app_path] }]\n else\n return {}\n end\nend", "title": "" }, { "docid": "94557d3e32ac3490b6409e91a996f601", "score": "0.5834192", "text": "def apps_block_windows_store_originated_apps\n return @apps_block_windows_store_originated_apps\n end", "title": "" }, { "docid": "fd716cfbc447c9c6ba46b5695eb2d578", "score": "0.5822926", "text": "def sharedimages\n\t\t@folders = current_user.folders unless current_user.nil?\n\t\t@shared_images = []\n\t\tShareimage.where(:shared_owner => current_user.id).each do |sharedimage|\n\t\t\t@shared_images << Image.find(sharedimage.image_id)\n\t\tend\n\tend", "title": "" }, { "docid": "165b42b1ceea761d036f37312a64010b", "score": "0.58223355", "text": "def can_assign_specific_app?(context, checked_app)\n if !context.logged_in? ||\n over? ||\n ![STATUS_PAUSED, STATUS_SETUP, STATUS_PRE_REGISTRATION].include?(status) ||\n app_owner != context.user ||\n app_id == checked_app.id\n false\n else\n true\n end\n end", "title": "" }, { "docid": "9feae8422fa9edc8744be8af41eff246", "score": "0.5819958", "text": "def shared_by?(user)\n Reminder.from_idea_by_user(self, user).size > 0\n end", "title": "" }, { "docid": "117fdf9b65d1ba9a7caa16b2f2eb2a43", "score": "0.58194435", "text": "def shared\n containers = current_user.shared_containers.map do |c|\n c.to_api\n end\n\n render response_ok containers\n end", "title": "" }, { "docid": "36c7d1da2cf727e6d3486ef592b8fbaa", "score": "0.58170867", "text": "def apps\n @apps || fill_in_apps\n end", "title": "" }, { "docid": "cb7b3ba63bc31558ad960733c459f82d", "score": "0.58143014", "text": "def share\n org = shift_argument || error(\"Must specify an organization name\")\n email = shift_argument || error(\"Must specify a user email address\")\n action \"Adding #{email} to #{org}\" do\n begin\n response = server[\"/buildpacks/#{org}/share/#{email}\"].post({})\n rescue RestClient::BadRequest => e\n error json_decode(e.http_body)[\"message\"]\n rescue RestClient::Forbidden\n error \"You do not have access to #{org}.\"\n rescue RestClient::Conflict\n error \"#{email} is already a member of #{org}.\"\n end\n end\n end", "title": "" }, { "docid": "7bcd6713415f360b87cc71c839d35100", "score": "0.5808408", "text": "def has_share_access?(collection) \n\n #has share access if the collection is one of one of his own \n return true if self.collections.include?(collection) \n\n #has share access if the collection is one of the shared_collections_by_others \n return true if self.shared_collections_by_others.include?(collection) \n\n return_value = false\n \n return false\nend", "title": "" }, { "docid": "8704f09685852949aeb6862085c834b6", "score": "0.58049566", "text": "def shared_to_me(user)\n @school= School.find(self.school)\n @shared= SharedUsers.find(:first, :conditions => { :user_id => user.id})\n if @school != nil && @shared != nil\n if user.is_limited == false\n if @shared.owned_by == @school.owned_by\n return true\n else\n return false\n end\n else\n if SharedSchool.find(:first, :conditions => { :user_id => user.id, :school_id => @school.id}).nil?\n return false\n else\n return true\n end\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "5ad96a67535a91190b97bd0fa48ffbf4", "score": "0.5804655", "text": "def apps\n track('CLI - Apps for User')\n render json: @current_user.apps_by_team\n end", "title": "" }, { "docid": "5cf2b29a7eabe3c6aa9f2df55e513a7f", "score": "0.5803576", "text": "def users_for_shared_access\n errors.add(:access, :share_campaign) if self[:access] == \"Shared\" && permissions.none?\n end", "title": "" }, { "docid": "bf77dfc39c71d696277011fe4799ffd2", "score": "0.5792607", "text": "def store; context.share_store; end", "title": "" }, { "docid": "0967749b9fa75900cf60b4f4136e699a", "score": "0.5781089", "text": "def file_shares\n getAssociators(HostToFileShareShortcut)\n end", "title": "" }, { "docid": "0c17513abee840c8aff8e542ae30313c", "score": "0.5778388", "text": "def project_sharing_user project_id, user_id\n get \"projects/#{project_id}/sharing/#{user_id}\"\n end", "title": "" }, { "docid": "451d4be7e7c06e1a39aba2e70d52b7bf", "score": "0.57697904", "text": "def check_and_assign_shared_ids_to_shared_folders\n # first check if the new user's email exists in any of the shared folder records\n shared_folders_with_same_email = SharedFolder.find_all_by_shared_email(self.email)\n \n if shared_folders_with_same_email\n # loop and update the shared user id with this new user id\n shared_folders_with_same_email.each do |shared_folder|\n shared_folder.shared_user_id = self.id\n shared_folder.save\n end\n end\n end", "title": "" }, { "docid": "35d6cf8cd96e2307bb377575f98bd5f0", "score": "0.5760537", "text": "def all_apps\n manifest[:applications]\n end", "title": "" }, { "docid": "2e3f1fbc71d7dae645313a6d4146dbda", "score": "0.5759909", "text": "def check_and_assign_shared_ids_to_shared_folders\n # first check if the new user's email exists in any of the shared folder records\n\n shared_folders_with_same_email = SharedFolder.where(shared_email: self.email)\n \n if shared_folders_with_same_email\n # loop and update the shared user id with this new user id\n shared_folders_with_same_email.each do |shared_folder|\n shared_folder.shared_user_id = self.id\n shared_folder.save\n end\n end\n end", "title": "" }, { "docid": "9f320ac036c9884b3f8c076a5508a534", "score": "0.57564324", "text": "def shared?\n sharing != 'none'\n end", "title": "" }, { "docid": "9f320ac036c9884b3f8c076a5508a534", "score": "0.57564324", "text": "def shared?\n sharing != 'none'\n end", "title": "" }, { "docid": "4f99921f2bb110987aa7b3a3b3036154", "score": "0.57499313", "text": "def shares\n @caldav_backend.shares(@calendar_info['id'])\n end", "title": "" }, { "docid": "5433c271e0c7d577f2117a912b471f13", "score": "0.5733301", "text": "def apps\n\t\t\tget_bh_collection 'apps'\n\t\tend", "title": "" }, { "docid": "fab0a5f7b06cb5af7ae542e15254c82e", "score": "0.57330215", "text": "def all_apps\n apps = []\n\n each_app do |app|\n apps << app\n end\n\n apps\n end", "title": "" }, { "docid": "fd0bd0f3b8fb5247c7bf1aa3ddeb07b3", "score": "0.57279336", "text": "def share()\n raise NotImplementedError\n end", "title": "" }, { "docid": "00cccbc8e00bc13520a378b363c37af3", "score": "0.57185125", "text": "def applications\n @applications ||= {}\n end", "title": "" }, { "docid": "386292ccacf829c9fdfaea4f371ccec2", "score": "0.57128245", "text": "def not_shared_project\n if params[:id] and !current_member.admin?\n version = Version.find(params[:id])\n if !version.model_file.projects.map { |project| project.share }.reduce{ |r,e| r && e }\n redirect_to root_path unless current_member.owns?(version.model_file)\n end\n end\n end", "title": "" }, { "docid": "722583643875558a74adadfe6570b111", "score": "0.57095915", "text": "def app_list\n Configuration.shared_apps_root.children.select(&:directory?).sort\n end", "title": "" }, { "docid": "dd190c2068744d635a9090073e71b570", "score": "0.57049567", "text": "def get_apps\n Palmade::AssetPackager.configuration.apps\n end", "title": "" }, { "docid": "fc339f1f28f6b477e7fd752c4acb1510", "score": "0.5700256", "text": "def multiple_applications_allowed?\n return false unless settings\n settings.multiple_applications.visible?\n end", "title": "" }, { "docid": "989a6919398915f654edd4938858acdf", "score": "0.5697271", "text": "def shares\n Resources::BaseFactory.new(self, 'Share')\n end", "title": "" }, { "docid": "ec1de8f64d30b3e8569ec5da3cc20d83", "score": "0.56941575", "text": "def applications\n @applications ||= {}\n @applications\n end", "title": "" }, { "docid": "955d0876e4fa6df82e6cec12618231cb", "score": "0.5674916", "text": "def roomsharing_permissions(user)\n if user.has_role?(:roomsharing) || user.has_role?(:company_admin)\n can :manage, Roommate\n can :manage, RoomsharingApplication\n else\n can [:new, :create, :show], Roommate\n end\n end", "title": "" }, { "docid": "0cc8686ab2e46a21af984dda207da982", "score": "0.56682026", "text": "def share\n share_on_facebook if @user.share_facebook\n end", "title": "" }, { "docid": "155a34bac49e16663da699c08e01aa02", "score": "0.5665119", "text": "def get_apps\n\t\tam = ErAppMember.where(er_user_id: session[:er_usr_parm])\n\t\trender json: am.to_json(include: :er_user_app) , status: 200\n\tend", "title": "" }, { "docid": "006ab5e46cba54e4a387e59ff854a494", "score": "0.5654291", "text": "def share?\n self.model_file.projects.map {|p| p.share}.reduce {|r,e| r&&e}\n end", "title": "" }, { "docid": "e56105031c1a11f420803f64456cf23b", "score": "0.5650341", "text": "def set_ShareWithPublic(value)\n set_input(\"ShareWithPublic\", value)\n end", "title": "" }, { "docid": "6fdf3534f68ef14324db860ef3de7a21", "score": "0.5638836", "text": "def shared? \n \t@shared_folder = SharedFolder.find_by_folder_id(self.id)\n \tif @shared_folder.nil?\n \t\tfalse\n \telse\n \t\ttrue\n \tend \n\tend", "title": "" }, { "docid": "cebfe68cf15728c8cd4dea84a9d98074", "score": "0.5626364", "text": "def shared_with_teams\n return @shared_with_teams\n end", "title": "" }, { "docid": "f997c35eed22457eb91bee65aef6cf29", "score": "0.5615501", "text": "def is_shared_by? user\n Rails.cache.fetch \"cache_is_shared_by_#{user.id}_#{id}\" do\n Share.where(user: user, content: self).any?\n end\n end", "title": "" }, { "docid": "438b72d16183650d414f70bdb65e8629", "score": "0.56128293", "text": "def project_sharing_user(project_id, user_id)\n get \"projects/#{project_id}/sharing/#{user_id}\"\n end", "title": "" }, { "docid": "ef41e31ba7b510b407569b8d8df06ae1", "score": "0.56122524", "text": "def index\n @shared_folders = SharedFolder.all\n end", "title": "" }, { "docid": "e8f48abfc66208d9ace94654b6c1a3c3", "score": "0.56114227", "text": "def shared_server_ids\n redis.smembers(\"servers:shared\")\n end", "title": "" }, { "docid": "003c4445db404df7a8fe78ec9f8d7805", "score": "0.56080216", "text": "def has_multiple_share_classes?\n !share_classes.empty?\n end", "title": "" }, { "docid": "9eb4f66a0edd0bed3c8f4bcbba7be41c", "score": "0.56037736", "text": "def index\n @mobile_apps = current_user.mobile_apps\n end", "title": "" }, { "docid": "611af918f11582efb6b85a4f6e64415f", "score": "0.56004906", "text": "def index\n @client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "611af918f11582efb6b85a4f6e64415f", "score": "0.56004906", "text": "def index\n @client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "8338e8df157d1b57c22881edb8997fec", "score": "0.5592595", "text": "def notify_and_share_admins\n mentioned_admins.each do |mentioned|\n # Here, Send an email\n entry = self.library_entries.create(sender_id: self.admin.id, receiver_id: mentioned.id, admin_library_id: mentioned.library.id, shared: true)\n if entry.valid?\n Notification.create(recipient: mentioned, actor: self.admin, action: \"shared\", notifiable: self)\n end\n end\n end", "title": "" }, { "docid": "5731722e76dc9f85f68cfc43753ace46", "score": "0.5590576", "text": "def reset_apps\n @apps = Hash.new(false)\n @apps.merge!(DEFAULT_APPS)\n end", "title": "" }, { "docid": "0eb6c3dce3922d2e7e5fcc62341163ac", "score": "0.55886877", "text": "def common_friends\n \n end", "title": "" }, { "docid": "1b7e3a56cc99a62af0b99b410959167b", "score": "0.5567369", "text": "def shareable=(value)\n @shareable = value\n end", "title": "" }, { "docid": "1b7e3a56cc99a62af0b99b410959167b", "score": "0.5567369", "text": "def shareable=(value)\n @shareable = value\n end", "title": "" }, { "docid": "ee0d170b244730cbaa429c8c6f787ed0", "score": "0.55580944", "text": "def is_shared\n return @is_shared\n end", "title": "" }, { "docid": "ee0d170b244730cbaa429c8c6f787ed0", "score": "0.55580944", "text": "def is_shared\n return @is_shared\n end", "title": "" }, { "docid": "86802adc31e91830a829352314638133", "score": "0.55491865", "text": "def friends_sharing_calendars\n friends( nil, nil, true )\n end", "title": "" } ]
ec90c1236c017f762d8b9491615ea5a1
We want to be able to iterate over news items
[ { "docid": "fef371d83a663910e318d4c8700d4d50", "score": "0.0", "text": "def virtual?\n false\n end", "title": "" } ]
[ { "docid": "6e0773863164f80ea7ffc4f3acac375e", "score": "0.772402", "text": "def items\n @news_feed.items\n end", "title": "" }, { "docid": "46694295fc3339271ba9df0828f61fa3", "score": "0.70307994", "text": "def index\n @news_items = NewsItem.formatted_list\n end", "title": "" }, { "docid": "7904517f2bf263b86af645e85a5c2201", "score": "0.69334143", "text": "def index\n\t\trespond_with @news_items = NewsItem.all\n\tend", "title": "" }, { "docid": "f6dcbcf9ec690278f2359c12b4cf97cc", "score": "0.6852738", "text": "def get_news_list(page=1)\n news_list = []\n doc = Nokogiri::HTML(open(\"#{URL}?p=#{page}\"))\n doc.xpath(\"//body//table[@id='hnmain']//table[@class='itemlist']//tr\").select{|tr| tr['class'].in? ['athing', nil]}.each_slice(2) do |nodes|\n title_node, meta_node = nodes\n next if title_node.nil? || meta_node.nil?\n\n id = title_node.xpath(\"./td\").first&.content&.gsub('.', '').to_i\n title = title_node.xpath(\"./td[@class=$t]/a\", nil, t: 'title').first&.content\n site = title_node.xpath(\"./td[@class=$t]/span/a\", nil, t: 'title').first&.content\n original_url = title_node.xpath(\"./td[@class=$t]/a\", nil, t: 'title').first['href']\n original_url = is_internal_link?(original_url) ? \"#{SITE}/#{original_url}\" : original_url\n\n score = meta_node.xpath(\"./td[@class=$t]/span[@class=$c]\", nil, t: 'subtext', c: 'score').first&.content&.split(' ')&.first&.to_i\n user = meta_node.xpath(\"./td[@class=$t]/a[@class=$c]\", nil, t: 'subtext', c: 'hnuser').first&.content\n created_time = meta_node.xpath(\"./td[@class=$t]/span[@class=$c]\", nil, t: 'subtext', c: 'age').first&.content\n comments = meta_node.xpath(\"./td[@class=$t]/a[last()]\", nil, t: 'subtext').first&.content&.split(' ')&.first\n begin\n detail_doc = Nokogiri::HTML(open(original_url))\n rescue\n # TODO notify admin\n next # skip this news\n end\n\n cover_image = (img = detail_doc.xpath(\"//meta[@property='og:image']\").first) ? img['content'] : nil\n cover_image ||= (img = detail_doc.xpath(\"//img\").first) ? img['src'] : nil\n cover_image = URI.join(original_url, cover_image).to_s if cover_image.present?\n # default cover image of news\n cover_image ||= \"https://news.ycombinator.com/y18.gif\"\n content = detail_doc.xpath(\"//p\").map(&:content)\n\n news = {\n id: id,\n title: title,\n site: site,\n original_url: original_url,\n score: score,\n user: user,\n created_time: created_time,\n comments: comments,\n cover_image: cover_image,\n content: content\n }\n\n news_list.push(news)\n end\n news_list\n end", "title": "" }, { "docid": "3e6bab6c0f98638cf9e33e5a0b42eeae", "score": "0.68227255", "text": "def get_news_items\n news_items = @feed_urls.each_with_object(Array.new) do |url, items|\n open(url) do |rss|\n feed = RSS::Parser.parse(rss)\n items.concat feed.items\n end\n end\n return news_items.empty? ? nil : news_items\n end", "title": "" }, { "docid": "4c185d8d8fc85e60cbe41e3bd9efa157", "score": "0.68033177", "text": "def newsCategoryGetter(bot, chat, title, category, id)\r\n json = news_category_handler(category, id)\r\n news = json['result'].each do |result|\r\n items = result['items']\r\n newsSender(items, bot, chat)\r\n end\r\nend", "title": "" }, { "docid": "db25fb0a3f8a0f976fc4ee45c4f8cae9", "score": "0.67363083", "text": "def feed_items\n feed_item\n end", "title": "" }, { "docid": "5bf278a46f1c983d58bfcb834e8667d6", "score": "0.6732519", "text": "def index\n @newsitems = Newsitem.all\n end", "title": "" }, { "docid": "1d1229e583dbbb7b368cfa4f6cce3a5e", "score": "0.6699697", "text": "def news_list\n @activities = PeClass.find_news(current_user.id)\n \n end", "title": "" }, { "docid": "5f353d153bbe6ca85fa222a87899c63c", "score": "0.6697015", "text": "def index\n @stack_overflow_news_items = StackOverflowNewsItem.all\n end", "title": "" }, { "docid": "646efc74ace896e015094e6cc2a92809", "score": "0.6628021", "text": "def find_recent_news_items\n @news_items = @news_archive.news_items.accessible.page(params[:page]).per(@max_news_items).to_a\n @latest_news_items = []\n\n if params[:page].blank? || params[:page].to_i == 1\n @latest_news_items = @news_items[0..@featured_news_items-1] if @featured_news_items > 0\n @news_items_for_table = @news_items[@featured_news_items..@max_news_items-1] if @featured_news_items < @max_news_items\n end\n end", "title": "" }, { "docid": "46e8bab818dc42b18aaa513bae93a7b9", "score": "0.6612959", "text": "def index\n @github_news_items = GithubNewsItem.all\n end", "title": "" }, { "docid": "f43b4b871340339f4af0826aa522d37f", "score": "0.6602795", "text": "def update_news_items\n # Destroy old items\n news_items.delete(news_items.all(include: :node, conditions: ['nodes.publication_start_date < ?', (Settler['news_viewer_time_period'] ? Settler['news_viewer_time_period'].to_i : 2).weeks.ago]))\n # Add any news items from the archives\n news_archives.each { |news_archive| news_archive.news_items.newest.each { |item| self.news_items << item rescue nil } }\n end", "title": "" }, { "docid": "0df74d349fed33a09b96c86004232c86", "score": "0.6596117", "text": "def list_articles_by_title\n NewsFeedProject::Article.all.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.title}\"\n end \n menu\n end", "title": "" }, { "docid": "85eaa293151bc4eea08484eb58d8c586", "score": "0.65933156", "text": "def news\n self.related_items.map {|rel| rel.eventable if rel.eventable.is_a?(News)}.compact\n end", "title": "" }, { "docid": "5df7dd45351e5334385ba369e09ec74a", "score": "0.6589491", "text": "def fetchArticle(i)\n # RSS source: news.google.com (Taiwan version)\n feed = \"https://news.google.com/news/feeds?pz=1&cf=all&ned=tw&hl=zh-TW&output=rss\"\n result = []\n bodyStr = \"\"\n rss = SimpleRSS.parse open(feed)\n #for i in 0...5#d.entries.length\n title = rss.entries[i].title\n source_url = rss.entries[i].link\n source_url = source_url.split(\"url=\").last\n doc = Nokogiri::HTML.parse(open(source_url))\n #body_text = []\n #line = doc.gets\n #while line\n #if line.start_with?(\"<p>\")\n #end\n #line = doc.gets\n doc.search('p').each do |line|\n bodyStr << line.text\n end\n\n # for p in body_text\n # bodyStr << p\n # #bodyStr << '\\n'\n # end\n\n #doc.close()\n #break\n #end\n result.push(title)\n result.push(bodyStr)\n result.push(source_url)\n return result\n end", "title": "" }, { "docid": "ff1aa2121feed8f2d5c8045e355e6653", "score": "0.65869224", "text": "def show\n @news_items = @coin.feed_items.order(created_at: :desc)\n end", "title": "" }, { "docid": "1c3551904d27e1c8bd323f5167059f39", "score": "0.65744734", "text": "def newsSender(news, bot, id)\r\n news[0..4].each do |item|\r\n sendResponse(bot, id, \"#{item['title']} \\n\\n #{item['shortUrl']}\")\r\n end\r\nend", "title": "" }, { "docid": "57a91ef308168e9fad776bdd34ab6fc1", "score": "0.65734106", "text": "def get_new_articles\n # Download the RSS feed and save to self.doc\n get_source\n \n # Keep track of which articles are in the feed \n articles = []\n \n # For each item in the RSS feed \n (self.doc/'item').each_with_index do |item, index| \n # Create or update the article in the db\n articles << Article.factory(\n :category => self.category,\n :description => (item/'description').inner_html,\n :feed => self,\n :url => (item/'link').inner_html,\n :priority => index\n )\n end\n \n articles\n end", "title": "" }, { "docid": "77f7c4b192b7d3d54ff27c169c3dae33", "score": "0.65726024", "text": "def search_news(bot, chat, query)\r\n response = search_news(query)\r\n news_ids = []\r\n news = response['result']['items']\r\n news[0..4].each do |item|\r\n news_ids.push(item['id'])\r\n end\r\n news_json = get_news(news_ids)\r\n new_json = news_json['result']['items']\r\n newsSender(new_json, bot, chat)\r\nend", "title": "" }, { "docid": "ea831880d93691b7dca7c1db2d875772", "score": "0.65128946", "text": "def find_recent_news_items\n @news_items = @news_archive.news_items.accessible.includes(:node).page(1).per(25)\n @news_items_for_table = @news_items.to_a\n @latest_news_items = @news_items_for_table[0..7]\n @news_items_for_table -= @latest_news_items\n end", "title": "" }, { "docid": "7eb017a5678e10939de7422514fb1912", "score": "0.6512788", "text": "def index\n @reddit_news_items = RedditNewsItem.all\n end", "title": "" }, { "docid": "5652862af9a00440f5263730f50e5ec6", "score": "0.6509326", "text": "def fetch_feed_items\n open(url) do |rss|\n feed = RSS::Parser.parse(rss)\n feed.items.each do |item|\n feed_items << FeedItem.create(title: item.title, link: item.link, pub_date: item.pubDate)\n end\n end \n end", "title": "" }, { "docid": "39d2aeb3cc3648acd8781c0cf50d5f26", "score": "0.6503899", "text": "def read_news\n end", "title": "" }, { "docid": "eaa325d54572d0890636effcc45f1241", "score": "0.64616144", "text": "def news_list\n @activities = PeClass.find_news(session[:user_id])\n \n end", "title": "" }, { "docid": "6a9464065b8348949df20bd2e902d5b2", "score": "0.64155805", "text": "def each\n raise \"Expected a block\" unless block_given?\n rss.items.each do |item|\n yield item\n end\n end", "title": "" }, { "docid": "edb15ff298093463292131a8e4b8980e", "score": "0.64155656", "text": "def load_news\n feed = Array.new\n news = Feed.all.order(created_at: :desc).limit(4)\n news.each do |item|\n feed.push(item.generate_metadata)\n end\n @news = feed\n end", "title": "" }, { "docid": "74f377982332544e7499dc351b584e2a", "score": "0.6410993", "text": "def news_feed\n @news_feed ||= parse_feed\n end", "title": "" }, { "docid": "861b95e6b5aa7b384602b3b7011b9f81", "score": "0.64093935", "text": "def feed_items\n self.feed_item\n end", "title": "" }, { "docid": "e53be5522b87bd77273f66ac3f6794d9", "score": "0.6391242", "text": "def accessible_news_items(options = {})\n news_items.newest.accessible.scoped({ order: 'news_viewer_items.position, nodes.publication_start_date DESC' }.merge(options))\n end", "title": "" }, { "docid": "0b14959315458b815f20a5226a29ea8c", "score": "0.6337575", "text": "def news_links\n visit LIST_URL\n\n links = doc.css(\".listing ul li a\").collect do |anchor|\n link = Link.new\n link.title = anchor.text\n link.url = URI::join(LIST_URL, anchor[\"href\"]).to_s\n link\n end\n links\n end", "title": "" }, { "docid": "5a7ca7d61feda73751e61976f4d2f8ee", "score": "0.6297584", "text": "def list_headlines\n \n \n NprCliProject::Scraper.make_stories\n @news = NprCliProject::NPR.all\n #binding.pry \n \n count = 1 \n @news.each do |news_stories|\n puts \"#{count}. \" + news_stories.headline \n count +=1 \n end \n puts \"\"\n end", "title": "" }, { "docid": "2182a893723c99c3266c55268a1cdc30", "score": "0.6284821", "text": "def process_news(total = 25)\n items.map.with_index do |item, num|\n @headlines << format_headline(item, num) if total_met?(total)\n end.compact || nil\n end", "title": "" }, { "docid": "142c386c06707faaa544be54bf1a9cb4", "score": "0.628437", "text": "def getTrumpCNNStories\n stories = []\n doc = Nokogiri::XML(open(CNN_NEWS_URL))\n doc.xpath('//item/title').each do |title| \n break if stories.length > 25\n if title.content.downcase.include? \"trump\"\n link = title.parent.css('link').first.content\n stories << {title: title.content, \n link: link,\n body: getCNNStoryBody(link)}\n end\n end\n stories\nend", "title": "" }, { "docid": "38e32beca36ab4d12479fee25e8049ed", "score": "0.62819195", "text": "def pullItems\n (1..80).each do |num|\n begin\n feed = Nokogiri::XML(open('https://edwardsnowden.com/feed?paged='+num.to_s))\n feed.xpath('//item').each do |i| \n item_parsed = parseItem(i)\n if item_parsed[:categories].include? \"Revealed documents\"\n @results.push(parseItem(i))\n end\n end\n rescue\n end\n end\n \n JSON.pretty_generate(@results)\n end", "title": "" }, { "docid": "055cd872c884518a88d1b153ff68cd7c", "score": "0.62786496", "text": "def articles\n posts = @items.select {|item| item.identifier =~ %r{^/post} }\n # Setup some things that the Blogging module expect\n posts.each do |item|\n item[:kind] ||= \"article\"\n item[:created_at] ||= extract_post_created_at(item)\n item[:subtitle] ||= (time = attribute_to_time(extract_post_created_at(item))).strftime(\"%A %e#{time.day_ordinal_suffix} of %B %Y\")\n end\n posts\n end", "title": "" }, { "docid": "f13f9e5dde33c51d233e3b18aad26790", "score": "0.6274768", "text": "def index\n @news_items = NewsItem.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 4\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @news_items }\n end\n end", "title": "" }, { "docid": "35194ec1882da06b6d91909ed3a5eb82", "score": "0.6270545", "text": "def items\n self.newsletter_edition_items.order('position ASC').all.map { |ed_item| ed_item.item }\n end", "title": "" }, { "docid": "0ccf16f71aaa185de6becedbb113bab6", "score": "0.62657243", "text": "def save_rss_stories\n all_rss_feed_items.each do |item|\n News_rss.create(pub_date: \"#{item.pubDate}\",\n headline: \"#{item.title}\",\n url: \"#{item.link}\",\n pic_url: nil,\n source_name:nil,\n summary: nil,\n # source_name: \"#{rss_url.channel.title}\", #ask john, how to get this\n # summary: \"#{item.description[0..140]}<a href='#{item.link}'>...</a>\", #possibly use for feedly\n keywords: nil)\n end\n end", "title": "" }, { "docid": "dd52f6cc1d75d34e1fb8fed3ccd879e9", "score": "0.62533045", "text": "def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\n end", "title": "" }, { "docid": "8f2bef02ef3111867c298ca82526bfc8", "score": "0.62455094", "text": "def read_all_items\n open(@feed_start_url) do |rss|\n feed = RSS::Parser.parse(rss)\n puts \"Title: #{feed.channel.title}\" unless @options.quiet\n feed.items.each do |item|\n puts \"Item: #{item.title}\" unless @options.quiet\n end\n end\n\n end", "title": "" }, { "docid": "534bc25975919bc24e2f3fb8161098a2", "score": "0.6243578", "text": "def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\nend", "title": "" }, { "docid": "c8b7b79f7f6f41472241a5b387238293", "score": "0.6224699", "text": "def fetch \n items = []\n # File.open(options[:feeds], 'r').each_line { |f| }\n options[:feeds].each { |url|\n p \"Fetching: #{url}\"\n open(url) do |rss| \n doc = Nokogiri::XML(rss.read) # Nokogiri::XML::ParseOptions::NOCDATA\n doc.xpath('//item').map do |i|\n items << { \n title: i.xpath('title').text, \n description: i.xpath('description').text, \n link: RSS::Util.item_source_url(i),\n image: RSS::Util.item_image_url(i), \n category: i.xpath('category').text, \n pubDate: Time.parse(i.xpath('pubDate').text)\n }\n end\n end \n } \n items.sort_by { |k| k[:pubDate] }.reverse \n end", "title": "" }, { "docid": "9bd0cc34ced3387ed93e369125b6237c", "score": "0.6223507", "text": "def index\n @news_items = NewsItem.find(:all, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "title": "" }, { "docid": "da851f9fdad226835bcb3317188aa8b7", "score": "0.621573", "text": "def scrape\n @articles = []\n # CODE HERE\n @feed.items.each do |item|\n # set different items to article object\n article = Article.create(author: nil,\n title: item.title.delete(','),\n summary: item.description.to_s.delete(','),\n imageURL: nil,\n source: THEAGEImporter.source_name,\n pubDate: DateTime.parse(item.pubDate.to_s),\n link: item.link)\n # DEBUGGING\n puts \"Successfully scraped one article:\\nTitle:#{article.title}\"\n @articles << article\n end\n @articles\n end", "title": "" }, { "docid": "4c632475570f5f80a6cbcf4ca07225b2", "score": "0.62118137", "text": "def articles\n posts = @items.select {|item| item.identifier =~ %r{^/post} }\n # Setup some things that the Blogging module expect\n posts.each do |item|\n item[:kind] ||= \"article\"\n item[:created_at] ||= extract_post_created_at(item)\n item[:title] ||= extract_post_title(item)\n end\n posts\n end", "title": "" }, { "docid": "6321c81f4dc5fab934d4a87891e54d83", "score": "0.62108606", "text": "def parse_rss(media)\n url = media.url\n Nokogiri::XML(open(url)).css('item').map do |item|\n NewsItem.new(\n media: media,\n title: item.css('title').text,\n short_text: item.css('description').text,\n url: item.css('link').text\n )\n end\nend", "title": "" }, { "docid": "56276fa40533d519fe2b2595b51b33c6", "score": "0.6203681", "text": "def get_org_unit_news_items(org_unit_id, since = \"\")\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/news/\"\n path += \"?since=#{since}\" if since != \"\"\n _get(path)\nend", "title": "" }, { "docid": "7d96d9d14aac45fb8428f737d229b2c9", "score": "0.6175067", "text": "def scrape\n # Define the url\n url = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_topstories_2803.xml'\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 # Iterate each item and scrape information\n feed.items.each do |item|\n \n # Check if there is information on author or not\n if item.source == nil\n author = nil\n else\n author = item.source.content\n end\n \n # Check if there is information on image or not\n if item.enclosure == nil\n images = nil\n else\n images = item.enclosure.url\n end\n\n # Store infomation into HeraldArticle object\n temp = News::HeraldArticle.new(\n author: author,\n title: item.title,\n summary: item.description,\n images: images,\n source: item.link,\n date: item.pubDate,\n guid: item.guid.content\n )\n \n # Put the object into articles array\n @articles << temp\n end\n \n end\n # Return the array of articles\n @articles\n end", "title": "" }, { "docid": "0088d6508b5718007e6dff5de56af7a0", "score": "0.61709905", "text": "def parse_feed(title, url)\n xml = HTTParty.get(url).body\n feed = Feedjira.parse(xml)\n\n f = Feed.new(title)\n feed.entries.each_with_index do |e, i|\n f.add_news(i+1,\n e.title.to_s,\n e.url.to_s,\n ' ')\n # print(\"num #{i} : #{e.title} #{e.url}\\n\")\n end\n f\nend", "title": "" }, { "docid": "d67297f983ea70e9457f4dbdfcdcd8ce", "score": "0.61606365", "text": "def news\n end", "title": "" }, { "docid": "6e9a5024c1ec1f91e3496d873297a6fd", "score": "0.6155137", "text": "def add_news_to_entries\n feed = Feedjira::Feed.fetch_and_parse(config[\"url\"])\n feed.entries.take(@config[\"consume_top\"].to_i).each do |entry|\n next if @entries.any? {|e| e[:link] == entry.url} # skip duplicate entries\n @entries << { \n title: entry.title,\n summary: entry.summary,\n link: entry.url\n } # entry.published\n end\n end", "title": "" }, { "docid": "cfa73bb3ac46c586112411968b8b77eb", "score": "0.61539227", "text": "def articles\n page.search(\".view-content article\")\n .take(5)\n .map { |article| parse_article(article) }\n end", "title": "" }, { "docid": "0772bf4bb597c05a485154714d7d0683", "score": "0.6153452", "text": "def index\n set_news_list\n end", "title": "" }, { "docid": "12572a12f736c56336ce7bebe96fb124", "score": "0.6151752", "text": "def get_news\n @titles = []\n\n source = params[:s]\n if source\n @news = get_news_from_source(source)\n @page_title = source\n\n @news.each do |sitenews|\n sitenews.each do |sitenew|\n if sitenew[\"shows\"]\n sitenew[\"shows\"].each do |show|\n @titles << \"#{sitenew[:article].title} (about the show #{show[:x]})\"\n end\n end\n if sitenew[\"people\"]\n sitenew[\"people\"].each do |person|\n @titles << \"#{sitenew[:article].title} (about the person #{person[:x]})\"\n end\n end\n end\n end\n end\n \n render \"fetcher/fetcher\"\n end", "title": "" }, { "docid": "0cd45f8161ce9995f2574156da428f95", "score": "0.614394", "text": "def index\n @trending_weekly_news_items = TrendingWeeklyNewsItem.all\n end", "title": "" }, { "docid": "ee8e6ecd4a8f23cbec1301ca8394d09f", "score": "0.6141042", "text": "def index\n @community_news = CommunityNews.all.page(params[:page]).per(10)\n end", "title": "" }, { "docid": "b69ce9daf778e84e845f8a3091741a8d", "score": "0.6136001", "text": "def index\n @trending_daily_news_items = TrendingDailyNewsItem.all\n end", "title": "" }, { "docid": "8c0285b5fd9631519a51e8c105f01080", "score": "0.6126925", "text": "def get_news_feed(user_id)\r\n \r\n end", "title": "" }, { "docid": "139ca1efa96e3e532ea31c146d127e49", "score": "0.61053264", "text": "def newsfeed\n @activities = current_user.get_activities\n end", "title": "" }, { "docid": "87e9998aa4869a80d81750c8d4ac68b4", "score": "0.6089406", "text": "def list\n return unless has_permission :can_post_news\n @page_title = 'Posted News'\n @document_pages, @documents = paginate :news_article, :order_by => '-id', :per_page => 25 \n end", "title": "" }, { "docid": "b44e1f22788224c3a5479f6ac92ce527", "score": "0.6084303", "text": "def index\n @trending_monthly_news_items = TrendingMonthlyNewsItem.all\n end", "title": "" }, { "docid": "ca9308c1dd9eeb079b2758a05e02e94a", "score": "0.60773957", "text": "def index\n @news = news.page(params[:page]).per_page(20)\n end", "title": "" }, { "docid": "238b0c8269ad2dbf3399ff78e6803b9e", "score": "0.607112", "text": "def get_news_feed(user_id)\n \n end", "title": "" }, { "docid": "238b0c8269ad2dbf3399ff78e6803b9e", "score": "0.607112", "text": "def get_news_feed(user_id)\n \n end", "title": "" }, { "docid": "9608004c0c1285344719f02bcd224a5d", "score": "0.6052379", "text": "def index\n @news = @user.news.paginate(:page => params[:page], :per_page => 10)\n end", "title": "" }, { "docid": "fd814b5160ee9f98b88029137602b4c2", "score": "0.6038924", "text": "def world_news\n @client.request_cmd(\n {\n 'world_news_get_list' => 1,\n 'app_version' => @version\n }\n )\n end", "title": "" }, { "docid": "05cefaa113ffa9eefb5563476f83fac6", "score": "0.60260504", "text": "def each_list_item; end", "title": "" }, { "docid": "05cefaa113ffa9eefb5563476f83fac6", "score": "0.60260504", "text": "def each_list_item; end", "title": "" }, { "docid": "300579c01c44afc7ba164b1bd4143f67", "score": "0.6021783", "text": "def post_data\n rss = RSS::Parser.parse(@news_url, false)\n rss.items.each do |item|\n response = HTTParty.post(\"#{@@base_uri}channels/#{@channel_id}/posts\",\n headers: {\n \"Authorization\" => @@api_key,\n \"Content-Type\" => \"application/json\"\n }, \n body:{\n \"contents\": {\n \"en_US\": {\n \"content\": \"#{item.description}\",\n \"teaser\": \"New Article!!!\",\n \"title\": \"#{item.title}\", \n \"image\": \"#{item.enclosure.url}\"\n }\n }\n }.to_json \n ) \n end\n end", "title": "" }, { "docid": "58dfad8775590d9bbb59ce2d9506be7d", "score": "0.60203", "text": "def home_news\n NewsItem.latest(2)\n end", "title": "" }, { "docid": "fab06c6925117a676a69a43fec2cfac3", "score": "0.6017093", "text": "def index\n @news = current_author.news.most_recent.list_for(params[:page], params[:tag])\n end", "title": "" }, { "docid": "9eadb7689ad000ef0d1d0d53c6c56c6a", "score": "0.60163665", "text": "def index\n @api_v1_news_feed_links = Api::V1::NewsFeedLink.all\n end", "title": "" }, { "docid": "7be7127420f924bf6e7e4e1ad94e51f1", "score": "0.6008917", "text": "def index\n @unisys_news = UnisysNews.all\n end", "title": "" }, { "docid": "5609298110706d29218bb713ac7506b6", "score": "0.6004727", "text": "def get_news\n\t@espn_json_2 = JSON.load(RestClient.get(\"http://api.espn.com/v1/sports/soccer/fifa.world/teams/#{@storage[@user_input]}/news?apikey=6rm42hyheg2795t9tpgrymmw\"))\n\t@espn_json_2[\"headlines\"].each do |x|\n\t\tif x[\"secondaryDescription\"] == nil\n\t\t\t\tputs x[\"headline\"]\n\t\t\telse\n\t\t\t\tputs x[\"headline\"]\t\n\t\t\t\tputs \" \" + x[\"secondaryDescription\"]\n\t\t\t\tputs \"\"\n\t\t\tend\n\t\t@news_array << x[\"headline\"]\n\tend\nend", "title": "" }, { "docid": "19d60c2342e8df837afc256b41b94fcf", "score": "0.6004455", "text": "def feed_items(most_recent = true)\n if logged_in?\n \n # Configure sorting method\n if most_recent && @agent.page.link_with(:text => 'Most Recent')\n @agent.page.link_with(:text => 'Most Recent').click\n elsif !most_recent && @agent.page.link_with(:text => 'Top News')\n @agent.page.link_with(:text => 'Top News').click\n end\n \n # Scrape the feed items\n feed_items = []\n @agent.page.search(\"#m_stream_stories/div\").each_with_index do |item, index|\n name = item.search(\"a/strong\").text.strip\n content = item.search(\"span\").text.strip\n timestamp = item.search(\"div/abbr\").text.strip\n feed_item = {:name => name, :content => content, :timestamp => timestamp}\n feed_items[index] = feed_item\n end \n return feed_items\n end\n false\n end", "title": "" }, { "docid": "b6aa05956c70b992c7f6c24f7fbcfe82", "score": "0.6000541", "text": "def show\n # @news = News.find(params[:id])\n \n # just show all news items for now\n index\n end", "title": "" }, { "docid": "7e0a925772143b568dcba08edaedbbd9", "score": "0.5981363", "text": "def crawl\n update_all_feeds\n fetch_and_store_articles\n end", "title": "" }, { "docid": "e9dfab0a2bce8647516aa6d9ac3f0416", "score": "0.59805804", "text": "def index\n @news_pieces = NewsPiece.all\n end", "title": "" }, { "docid": "406f6f54b6347b936428439cb11f7860", "score": "0.5975283", "text": "def index\n @news_posts = NewsPost.all\n end", "title": "" }, { "docid": "50a197b74bd090e2510deb69895e4b2b", "score": "0.59690875", "text": "def feeds; end", "title": "" }, { "docid": "2139dd153dde6d2bf9773314e3526269", "score": "0.5966364", "text": "def scrape\n\t\turl = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_technology_2790.xml'\n open(url) do |rss|\n \tfeed = RSS::Parser.parse(rss, false)\n \tputs \"Title: #{feed.channel.title}\"\n puts \"*********************************\"\n puts \" \"\n feed.items.each do |item|\n tags = tag_article(item.title.to_s.gsub(/\"/,'\\''))\n \tarticle = Article.new(title: item.title.to_s.gsub(/\"/,'\\''), \n summary: item.description.to_s.gsub(/&#8217;/,'\\'').gsub(/\\\"/,'\\''), \n image: item.enclosure.url, \n link: item.link,\n date: item.pubDate.to_s.gsub(/,/,'').gsub(/\\\"/,'\\'').gsub(/'s/,''), \n tag_list: tags, \n source: \"Herald Sun\")\n article.save\n end\n end\n end", "title": "" }, { "docid": "e0ff10ee11312a40111d8c9ceaba9f75", "score": "0.5959723", "text": "def show\n @subscription = current_user.subscriptions\n .joins(:feed)\n .find_by! feed_id: params[:id]\n @feed = @subscription.feed\n @entries = @subscription.entries.includes(:newsitem).for_view.page params[:page]\n end", "title": "" }, { "docid": "8c781c5861de439ae96b4ea8c4706857", "score": "0.5955277", "text": "def index\n @news = News.all.page(params[:page]).per(10)\n end", "title": "" }, { "docid": "0f53a3f3466ffc2c6a2f5d6a096464f0", "score": "0.5949821", "text": "def last_news\n limit = @opts[:limit] || 3\n entries = DcNews.only(:created_by_name, :link, :subject, :created_at)\n .where(active: true) \n .order_by(created_at: -1).limit(limit).to_a\n\n entries.inject('') do |result, element|\n result << @parent.link_to(\"/news/#{element.link}\") do \n %Q[<div>\n <span class=\"date\">#{@parent.dc_pretty_date(element.created_at)} : </span>\n <span class=\"title\">#{element.subject}</span>\n </div>].html_safe\n end\n end\nend", "title": "" }, { "docid": "bba61f133c8b9d02f85e905957864d07", "score": "0.5945624", "text": "def index\n @news_posts = NewsPost.page(params[:page])\n end", "title": "" }, { "docid": "c46b2674dd6f51ac168782e1e3d4fc26", "score": "0.5945516", "text": "def scrape\n @articles = []\n # CODE HERE\n url = 'http://www.abc.net.au/sport/syndicate/sport_all.xml'\n open(url) do |rss|\n feed = RSS::Parser.parse(rss)\n feed.items.each do |item|\n title = item.title\n summary = item.description\n pub_date = DateTime.parse(item.pubDate.to_s)\n link = item.link\n # set different items to article object\n # how to get author, image ?\n article = Article.create(author: nil,\n title: title,\n summary: summary,\n imageURL: nil,\n source: ABCImporter.source_name,\n pubDate: pub_date,\n link: link)\n @articles << article\n # DEBUGGING\n puts \"Successfully scraped one article:\\nTitle:#{article.title}\"\n end\n end\n @articles\n end", "title": "" }, { "docid": "d42799abd378d451a8041ac04634d46a", "score": "0.59446824", "text": "def clubs_news\r\n @news = NewsItem.club_news.latest_first.find(:all, :limit => 15)\r\n set_headers\r\n record_stats('site_news')\r\n render :action => :site_news\r\n end", "title": "" }, { "docid": "b5e2eed86b6bdb4016f1b58c1472c023", "score": "0.5941878", "text": "def parse_news(webpage)\n agent = Mechanize.new\n # 39 => index for news link for a given sport\n main = \"https://ohiostatebuckeyes.com\"\n news_page_ref = webpage.links_with(href: /news/, text: /News/)[39].href.to_s #index of the specific sport news\n news_page = agent.get main + \"#{news_page_ref}\"\n news_articles = Array.new\n current_yr = nil\n prev_yr = nil\n # Parses each news article.\n news_page.css('div[class=\"sport_news_list__item col-md-4 col-sm-6 col-xs-12\"]').each do |value|\n date = value.css('span').text.split\n date = date[0]\n\n # Only takes in news articles for current year. \n current_yr = date.split('/')[2]\n prev_yr = current_yr if prev_yr == nil\n break if current_yr != prev_yr\n prev_yr = current_yr\n\n title = value.css('div[class=\"inner\"] > a').text.strip\n url = value.css('div[class=\"inner\"]').css('a')[1]['href']\n news_articles.push [date,title,url]\n end\n \n news_articles\nend", "title": "" }, { "docid": "ce1674fb8fcec2b07f5786d22728cb4d", "score": "0.5930486", "text": "def items\n content.items.map do |i|\n RSSCache::Feed::Item.new item: i\n end\n end", "title": "" }, { "docid": "4f086fb5471a63f0af6593ea285bc8a7", "score": "0.59238696", "text": "def index\n @news_events = NewsEvent.page(params[:page])\n end", "title": "" }, { "docid": "c57ba98567cd5efe22da9f4cc8cd819a", "score": "0.59135145", "text": "def add_news_to_entries\n doc = Nokogiri::HTML(open(@config[\"url\"]))\n doc.css('tr>td.title>a').take(@config[\"consume_top\"]).each do |link|\n next if @entries.any? {|e| e[:href] == link['href']} # skip duplicate entries\n @entries << {\n title: link.content,\n href: link['href']\n }\n end\n end", "title": "" }, { "docid": "cccd7cb4f148717c4063bd779ad41328", "score": "0.5911031", "text": "def fetch_facebook_news_feed(options={}, &block)\n objs = []\n # This fetches objects only posted by FB Link app.\n # fetch_facebook_objects(FACEBOOK_NEWS_FEED_PATH, filter: FACEBOOK_LINK_APP_ID, limit: options[:per_page], since: options[:since]) do |obj|\n # This fetches all Links.\n fetch_facebook_objects(FACEBOOK_NEWS_FEED_PATH, limit: options[:per_page]) do |obj|\n # fetch_facebook_objects(FACEBOOK_NEWS_FEED_PATH, limit: options[:per_page], since: options[:since]) do |obj|\n # status_type: {mobile_status_update, created_note, added_photos, added_video, shared_story, created_group, created_event, wall_post, app_created_story, published_story, tagged_in_photo, approved_friend}\n # type: {link, status, photo, video}\n if block_given? and\n (obj['status_type'] == 'shared_story' or obj['status_type'] == 'published_story') and\n obj['type'] == 'link'\n if options[:only_liked_by_me]\n obj['likes']['data'].each do |d|\n if d['id'] == self.uid\n objs << obj\n block.call(obj)\n end\n end if obj['likes'] and obj['likes']['data']\n else\n objs << obj\n block.call(obj)\n end\n end\n end\n objs\n end", "title": "" }, { "docid": "c5944dcb290340b97b324ceca875a723", "score": "0.59065676", "text": "def index\n require 'nokogiri'\n require 'open-uri'\n #require \"http\"\n\n doc = Nokogiri::XML(open(\"http://sports.yahoo.com/top/rss.xml\"))\n\n @newsfeeds = doc.xpath('//item').map do |i|\n {'title' => i.xpath('title').inner_text,\n 'link' => i.xpath('link').inner_text,\n 'description' => i.xpath('description').inner_text\n }\n\n end\n # @newsfeeds = Newsfeed.all\n\n# Newsfeed.add(@newsfeeds)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @newsfeeds }\n end\n p @newsfeeds\n end", "title": "" }, { "docid": "aba6eaa3df93690bce78e7cb71915745", "score": "0.59032005", "text": "def index\n @news_items = NewsItem.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @news_items }\n end\n end", "title": "" }, { "docid": "371da3f76c4fc6759c8391417da35867", "score": "0.5898889", "text": "def foreach(_item); end", "title": "" }, { "docid": "31549772fbbf8fc6f3c0e946ae967b55", "score": "0.58978856", "text": "def items(count = 20)\n create_entries get_feed_items(:n => count)\n end", "title": "" }, { "docid": "16dbb00706c03607e8098a2e41c5070f", "score": "0.5896369", "text": "def get_news(sport, all_news)\n all_news.each do |current|\n return current if current.sport == sport\n end\nend", "title": "" }, { "docid": "3376befbee76479d470863c279578e18", "score": "0.58923334", "text": "def feed\n @articles = Article.feed_list(current_user, params[:page])\n end", "title": "" }, { "docid": "97475c3dedaafe294acb4e05311b5909", "score": "0.5889581", "text": "def items\n law_articles\n end", "title": "" }, { "docid": "57c69d85ece07b9e7d5f77a3a7603e0f", "score": "0.5887584", "text": "def search_news(key)\n queue = []\n\n Google::Search::News.new(:query => key, :tbs => 'sbd:1,qdr:w', 'tbm' => 'nws').each do |s|\n queue.push({:url => s.uri, :date_published => s.published})\n end\n queue\nend", "title": "" } ]
b02d98a10d5d2a011581b9a69f51d857
Public: Get a String representation of the institution. Returns a String.
[ { "docid": "248d968208a67c51da9e203c9aa41706", "score": "0.6810799", "text": "def inspect\n \"#<Plaid::SearchResultInstitution id=#{id.inspect}, name=#{name.inspect}, \" \\\n '...>'\n end", "title": "" } ]
[ { "docid": "c2cb2ca49366e11218baebea3e8dd458", "score": "0.71856993", "text": "def institution_name\n owner ? owner.institution.full_name : \"Unknown\"\n end", "title": "" }, { "docid": "c60924762bcf240dc935fe5e3386c0c4", "score": "0.70867985", "text": "def inspect\n \"#<Plaid::Institution id=#{id.inspect}, type=#{type.inspect}, \" \\\n \"name=#{name.inspect}>\"\n end", "title": "" }, { "docid": "488cb60fc14e963d7900ebea92680db1", "score": "0.70070446", "text": "def name_and_institution\n if institution\n return \"#{name} (#{institution})\"\n else\n return name\n end\n end", "title": "" }, { "docid": "c1b7c5840fccd0caf667632c35d1c380", "score": "0.69089776", "text": "def institution_for(user)\n gradyear = user.gradyear.nil? ? '' : \"#{gradyear_short(user.gradyear)}\"\n user.institution.nil? ? '' : \"#{user.institution.name} #{gradyear}\"\n end", "title": "" }, { "docid": "b0baf77ccc73fbc1030146e8eb96ee45", "score": "0.6800789", "text": "def institution_info\n\t\t[\"Institution1\", \"Institution2\"]\n\tend", "title": "" }, { "docid": "ffe59481ac4290cf576df6dd6f8ab268", "score": "0.67447025", "text": "def institution_as_uri\n return nil if institution&.name.blank?\n\n ControlledVocabulary.era.institution.from_value(institution.name)\n end", "title": "" }, { "docid": "dfb3d646bedf18871360e72f22912cd6", "score": "0.6666832", "text": "def to_s # :nodoc:\n @implicants.to_s\n end", "title": "" }, { "docid": "115015ed4368b640acd72a6801a539a5", "score": "0.66613245", "text": "def to_s\n affiliation = \"#{self.title}, #{self.department}, #{self.organization}\"\n end", "title": "" }, { "docid": "458460da4e325b7709a04d9c4d69a03c", "score": "0.6640471", "text": "def to_s\n if not @identity.org.nil?\n @identity.org\n else\n \"unknown activation\"\n end\n end", "title": "" }, { "docid": "db280b0a853d82dc9a0e2c38ca364b11", "score": "0.66121846", "text": "def institution\n unless institution_code.blank?\n @institution ||= Institutions.institutions[institution_code.to_sym]\n end\n end", "title": "" }, { "docid": "5c6b9e3caf1b66d51cb84b862a815c4f", "score": "0.6576595", "text": "def to_institution\n campus_name || institution_name\n end", "title": "" }, { "docid": "930a7e1cc1bb2b6c91e3434adcb34d18", "score": "0.656624", "text": "def institution\n bag.description_object.institution\n end", "title": "" }, { "docid": "1d9cb62d017e3c1a9a5c7b91d00d4c9a", "score": "0.64844567", "text": "def institution\n Settings.HARVESTER.INSTITUTION.name\n end", "title": "" }, { "docid": "b23c2e93640cd4aee520789de877bbd9", "score": "0.64782804", "text": "def get_institution_name(text)\n name_from_academic_domain(get_domain(text))\n end", "title": "" }, { "docid": "da5834a463f4cd15dcf0f3631dd00101", "score": "0.64135826", "text": "def to_s\n \"#{@name} #{@url} #{@risk} #{@description} #{@solution} #{@reference}\"\n end", "title": "" }, { "docid": "d6d185e05cd09a03b093f6312ce9a552", "score": "0.6269737", "text": "def institution(id = nil)\n res = Plaid::Connection.get('institutions', id)\n id.nil? ? Plaid::Institution.all(res) : Plaid::Institution.one(res)\n end", "title": "" }, { "docid": "e7401bb579917ce9c742624a47eb38f2", "score": "0.62664855", "text": "def to_s\r\n \"#{@strasse} #{@hausnr}, #{@plz} #{@stadt}, #{@land}\"\r\n end", "title": "" }, { "docid": "e8bf8add2ca062cebb3152bc8c1d9032", "score": "0.6215287", "text": "def to_s\n @irn\n end", "title": "" }, { "docid": "6d478b50e29c9c0c93390e5105f9d6d1", "score": "0.6190465", "text": "def to_s\n principle\n end", "title": "" }, { "docid": "48f204ac10cb3bcb181afda7128d2836", "score": "0.61603415", "text": "def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nreal_name: \" + real_name.to_s + \"\\nid: \" + id.to_s + \"\\nlanguage: \" + language.to_s + \"\\nutc: \" + utc.to_s + \"\\ngeo: \" + geo.to_s + \"\\ndescription: \" + description.to_s + \"\\navatar: \" + avatar.to_s + \"\\nlocation: \" + location.to_s + \"\\nsubscribers: \" + subscribers.to_s + \"\\nsubscriptions: \" + subscriptions.to_s + \"\\npostings: \" + postings.to_s + \"\\nprofile: \" + profile.to_s + \"\\nwebsite: \" + website.to_s\n\t\tres\n\tend", "title": "" }, { "docid": "7f9c8b612b1e64f89f0141332f61e13b", "score": "0.61577106", "text": "def to_str\n @irn\n end", "title": "" }, { "docid": "d68ce1c12e90f112095453d020c53a33", "score": "0.6156526", "text": "def to_s\n return site || ''\n end", "title": "" }, { "docid": "8daf8d280918ef551bc6716c193d79b8", "score": "0.61348295", "text": "def to_s\n\t\tself.provider.titleize\n\tend", "title": "" }, { "docid": "edbe2b8d3c1433cb602644d3d49f69bf", "score": "0.6124397", "text": "def dwc_institution_code\n repository_acronym\n end", "title": "" }, { "docid": "adfe0d463793f76edc0508608484c743", "score": "0.6123244", "text": "def to_s\n @string\n end", "title": "" }, { "docid": "574060d972a7fd314419e103836099c8", "score": "0.61230767", "text": "def display_name\n \"#{Institution.find(institution_id).name} #{gender}'s #{sport_name}\"\n end", "title": "" }, { "docid": "495dbd3109cab73d698c4bc864888f4e", "score": "0.611266", "text": "def to_s\n full_name()\n end", "title": "" }, { "docid": "9b938cdba68f4d400b9c551fb82a2ee6", "score": "0.6089608", "text": "def dwc_institution_id\n repository_url\n end", "title": "" }, { "docid": "155e25d5f0afed82a7106ebe1b90691c", "score": "0.6075922", "text": "def to_s\n @string\n end", "title": "" }, { "docid": "f017dcf3b981eb5614af84f2408c868f", "score": "0.60714734", "text": "def to_s\n str = self.account_name.to_s\n str = '#' + self.id.to_s if str.size == 0 # Use ID if no account name\n if self.person and self.person.full_name.size > 0\n str += ' (' + self.person.full_name + ')'\n end #if\n return str\n end", "title": "" }, { "docid": "97d9c57822555c523dce3148048d7b1c", "score": "0.6063666", "text": "def to_s\n @string\n end", "title": "" }, { "docid": "97d9c57822555c523dce3148048d7b1c", "score": "0.6063666", "text": "def to_s\n @string\n end", "title": "" }, { "docid": "a8b6af03885c8093051929cec2fb1e3d", "score": "0.60534513", "text": "def institution_code\n (from_aleph?) ? aleph_item.institution : super\n end", "title": "" }, { "docid": "1718683deb59a915a6548f33609a7dd7", "score": "0.6040614", "text": "def to_s\n\t\[email protected]_s\n\tend", "title": "" }, { "docid": "7db00d3a43b000d33882aaa00c44127d", "score": "0.6006095", "text": "def to_s\n if name.present?\n name\n elsif slug.present?\n slug\n elsif saml_issuer_uri\n saml_issuer_uri\n end\n end", "title": "" }, { "docid": "aacbc6e8c226dc696e6a1545ebb5d198", "score": "0.6004262", "text": "def current_institution\n Institution.find_by_fqdn(request.host_with_port)\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.59951645", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.59951645", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.59951645", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.59951645", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "7be93a1c6af26ee3641289958f5aad15", "score": "0.5963794", "text": "def get_host_name\n return self.institution.short_name;\n end", "title": "" }, { "docid": "f8cb9fc9ede4c38635a029165b2b5e2c", "score": "0.5960406", "text": "def to_s\n account.to_s\n end", "title": "" }, { "docid": "01300333261d5f0f03ca862cf1ec9055", "score": "0.5958848", "text": "def to_s\n return @uri.to_s\n end", "title": "" }, { "docid": "01300333261d5f0f03ca862cf1ec9055", "score": "0.5958848", "text": "def to_s\n return @uri.to_s\n end", "title": "" }, { "docid": "d13869c5cc419421fbea3c80b2caa9e3", "score": "0.5936932", "text": "def to_s\n to_string\n end", "title": "" }, { "docid": "237c18547700f016ba38446da4dba916", "score": "0.5935262", "text": "def to_s\n TIPR.generate_sip(self)\n end", "title": "" }, { "docid": "885cf944d3b3944e770fbf3a609f0a3a", "score": "0.59303087", "text": "def to_s\n full_name()\n end", "title": "" }, { "docid": "17c93861ab64570a12e9c148e7e86b3e", "score": "0.59261805", "text": "def to_s\n \"#{resource_name}[#{name}]\"\n end", "title": "" }, { "docid": "525ce59aabc46d0dfc3acff91957516e", "score": "0.59248257", "text": "def to_s\n self.full_name\n end", "title": "" }, { "docid": "9175b5706efbb3b768b133a9fc8c7f84", "score": "0.59230983", "text": "def get_institution_detail id, oauth_token_info = IntuitIdsAggcat::Client::Saml.get_tokens(\"default\"), consumer_key = IntuitIdsAggcat.config.oauth_consumer_key, consumer_secret = IntuitIdsAggcat.config.oauth_consumer_secret\n write_to_log(\n \"=================================================\",\n __method__,\n \"=================================================\"\n )\n response = oauth_get_request \"https://financialdatafeed.platform.intuit.com/v1/institutions/#{id}\", oauth_token_info, consumer_key, consumer_secret\n if response.present? && response[:response_code] == \"200\"\n institutions = InstitutionDetail.load_from_xml(response[:response_xml].root)\n institutions\n else\n IntuitIdsAggcat::Client::ServiceError.new(response)\n end\n end", "title": "" }, { "docid": "d6ec41be6d1c0d02273e3194ff7778ff", "score": "0.59211695", "text": "def to_s\n STRING_REP\n end", "title": "" }, { "docid": "36c595fbf524b4ba828a645dc2fdd87b", "score": "0.5920779", "text": "def to_s\n self.resource_desc\n end", "title": "" }, { "docid": "fcc6a05825fd9ba1f96a4a8033d8c436", "score": "0.59197307", "text": "def to_s\n %{\n #{@company_info.to_s}\n #{@partner_info.to_s}\n #{@admin_info.to_s}\n #{@acccount_detail.to_s}\n #{@credit_card.to_s}\n use company info: #@use_company_info\n subscription period: #@subscription_period\n has initial purchase: #@has_initial_purchase\n net term payment: #@net_term_payment}\n end", "title": "" }, { "docid": "3e1ee77702ce37d6442735e5efabb453", "score": "0.59195054", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "3e1ee77702ce37d6442735e5efabb453", "score": "0.59195054", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "b58c5a55040c1f4c19087d5f772e78c8", "score": "0.5915638", "text": "def to_s\n [account.name, name].join('/')\n end", "title": "" }, { "docid": "d72e3d08d8df9d9400710fe9ea6b6f8a", "score": "0.59032667", "text": "def to_s\n s = @domain\n s = \"#{@node}@#{s}\" if @node\n s = \"#{s}/#{@resource}\" if @resource\n s\n end", "title": "" }, { "docid": "947c8de153f40555c311971a809b4260", "score": "0.5897428", "text": "def to_s\n res = \"#{repo_type} #{url}\"\n end", "title": "" }, { "docid": "0d505ae8263313c9298cf7b65f1426e2", "score": "0.5896105", "text": "def to_s\n \"EC2 InternetGateway: #{@igw_id}\"\n end", "title": "" }, { "docid": "2837e805923e5957a1611d05ecc745f6", "score": "0.5894491", "text": "def to_s\n internal_to_s_with_reference(false)\n end", "title": "" }, { "docid": "5363aa5fa3ba11d0c9a7bf11a52fc2a4", "score": "0.5890683", "text": "def to_s\n\t\t\tstring=\"\"\n\t\t\tstring << @autor << \" (\" << Date::MONTHNAMES[get_publicacion.month] << \" \" << get_publicacion.day.to_s << \", \" << get_publicacion.year.to_s << \"). \" << @titulo << \" (\" << @edicion.to_s << \") (\" << @volumen.to_s << \"). \" << @editorial << \".\"\n\t\tend", "title": "" }, { "docid": "f077af52f6645724a33df49ffd434d73", "score": "0.58902645", "text": "def to_s\n (organ ? organ.full_name : \"\" )+ \":\" + membership.name\n end", "title": "" }, { "docid": "28a5e5fa537ab8d7f3efcadb3f02d48e", "score": "0.5889989", "text": "def to_s\n\t\t\tstring = \"\"\n\t\t\tstring << @autor << \" (\" << Date::MONTHNAMES[get_publicacion.month] << \" \" << get_publicacion.day.to_s << \", \" << get_publicacion.year.to_s << \"). \" << @titulo << \". \" << @editorial << \", pp. \" << @formato << \", \" << @paginas.to_s << \" paginas\" << \".\"\n\t\tend", "title": "" }, { "docid": "78b05f01f954ced21ce9cb00ca11bc7b", "score": "0.58812934", "text": "def institution_param_name\n 'umlaut.institution'\n end", "title": "" }, { "docid": "eaa9708d141fc759d1f4e9eb35fb1d8d", "score": "0.5878842", "text": "def to_s\n name.to_s\n end", "title": "" }, { "docid": "eaa9708d141fc759d1f4e9eb35fb1d8d", "score": "0.5878842", "text": "def to_s\n name.to_s\n end", "title": "" }, { "docid": "274a066f39be5b60e5ca6441d02b4861", "score": "0.5877302", "text": "def org_type_to_s\n ret = []\n ret << \"Institution\" if self.institution?\n ret << \"Funder\" if self.funder?\n ret << \"Organisation\" if self.organisation?\n ret << \"Research Institute\" if self.research_institute?\n ret << \"Project\" if self.project?\n ret << \"School\" if self.school?\n return (ret.length > 0 ? ret.join(', ') : \"None\")\n end", "title": "" }, { "docid": "e08efde193d6a48587355139b6987604", "score": "0.5874928", "text": "def to_s\n @resource_desc\n end", "title": "" }, { "docid": "e08efde193d6a48587355139b6987604", "score": "0.5874928", "text": "def to_s\n @resource_desc\n end", "title": "" }, { "docid": "d6078c919a6cf5dc6ba3cf27abffa55c", "score": "0.5871778", "text": "def to_s\n @uri_s\n end", "title": "" }, { "docid": "e49775c995cb5253cdf500dc18ef1792", "score": "0.5864722", "text": "def to_s\n self[:uri]\n end", "title": "" }, { "docid": "e49775c995cb5253cdf500dc18ef1792", "score": "0.5864722", "text": "def to_s\n self[:uri]\n end", "title": "" }, { "docid": "f916dcbe105fd4dbd3097f0a17dfb888", "score": "0.58637273", "text": "def to_s\n make_citation(:apa)\n end", "title": "" }, { "docid": "f916dcbe105fd4dbd3097f0a17dfb888", "score": "0.58637273", "text": "def to_s\n make_citation(:apa)\n end", "title": "" }, { "docid": "f916dcbe105fd4dbd3097f0a17dfb888", "score": "0.58637273", "text": "def to_s\n make_citation(:apa)\n end", "title": "" }, { "docid": "6f3d79585cfef66dc7eb1c67d05843c3", "score": "0.58522457", "text": "def to_s\n \"#{owner}/#{name}\"\n end", "title": "" }, { "docid": "4dadbceff075680e56589d497652cf0a", "score": "0.5850874", "text": "def to_s\n s = @domain\n s = \"#{@node}@#{s}\" if @node\n s = \"#{s}/#{@resource}\" if @resource\n s\n end", "title": "" }, { "docid": "800d492b8cf6c7d0bef6c79eae4be57c", "score": "0.58503735", "text": "def to_s\n 'ISSN ' + first_part().join + '-' + second_part().join\n end", "title": "" }, { "docid": "d31191d9e14d90e3f18bda3ee6301f5a", "score": "0.5847668", "text": "def as_string\n self\n end", "title": "" }, { "docid": "a3211b5cfe2e495a70a37fc896d27ddf", "score": "0.58466405", "text": "def to_s\n base.to_s\n end", "title": "" }, { "docid": "4358dbdacfa57b5bd658b433386562b0", "score": "0.58462805", "text": "def us_string\n \"US #{@us}\".strip\n end", "title": "" }, { "docid": "18b11e28af67dac2c0220c3f6382a1b4", "score": "0.58406675", "text": "def to_s\n \"#{name} #{surname}\"\n end", "title": "" }, { "docid": "9790e8295b0856415e0cd60b08415aeb", "score": "0.58405715", "text": "def to_s\n\n\t\t\t@name\n\t\tend", "title": "" }, { "docid": "6ca7128b5d0656ac23e55223e336ffca", "score": "0.5840407", "text": "def to_s\n out = @name\n out += \" has payment address #{ @payment_address}\" if @payment_address\n out\n end", "title": "" }, { "docid": "501978d1dfe6cacac537cba795e163d9", "score": "0.5839717", "text": "def record_owner\n self.institution\n end", "title": "" }, { "docid": "031b6bf12ffdd29946823b43c5b75376", "score": "0.5837277", "text": "def to_s\n\t\t\t\"#{name} #{@resource_class.name}\"\n\t\tend", "title": "" }, { "docid": "8b8841fe61213a4dfa5d004d28e09ef0", "score": "0.5836101", "text": "def to_s\n @str\n end", "title": "" }, { "docid": "f82476763dd6f378992faab7ed675ae8", "score": "0.5835197", "text": "def to_s\n \"#{self.provider} #{self.uid}\"\n end", "title": "" }, { "docid": "ef72c3a1efbc684819b5d967236ea66a", "score": "0.58348703", "text": "def awarding_institution\n self[Solrizer.solr_name('awarding_institution')]\n end", "title": "" }, { "docid": "185efa7dd96fc0a9234200c462e16e59", "score": "0.5834736", "text": "def to_s\n full\n end", "title": "" }, { "docid": "38673cba1885d1eb58e056470d7ce844", "score": "0.5832423", "text": "def to_s\n \"Provider: #{provider}\\n Street: #{street_address}\\nCity: #{city}\\nState: #{state}\\nZip: #{zip}\\nLatitude: #{lat}\\nLongitude: #{lng}\\nCountry: #{country_code}\\nSuccess: #{success}\"\n end", "title": "" }, { "docid": "38673cba1885d1eb58e056470d7ce844", "score": "0.5832423", "text": "def to_s\n \"Provider: #{provider}\\n Street: #{street_address}\\nCity: #{city}\\nState: #{state}\\nZip: #{zip}\\nLatitude: #{lat}\\nLongitude: #{lng}\\nCountry: #{country_code}\\nSuccess: #{success}\"\n end", "title": "" }, { "docid": "23364cc0f6f16772b0c109eeef538326", "score": "0.5831664", "text": "def to_s\n to_string_io.string\n end", "title": "" }, { "docid": "8e311c7e95c0a4fb7f3874c01f2148df", "score": "0.58289415", "text": "def to_s\n \"Provider: #{provider}\\nStreet: #{street_address}\\nCity: #{city}\\nState: #{state}\\nZip: #{zip}\\nLatitude: #{lat}\\nLongitude: #{lng}\\nCountry: #{country_code}\\nSuccess: #{success}\"\n end", "title": "" }, { "docid": "8f8e6280c9cb9ee9c856de46a2c3aba9", "score": "0.5827882", "text": "def to_s\n \n \"#{self.rfc} #{self.nombre}\"\n \n end", "title": "" }, { "docid": "8f8e6280c9cb9ee9c856de46a2c3aba9", "score": "0.5827882", "text": "def to_s\n \n \"#{self.rfc} #{self.nombre}\"\n \n end", "title": "" }, { "docid": "8b9270144b2776972be1e0e767cd6884", "score": "0.58210945", "text": "def to_string\n retVal = \"#{self.fname} #{self.lname} (#{self.login})\"\n return retVal\n end", "title": "" }, { "docid": "e836c41071a21d5c7c57bfbda782006f", "score": "0.58172023", "text": "def to_s\n @s\n end", "title": "" }, { "docid": "c2bb03f1ea78c0d0adc12e0b12dc5faa", "score": "0.58143556", "text": "def to_s\n @name.to_s\n end", "title": "" }, { "docid": "0c364fe2911dfe7cbf6a49ed99540d28", "score": "0.58121353", "text": "def to_s\r\n \"#{vorname} #{name}\"\r\n end", "title": "" } ]
ef424079311974580e71b1f0b3689fe9
have to iterate through two ll's that are the same length in order to find intersection find length of both, get difference remove that many from the longest ll iterate through both, find the value that's the same
[ { "docid": "deb2ef1f51370838408a325c0c54b60c", "score": "0.6220592", "text": "def intersection(ll1, ll2)\n return nil if ll1 == nil || ll2 == nil\n\n ll1length = 0\n ll2length = 0\n\n ll1header = ll1.head\n ll2header = ll2.head\n\n ll1tail = nil\n ll2tail = nil\n\n until ll1 == nil\n ll1length = ll1length + 1\n ll1 = ll1.next\n end\n ll2tail = ll1\n\n until ll2 == nil\n ll2length = ll2length + 1\n ll2 = ll2.next\n end\n ll2tail = ll2 \n\n diff_in_length = (ll1length - ll2length).abs\n\n if ll1length < ll2length\n diff_in_length.times do |i|\n ll2header = ll2header.next\n end\n else\n diff_in_length.times do |i|\n ll1header = ll1header.next\n end\n end\n\n until ll1header == nil \n if ll1header.next.val == ll2header.next.val\n return llheader.next.val\n end\n ll1header = ll1header.next\n ll2header = ll2header.next\n end\n\n return nil\nend", "title": "" } ]
[ { "docid": "d5dbd5bd53a46117edf9cf3e7c777454", "score": "0.70128554", "text": "def longest(a1, a2)\n (normalize(a1) + normalize(a2)).uniq.sort.join\nend", "title": "" }, { "docid": "aa5b793879fab41fb5170340627f3de7", "score": "0.6901112", "text": "def converging_node(list1, list2)\r\n head1 = list1.head\r\n head2 = list2.head \r\n length1, length2 = 0, 0\r\n until !head1.next \r\n length1++\r\n end\r\nend\r\n\r\n# Given a string s, find the longest palindromic substring in s. \r\n# You may assume that the maximum length of s is 1000.\r\n\r\ndef longest_palindrome(str)\r\n longest = \"\"\r\n for i in 0...str.length\r\n for j in (i + longest.length)...str.length\r\n substr = str[i..j]\r\n longest = substr if str[j] == str[i] && substr == substr.reverse\r\n end\r\n end\r\n longest\r\nend\r\n\r\n# Write a function to find the longest common prefix string amongst an array of strings.\r\n\r\n# If there is no common prefix, return an empty string \"\".\r\n\r\n# Example 1:\r\n\r\n# Input: [\"flower\",\"flow\",\"flight\"]\r\n# Output: \"fl\"\r\n# Example 2:\r\n\r\n# Input: [\"dog\",\"racecar\",\"car\"]\r\n# Output: \"\"\r\n# Explanation: There is no common prefix among the input strings.\r\n# Note:\r\n\r\n# All given inputs are in lowercase letters a-z.\r\n\r\ndef longest_common_prefix(strs)\r\n return \"\" if strs.empty? || strs == [\"\"]\r\n longest = \"\"\r\n idx = 0\r\n while idx < strs[0].length\r\n prefix = strs[0][0..idx]\r\n strs.each do |word|\r\n return longest if word[0..idx] != prefix\r\n end\r\n longest = prefix\r\n idx += 1\r\n end\r\n longest\r\nend\r\n\r\n# Given an array nums and a value val, remove all instances of that value in-place \r\n# and return the new length.\r\n\r\n# Do not allocate extra space for another array, you must do this by modifying the \r\n# input array in-place with O(1) extra memory.\r\n\r\n# The order of elements can be changed. It doesn't matter what you leave beyond the \r\n# new length.\r\n\r\n# Example 1:\r\n\r\n# Given nums = [3,2,2,3], val = 3,\r\n\r\n# Your function should return length = 2, with the first two elements of nums being 2.\r\n\r\n# It doesn't matter what you leave beyond the returned length.\r\n# Example 2:\r\n\r\n# Given nums = [0,1,2,2,3,0,4,2], val = 2,\r\n\r\n# Your function should return length = 5, with the first five elements of nums \r\n# containing 0, 1, 3, 0, and 4.\r\n\r\n# Note that the order of those five elements can be arbitrary.\r\n\r\n# It doesn't matter what values are set beyond the returned length.\r\n# Clarification:\r\n\r\n# Confused why the returned value is an integer but your answer is an array?\r\n\r\n# Note that the input array is passed in by reference, which means modification to the \r\n# input array will be known to the caller as well.\r\n\r\n# Internally you can think of this:\r\n\r\n# // nums is passed in by reference. (i.e., without making a copy)\r\n# int len = removeElement(nums, val);\r\n\r\n# // any modification to nums in your function would be known by the caller.\r\n# // using the length returned by your function, it prints the first len elements.\r\n# for (int i = 0; i < len; i++) {\r\n# print(nums[i]);\r\n# }\r\n\r\ndef remove_element(nums, val)\r\n nums.delete(val)\r\n nums.length\r\nend", "title": "" }, { "docid": "9fc276076497052a80e6cfd3f4d551ff", "score": "0.6760187", "text": "def find_lu_slength(a, b)\n return -1 if a == b\n [a.length, b.length].max\nend", "title": "" }, { "docid": "2cebd42c629eeecc02ad0826d6f5bc34", "score": "0.6698107", "text": "def lcs(a, b)\n lengths = Array.new(a.size+1) { Array.new(b.size+1) { 0 } }\n # row 0 and column 0 are initialized to 0 already\n a.each_with_index { |x, i|\n b.each_with_index { |y, j|\n if x == y\n lengths[i+1][j+1] = lengths[i][j] + 1\n else\n lengths[i+1][j+1] = \\\n [lengths[i+1][j], lengths[i][j+1]].max\n end\n }\n }\n # read the substring out from the matrix\n result = []\n x, y = a.size, b.size\n while x != 0 and y != 0\n if lengths[x][y] == lengths[x-1][y]\n x -= 1\n elsif lengths[x][y] == lengths[x][y-1]\n y -= 1\n else\n # assert a[x-1] == b[y-1]\n result << a[x-1]\n x -= 1\n y -= 1\n end\n end\n result.reverse\nend", "title": "" }, { "docid": "b2db6a4bcd874c08a8ccd4d2da540dad", "score": "0.66933244", "text": "def getMinimumDifference(a,b)\n return -1 unless a.length == b.length\n\n a_split = a.chars\n b_split = b.chars\n\n # count = a.length - a_split.select { |ltr| a_split.count(ltr) == b_split.count(ltr) }\nend", "title": "" }, { "docid": "5d08d4b0a3ad4f99a218a4aefb41ba57", "score": "0.66768616", "text": "def levenshtein(first, second)\n matrix = [(0..first.length).to_a]\n (1..second.length).each do |j|\n matrix << [j] + [0] * (first.length)\n end\n \n (1..second.length).each do |i|\n (1..first.length).each do |j|\n if first[j-1] == second[i-1]\n matrix[i][j] = matrix[i-1][j-1]\n else\n matrix[i][j] = [\n matrix[i-1][j],\n matrix[i][j-1],\n matrix[i-1][j-1],\n ].min + 1\n end\n end\n end\n return matrix.last.last\nend", "title": "" }, { "docid": "4294e8566f216a67b898256d833d31f5", "score": "0.66671634", "text": "def dameraulevenshtein(seq1, seq2 = self)\n oneago = nil\n thisrow = (1..seq2.size).to_a + [0]\n seq1.size.times do |x|\n twoago, oneago, thisrow = oneago, thisrow, [0] * seq2.size + [x + 1]\n seq2.size.times do |y|\n delcost = oneago[y] + 1\n addcost = thisrow[y - 1] + 1\n subcost = oneago[y - 1] + ((seq1[x] != seq2[y]) ? 1 : 0)\n thisrow[y] = [delcost, addcost, subcost].min\n if (x > 0 and y > 0 and seq1[x] == seq2[y-1] and seq1[x-1] == seq2[y] and seq1[x] != seq2[y])\n thisrow[y] = [thisrow[y], twoago[y-2] + 1].min\n end\n end\n end\n return thisrow[seq2.size - 1]\n end", "title": "" }, { "docid": "2442b2ba896afd7a6486c9ef8e81755b", "score": "0.66649204", "text": "def is_one_away_diff_lengths(s1, s2)\n count_diff = 0\n s1.each_with_index do |_ele, index|\n next if s1[index + count_diff] == s2[index]\n count_diff += 1\n return false if count_diff > 1\n end\n true\nend", "title": "" }, { "docid": "74cce2a0dc1ce08949c0053f0e19db78", "score": "0.66509694", "text": "def _levenshtein_rb(first, second)\n len1, len2 = first.size, second.size\n return len1 if len2.zero?\n return len2 if len1.zero?\n\n matrix = [(0..len1).to_a]\n (1..len2).each do |j|\n matrix << [j] + [0] * len1\n end\n\n (1..len2).each do |i|\n (1..len1).each do |j|\n if first[j - 1] == second[i - 1]\n matrix[i][j] = matrix[i - 1][j - 1]\n else\n matrix[i][j] = [\n matrix[i - 1][j],\n matrix[i][j - 1],\n matrix[i - 1][j - 1],\n ].min + 1\n end\n end\n end\n return matrix.last.last\nend", "title": "" }, { "docid": "27c1c08657c365c6cf7c0af330860880", "score": "0.6644154", "text": "def too_clever(st1, st2)\n arr = [st1, st2].sort_by { |el| el.length }\n arr[0] + arr[1] + arr[0] # or arr.first + arr.last + arr.first\nend", "title": "" }, { "docid": "1be158b7b97fe02afa313e04d2d97b10", "score": "0.6635889", "text": "def longest(a1, a2)\n # (a1 + a2).chars.uniq.sort.join\n (a1 + a2).chars\n .uniq\n .sort\n .join\nend", "title": "" }, { "docid": "927a065f1584f001fd52b08dbec8ec5a", "score": "0.66177547", "text": "def compare_with(seq2)\n seq1 = self\n length = seq1.size\n diff = 0\n (0..(length-1)).each do |position|\n nt1 = seq1[position]\n nt2 = seq2[position]\n diff += 1 unless nt1 == nt2\n end\n return diff\n end", "title": "" }, { "docid": "3ace97d9861d41216643161c984b9627", "score": "0.65925604", "text": "def longest(a1, a2)\n finalArray=[]\n mydict=Hash.new\n myarray=a1.concat(a2).split(\"\")\n myarray.each do |elm|\n mydict[elm]=0\n end\n mydict.select do |key,value|\n finalArray << key\n end\n return finalArray.sort!.join('')\nend", "title": "" }, { "docid": "2b26ee1fe6c7481298a441ad80503048", "score": "0.656303", "text": "def longest(a1, a2)\n \n (a1+a2).chars.uniq.sort.join\n \n end", "title": "" }, { "docid": "fcb24dd83f9fc50d7e6e72b8b10df4d9", "score": "0.6534633", "text": "def find_lu_slength(a, b)\n a == b ? -1 : [a.length, b.length].max\nend", "title": "" }, { "docid": "96eed98cd9b17e085a04c9b4f4cfc3d3", "score": "0.6533111", "text": "def find_lu_slength(a, b)\n a == b ? -1 : [a.length, b.length].max\nend", "title": "" }, { "docid": "6da284f682fc64c9bd29492b5e0dc596", "score": "0.6492493", "text": "def find_longest(a, b)\n dup_chars = Regexp.union(a.chars & b.chars)\n substrings = (a+b).split(dup_chars) + (b+a).split(dup_chars)\n substrings.empty? ? 0 : substrings.max_by(&:length).length\n end", "title": "" }, { "docid": "ca07e0c1cdd2056acf0d801733e42b50", "score": "0.6478018", "text": "def LevenshteinDistance (first, second)\n n = first . length\n m = second . length\n distance = []\n for i in 0 .. n do\n distance [i] = []\n for j in 0 .. m do\n distance [i] [j] = i == 0 || j == 0 ? i + j\n : [distance [i - 1] [j] + 1,\n distance [i] [j - 1] + 1,\n distance [i - 1] [j - 1] +\n (first [i - 1] == second [j - 1] ? 0 : 1)] . min\n end\n #\n # Release memory\n #\n if i > 1\n distance [i - 1] = nil\n end\n end\n return distance [n] [m]\nend", "title": "" }, { "docid": "976288b06b220376a27359a53103b0f2", "score": "0.64475244", "text": "def levenshtein(seq1, seq2)\n oneago = nil\n thisrow = (1..seq2.size).to_a + [0]\n seq1.size.times do |x|\n twoago, oneago, thisrow = oneago, thisrow, [0] * seq2.size + [x + 1]\n seq2.size.times do |y|\n delcost = oneago[y] + 1\n addcost = thisrow[y - 1] + 1\n subcost = oneago[y - 1] + ((seq1[x] != seq2[y]) ? 1 : 0)\n thisrow[y] = [delcost, addcost, subcost].min\n if (x > 0 and y > 0 and seq1[x] == seq2[y-1] and seq1[x-1] == seq2[y] and seq1[x] != seq2[y])\n thisrow[y] = [thisrow[y], twoago[y-2] + 1].min\n end\n end\n end\n return thisrow[seq2.size - 1]\n end", "title": "" }, { "docid": "f9f0af8baf4288ff8dd214ad997424ef", "score": "0.6443371", "text": "def longest(a1, a2)\n (a1+a2).chars.uniq.sort.join\nend", "title": "" }, { "docid": "1dc99bfc05a44abf627cd3f67d7180c4", "score": "0.644216", "text": "def hamming(dna1,dna2)\n res = []\n len = dna1.length\n (0..len).each do |i|\n if dna1[i] != dna2[i]\n res << dna1[i]\n end\n end\n puts \"the comparison result is : #{res.length}\"\nend", "title": "" }, { "docid": "ce52472d1d030bc72fab73667b783d2b", "score": "0.64382005", "text": "def longest(a1, a2)\n (a1 + a2).chars.uniq.sort.join\nend", "title": "" }, { "docid": "6d41a1dbfbc47b5752c39ad0ad878b32", "score": "0.643096", "text": "def longest(a, b)\n arr1 = a.split(\"\")\n arr2 = b.split(\"\")\n joined = arr1.concat(arr2)\n return joined.uniq.sort.join\nend", "title": "" }, { "docid": "aaf77d5fe0e019a5110503e47e8e85cf", "score": "0.64038163", "text": "def edit_distance(str1, str2)\n count = 0\n return count if str1 == str2\n return str2.length if str1.empty?\n return str1.length if str2.empty?\n list1 = str1.split('')\n list2 = str2.split('')\n if str1.length == str2.length\n list1.each_index do |i|\n count += 1 if list1[i] != list2[i]\n end\n elsif str1.length < str2.length\n min_edit_distance = Float::INFINITY\n list2.each_index do |i|\n modifiable = list1.dup\n times = list1.length\n times.times do |j|\n new_word = modifiable.insert(j, list2[i]).join('')\n new_edit_distance = edit_distance(new_word, str2)\n min_edit_distance = (new_edit_distance + 1) if new_edit_distance < min_edit_distance\n end\n end\n return min_edit_distance\n else\n min_edit_distance = Float::INFINITY\n list1.each_index do |i|\n new_word = list1[0...i].concat(list1[i + 1..-1]).join('')\n new_edit_distance = edit_distance(new_word, str2)\n min_edit_distance = (new_edit_distance + 1) if new_edit_distance < min_edit_distance\n end\n return min_edit_distance\n end\n count\nend", "title": "" }, { "docid": "e483b1e975afe57f6887a9e3820b3171", "score": "0.6399703", "text": "def longest_common_subsequence(text1, text2)\n # shorter_word = [text1.length, text2.length].min\n \n # i = 0\n # while i < shorter_word\n # if text1[i] != text2[i]\n \n # end\n # end\n \n if text1.length > text2.length\n longer_word = text1\n shorter_word = text2\n else\n longer_word = text2\n shorter_word = text1\n end\n \n \n longer_counter = 0\n subsequence = []\n \n # i = 0\n # while longer_counter < longer_word.length\n # if shorter_word[i] != longer_word[longer_counter]\n # longer_counter += 1\n # else\n # i += 1\n # longer_counter += 1\n # counter += 1\n # end\n # end\n \n i = 0\n while i < shorter_word.length\n j = i\n while j < longer_word.length\n if shorter_word[i] == longer_word[j]\n subsequence.push(shorter_word[i])\n end\n j += 1\n end\n i += 1\n end\n \n return subsequence.length\n end", "title": "" }, { "docid": "7522716ebe4804dbaaeb7ae6a34f004f", "score": "0.6392357", "text": "def lcs(a, b)\n lengths = Array.new(a.size + 1) { Array.new(b.size + 1) { 0 } }\n # row 0 and column 0 are initialized to 0 already\n a.split('').each_with_index do |x, i|\n b.split('').each_with_index do |y, j|\n if x == y\n lengths[i + 1][j + 1] = lengths[i][j] + 1\n else\n lengths[i + 1][j + 1] = \\\n [lengths[i + 1][j], lengths[i][j + 1]].max\n end\n end\n end\n\n # read the substring out from the matrix\n result = ''\n x, y = a.size, b.size\n while x != 0 and y != 0\n if lengths[x][y] == lengths[x - 1][y]\n x -= 1\n elsif lengths[x][y] == lengths[x][y - 1]\n y -= 1\n else\n # assert a[x-1] == b[y-1]\n result << a[x - 1]\n x -= 1\n y -= 1\n end\n end\n\n result.reverse\n end", "title": "" }, { "docid": "bf99a732e1d12f787aba701f44c9f4c6", "score": "0.6386646", "text": "def lcs(a, b)\n lengths = Array.new(a.size + 1) { Array.new(b.size + 1) { 0 } }\n # row 0 and column 0 are initialized to 0 already\n a.split('').each_with_index do |x, i|\n b.split('').each_with_index do |y, j|\n if x == y\n lengths[i + 1][j + 1] = lengths[i][j] + 1\n else\n lengths[i + 1][j + 1] = \\\n [lengths[i + 1][j], lengths[i][j + 1]].max\n end\n end\n end\n\n # read the substring out from the matrix\n result = ''\n x = a.size\n y = b.size\n while x != 0 and y != 0\n if lengths[x][y] == lengths[x - 1][y]\n x -= 1\n elsif lengths[x][y] == lengths[x][y - 1]\n y -= 1\n else\n # assert a[x-1] == b[y-1]\n result << a[x - 1]\n x -= 1\n y -= 1\n end\n end\n\n result.reverse\n end", "title": "" }, { "docid": "5f9f898ab739c70da9a0004ac78f4b7d", "score": "0.63832307", "text": "def longest(s1, s2)\n (s1 + s2).split('').uniq.sort.join\nend", "title": "" }, { "docid": "e4e6eeb964f02ecc2fe552efb4e2b8c8", "score": "0.6381019", "text": "def lcs_size(s1, s2)\n num=Array.new(s1.size){Array.new(s2.size)}\n len,ans=0,0\n s1.scan(/./).each_with_index do |l1,i |\n s2.scan(/./).each_with_index do |l2,j |\n unless l1==l2\n num[i][j]=0\n else\n (i==0 || j==0)? num[i][j]=1 : num[i][j]=1 + num[i-1][j-1]\n len = ans = num[i][j] if num[i][j] > len\n end\n end\n end\n ans\n end", "title": "" }, { "docid": "92eb5d8b8ddacc7b1c2dc5df4c5c9e50", "score": "0.638032", "text": "def longest(a1, a2)\n (a1 + a2).split('').uniq.sort.join\nend", "title": "" }, { "docid": "edafaf4cf4f6c0b9bf878f4f9397ab72", "score": "0.63769245", "text": "def longest_seq(arr)\n\thash1 = {}\n\tcount = 0\n\t(0...arr.length).each do |i|\n\t\thash1[i] = arr[i]\n\tend\n\thash = hash1.dup\n\thash1.each_key do |i|\n\t\tp hash1\n\t\tp i\n\t\tleft = hash1[i] - 1\n\t\tright = hash1[i] + 1\n\t\tcount = 1\n\t\twhile hash.has_value?(left)\n\t\t\tcount += 1\n\t\t\thash.delete(left)\n\t\t\tleft -= 1\n\t\t\t#remove element\n\t\tend\n\t\twhile hash.has_value?(right)\n\t\t\tcount += 1\n\t\t\t#remove element\n\t\t\thash.delete(right)\n\t\t\tright += 1\n\t\tend\n\tend\n\tputs count\nend", "title": "" }, { "docid": "1bd02aa8793e4eff62f3df75f3bc8a08", "score": "0.63695616", "text": "def longest(a1, a2)\n return (a1 + a2).chars.uniq.sort.join\nend", "title": "" }, { "docid": "ddfc10ba01ac42e7552a2bd3f7fc192d", "score": "0.63632655", "text": "def longest(a1, a2)\r\n\r\nend", "title": "" }, { "docid": "d0a0f56b33b0125cb8d2fbdfd1d6ed62", "score": "0.6355286", "text": "def longest(s1, s2)\n s3 = s1 + s2\n s3.split(\"\").uniq.sort.join(\"\")\nend", "title": "" }, { "docid": "69ee6feebeb7877c787c04a1e66a2dcc", "score": "0.6354669", "text": "def longest(a1, a2)\n array1 = a1.chars\n array2 = a2.chars\n combined_array = array1 + array2\n combined_array.sort.uniq.join\nend", "title": "" }, { "docid": "85b8744e8aa64f8c023a065fa7d70e4a", "score": "0.6353439", "text": "def levenshtein(a, b)\n case\n when a.empty? then b.length\n when b.empty? then a.length\n else [(a[0] == b[0] ? 0 : 1) +\n levenshtein(a[1..-1], b[1..-1]),\n 1 + levenshtein(a[1..-1], b),\n 1 + levenshtein(a, b[1..-1])].min\n end\nend", "title": "" }, { "docid": "3942b71bc3e1532e921d15e828d39060", "score": "0.63488734", "text": "def levenshtein(a, b)\n case\n when a.empty? then b.length\n when b.empty? then a.length\n else [(a[0] == b[0] ? 0 : 1) + levenshtein(a[1..-1], b[1..-1]),\n 1 + levenshtein(a[1..-1], b),\n 1 + levenshtein(a, b[1..-1])].min\n end\nend", "title": "" }, { "docid": "1744f1c1128e52b96f52499c1ad3d692", "score": "0.6338567", "text": "def longest(a1, a2)\n (a1.split(\"\") + a2.split(\"\")).uniq.sort.join\nend", "title": "" }, { "docid": "9725827859b666252084415f6f4768dc", "score": "0.6318443", "text": "def lcs seq1, seq2\n n, m = seq1.size, seq2.size\n table = (0..n).map { (0..m).map { 0 } }\n\n # Build table of LCS lengths\n for i in 1..n\n for j in 1..m\n if seq1[i - 1] == seq2[j - 1]\n # Last characters of both sequences at this point are the same\n table[i][j] = table[i - 1][j - 1] + 1\n else\n # Last characters aren't the same, so pick the longest sequence so far\n table[i][j] = [table[i - 1][j], table[i][j - 1]].max\n end\n end\n end\n\n # Retrieves character sequence from the table\n retrieve_seq = lambda do |i, j|\n if i == 0 or j == 0\n return ''\n elsif seq1[i - 1] == seq2[j - 1]\n return retrieve_seq.call(i - 1, j - 1) + seq1[i - 1]\n elsif table[i - 1][j] > table[i][j - 1]\n return retrieve_seq.call(i - 1, j)\n else\n return retrieve_seq.call(i, j - 1)\n end\n end\n retrieve_seq.call(n, m)\nend", "title": "" }, { "docid": "e09684f15b97e81f152cc76e206baa99", "score": "0.63180393", "text": "def lcs(str1, str2)\n len1 = str1.length\n len2 = str2.length\n\n max = 1\n start = 0\n\n for i in 0...len1 #O(n)\n for j in 0...len2 #O(m)\n if(str1[i] == str2[j])\n\n len = find_matching_str(i, j, str1, str2, len2) #O(m)\n if(len > max)\n max = len\n start = j\n end \n end \n end\n end\n\n puts max \n puts str2[start...(max+start)] \nend", "title": "" }, { "docid": "81e16b3f8898cc6db6d145177019ca99", "score": "0.63178396", "text": "def get_similarity(first, second)\n\tfirst_prefixes = Array.new(first.length) {|i| first[0, i + 1]}\n\tsecond_prefixes = Array.new(second.length) {|i| second[0, i + 1]}\n\n\tlongest = 0\n\tfirst_prefixes.each do |prefix|\n\t\tsecond_prefixes.each do |second|\n\t\t\tlongest = second.length if second == prefix && second.length > longest\n\t\tend\n\tend\n\n\treturn longest\nend", "title": "" }, { "docid": "49c84577200bc9bf515d4c394f91cb75", "score": "0.62888885", "text": "def longest(a1, a2)\n (a1 + a2).split(\"\").uniq.sort.join\nend", "title": "" }, { "docid": "c3c105aeada96f0cf64f9ba48ee674df", "score": "0.62860715", "text": "def get_edit_distance(s1, s2)\n finalStr1 = \"\"\n finalStr2 = \"\"\n \n if ((s1.blank?) || (s2.blank?))\n return \"Miss\",\"\"\n end\n=begin\n if ((s1.blank?) && (s2.blank?))\n return finalStr1, finalStr2\n end\n \n if(s1.blank?)\n return finalStr1, s2\n end\n if(s2.blank?)\n return s1, finalStr2\n end\n=end\n \n \n len1 = s1.length\n len2 = s2.length\n \n\n dp = Hash.new{|h, k| h[k] = []}\n direction = Hash.new{|h, k| h[k] = []}\n\n for i in 0..len1\n for j in 0..len2\n if i == 0\n dp[i][j] = j\n direction[i][j] = 'd'\n elsif j == 0\n dp[i][j] = i\n direction[i][j] = 'i'\n elsif s1[i - 1] == s2[j - 1]\n dp[i][j] = dp[i - 1][j - 1]\n direction[i][j] = 'n'\n else\n insertVal = dp[i - 1][j]\n deleteVal = dp[i][j - 1]\n subsVal = dp[i - 1][j - 1]\n\n transVal = 1000000000\n if i > 1 and j > 1 and s1[i - 1] == s2[j - 2] and s1[i - 2] == s2[j - 1]\n transVal = dp[i - 2][j - 2]\n end\n\n minAll = [insertVal, deleteVal, subsVal, transVal].min\n\n if minAll == transVal\n direction[i][j] = 't'\n elsif minAll == insertVal\n direction[i][j] = 'i'\n elsif minAll == deleteVal\n direction[i][j] = 'd'\n else\n direction[i][j] = 's'\n end\n dp[i][j] = minAll + 1\n end\n end\n end\n\n \n stI = len1\n stJ = len2\n while stI > 0 or stJ > 0\n if direction[stI][stJ] == 'i'\n finalStr1 = s1[stI - 1] + finalStr1\n finalStr2 = \" \" + finalStr2\n stI = stI - 1\n\n elsif direction[stI][stJ] == 'd'\n finalStr1 = \" \" + finalStr1\n finalStr2 = s2[stJ -1] + finalStr2\n stJ = stJ - 1\n\n elsif direction[stI][stJ] == 's'\n finalStr1 = s1[stI -1] + finalStr1\n finalStr2 = s2[stJ - 1] + finalStr2\n stI = stI - 1\n stJ = stJ - 1\n\n elsif direction[stI][stJ] == 'n'\n finalStr1 = \"-\" + finalStr1\n finalStr2 = \"-\" + finalStr2\n stI = stI - 1\n stJ = stJ - 1\n\n else\n finalStr1 = \"TX\" + finalStr1\n finalStr2 = \"TX\" + finalStr2\n stI = stI - 2\n stJ = stJ - 2\n end\n end\n\n #puts finalStr1, finalStr2\n\n return finalStr1, finalStr2\n end", "title": "" }, { "docid": "352e57497da4bb1edce21d8bffb7be2f", "score": "0.6282287", "text": "def _diff res\n raise \"diff sizes\" if res.map(&:size).uniq.size != 1\n size = res.first.size\n\n dstart = nil\n dend = size - 1\n prev_eq = true\n\n size.times do |i|\n eq = res.map{ |re| re[i] }.uniq.size == 1\n if eq != prev_eq\n if eq\n # end of current diff\n dend = i-1\n else\n # start of new diff\n return nil if dstart # return nil if it's a 2nd diff\n dstart = i\n end\n end\n prev_eq = eq\n end\n dstart ||= 0\n r = dstart..dend\n r == (0..(size-1)) ? nil : r\n end", "title": "" }, { "docid": "2a9ed9bd3506dc8fc6ba497d92e70a8f", "score": "0.6282012", "text": "def longest_common_sub_strings(old_arr, new_arr, options = {})\n minimum_lcs_size = options[:minimum_lcs_size] || 0\n\n counter_hash = Hash.new\n counter_array = Array.new\n old_arr.each_with_index do |old_el, old_i|\n counter_hash[old_i] = Hash.new\n new_arr.each_with_index do |new_el, new_i|\n if old_el == new_el\n if new_i > 0 and old_i > 0 and counter_hash[old_i - 1][new_i - 1]\n counter_hash[old_i][new_i] = counter_hash[old_i - 1][new_i - 1]\n counter_hash[old_i][new_i].step_up\n else\n counter = Counter.new(old_i, new_i)\n counter_hash[old_i][new_i] = counter\n counter_array.push(counter)\n end\n end\n end\n end\n\n in_old_p_r_list = PositionRange::List.new\n in_new_p_r_list = PositionRange::List.new\n\n counter_array = counter_array.select {|co| co.step_size > minimum_lcs_size}\n\n while counter = counter_array.sort!.pop\n i = 0\n while i < counter_array.size\n if counter_array[i].in_old === counter.in_old\n counter_array[i].in_old = counter_array[i].in_old - counter.in_old\n end\n if counter_array[i].in_new === counter.in_new\n counter_array[i].in_new = counter_array[i].in_new - counter.in_new\n end\n if counter_array[i].size <= minimum_lcs_size\n counter_array.delete_at(i)\n else\n i += 1\n end\n end\n in_old_p_r_list.push(counter.in_old)\n in_new_p_r_list.push(counter.in_new)\n end\n return {:matched_old => in_old_p_r_list,\n :matched_new => in_new_p_r_list}\n end", "title": "" }, { "docid": "f2ec80da00c5b00253e9e4784eb308db", "score": "0.6274208", "text": "def one_away(str1,str2)\n i,j = 0,0\n idx_equalizer = str1.length == str2.length ? 1 : 0\n diff_count = 0\n if str1.length > str2.length\n long_string = str1\n short_string = str2\n else\n long_string = str2\n short_string = str1\n end\n while i + j < long_string.length + short_string.length\n if long_string[i] == short_string[j]\n i += 1\n j += 1\n else\n diff_count += 1\n i += 1\n j += idx_equalizer\n idx_equalizer = 0\n end\n end\n diff_count <= 1\nend", "title": "" }, { "docid": "9a0203bcdc55045a4c1db5b1046502f3", "score": "0.62720263", "text": "def lcs(a, b)\r\n\tl = max(a.size, b.size)\r\n\ts1 = Array.new(a.size + 1, 0)\r\n\ts2 = Array.new(a.size + 1, 0)\r\n\ti = 1\r\n\twhile i <= l\r\n\t\tj = 1\r\n\t\twhile j <= l\r\n\t\t\tif a[i - 1] == b[j - 1]\r\n\t\t\t\ts2[j] = s1[j - 1] + 1\r\n\t\t\telse\r\n\t\t\t\ts2[j] = max(s1[j], s2[j - 1])\r\n\t\t\tend\r\n\r\n\t\t\tj += 1\r\n\t\tend\r\n\t\tp s2\r\n\t\ts1 = s2\r\n\t\ts2 = Array.new(a.size + 1, 0)\r\n\t\ti += 1\r\n\tend\r\n\ts1[a.size]\r\nend", "title": "" }, { "docid": "0680cda2f512d3b4b5b8e1a99da39505", "score": "0.6262239", "text": "def longest(a1, a2)\n str = a1 + a2\n str.split(\"\").uniq.join\nend", "title": "" }, { "docid": "b3dd1c5df54efa357652f3e2b6d74ea5", "score": "0.62619054", "text": "def edit_distance(a, b)\n res = (0..a.length).map { |*| Array.new b.length }\n achars = a.codepoints#.sort!\n bchars = b.codepoints#.sort!\n res[0][0] = 0\n achars.each_with_index { |c,i| res[i+1][0] = i + 1 }\n bchars.each_with_index { |c,i| res[0][i+1] = i + 1 }\n achars.each_with_index { |ac,i|\n bchars.each_with_index { |bc,j|\n if ac == bc\n res[i+1][j+1] = res[i][j]\n else\n res[i+1][j+1] = [res[i][j+1], res[i+1][j], res[i][j]].min + 1\n end\n }\n }\n res.last.last\n end", "title": "" }, { "docid": "6895a4405c410db1e9eb1daeed37a84d", "score": "0.6256833", "text": "def one_away(str1, str2)\n return false if (str1.length - str2.length).abs > 1\n\n if str1.length > str2.length\n longer, shorter = str1, str2\n else\n longer, shorter = str2, str1\n end\n\n if (longer.length - shorter.length) == 1\n # brute force O(n^2)\n # longer_chars = longer.chars\n # shorter.chars.each do |ch| #n2\n # return false if longer_chars.delete(ch).nil?\n # end\n # return true\n\n #optimization1 O(nlogn) because of sort\n longerChars = longer.chars.sort\n shorterChars = shorter.chars.sort\n longer_index = 0\n shorter_index = 0\n diff = 0\n until longer_index == longer.length - 1 || shorter_index == shorter.length - 1\n if longerChars[longer_index] != shorterChars[shorter_index]\n diff += 1\n longer_index += 1\n return false if diff > 1\n else\n longer_index += 1\n shorter_index += 1\n end\n end\n else #3n => n\n longer_count = {}\n shorter_count = {}\n longer.chars.each do |ch| #n\n if longer_count[ch]\n longer_count[ch] += 1\n else\n longer_count[ch] = 1\n end\n end\n\n shorter.chars.each do |ch| #n\n if shorter_count[ch]\n shorter_count[ch] += 1\n else\n shorter_count[ch] = 1\n end\n end\n\n diff = 0\n\n longer_count.each do |key, value| #n\n diff += 1 if shorter_count[key].nil? || shorter_count[key] != value\n end\n\n return false if diff > 1\n end\n\n true\nend", "title": "" }, { "docid": "25e4333e67ef1a718ed5403fce73f0e4", "score": "0.62562335", "text": "def longest_common_prefix(s1, s2, distance)\n min = [s1.size, s2.size, distance].min\n min.times do |x|\n return s1[0...x] if s1[x] != s2[x]\n end\n return s1[0...min]\n end", "title": "" }, { "docid": "69970023a3daa07c00abf1aec910dc6b", "score": "0.62432414", "text": "def longest(a1, a2)\n (a1 + a2).split(\"\").uniq.sort.join(\"\")\nend", "title": "" }, { "docid": "8180fbd10215b94139e7a908c31d0d50", "score": "0.62345856", "text": "def common_longest_subsequence(s1, s2)\n return 0 if s1.empty? || s2.empty?\n\n num = Array.new(s1.size) { Array.new(s2.size) }\n\n chars = []\n\n s1.each_char.with_index do |letter1, i|\n s2.each_char.with_index do |letter2, j|\n if letter1 == letter2\n if i == 0 || j == 0\n num[i][j] = 1\n else\n num[i][j] = 1 + num[i - 1][j - 1]\n chars << [letter1, i, j] unless chars.any? { |char| char[1] > i || char[2] > j }\n end\n else\n if i == 0 && j == 0\n num[i][j] = 0\n elsif i == 0 && j > 0 # First ith element\n num[i][j] = [0, num[i][j - 1]].max\n elsif j == 0 && i > 0 # First jth element\n num[i][j] = [0, num[i - 1][j]].max\n else\n num[i][j] = [num[i - 1][j], num[i][j - 1]].max\n end\n end\n end\n end\n\n p num[s1.length - 1][s2.length - 1]\n chars.map(&:first).join\n end", "title": "" }, { "docid": "c2fb05c7674d288ecb8539f12d41fd92", "score": "0.61996335", "text": "def levenshteinDistance( s1, s2 )\n # Make a table of s1.length+1 rows by s2.length+1 columns\n table = Array.new( s1.length + 1 )\n table.collect! { |x| Array.new( s2.length + 1, 0 ) }\n\n s1.length.times { |i|\n table[i][0] = i\n }\n s2.length.times { |i|\n table[0][i] = i\n }\n (1..(s1.length)).each { |i|\n (1..(s2.length)).each { |j|\n cost = 0\n if s1[i] != s2[j] then\n cost = 1\n end\n table[i][j] = [\n table[i-1][j] + 1, # Deletion\n table[i][j-1] + 1, # Insertion\n table[i-1][j-1] + cost # Substitution\n ].min\n }\n }\n return table[-1][-1]\nend", "title": "" }, { "docid": "2d212782d9cfdc8a2206ad0b01ba702a", "score": "0.6194522", "text": "def getMinimumDifference(a, b)\n arr = []\n for i in 0..a.length-1\n if (a[i].length != b[i].length)\n arr.push(-1);\n \n elsif (a[i].length == 0)\n arr.push(0);\n \n else \n m1 = getMap(a[i])\n m2 = getMap(b[i])\n puts count(m1,m2)\n puts count(m2,m1)\n arr.push([count(m1, m2), count(m2, m1)].max)\n end\n end\n return arr;\nend", "title": "" }, { "docid": "0255afc257c571a0ccec6f82cee85ed4", "score": "0.61939067", "text": "def commonPrefixLength(lists)\n minLength = lists.map{|list| list.size()}.min()\n prefixLen = 0\n\n for i in 0...minLength\n part = nil\n same = true\n\n lists.each{|list|\n if (part == nil)\n part = list[i]\n elsif (part != list[i])\n same = false\n break\n end\n }\n\n if (same)\n prefixLen += 1\n else\n break\n end\n end\n\n return prefixLen\nend", "title": "" }, { "docid": "246604dd1bdd24b421a1fa53814aae41", "score": "0.6184399", "text": "def ladder_length(begin_word, end_word, word_list)\n word_list = word_list.to_set\n return 0 if !word_list.include?(end_word)\n qb, qe, dist = Set[begin_word], Set[end_word], 1\n while !qb.empty? && !qe.empty?\n dist += 1\n temp = Set.new\n qb.each do |x|\n x.size.times do |i|\n ('a'..'z').each do |c|\n w = x[0, i] + c + x[i+1, x.size-i]\n return dist if qe.include?(w)\n next if !word_list.include?(w)\n word_list.delete(w)\n temp << w\n end\n end\n end\n if temp.size < qe.size\n qb = temp\n else\n qb, qe = qe, temp\n end\n end\n 0\nend", "title": "" }, { "docid": "3c57a9f28de05ab293dd18860e308eaf", "score": "0.61827284", "text": "def longest(a1, a2)\n both_strings = a1 + a2\n both_strings.split('').uniq.sort.join('')\nend", "title": "" }, { "docid": "2ec3aa3ac0fce9ea0e99baa2de94f802", "score": "0.6174601", "text": "def common_prefix_len(str1, str2)\n min_len = [str1.length, str2.length].min\n (0..min_len).each { |i| if str1[i] != str2[i] then return i end }\n return smaller_str_len\nend", "title": "" }, { "docid": "1a1bced74a8ee53896a9e3e4bf55a2c5", "score": "0.61714447", "text": "def longest(arr1, arr2)\n (arr1 + arr2).split('').sort.uniq.join('')\nend", "title": "" }, { "docid": "8f8260a65106588436b9558bf785287d", "score": "0.6170695", "text": "def longest(s1, s2)\n all_letters = s1 + s2\n p all_letters.chars.uniq.sort.join\nend", "title": "" }, { "docid": "cad795b7177cb1e10c03a341c0cce9cd", "score": "0.616523", "text": "def sim(str1, str2)\n longer = [str1, str2].max\n same = str1.each_char.zip(str2.each_char).select {|str1,str2| str1 == str2}.size\n return same\nend", "title": "" }, { "docid": "f1ea9b0289f63a368e75e55393e47271", "score": "0.6135117", "text": "def ladder_length(begin_word, end_word, word_list)\n word_set = Set.new(word_list)\n return 0 unless word_set.member?(end_word) # member alis of include\n queue = [[begin_word, 1]]\n \n while !queue.empty? do \n s = queue[0][0]\n l = queue[0][1]\n return l if s == end_word\n queue.delete_at(0)\n s.size.times do |i|\n left = s[0...i]\n right = s[(i + 1)...s.size]\n#on word trying all combination's change single letter 'a'..'z' each time\n for c in \"a\".ord..\"z\".ord do\n# \"agh\".ord => 97 returns codepoint of 1st char in str\n next if c == s[i].ord\n combined = left + c.chr + right\n if word_set.member?(combined) then\n word_set.delete(combined)\n queue << [combined, l + 1]\n end\n end\n \n end\n end\n \n 0\nend", "title": "" }, { "docid": "6b4562a6c394dd5e956640fbe74a7448", "score": "0.61329377", "text": "def longest_common_prefix(s1, s2, max = nil)\n l1, l2 = s1.size, s2.size\n min = l1 < l2 ? l1 : l2\n min = min < max ? min : max if max\n min.times do |i|\n return s1.slice(0, i) if s1[i] != s2[i]\n end\n return s1.slice(0, min)\nend", "title": "" }, { "docid": "4441cf94d04d8bb6b27d28732d95ea1e", "score": "0.61223006", "text": "def range_with_diff_subseq(other)\n self_size = self.size\n other_size = other.size\n\n low = 0\n max_pos = self_size < other_size ? self_size : other_size\n # trim beginning with the same value\n while low < max_pos and self[low] == other[low]\n low += 1\n end\n\n high = -1\n max_pos = -max_pos\n # trim end with the same value\n while high > max_pos and self[high] == other[high]\n high -= 1\n end\n\n # the two arrays within this range contain different values\n (low..high)\n end", "title": "" }, { "docid": "403e90b5ed1ac892e3f9149d38706dc5", "score": "0.61210436", "text": "def intersect(list1, list2)\n if list1 == nil && list2 == nil\n return nil\n end\n\n result1 = getTailAndSize(list1)\n result2 = getTailAndSize(list2)\n if result1.tail != result2.tail\n return nil\n end\n\n shorter = result1.size < result2.size ? list1 : list2\n longer = result1.size > result2.size ? list1 : list2\n longer_node = getKthNode(longer, Math.abs(result1.size - result2.size))\n\n while shorter != longer_node\n shorter = shorter.next\n longer_node = longer_node.next\n end\n\n return shorter\nend", "title": "" }, { "docid": "fd65d1f145815f32f434c3a3931d3c93", "score": "0.61157024", "text": "def solution(a)\n a1 = []\n a2 = []\n len = a.length\n count = 0\n \n a.each_with_index do |el, i|\n a1 << i-el\n a2 << i+el\n end\n \n a1.sort\n a2.sort\n \n (len-1).downto(0) do |i|\n position = a2.find_index(a1[i])\n if position && position >= 0\n while ((position < len) && (a2[position] == a1[i])) do\n position += 1\n end\n count += position \n else\n insertion_point = -(position+1)\n count += insertion_point\n end\n end\n \n sub = len*((len+1)/2)\n \n return -1 if (count > 10000000)\n \n count\nend", "title": "" }, { "docid": "e697344525229449e809e37335d3e126", "score": "0.6111237", "text": "def levenshtein_distance(str1, str2)\n small = str1.length < str2.length ? str1 : str2\n big = str1.length >= str2.length ? str1 : str2\n\n even_edits = Array(0..small.length + 1)\n odd_edits = Array.new(small.lenghth + 1, nil)\n\n (1..big.length + 1).each do |i|\n if i % 2 == 1\n current_edits = odd_edits\n previous_edits = even_edits\n else\n current_edits = even_edits\n previous_edits = odd_edits\n end\n\n current_edits[0] = i\n (1..small.length + 1).each do |j|\n if big[i - 1] == small[j - 1]\n current_edits[j] = previous_edits[j - 1]\n else\n current_edits[j] = 1 + [previous_edits[j - 1], previous_edits[j], current_edits[j - 1]].min\n end\n end\n end\n\n big.length % 2 == 0 ? even_edits[-1] : odd_edits[-1]\nend", "title": "" }, { "docid": "20f1499c52d737baf8369ba94f9ffc95", "score": "0.6086667", "text": "def getMaxLCS(p1, p2)\n\t\ti = 1\n\t\trootOffset = p1[i]\n\t\twhile p1[i] == p2[i] && i <= p1.size && i <= p2.size\n\t\t\ti += 1\n\t\tend\n\t\t[i-1, rootOffset, p1[i-1]]\n\tend", "title": "" }, { "docid": "8a122d735ce14a10ee4f27f4cb9babed", "score": "0.60859823", "text": "def longest_string(list_of_words)\n list1=[]\n list2=[]\n zero= list_of_words.length\n if zero==0\n return nil\n end\n list_of_words.each do |n|\n\n\n\n if list1.length== 0\n list1.push n\n next\n end\n list2.push n\n comp1=list1[0].length\n comp2=list2[0].length\n\n if comp1 > comp2\n list2= []\n next\n elsif comp1 < comp2\n list1= list2\n list2=[]\n next\n end\n\n end\n return list1.join\n\nend", "title": "" }, { "docid": "507995950f049a4fab8bd73b948d34ee", "score": "0.6084794", "text": "def longest(string1,string2)\n (string1.chars + string2.chars).sort.uniq.join\nend", "title": "" }, { "docid": "50ee0aa34368b3323681d5d802531ab3", "score": "0.60713136", "text": "def dynamic_lcs(str1, str2)\n c = []\n 0.upto(str1.length) do |i|\n row = []\n 0.upto(str2.length) do |j|\n row << {value: 0, subseq: \"\"}\n end\n c << row\n end\n\n 0.upto(str1.length) do |i|\n 0.upto(str2.length) do |j|\n unless i == 0 || j == 0\n if str1[i-1] != nil && str2[j-1] != nil && str1[i-1] == str2[j-1]\n c[i][j][:value] = c[i-1][j-1][:value] + 1\n c[i][j][:subseq] = c[i-1][j-1][:subseq] + str1[i-1]\n elsif c[i][j-1][:value] > c[i-1][j][:value]\n c[i][j][:value] = c[i][j-1][:value]\n c[i][j][:subseq] = c[i][j-1][:subseq]\n else\n c[i][j][:value] = c[i-1][j][:value]\n c[i][j][:subseq] = c[i-1][j][:subseq]\n end\n end\n end\n end\n printMatrix(c)\n c[str1.length][str2.length]\nend", "title": "" }, { "docid": "2531041e3eadb9f11de3d456282a3496", "score": "0.6070704", "text": "def distance a, b \n\ta_size= a.size\n\tb_size=b.size\n\tmin = 2**30\n\t(0..a_size-1).each do |i| \n\t\t(0..b_size-1).each do |j|\n\t\t temp= @list.select{|(x, y)| (x == a[i]&&y==b[j])|| (y == a[i]&&x==b[j])}\n\t\t if !temp[0].nil? && temp[0][2] < min \n\t\t min = temp[0][2]\n\t\t end\n\t\tend\t\n\tend\n\treturn min \nend", "title": "" }, { "docid": "46975906abd9c7f932b602a89a484c32", "score": "0.6063554", "text": "def long_comm_substring(s1, s2)\n table = []\n maximum = nil\n\n i = 0\n while i < s1.length\n table << []\n j = 0\n while j < s2.length\n value = s1[i] == s2[j] ? 1 : 0\n if i == 0 || j == 0\n table[i] << value\n else\n if value == 1\n table[i] << (table[i - 1][j - 1] + value)\n else\n table[i] << 0\n end\n end\n\n if maximum.nil? || table[i][j] > maximum\n maximum = table[i][j]\n end\n\n j += 1\n end\n i += 1\n end\n\n maximum\nend", "title": "" }, { "docid": "24c1390d542e276f5b88eebe1927f539", "score": "0.6062899", "text": "def damerau_levenshtein(other)\n n, m = self.length, other.length\n return m if n == 0\n return n if m == 0\n matrix = Array.new(n+1) do |i|\n Array.new(m+1) do |j|\n if i == 0 then j\n elsif j == 0 then i \n else 0 end\n end\n end\n (1..n).each do |i|\n (1..m).each do |j|\n cost = (self[i] == other[j]) ? 0 : 1\n delete = matrix[i-1][j] + 1\n insert = matrix[i][j-1] + 1\n substitution = matrix[i-1][j-1] + cost\n matrix[i][j] = [delete, insert, substitution].min\n if (i > 1) && (j > 1) && (self[i] == other[j-1]) && (self[i-1] == other[j])\n matrix[i][j] = [matrix[i][j], matrix[i-2][j-2] + cost].min\n end\n end\n end\n return matrix.last.last\n end", "title": "" }, { "docid": "a7e5b6647e7edffc7379601b3c9920de", "score": "0.60609096", "text": "def levenshtein_distance(str1, str2)\n s = str1.encode(Encoding::UTF_8).unpack(\"U*\")\n t = str2.encode(Encoding::UTF_8).unpack(\"U*\")\n\n n = s.length\n m = t.length\n\n return m if n.zero?\n return n if m.zero?\n\n d = (0..m).to_a\n x = nil\n\n n.times do |i|\n e = i + 1\n m.times do |j|\n cost = s[i] == t[j] ? 0 : 1\n insertion = d[j + 1] + 1\n deletion = e + 1\n substitution = d[j] + cost\n x = insertion < deletion ? insertion : deletion\n x = substitution if substitution < x\n\n d[j] = e\n e = x\n end\n d[m] = x\n end\n\n return x\n end", "title": "" }, { "docid": "edb14a48b836cfe3b121b6c0d3948857", "score": "0.6060234", "text": "def levenshtein_distance(word1, word2)\n len1 = word1.length\n len2 = word2.length\n\n # init: deletion only case\n for i in 0..lenl\n d[i][0] = i\n end\n\n # init: insertion only case\n for j in 1..len2\n d[0][j] = j\n end\n\n for j in 1..len2\n for i in 1..len1\n if word1[i] == word2[j] # same as distance until index-1 chars\n d[i][j] = d[i-1][j-1]\n else\n [ d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1 #substitution\n ].min\n end\n end\n end\nend", "title": "" }, { "docid": "e288416ea5e64f976cece5b5fbae1a0a", "score": "0.60593414", "text": "def damerau_levenshtein(other)\n n, m = self.length, other.length\n return m if n == 0\n return n if m == 0\n matrix = Array.new(n+1) do |i|\n Array.new(m+1) do |j|\n if i == 0 then j\n elsif j == 0 then i\n else 0 end\n end\n end\n (1..n).each do |i|\n (1..m).each do |j|\n cost = (self[i] == other[j]) ? 0 : 1\n delete = matrix[i-1][j] + 1\n insert = matrix[i][j-1] + 1\n substitution = matrix[i-1][j-1] + cost\n matrix[i][j] = [delete, insert, substitution].min\n if (i > 1) && (j > 1) && (self[i] == other[j-1]) && (self[i-1] == other[j])\n matrix[i][j] = [matrix[i][j], matrix[i-2][j-2] + cost].min\n end\n end\n end\n return matrix.last.last\n end", "title": "" }, { "docid": "e288416ea5e64f976cece5b5fbae1a0a", "score": "0.60593414", "text": "def damerau_levenshtein(other)\n n, m = self.length, other.length\n return m if n == 0\n return n if m == 0\n matrix = Array.new(n+1) do |i|\n Array.new(m+1) do |j|\n if i == 0 then j\n elsif j == 0 then i\n else 0 end\n end\n end\n (1..n).each do |i|\n (1..m).each do |j|\n cost = (self[i] == other[j]) ? 0 : 1\n delete = matrix[i-1][j] + 1\n insert = matrix[i][j-1] + 1\n substitution = matrix[i-1][j-1] + cost\n matrix[i][j] = [delete, insert, substitution].min\n if (i > 1) && (j > 1) && (self[i] == other[j-1]) && (self[i-1] == other[j])\n matrix[i][j] = [matrix[i][j], matrix[i-2][j-2] + cost].min\n end\n end\n end\n return matrix.last.last\n end", "title": "" }, { "docid": "ae10f5e1641f5047aa611f426748fe1d", "score": "0.60405064", "text": "def solution(s)\n # write your code in Ruby 2.2\n len = s.length\n return 0 if len == 1\n return -1 if len % 2 == 0\n \n mid = s.length / 2\n (0...mid).each do |i|\n j = len - 1 - i\n return -1 if s[i] != s[j]\n end \n \n mid\nend", "title": "" }, { "docid": "ecc632c76314100689177821649bf13f", "score": "0.60400516", "text": "def LIS(arr)\n longest = Array.new(arr.size) { Array.new }\n longest[0] << arr[0]\n (1...arr.size).each do |i|\n (0...i).each do |j|\n if arr[j] < arr[i] && longest[i].size < longest[j].size + 1 \n longest[i] = longest[j].dup\n end\n end\n longest[i] << arr[i]\n end\n longest.max_by(&:length).length\n\nend", "title": "" }, { "docid": "e9fd845e5d873e75e86502aa4c1be95a", "score": "0.6036161", "text": "def _trace_glcs_table\n @front_overflow, @rear_overflow = 0, 0\n @common_elements, @mapped_elements = [], []\n diff_string1, diff_string2 = '', ''\n\n @position_map_begin, @position_map_end = {}, {}\n addition, deletion = [], []\n p1, p2 = 0, 0\n\n while p1 <= @len1 && p2 <= @len2\n s1, s2 = _prefix_eq(@str1[p1..@len1], @str2[p2..@len2])\n if s1 != nil\n l1, l2 = s1.length, s2.length\n\n @position_map_begin[p1], @position_map_end[p1] = p2, p2\n (p1 + 1 ... p1 + l1).each{|i| @position_map_begin[i], @position_map_end[i] = nil, nil}\n\n @common_elements << [s1, s2]\n\n if !addition.empty? && deletion.empty?\n # If an addition is found in the front or the rear, it is a case of underflow\n @str2_match_begin = addition.length if p1 == 0\n @str2_match_end = l2 - addition.length if p1 == @len1\n\n if p1 == 0\n # leave as it is\n elsif p1 == @len1\n # retract from the end\n @position_map_begin[p1] = p2 - addition.length\n @position_map_end[p1] = @position_map_begin[p1]\n else\n # correct the position for end\n @position_map_end[p1] = p2 - addition.length\n end\n elsif addition.empty? && !deletion.empty?\n # If a deletion is found in the front or the rear, it is a case of overflow\n @str1_match_begin = deletion.length if p1 == deletion.length\n @str1_match_end = l1 - deletion.length if p1 == @len1\n\n deletion.each{|p| @position_map_begin[p], @position_map_end[p] = p2, p2}\n elsif !addition.empty? && !deletion.empty?\n # If an addition and a deletion are both found in the front or the rear,\n # the overflow/underflow is approximated to the difference.\n al, dl = addition.length, deletion.length\n @front_overflow = dl - al if p1 == dl\n @rear_overflow = dl - al if p1 == @len1\n\n @mapped_elements << [@str1[deletion[0], dl], @str2[addition[0], al]]\n\n @position_map_begin[deletion[0]], @position_map_end[deletion[0]] = addition[0], addition[0]\n deletion[1..-1].each{|p| @position_map_begin[p], @position_map_end[p] = nil, nil}\n end\n\n addition.clear; deletion.clear\n p1 += l1; p2 += l2\n\n elsif p2 < @len2 && (p1 == @len1 || @glcs[p1][p2 + 1] > @glcs[p1 + 1][p2])\n diff_string2 += @str2[p2]\n\n addition << p2\n p2 += 1\n elsif p1 < @len1 && (p2 == @len2 || @glcs[p1][p2 + 1] <= @glcs[p1 + 1][p2])\n diff_string1 += @str1[p1]\n\n deletion << p1\n p1 += 1\n end\n end\n\n @common_elements.pop\n @diff_strings = [diff_string1, diff_string2]\n end", "title": "" }, { "docid": "36e57154ec512909fa7f8b3d8c2f67b5", "score": "0.6035851", "text": "def levenshtein_distance(str1, str2, prefix_len, dist)\n for j in (1..str2.length) do \n for i in (prefix_len+1..str1.length) do\n if (str1[i-1] == str2[j-1])\n dist[i][j] = dist[i-1][j-1]\n else\n dist[i][j] = [dist[i-1][j]+1, dist[i-1][j-1]+1, dist[i][j-1]+1].min\n end\n end \n end\n return dist[str1.length][str2.length]\nend", "title": "" }, { "docid": "b568a05147885b841a6e4b020b3fc387", "score": "0.60248446", "text": "def short_long_short(string1, string2)\r\n arr = [string1, string2].sort_by { |el| el.length }\r\n arr.first + arr.last + arr.first\r\nend", "title": "" }, { "docid": "082d949ed2db1c4eb11fc764b2da1480", "score": "0.6022017", "text": "def short_long_short(string1, string2)\n arr = [string1, string2].sort_by { |el| el.length }\n arr.first + arr.last + arr.first\nend", "title": "" }, { "docid": "62660b03b60731282ca191a425b51fce", "score": "0.6021141", "text": "def short_long_short(array1, array2)\n arr = [array1, array2].sort_by { |element| element.length }\n arr.first + arr.last + arr.first\nend", "title": "" }, { "docid": "1adf62c2032d89e6552ff640145a945a", "score": "0.60201734", "text": "def hamming(strand1, strand2)\n differences = 0\n \n length = strand1.length\n \n length.times do |i|\n if strand1[i] != strand2[i]\n differences += 1\n end\n end\n \n return differences\nend", "title": "" }, { "docid": "1a261466fad7112621c428467159b7b2", "score": "0.6018124", "text": "def f(str1, str2)\n # commented length restriction to calculate for long case\n return '' if str1.length.zero? #|| str1.length > 4096\n return '' if str2.length.zero? #|| str2.length > 4096\n\n return str1 if (str1 <=> str2) == 0\n # найти все общие вхождения в виде массива\n # сделать из массива строку\n # сделать словарь из этой строки (из все общих символов)\n # найти вхождения из словаря в строке№2\n set1 = str1.split('').to_set\n set2 = str2.split('').to_set\n list_of_intersectional_chars = set1.intersection(set2)\n intersectional_string = list_of_intersectional_chars.to_a.join('')\n intersectional_string.insert(0, '[')\n intersectional_string.insert(-1, ']')\n\n regexp = Regexp.new(intersectional_string)\n str1_intersections_only = str1.scan(regexp).join('')\n\n sl = (1..str1_intersections_only.length).to_a.reverse\n sl.slice!(0)\n\n for n in sl do\n for i in 0..(str1_intersections_only.length) do\n if (str1_intersections_only.length - n) > i\n return str1_intersections_only[i, n] if str2.include?(str1_intersections_only[i, n])\n end\n end\n end\nend", "title": "" }, { "docid": "d2a29f1143b43686a809cdad7dcb8be3", "score": "0.60181034", "text": "def lcs(x, y)\n first_sequence_array = x.split(\"\")\n second_sequence_array = y.split(\"\")\n common_sequence_array = []\n\n common_elements = first_sequence_array & second_sequence_array #check if the arrays have common elements\n if common_elements.empty? #if the array is empty, no common elements\n return \"\"\n else #there are common elements\n while second_sequence_array.length > 0 || first_sequence_array.length > 0\n\n if first_sequence_array[first_sequence_array.length-1] == second_sequence_array[second_sequence_array.length-1]\n common_sequence_array.push(first_sequence_array[first_sequence_array.length-1])\n first_sequence_array.slice!(-1)\n second_sequence_array.slice!(-1)\n\n elsif first_sequence_array.count(second_sequence_array[-1]) == 0 && second_sequence_array.count(first_sequence_array[-1]) == 0\n first_sequence_array.slice!(-1)\n second_sequence_array.slice!(-1)\n\n elsif second_sequence_array.count(first_sequence_array[-1]) == 0\n first_sequence_array.slice!(-1)\n\n elsif first_sequence_array.count(second_sequence_array[-1]) == 0\n second_sequence_array.slice!(-1)\n\n elsif first_sequence_array[-1] < second_sequence_array[-1]\n first_sequence_array.slice!(-1)\n else\n second_sequence_array.slice!(-1)\n\n end\n end\n return common_sequence_array.reverse.join()\n end\nend", "title": "" }, { "docid": "fa67b166dd11ad9d770dabd76b66ed00", "score": "0.6012747", "text": "def levenshtein_distance(a, b)\n a_len = a.length\n b_len = b.length\n d = Array.new(a_len + 1).map! {\n Array.new(b_len + 1).map!{\n 0\n }\n }\n (a_len + 1).times { |i| d[i][0] = i }\n (b_len + 1).times { |i| d[0][i] = i }\n\n for i in 1..(a_len)\n for j in 1..(b_len)\n cost = (a[i - 1] == b[j - 1]) ? 0 : 1\n d[i][j] = [ d[i-1][j] + 1 , d[i][j-1] + 1 ,d[i-1][j-1] + cost].min\n end\n end\n d[-1][-1]\n end", "title": "" }, { "docid": "a32d8c97c68e3c759722578d2ce30ad7", "score": "0.6008229", "text": "def solution(a, b)\n downstream = a.zip(b).map { |size, dir| [size, dir] }\n alive = 0\n upstream = []\n\n loop do\n if upstream.empty?\n size, dir = downstream.pop\n if dir == 1 # keep alive\n alive += 1\n else\n upstream << [size, dir]\n end\n else\n down_size, down_dir = downstream.last\n up_size, up_dir = upstream.last\n\n if up_dir == down_dir\n upstream << downstream.pop\n else\n if up_size > down_size\n downstream.pop\n else\n upstream.pop\n end\n end\n end\n\n break if downstream.empty?\n end\n\n downstream.size + upstream.size + alive\nend", "title": "" }, { "docid": "cd5312d82ca940ac2dddc743dd73a391", "score": "0.60057175", "text": "def similar(w1,w2)\n#two different ways to construct a multiset http://stackoverflow.com/questions/5128200/how-to-count-identical-string-elements-in-a-ruby-array\n#a.group_by {|name| name}.map {|k,v| [k,v.length]}\n#a.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n\tc1=w1.chars;c2=w2.chars;\n\th1=c1.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n\th2=c2.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n\tw1 != w2 and (h1.keys+h2.keys).uniq.each.inject(0) do |sum,k|\n\t\tsum+(h1[k]-h2[k]).abs\n\tend <= 2\nend", "title": "" }, { "docid": "3001dd8908758968f816ea16834a6262", "score": "0.59936213", "text": "def solution(a, b)\n\n s = []\n\n (0..(a.length-1)).each do |i|\n fish_size = a[i]\n fish_direction = b[i]\n\n if(s.length == 0)\n s.unshift(i)\n next\n end\n\n\n while(s.length > 0 && fish_direction - b[s[0]] == -1 && a[s[0]] < fish_size)\n s.shift()\n end\n\n if((s.length == 0)||(s.length > 0 && fish_direction - b[s[0]] != -1))\n s.unshift(i)\n end\n end\n\n s.length\nend", "title": "" }, { "docid": "7a865ff5a7b2aedbe4d42c7c7e7d986c", "score": "0.5992897", "text": "def min_diff(array_1, array_2)\n array_1.sort!\n array_2.sort!\n \n longest=[array_1.length, array_2.length].max\n min_diff=nil\n i=0\n j=0\n while(array_1[i] && array_2[j])\n difference=array_1[i]-array_2[j]\n if difference<0\n i+=1\n elsif difference>0\n j+=1\n else \n return difference\n end\n min_diff = difference.abs if ( !min_diff ||difference.abs < min_diff) \n end\n return min_diff\n end", "title": "" }, { "docid": "454d21a24183b239d2eacd08aeaa4272", "score": "0.5989304", "text": "def find_common_stops(arr1, arr2, num_seqs)\n # for each array,\n last_stops_arr1, last_stops_arr2 = [arr1, arr2].collect { |arr|\n arr.collect { |sequence|\n last_stop = Stop.find(sequence.last[0])\n }\n }\n\n common_stops = last_stops_arr1.collect { |arr1_stop|\n last_stops_arr2.collect { |arr2_stop|\n [arr1_stop, arr2_stop] if (arr1_stop.stop_lat - arr2_stop.stop_lat).abs < 0.0035 &&\n (arr1_stop.stop_lon - arr2_stop.stop_lon).abs < 0.0035\n }.compact\n }.uniq.reject { |arr| arr.size == 0}\n\n if common_stops.size > 0\n best_sequences = common_stops.collect { |stop_pair|\n\n # choose the shortest sequence that gets you to the common stop\n arr1_stop = stop_pair.flatten[0]\n arr1_shortest_sequence = arr1.select { |sequence|\n sequence[-1][0] == arr1_stop.stop_id\n }.sort_by(&:length)[0]\n\n # choose the shortest sequence that gets you to the common stop\n arr2_stop = stop_pair.flatten[1]\n arr2_shortest_sequence = arr2.select { |sequence|\n sequence[-1][0] == arr2_stop.stop_id\n }.sort_by(&:length)[0]\n\n [arr1_shortest_sequence, arr2_shortest_sequence]\n }.reject { |arr| arr.size == 0}\n\n # for each pair of sequences, determine how equal they are\n ranked_indexes = best_sequences.collect.with_index { |sequence, i|\n arr1_size = sequence[0].size\n arr2_size = sequence[1].size\n tot_size = arr1_size + arr2_size\n avg_size = (arr1_size + arr2_size) / 2.0\n equality = (arr1_size - avg_size).abs + (arr2_size - avg_size).abs / 2.0\n\n [i, equality, tot_size]\n }\n\n # sort by equality\n sorted_indexes = ranked_indexes.sort do |a,b|\n comp = (a[1] <=> b[1])\n comp.zero? ? (a[2] <=> b[2]) : comp\n end\n\n # return only a subset of sequences\n indexes_to_return = sorted_indexes[0..num_seqs-1].collect { |arr|\n arr[0]\n }\n\n indexes_to_return.collect { |i|\n best_sequences[i]\n }\n else\n []\n end \n end", "title": "" }, { "docid": "1766cfe92a35ecbaa51cbf6e1837046a", "score": "0.59872055", "text": "def common_prefix_len(toks)\n n = toks.map { |t| t.length }.min()\n is_prefix = lambda { |_n| toks[1..-1].all? { |t| t[0..._n] == toks.first[0..._n] }}\n while n > 1 && ! is_prefix[n]\n n -= 1\n end\n n\nend", "title": "" }, { "docid": "b630ad20a2e291cf9431d074ab39c9fb", "score": "0.5983036", "text": "def update_array_length(arr_one, arr_two)\n if arr_one.length < arr_two.length\n adjusted_arr_one = []\n arr_two.each_with_index do |value, index|\n if arr_one.length == 1\n adjusted_arr_one << arr_one[0]\n elsif index >= arr_one.length\n if index >= arr_one.length * 2\n adjusted_arr_one << arr_one[index % arr_one.length]\n else\n adjusted_arr_one << arr_one[index - arr_one.length]\n end\n else\n adjusted_arr_one << arr_one[index]\n end\n end\n return adjusted_arr_one, arr_two\n elsif arr_one.length > arr_two.length\n adjusted_arr_two = []\n arr_one.each_with_index do |value, index|\n if arr_two.length == 1\n adjusted_arr_two << arr_two[0]\n elsif index >= arr_two.length\n if index >= arr_two.length * 2\n adjusted_arr_two << arr_two[index % arr_two.length]\n else\n adjusted_arr_two << arr_two[index - arr_two.length]\n end\n else\n adjusted_arr_two << arr_two[index]\n end\n end\n return arr_one, adjusted_arr_two\n end\nend", "title": "" }, { "docid": "cec66736f32b309de02056ac1aec59b3", "score": "0.59829754", "text": "def min_deletions(str1, str2)\n # make hashes of the number of letters in each string and get total difference\n a_hash = {}\n b_hash = {}\n diff = 0\n\n str1.split('').each { |ltr| a_hash[ltr] ? a_hash[ltr] += 1 : a_hash[ltr] = 1}\n str2.split('').each { |ltr| b_hash[ltr] ? b_hash[ltr] += 1 : b_hash[ltr] = 1}\n\n a_hash.each { |ltr, amt| b_hash[ltr] ? diff += (amt - b_hash[ltr]).abs : diff += amt }\n\n b_hash.each { |ltr, amt| diff += amt unless a_hash[ltr] }\n\n diff\nend", "title": "" }, { "docid": "a16e6337362dc31c74a4ecaa69504cdd", "score": "0.59815514", "text": "def solution(a, b)\r\n p a+b+a if b.length > a.length\r\n p b+a+b if a.length > b.length \r\n \r\nend", "title": "" }, { "docid": "4f592e5ac0c08383e4b881e337f4c25c", "score": "0.59779674", "text": "def solution(a, b)\n segments = a.zip(b)\n return 0 if segments.length == 0\n\n count, tail = 0, -1\n segments.each do |s|\n if s[0] > tail\n count += 1\n tail = s[1]\n end\n end\n\n count\nend", "title": "" } ]
5bbd9bba2a22ecb46b34f7b160b0ca13
GET /star_golds/1 GET /star_golds/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "87ba77e964e86acf7e91fcc5ebdcb5db", "score": "0.7100197", "text": "def show\n @star = Star.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star }\n end\n end", "title": "" }, { "docid": "fd6df0810330672e9db3ac377c3242d6", "score": "0.69523436", "text": "def show\n @gold = Gold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gold }\n end\n end", "title": "" }, { "docid": "03ef76ff1219436f35ad824993d9fdd5", "score": "0.68738693", "text": "def starred\n connection.get(\"#{path_prefix}/starred\").body\n end", "title": "" }, { "docid": "eb3c549f9806773da379129879fa8d95", "score": "0.6828541", "text": "def index\n @stars = Star.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stars }\n end\n end", "title": "" }, { "docid": "b79da73fee5f06f5bcd0730067333f8f", "score": "0.6774235", "text": "def set_star_gold\n @star_gold = StarGold.find(params[:id])\n end", "title": "" }, { "docid": "d58b5f131d2bc454a483c6b09be07135", "score": "0.6590844", "text": "def new\n @star = Star.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star }\n end\n end", "title": "" }, { "docid": "a8160455a103a286a717b7333be371b8", "score": "0.65109354", "text": "def create\n @star_gold = StarGold.new(star_gold_params)\n\n respond_to do |format|\n if @star_gold.save\n format.html { redirect_to @star_gold, notice: 'Record successfully created.' }\n format.json { render :show, status: :created, location: @star_gold }\n else\n format.html { render :new }\n format.json { render json: @star_gold.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31b7686355b1e98df5164bf8dcca552a", "score": "0.6502674", "text": "def star\n res = client.put(path_star, star: true).to_h\n end", "title": "" }, { "docid": "ed02bb7012211525e2ea14a3e9671f47", "score": "0.6421603", "text": "def parse_star_wars\n response_string = RestClient.get('http://swapi.dev/api/people')\n JSON.parse(response_string)\nend", "title": "" }, { "docid": "037470a5da9b31a58d2ccb8db65cf9e8", "score": "0.6392833", "text": "def show\n @gig = Gig.find(params[:id])\n\n render json: @gig\n end", "title": "" }, { "docid": "25ae7046eedb10c6fa98cb653e31b046", "score": "0.63109237", "text": "def show\n @rating = Rating.find(params[:id])\n render json: @rating\nend", "title": "" }, { "docid": "a1b943deafe665aa7bb9c4e16aae2314", "score": "0.62964135", "text": "def show\n @star = Star.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @star }\n end\n end", "title": "" }, { "docid": "0dd820d98691a00a506dbb28de14389e", "score": "0.6294164", "text": "def show\n @rating = Rating.find(params[:id])\n\n render json: @rating\n end", "title": "" }, { "docid": "4b83900208d3b9008ff123fa21659d40", "score": "0.62434167", "text": "def update\n respond_to do |format|\n if @star_gold.update(star_gold_params)\n format.html { redirect_to @star_gold, notice: 'Record successfully updated.' }\n format.json { render :show, status: :ok, location: @star_gold }\n else\n format.html { render :edit }\n format.json { render json: @star_gold.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b54a11f2f3db28f92e27641d5a6b492", "score": "0.62431884", "text": "def index\n @golds = Gold.all\n end", "title": "" }, { "docid": "fb10dbb2fd4177003368288d286219f3", "score": "0.62339675", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end", "title": "" }, { "docid": "5bce0d70c70f5cc57e0275b1e12b2557", "score": "0.62226385", "text": "def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end", "title": "" }, { "docid": "9774634d562f33522fbe7895566e3f34", "score": "0.62189823", "text": "def starring(username=nil)\n if username\n get \"/users/#{username}/starred\"\n else\n get \"/user/starred\"\n end\n end", "title": "" }, { "docid": "bae167bfd66f68794ae8c274bfb69ef1", "score": "0.6213487", "text": "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig }\n end\n end", "title": "" }, { "docid": "bae167bfd66f68794ae8c274bfb69ef1", "score": "0.6213487", "text": "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig }\n end\n end", "title": "" }, { "docid": "1da6e86c4cb4060fd2f03787ea4e5fe9", "score": "0.62066686", "text": "def show\n\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig }\n end\n end", "title": "" }, { "docid": "e379e3699386887e2091c673ab91e9ed", "score": "0.6200585", "text": "def show\n @grit = Grit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grit }\n end\n end", "title": "" }, { "docid": "599b87772c47a8c8f2e1c9d176b6ff5a", "score": "0.6170414", "text": "def star\n connection.put(\"#{path_prefix}/star\").status == 204\n end", "title": "" }, { "docid": "269570ad1a3a080cb6cc743741f2566b", "score": "0.6169421", "text": "def show\n @galery = Galery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galery }\n end\n end", "title": "" }, { "docid": "c2e9fb3f7df13f8c22679e049193a593", "score": "0.61685914", "text": "def show\n @rat = @resturant.ratings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @resturant}\n end\n end", "title": "" }, { "docid": "42b4592c631acaab80db1c17d54bd91a", "score": "0.6160291", "text": "def index\n @ratings = Rating.all\n render json: @ratings\n end", "title": "" }, { "docid": "053a9cbbb745d20cd811027cd93817cd", "score": "0.6158334", "text": "def show\n @star_date = Star::Date.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star_date }\n end\n end", "title": "" }, { "docid": "8df1c5a9bef0b1b178fc1904d4bafcef", "score": "0.6149541", "text": "def index\n @ratings = Rating.all\n\n render json: @ratings\n end", "title": "" }, { "docid": "3f2bc1b7b9e5e7bd6d50024a6c5e51a0", "score": "0.61431664", "text": "def show\n @badges_scout = BadgesScout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @badges_scout }\n end\n end", "title": "" }, { "docid": "cd236ba12a31a46b7e6870e4f2f25eb7", "score": "0.61418444", "text": "def show\n @glosentry = Glosentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glosentry }\n end\n end", "title": "" }, { "docid": "1f226a4e02b359e4d00b18d23c050030", "score": "0.6135091", "text": "def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end", "title": "" }, { "docid": "f60815c05b593915a4eecf89b9057d46", "score": "0.61300325", "text": "def show\n @battlestar_galactica = BattlestarGalactica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @battlestar_galactica }\n end\n end", "title": "" }, { "docid": "31a17b7df752d0907efba47daf7a3eb5", "score": "0.6118054", "text": "def show\n @rating = Rating.find(params[:id])\n\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "987b4282147a198cf1dd58f4f43f5be0", "score": "0.61179656", "text": "def index\n #not used\n @ratings = Rating.all\n render json: @ratings\n end", "title": "" }, { "docid": "7ebf5c757950bb4556c9386cc3ae652e", "score": "0.6104147", "text": "def index\n @ratings = Rating.all\n respond_to do |format|\n format.json { render json: {ratings: @ratings}, status: :ok }\n end\n end", "title": "" }, { "docid": "0f9a0a86cb220155be70fbeb79843f98", "score": "0.6101671", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "0f9a0a86cb220155be70fbeb79843f98", "score": "0.6101671", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "0f9a0a86cb220155be70fbeb79843f98", "score": "0.6101671", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "0f9a0a86cb220155be70fbeb79843f98", "score": "0.6101671", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "0f9a0a86cb220155be70fbeb79843f98", "score": "0.6101671", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "81d0af333e8ce4d523c7ae402190e3f9", "score": "0.6098278", "text": "def show\n render json: @rating\n end", "title": "" }, { "docid": "81d0af333e8ce4d523c7ae402190e3f9", "score": "0.6098278", "text": "def show\n render json: @rating\n end", "title": "" }, { "docid": "81d0af333e8ce4d523c7ae402190e3f9", "score": "0.6098278", "text": "def show\n render json: @rating\n end", "title": "" }, { "docid": "e7ba74c00bc3d22e4ab1a8dbf4dd8ef0", "score": "0.6095876", "text": "def show\n respond_to do |format|\n format.json { render json: {request_rating: @request_rating}, status: :ok }\n end\n end", "title": "" }, { "docid": "0125fece823159c6886187cace1d794c", "score": "0.6092341", "text": "def index\n @stars = Star.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stars }\n end\n end", "title": "" }, { "docid": "088a92dfca357d206c5b7714a2899ff5", "score": "0.6073626", "text": "def show\n respond_to do |format|\n format.json { render json: {rating: @rating}, status: :ok }\n end\n end", "title": "" }, { "docid": "cc17f012e2f95f77dd064a7022283b6d", "score": "0.6064943", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rating }\n end\n end", "title": "" }, { "docid": "0f227ad6cafd2dd0bb14ba44faf38370", "score": "0.60567826", "text": "def show\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift }\n end\n end", "title": "" }, { "docid": "ac7d289815fdfa61490114afda5eb466", "score": "0.60518605", "text": "def fetch_star_status\n @star_status = client.gist_starred?(gist.gid)\n end", "title": "" }, { "docid": "9e101d0099b7533bfb8a77b753ea271a", "score": "0.6049982", "text": "def starship\n fetch('hitchhikers_guide_to_the_galaxy.starships')\n end", "title": "" }, { "docid": "82a2c4342a68a02890a535b3bb8d15bd", "score": "0.6044653", "text": "def show\n\t\t@rating = @recipe.ratings.find(params[:id])\n\n\t\trespond_to do | format |\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @rating }\n\t\tend\n\tend", "title": "" }, { "docid": "efde9ef25a0a587d671598bd2f3a1927", "score": "0.6042977", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "eb84b211bfa0ea8624e424b4b745c5ee", "score": "0.60379285", "text": "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Rating }\n end\n end", "title": "" }, { "docid": "22b94507799b4c83b9983d5b40541a99", "score": "0.6029442", "text": "def ratings\n Birdman::Requester.get(\"shows/#{id}/ratings\")\n end", "title": "" }, { "docid": "9ef5bd8ca7a02573b364ad527d3c6489", "score": "0.60217", "text": "def show\n @star_rate = StarRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @star_rate }\n end\n end", "title": "" }, { "docid": "d25a257d99db0ab175bd5828ba5c59cd", "score": "0.60190713", "text": "def index\n @star_ratings = StarRating.all\n end", "title": "" }, { "docid": "4ea6d57f63236ce2133653dbcebda036", "score": "0.6014153", "text": "def index\n @north_stars = NorthStar.all\n end", "title": "" }, { "docid": "763be16df2f22e180490773176fa2c14", "score": "0.6012947", "text": "def show\n @star_customer = Star::Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star_customer }\n end\n end", "title": "" }, { "docid": "126dd08d13d4fd1df5a4da9ecf861877", "score": "0.6007522", "text": "def generate_stars\n star_file = File.open(\"#{DATA_DIR}/stars.json\", \"r\")\n stars_array = JSON.parse(star_file.read)[\"stars\"]\n\n stars_array.each_with_index do |star, i|\n symbol, ra_decimal, dec_decimal = star[0], star[2], star[3]\n next if ra_decimal.nil? || dec_decimal.nil? || lang_json[\"starnames\"][\"#{symbol}\"].nil?\n formatted_search_bases << serialize(lang_json[\"starnames\"][\"#{symbol}\"], ra_decimal, dec_decimal, 'star')\n end\n end", "title": "" }, { "docid": "32e7345ba61acea61e3171ba6362278d", "score": "0.6001527", "text": "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "title": "" }, { "docid": "32e7345ba61acea61e3171ba6362278d", "score": "0.6001527", "text": "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "title": "" }, { "docid": "193eed04cd7a6562d0c2bc6b48471a74", "score": "0.59867406", "text": "def show\n @song = Song.find params[:song_id]\n @rating = Rating.find params[:id]\n\n respond_to do |format|\n format.html\n format.json { render json: @rating }\n end\n end", "title": "" }, { "docid": "3748318cadbc5958647e85d1d6f54964", "score": "0.5980741", "text": "def index\n @starships = Starship.all\n end", "title": "" }, { "docid": "3748318cadbc5958647e85d1d6f54964", "score": "0.5980741", "text": "def index\n @starships = Starship.all\n end", "title": "" }, { "docid": "9a6a219a5d113494eebeed184e0b56a6", "score": "0.598006", "text": "def new\n @gold = gold_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gold }\n end\n end", "title": "" }, { "docid": "695553217e1c4726bf6d0bd3eb62bacc", "score": "0.5957606", "text": "def get_service_star_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StarApi.get_service_star ...'\n end\n # unbox the parameters from the hash\n star_id = opts[:'star_id']\n # verify the required parameter 'star_id' is set\n if @api_client.config.client_side_validation && star_id.nil?\n fail ArgumentError, \"Missing the required parameter 'star_id' when calling StarApi.get_service_star\"\n end\n # resource path\n local_var_path = '/stars/{star_id}'.sub('{' + 'star_id' + '}', CGI.escape(star_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.api+json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'StarResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"StarApi.get_service_star\",\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: StarApi#get_service_star\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4f45501e4d6b323eeb4f7e2b14ec1654", "score": "0.5954734", "text": "def starred(*args)\n arguments(args)\n response = get_request(\"/gists/starred\", arguments.params)\n return response unless block_given?\n response.each { |el| yield el }\n end", "title": "" }, { "docid": "d23dabecfe8bf68243ca8bd0aaeba1e8", "score": "0.59352666", "text": "def top_starred\n begin\n results = RestClient::Request.execute(method: :get, url: \"https://api.github.com/search/repositories?q=user:#{@user}&sort=stars&order=desc&per_page=100\", headers: {Authorization: ENV['GITHUB_ACCESS_TOKEN']})\n JSON.parse(results)['items'].first(5)\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n e.response\n end\n end", "title": "" }, { "docid": "595de724093ec1246b398eecbffe42d5", "score": "0.59338325", "text": "def get_user_stars(user_id, params = {})\n get(\"users/#{user_id}/stars\", params)\n end", "title": "" }, { "docid": "951d8639691e02d2e9d7b9089659a27b", "score": "0.5933798", "text": "def show\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @badge }\n end\n end", "title": "" }, { "docid": "914b254d93b4a2d3d6486d00351e6d01", "score": "0.59312695", "text": "def index\n @story = Story.find(params[:story_id])\n @ratings = @story.ratings\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "title": "" }, { "docid": "378c87b07074f1e63873579b36de611d", "score": "0.5925746", "text": "def show\n @rink = Rink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rink }\n end\n end", "title": "" }, { "docid": "2be9c5c79fc82b5eb2ec95a07340c465", "score": "0.5922482", "text": "def show\n @star_palace = StarPalace.find(params[:id])\n respond_with(@star_palace)\n end", "title": "" }, { "docid": "256c47bf30ddada830368118cbe95c22", "score": "0.5919902", "text": "def show\n render json: [*@rate]\n end", "title": "" }, { "docid": "c0ffbad7b2e67edad3458779b87ea84a", "score": "0.59177256", "text": "def stars_list(options = {})\n post('stars.list', options)\n end", "title": "" }, { "docid": "6cde1fe1589f529a5ed4983ae7622b64", "score": "0.59166396", "text": "def show\n @users_artist_rating = UsersArtistRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_artist_rating }\n end\n end", "title": "" }, { "docid": "8e9d458d51b82917bfd1a6ddde8f2575", "score": "0.5908002", "text": "def show\n @gear_list = GearList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gear_list }\n end\n end", "title": "" }, { "docid": "e51d2f8d1d9e1b20ad1e232a5ba90e43", "score": "0.5907715", "text": "def show\n @gadd = Gadd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gadd }\n end\n end", "title": "" }, { "docid": "99dae04d344feb5fb27038a7ac91c321", "score": "0.5907544", "text": "def show\n @rating = Rating.where(camp_id: params[:id])\n\t json_response(@rating)\n\tend", "title": "" }, { "docid": "d600d628bbdad06ac9c45311f46112d4", "score": "0.5893219", "text": "def index\n @golds = gold_type.includes(:article).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @golds }\n end\n end", "title": "" }, { "docid": "0730adddab2373c950fb974f281cbbe6", "score": "0.5890502", "text": "def show\n @popularity = Popularity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @popularity }\n end\n end", "title": "" }, { "docid": "d45b729406674f9a4e363246c90398ec", "score": "0.5885789", "text": "def index\n render json: Girlfriend.all\n end", "title": "" }, { "docid": "2017ff45f4daf5627a0e3d5facc4722d", "score": "0.5884848", "text": "def show\n @user = User.find(params[:user_id])\n @gift = @user.gifts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gift }\n end\n end", "title": "" }, { "docid": "25d00bd78b053e9173350a2e291e6c7a", "score": "0.58839965", "text": "def show\n @rg = Rg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rg }\n end\n end", "title": "" }, { "docid": "be0d3d6b1102034f0e12572013e91a0e", "score": "0.5880608", "text": "def index\n @garages = Garage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @garages }\n end\n end", "title": "" }, { "docid": "c69a42c1635465e00de9fd202d42be9c", "score": "0.58752775", "text": "def show\n @badgeship = Badgeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @badgeship }\n end\n end", "title": "" }, { "docid": "7d157e386b52d35234b76eb807fa9f6f", "score": "0.5870124", "text": "def show\n @stencil = Stencil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stencil }\n end\n end", "title": "" }, { "docid": "08aab71cb450f0ffe2bfbfaee0a81642", "score": "0.58668494", "text": "def show\n @salt = Salt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salt }\n end\n end", "title": "" }, { "docid": "0e9e08cf3cbb141c282e25241063c2b0", "score": "0.5865973", "text": "def index\n @geeks = Geek.all\n render json: @geeks\n end", "title": "" }, { "docid": "8e42085beffd3e6a8f920a3be8cecb60", "score": "0.58625484", "text": "def star_gold_params\n params.require(:star_gold).permit(:star_level_id, :skater_id, :competition_id, :element, :year, :achieved)\n end", "title": "" }, { "docid": "e159d66a8e255d0420d90b65e947be4d", "score": "0.5862539", "text": "def index\n @gears = Gear.all\n end", "title": "" }, { "docid": "e16886f477f259a92b8608000c384feb", "score": "0.586186", "text": "def show\n @grm_stylist = GrmStylist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_stylist }\n end\n end", "title": "" }, { "docid": "42cd829628d4c575692d27ef4fc5400d", "score": "0.5858485", "text": "def show\n @badge = Merit::Badge.find(params[:id])\n\n render json: @badge\n end", "title": "" }, { "docid": "bf70414a00d3e9ea3abab15e7db355a9", "score": "0.5856493", "text": "def index\n @glosentries = Glosentry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glosentries }\n end\n end", "title": "" }, { "docid": "b31695038e29f533d478527a0f1694db", "score": "0.5847474", "text": "def index\n @badges = Badge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "title": "" }, { "docid": "3c94f035351ba0012045b09143d9a85d", "score": "0.5841149", "text": "def show\n @brewery = Brewery.find(params[:id])\n\t@ratings = @brewery.ratings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewery }\n end\n end", "title": "" }, { "docid": "7919776ce3471eb3752663f6af8af933", "score": "0.58401644", "text": "def getRatings\n @profile = Profile.find(params[:id])\n render json: @profile.getRatings(session)\n end", "title": "" }, { "docid": "48073ff0d594d5357930ee5ebe7f2b3e", "score": "0.5840015", "text": "def show\n @ring = Ring.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ring }\n end\n end", "title": "" }, { "docid": "3333fd305594ec6bc9047ef6222626d4", "score": "0.5839778", "text": "def destroy\n @star_gold.destroy\n respond_to do |format|\n format.html { redirect_to star_golds_url, notice: 'Star gold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "401b540df9648e9ad71448e0edb935fa", "score": "0.5834239", "text": "def new\n @star = Star.new\n respond_with(@star)\n end", "title": "" }, { "docid": "3058b22b0cfc5870c2057a08afc62cbc", "score": "0.58337104", "text": "def show\n @grocery = Grocery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @grocery.to_json(:only => :id, :methods => [:how_much, :ingredient_name]) }\n format.xml { render :xml => @grocery }\n end\n end", "title": "" } ]
2a9dcf0be9ee4c71853fdc6426923d66
PATCH/PUT /brands_categories/1 PATCH/PUT /brands_categories/1.json
[ { "docid": "60a3651cae5f06dd93155bf43dfd4c78", "score": "0.71189535", "text": "def update\n respond_to do |format|\n if @brands_category.update(brands_category_params)\n format.html { redirect_to @brands_category, notice: 'Brands category was successfully updated.' }\n format.json { render :show, status: :ok, location: @brands_category }\n else\n format.html { render :edit }\n format.json { render json: @brands_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "d7df55f0522862b16aacc76bfaf44b53", "score": "0.7011535", "text": "def update\n if @brand_category.update(brand_category_params)\n head :no_content\n else\n render json: @brand_category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "64342e33d137990e24b5fa224c350bd3", "score": "0.6945782", "text": "def update\n json_update(category,category_params, Category)\n end", "title": "" }, { "docid": "70fa0c97172b7b113971c8ea2dcba896", "score": "0.6774255", "text": "def update\n @brand_category = BrandCategory.find(params[:id])\n\n respond_to do |format|\n if @brand_category.update_attributes(params[:brand_category])\n format.html { redirect_to @brand_category, notice: 'Brand category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brand_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d042a4b8d67e19e968d8c4f929e81e33", "score": "0.6763194", "text": "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "title": "" }, { "docid": "2bd6f832cf95879546701b1ee43c0341", "score": "0.6660704", "text": "def update\n @b_category = BCategory.find(params[:id])\n\n respond_to do |format|\n if @b_category.update_attributes(params[:b_category])\n format.html { redirect_to @b_category, notice: 'B category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @b_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbe8e760819705b9e3acc0e70849b5a7", "score": "0.6554252", "text": "def set_brands_category\n @brands_category = BrandsCategory.find(params[:id])\n end", "title": "" }, { "docid": "5aa4fa32fd52cadf50791b842ab5bef4", "score": "0.6484792", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23218e16f67c2c2c9de11bf4d239094a", "score": "0.6390871", "text": "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "70019269a3316d58f81e8822824af602", "score": "0.625483", "text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92c8339bd944182f686d47e21f571f64", "score": "0.6253748", "text": "def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faeb4358c1d5a1806f2ff0a8ccb3df40", "score": "0.62393636", "text": "def update\n @budgetcategory = Budgetcategory.find(params[:id])\n\n respond_to do |format|\n if @budgetcategory.update_attributes(params[:budgetcategory])\n format.html { redirect_to @budgetcategory, notice: 'Budgetcategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budgetcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c8d3e2ad6c17a46ad1d38e5934f6f8e", "score": "0.6228518", "text": "def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7abf6c89344fa7348a027ac7a2890cc5", "score": "0.6222704", "text": "def update\n\t@vehicle_categories = VehicleCategory.all\n\t@vehicle_category = VehicleCategory.find(params[:id])\n respond_to do |format|\n if @vehicle_category.update(vehicle_category_params)\n format.html { redirect_to @vehicle_category, notice: 'Vehicle category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a56fb05643771aa9de938a1a0b057363", "score": "0.6217567", "text": "def update\n @billcategory = Billcategory.find(params[:id])\n\n respond_to do |format|\n if @billcategory.update_attributes(params[:billcategory])\n format.html { redirect_to @billcategory, notice: 'Billcategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64c0c7fa5d32b1cfa2782d5e6c276db4", "score": "0.6214854", "text": "def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c75d43cdecf4f06d147a84c96bd6a2ee", "score": "0.6200862", "text": "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "title": "" }, { "docid": "8efbadf20853ae8f07589d7714e7a347", "score": "0.6182773", "text": "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "title": "" }, { "docid": "e490a3ff4d83ad0640702be6f28b3a64", "score": "0.61733603", "text": "def update\n respond_to do |format|\n if @cat_blok.update(cat_blok_params)\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_blok }\n else\n format.html { render :edit }\n format.json { render json: @cat_blok.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8928bd2d901ca28607f62b14636c3664", "score": "0.61691904", "text": "def update\n \n #My product belongs_to category relationship won't work so I made this so when I update it reflects changes\n category_name = set_category.name\n Product.all.each do |product|\n product.category = category_params[:name] if product.category == category_name\n product.save\n end\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef8adb1a5704a8b5a121b08109edc7a3", "score": "0.6155235", "text": "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "701b99acc4deafdd77762599f1f3f15d", "score": "0.6150686", "text": "def update\n respond_to do |format|\n if @book.update(book_params)\n handle_book_categories\n format.html { redirect_to @book, notice: I18n.t(:changes_updated_successfully) }\n format.json { head :no_content }\n else\n @book_categories = {}\n BookCategory.all.order(:category_name).collect {|bc| @book_categories[bc.category_name] = bc.id }\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88fa900a8480b49aaa22b7e0d2ccdec0", "score": "0.61479133", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55def6f6897f95a74e4c46a5d60c7444", "score": "0.6121294", "text": "def update\n respond_to do |format|\n if @api_v1_group_category.update(api_v1_group_category_params)\n format.html { redirect_to @api_v1_group_category, notice: 'Group category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae7257ca4255c4c44b7c2d2c2ad0f5a6", "score": "0.6120741", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0536af2bad08e1fb54e251db7b7044e", "score": "0.61101675", "text": "def brands_category_params\n params.require(:brands_category).permit(:category_id_id, :brand_id_id)\n end", "title": "" }, { "docid": "beb2d759de177d8ebfd06e1052bc75c2", "score": "0.6104224", "text": "def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92f82c660c2a416ac2a500448c3520da", "score": "0.6094833", "text": "def update\n # Find the existing product in the database\n @product = Product.find(params[:id])\n\n respond_to do |format|\n # Try and update the product in the database\n if @product.update(product_params)\n update_nil_values(@product)\n # Product updated successfully. We will update the entry in the product_categories table if required\n if !params[:category_id].nil?\n @category = Category.find(params[:category_id])\n # Check to see if we have product_categories to update\n if @product.product_categories.exists?\n @product.product_categories.update_all(category_id: @category.id)\n else\n @product.product_categories.create(category: @category)\n end\n end\n\n # Redirect to the products list\n format.html {redirect_to admin_products_url}\n format.json {respond_with_bip(@product) }\n else\n # Product did not update successfully\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "315daeff315ccfe6e56f619b9f2e2479", "score": "0.6079393", "text": "def update\n @blog_category = BlogCategory.find(params[:id])\n\n respond_to do |format|\n if @blog_category.update_attributes(params[:blog_category])\n format.html { redirect_to([:admin, @blog_category], :notice => 'Blog category 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 => @blog_category.errors, :status => :unprocessable_entity }\n format.json { respond_with_bip(@blog_category) }\n end\n end\n end", "title": "" }, { "docid": "b64f7642f49af5088cd474b4a1fc0229", "score": "0.60792726", "text": "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "title": "" }, { "docid": "17e0a757ba253e5e1932e28ba8eb4d61", "score": "0.6072716", "text": "def update\n respond_to do |format|\n if @business_category.update(business_category_params)\n format.html { redirect_to @business_category, notice: 'Business category was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_category }\n else\n format.html { render :edit }\n format.json { render json: @business_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4095c38a998d1235ac57f37ab6e9c647", "score": "0.6070695", "text": "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6a4efecf97abab3f3c78a2b08667b10", "score": "0.60593945", "text": "def update\n respond_to do |format|\n if @company_category.update(company_category_params)\n format.html { redirect_to @company_category, notice: 'Company category was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_category }\n else\n format.html { render :edit }\n format.json { render json: @company_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ede9dca43e4cf476c0cea7f8d34458ee", "score": "0.60406005", "text": "def update\n respond_to do |format|\n if @internal_category.update(internal_category_params)\n format.html { redirect_to brands_path, notice: 'Internal category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @internal_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0aa3584662131dc90a19264af8140572", "score": "0.6040285", "text": "def update\n respond_to do |format|\n if @backend_category.update(backend_category_params)\n format.html { redirect_to backend_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @backend_category }\n else\n format.html { render :edit }\n format.json { render json: @backend_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15c36129d16955daed774f43f98349d8", "score": "0.5983649", "text": "def update\n @recipe = Recipe.find(params[:id])\n\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 @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5560e9da42d91d79fa879f12198ff3a", "score": "0.5982484", "text": "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b77c148880481acf864618c9ca7b23f", "score": "0.59806854", "text": "def update\r\n @brand = Brand.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @brand.update_attributes(params[:brand])\r\n format.html { redirect_to administration_brands_url, notice: 'Brand was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @brand.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "83a1bcdb77232f83f8687b6273c57268", "score": "0.59698534", "text": "def update\n update! {admin_categories_path}\n end", "title": "" }, { "docid": "6ab83db702b86968a078c76ca8f13fe1", "score": "0.5960534", "text": "def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cfa293fcedd9d142b87e170ab49ecf0e", "score": "0.59598565", "text": "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end", "title": "" }, { "docid": "20722cdb5153c418086ab36ffd8fe210", "score": "0.595663", "text": "def update_category_by_id_0_with_http_info(id, brand, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BrandsApi.update_category_by_id_0 ...\"\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 BrandsApi.update_category_by_id_0\"\n end\n # verify the required parameter 'brand' is set\n if @api_client.config.client_side_validation && brand.nil?\n fail ArgumentError, \"Missing the required parameter 'brand' when calling BrandsApi.update_category_by_id_0\"\n end\n # resource path\n local_var_path = \"/brands/{id}/\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(brand)\n auth_names = ['APIKeyHeader']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrandsApi#update_category_by_id_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "672077ce31f53104cb9e6938ef86e8e8", "score": "0.59540844", "text": "def update\r\n @category = Category.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @category.update_attributes(params[:category])\r\n flash[:notice] = 'Category was successfully updated.'\r\n format.html { redirect_to(admin_category_path) }\r\n format.xml { head :ok }\r\n else\r\n @businesses = Business.find(:all, :order => :name)\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a01cf3a8708bb8eedf8c88d276db6fe5", "score": "0.59504265", "text": "def update\n @brand = Brand.find(params[:id])\n\n respond_to do |format|\n if @brand.update_attributes(params[:brand])\n format.html { redirect_to brands_path, notice: 'Brand was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46c840b83689108f764ce2b6a7721ce3", "score": "0.59357154", "text": "def update\n @body_style_categorization = BodyStyleCategorization.find(params[:id])\n\n respond_to do |format|\n if @body_style_categorization.update_attributes(params[:body_style_categorization])\n format.html { redirect_to @body_style_categorization, notice: 'Body style categorization has been updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @body_style_categorization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "79143e8218d7f436e4ef98e5a92bfda0", "score": "0.5932844", "text": "def update\n @branch = Branch.friendly.find(params[:id])\n respond_to do |format|\n if @branch.update(branch_params)\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f784c01ad2ce4bfffac63a60705c01b9", "score": "0.59324527", "text": "def update\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01cee15e8402b509742e6ec1cf76ca99", "score": "0.59276104", "text": "def update\n respond_to do |format|\n if @asset_category.update(asset_category_params)\n format.html { redirect_to @asset_category, notice: 'Asset category was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_category }\n else\n format.html { render :edit }\n format.json { render json: @asset_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d58f40284f363360e62f92819ba9c127", "score": "0.5927056", "text": "def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff6334ba896161cdb90743abafe349de", "score": "0.59238344", "text": "def update\n @category.update(category_params)\n end", "title": "" }, { "docid": "ca85a368efcb7c62cd879c343ba5b54b", "score": "0.5919393", "text": "def update\n @abuse_category = AbuseCategory.find(params[:id])\n\n respond_to do |format|\n if @abuse_category.update_attributes(params[:abuse_category])\n format.html { redirect_to @abuse_category, notice: 'Abuse category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @abuse_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f7e5e4411b3f33fa7304e6173a3b293", "score": "0.59081477", "text": "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "title": "" }, { "docid": "5f7e5e4411b3f33fa7304e6173a3b293", "score": "0.59081477", "text": "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "title": "" }, { "docid": "2842e3067eb1f45d2f888f59d6d0c342", "score": "0.5906185", "text": "def update\n @mastery_category = MasteryCategory.find(params[:id])\n\n respond_to do |format|\n if @mastery_category.update_attributes(params[:mastery_category])\n format.html { redirect_to @mastery_category, notice: 'Mastery category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mastery_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09f22f0b33e467f07e644568a62faa3c", "score": "0.5901723", "text": "def update\n respond_to do |format|\n if @asset_categorization.update_attributes(params[:asset_categorization])\n format.html { redirect_to @asset_categorization, notice: I18n.t('controllers.update_success', name: @asset_categorization.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_categorization.errors, status: :unprocessable_entity }\n format.xml { render xml: @asset_categorization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f5e15e89818f3bd7dcfe711833a9f2c", "score": "0.59014344", "text": "def update\n respond_to do |format|\n if @available_category.update(available_category_params)\n format.html { redirect_to admin_available_categories_path, notice: 'Available category was successfully updated.' }\n format.json { render :show, status: :ok, location: @available_category }\n else\n format.html { render :edit }\n format.json { render json: @available_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab00f836a7fdb7fa74fe6a4a0e706e54", "score": "0.58990335", "text": "def update\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to @post_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc30d891e609c8f90bfd1050d9973f3d", "score": "0.58963025", "text": "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "308312b07c6a0f1048ee7f153d43a89b", "score": "0.5891208", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8fbb8fef91bf07050743cd453d68516", "score": "0.58910316", "text": "def set_brand\n set_category\n @brand = @category.brands.find(params[:id]) if params[:id]\n end", "title": "" }, { "docid": "d293d6fa0308ac3553929e7e6b947baa", "score": "0.5890552", "text": "def update\n @banesco.assign_attributes(banesco_params)\n # ask_for_permission(@banesco, 'update_banesco') and return if current_user.cannot 'update_banesco'\n # Extract category, if given\n category = params[:banesco][:category]\n unless category.nil?\n @banesco.category_type, @banesco.category_id = category.split(':')\n end\n #\n @banesco.save ?\n are_saved = update_balances(@banesco) : are_saved = [false]\n respond_to do |format|\n if are_saved.all?\n format.html { redirect_to banescos_url, notice: @banesco.table_name_to_show.concat(' fue actualizado satisfactoriamente.') }\n else\n format.html { render :edit }\n format.json { render json: @banesco.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f12fef4ae1285f31330e50444fc62e21", "score": "0.58905274", "text": "def update\n respond_to do |format|\n if @catalog_category.update(catalog_category_params)\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :ok, location: @catalog_category }\n else\n format.html { render :edit }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "925126951990e411804c1cf4c9bdf855", "score": "0.58896405", "text": "def update\n @bod.assign_attributes(bod_params)\n # ask_for_permission(@bod, 'update_bod') and return if current_user.cannot 'update_bod'\n # Extract category, if given\n category = params[:bod][:category]\n unless category.nil?\n @bod.category_type, @bod.category_id = category.split(':')\n end\n #\n @bod.save ?\n are_saved = update_balances(@bod) : are_saved = [false]\n respond_to do |format|\n if are_saved.all?\n format.html { redirect_to bods_url, notice: @bod.table_name_to_show.concat(' fue actualizado satisfactoriamente.') }\n else\n format.html { render :edit }\n format.json { render json: @bod.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3a5e495862299bb07c6cad107c04d9b", "score": "0.5886599", "text": "def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end", "title": "" }, { "docid": "1aa169ba7137e453bf88aaa25d7a2fe1", "score": "0.5875048", "text": "def update\n existing_categories = (Ebook.find_by id: params[:id]).categories\n is_already_category = (Ebook.find_by id: params[:id]).ebook_categorizations.pluck(:category_id).include? params[:category_id].to_i\n\n if(params[:checked] == \"checked\" )\n if(!is_already_category)\n existing_categories << (Category.find_by id: params[:category_id])\n end\n else\n if(is_already_category)\n existing_categories.delete(params[:category_id])\n end\n end\n\n respond_to do |format|\n if @ebook.update(ebook_params)\n format.html { redirect_to @ebook, notice: \"#{@ebook_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ebook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55dc679e8ae9ab08f7fe5756be21b439", "score": "0.58699244", "text": "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "title": "" }, { "docid": "3a573d5ffa87189fc8e8f4bd4cac80c0", "score": "0.58642656", "text": "def update\n respond_to do |format|\n if @cp_brand.update(cp_brand_params)\n format.html { redirect_to @cp_brand, notice: 'Brand was successfully updated.' }\n format.json { render :show, status: :ok, location: @cp_brand }\n else\n format.html { render :edit }\n format.json { render json: @cp_brand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8195ed06e2ef26885ba0bb08b8c67b5", "score": "0.58641464", "text": "def update_category_by_id_with_http_info(id, brand, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BrandsApi.update_category_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling BrandsApi.update_category_by_id\"\n end\n # verify the required parameter 'brand' is set\n if @api_client.config.client_side_validation && brand.nil?\n fail ArgumentError, \"Missing the required parameter 'brand' when calling BrandsApi.update_category_by_id\"\n end\n # resource path\n local_var_path = \"/brands/{id}/\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(brand)\n auth_names = ['APIKeyHeader']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrandsApi#update_category_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "aa056db28d23798cf2d504bd37220cfb", "score": "0.58555186", "text": "def update\n respond_to do |format|\n if @company_branch.update(company_branch_params)\n format.html { redirect_to admin_company_branches_path, notice: 'Company branch was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_branch }\n else\n format.html { render :edit }\n format.json { render json: @company_branch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e88ffd8c8a2dc13a2bf2336f18255019", "score": "0.58490324", "text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94fa7debcf5a56bbba9068d7e4e6373a", "score": "0.5848708", "text": "def update\n @link_category = LinkCategory.find(params[:id])\n\n respond_to do |format|\n if @link_category.update_attributes(link_category_params)\n format.html { redirect_to(@link_category, :notice => 'Link category was successfully updated.') }\n format.json { render :json => @link_category, :notice => 'Link category was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @link_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f980a1ae48b7243928498e28415910cd", "score": "0.58387095", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faa7ca4e14160ec55e7708edfbc590eb", "score": "0.58305496", "text": "def update\n @recipe.allergies.destroy_all\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n @allergies = Allergy.all\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c3afc035f4ece92a804bf21059f620e", "score": "0.5829863", "text": "def update\n begin\n if @auction_category.update_category!(auction_category_params, params[:auction_category][:attribute_ids])\n flash_msg('success', '修改分类成功!', 'index')\n end\n rescue Exception => e\n flash['danger'] = '修改分类失败!#{error_msg(@auction_category)}'\n return redict_to action: 'edit', id: @auction_category.id\n end\n end", "title": "" }, { "docid": "d5949395f75f1d67c73ed413d392f402", "score": "0.58231187", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3fac74b638ef28cb601ed9ea818fc6be", "score": "0.58141255", "text": "def editCat()\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.find(params[:id])\n status = c.update(name: params[:name])\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", "title": "" }, { "docid": "9050d85c2cc097354f1e75753ae5700f", "score": "0.5808104", "text": "def update\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n if @kategory.update_attributes(params[:kategory])\n format.html { redirect_to @kategory, notice: 'Kategory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0e31d566cb92aefebb9a452df510045", "score": "0.58077824", "text": "def category_update\n @finance_category = FinanceTransactionCategory.find(params[:id])\n unless @finance_category.update_attributes(params[:finance_category])\n @errors=true\n end\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @fixed_categories = @categories.reject { |c| !c.is_fixed }\n @other_categories = @categories.reject { |c| c.is_fixed }\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n end", "title": "" }, { "docid": "e8b1034127bdc798f4a83604e3b07c87", "score": "0.58065516", "text": "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "title": "" }, { "docid": "ebfeebcf83275287e20a892ec7c92276", "score": "0.58041817", "text": "def update\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to [:client,@post_category], notice: 'Post category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41fcb3c025cd91c1947ef5e828f457ef", "score": "0.5795888", "text": "def update\n Category.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_ads_path\n end", "title": "" }, { "docid": "e6903c5096b4c45bf1da0f69a9f2c06e", "score": "0.57898825", "text": "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42255bc467a35962a5b3b9aec62356b8", "score": "0.5789704", "text": "def update\n respond_to do |format|\n if @brand.update(brand_params)\n format.html { redirect_to cp_brand_url(@brand), notice: 'Бренд обновлен.' }\n format.json { render :show, status: :ok, location: @brand }\n else\n format.html { render :edit }\n format.json { render json: @brand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3dd4268c112648e14159e3870ad9c2d", "score": "0.5788266", "text": "def update\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_category.update_attributes(params[:taxonomy_category])\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c647cefb48b2562e3f2410d57d85e1c", "score": "0.5787685", "text": "def update\n @categories = Category.where(category:product_params[:category])\n @product.categories = @categories\n @product.brand = Brand.find_by(brandName: product_params[:brand])\n respond_to do |format|\n if @product.update(name: product_params[:name],description:product_params[:description],price:product_params[:price])\n if current_user.isAdmin\n format.html { redirect_to admin_products_path, notice: \"Product was successfully updated.\" }\n else\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n end\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8090be90e283f962e6814a5d1a7f9673", "score": "0.5782847", "text": "def update\r\n @bcat1 = Bcat1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @bcat1.update_attributes(params[:bcat1])\r\n flash[:notice] = 'Bcat1 was successfully updated.'\r\n format.html { redirect_to(@bcat1) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @bcat1.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a01f59f2f126375784c14b4343faa801", "score": "0.57823205", "text": "def update\n respond_to do |format|\n if @cms_blog_category.update(cms_blog_category_params)\n format.html { redirect_to cms_admin_blog_categories_url, notice: 'Blog category was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_blog_category }\n else\n format.html { render :edit }\n format.json { render json: @cms_blog_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19b48df61b0f45055170aa07eb5b52ca", "score": "0.5781125", "text": "def update\n respond_to do |format|\n if @specialization_category.update(specialization_category_params)\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_category }\n else\n format.html { render :edit }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5655b98df6460a73de7b81851d822c78", "score": "0.5780413", "text": "def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e65045d16285ee96950e80a481d28c", "score": "0.57768685", "text": "def update\n respond_to do |format|\n if @ledger_category.update(ledger_category_params)\n format.html { redirect_to @ledger_category, notice: 'Ledger category was successfully updated.' }\n format.json { render :show, status: :ok, location: @ledger_category }\n else\n format.html { render :edit }\n format.json { render json: @ledger_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c89345470e1722467d29ccd972ed789e", "score": "0.57762146", "text": "def update\n respond_to do |format|\n if @category.update category_params\n format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b166f30024b0501e80b7ef18bbee3f59", "score": "0.5776156", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3694992051f0c45a3bbf7915ffff922", "score": "0.5773303", "text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45c85a6eab978b4692dda539dee550b0", "score": "0.5772136", "text": "def update\n respond_to do |format|\n if @book_category.update(book_category_params)\n format.html { redirect_to @book_category, notice: 'Book category was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_category }\n else\n format.html { render :edit }\n format.json { render json: @book_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a64cc3f29becb54612eea84125a6636a", "score": "0.5768644", "text": "def update\n @super_category = SuperCategory.find(params[:id])\n\n respond_to do |format|\n if @super_category.update_attributes(params[:super_category])\n format.html { redirect_to @super_category, notice: 'Super category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1962ae0719ef47997ba9ae2f5e666153", "score": "0.5768578", "text": "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end", "title": "" }, { "docid": "115bd4aeab0db94bfe42390c60675136", "score": "0.57649547", "text": "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae71e441e462b175668c9f34c7aecef7", "score": "0.5763717", "text": "def update\n respond_to do |format|\n if @contractor_category.update(contractor_category_params)\n format.html { redirect_to @contractor_category, notice: 'Contractor category was successfully updated.' }\n format.json { render :show, status: :ok, location: @contractor_category }\n else\n format.html { render :edit }\n format.json { render json: @contractor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a0eec6fb8eae2b6177b049577e8cd08", "score": "0.57625455", "text": "def update\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n if @benefit_category.update_attributes(params[:benefit_category])\n format.html { redirect_to @benefit_category, notice: 'Benefit category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @benefit_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f2a5e8381cefb88fee69b401579b100", "score": "0.57610166", "text": "def update\n respond_to do |format|\n if @category.master_id == 1 && category_params[:master_id].to_i != 1\n format.html { render :edit, notice: '不能相互隶属,也不能把顶级分类降级~'}\n else\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: '分类修改成功,没事你就改着玩吧,哈~' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "9d74902dc61e10585929fb891c7e59e7", "score": "0.57580554", "text": "def update\n respond_to do |format|\n if @status_category.update(status_category_params)\n format.html { redirect_to @status_category, notice: 'Status category was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_category }\n else\n format.html { render :edit }\n format.json { render json: @status_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
2ddabcc0012488fbf1a49668cdd84174
Return the first file that exists in a list of files
[ { "docid": "8c9f81708136c2c1fceb22cd854fb239", "score": "0.75315225", "text": "def select_file(*files)\n files.each do |file|\n if File.exists?(file) then return file end\n end\n return nil\n end", "title": "" } ]
[ { "docid": "8ac0bbd6c8a54a19bd25ac29f3952958", "score": "0.7762605", "text": "def check_file(filenames)\n filenames.select{ |f| File.exists?(f) }.first\n end", "title": "" }, { "docid": "50c199d48944f5e38130a49071a25654", "score": "0.71770054", "text": "def find_file( *args )\n args.each {|fn| return fn if test(?f, fn)}\n args.first\n end", "title": "" }, { "docid": "0151157926c3f2abd779fae22344e958", "score": "0.70965016", "text": "def find_file(file)\n file_name = File.basename(file)\n # Firstly we'll drop obvious mismatches where basename of file differs\n candidates = @build_files.select { |path| File.basename(path) == file_name }\n # In case when got ambiguous files return all try to find closest match\n files = find_closest_files(file, candidates)\n\n # If has only option return first\n return files.first if files.size == 1\n # Return original file if files empty\n return file if files.empty?\n\n files # Return all files if many matched\n end", "title": "" }, { "docid": "52923683877c0bb93a9357105b1734dd", "score": "0.7094431", "text": "def find_file(file_name, path_array)\n result = nil\n lookup = []\n\n unless path_array.empty?\n search_paths = path_array\n\n if path_array.first.kind_of? String\n search_paths = [path_array]\n end\n\n search_paths.each do |elem|\n full_path = (elem.kind_of?(String)) ? elem : File.join(elem)\n\n files = Dir.glob(File.join(full_path, file_name))\n\n unless files.empty?\n result = files.sort.last\n break\n else\n lookup << full_path\n end\n end\n end\n\n if result.nil?\n fail \"Could not find file #{file_name} at #{lookup.join(', ')}\"\n end\n\n result\nend", "title": "" }, { "docid": "bb59d913b1e8ccb2ce7358e981fa3c2a", "score": "0.70797473", "text": "def find_file( path )\n find_files( path ).first\n end", "title": "" }, { "docid": "5b8c8bb03c4c13d2249d37454e0917a8", "score": "0.68108004", "text": "def find_file(file_name)\n match = Dir.glob(\"#{root_dir}/**/#{file_name}\")\n if match.empty?\n raise \"'File #{file_name}' not found anywhere under '#{root_dir}'\"\n elsif match.count > 1\n raise \"More than one file found with name: '#{file_name}'\"\n end\n match.first\n end", "title": "" }, { "docid": "b340a23d87bd175c5e96b931f6015695", "score": "0.67946136", "text": "def item_by_file(filename)\n item = self.item.select do |it|\n it.path.match(/.*(?:\\\\|\\/|^)(.+)$/)[1] == filename\n end\n item.first if item\n end", "title": "" }, { "docid": "ac9f3061aa88b3546c59cdb449558179", "score": "0.675446", "text": "def lookup_file_path\n file_path_list.each do |candidate_file_path|\n next unless File.file?(File.expand_path(candidate_file_path))\n return candidate_file_path\n end\n nil\n end", "title": "" }, { "docid": "14c075e738a534750e6ca1ec8ee82f14", "score": "0.64394796", "text": "def first_existing(*paths)\n\t\t\tlast_path = nil\n\t\t\tpaths.each do |path|\n\t\t\t\tlast_path = path\n\t\t\t\tbreak if @io.exist?(path)\n\t\t\tend\n\t\t\tlast_path\n\t\tend", "title": "" }, { "docid": "ea09194f06f61e31b28880d8823a46d9", "score": "0.64221543", "text": "def exists(files)\r\n files.each do |f|\r\n if f.name == 'Code Review Report'\r\n return f.id\r\n end\r\n end\r\n false\r\nend", "title": "" }, { "docid": "de56d9638330bdf83774ab302732b6bb", "score": "0.6403373", "text": "def file\n files.first\n end", "title": "" }, { "docid": "de56d9638330bdf83774ab302732b6bb", "score": "0.6403373", "text": "def file\n files.first\n end", "title": "" }, { "docid": "462afd77478628644ccc040578c074ec", "score": "0.6388592", "text": "def filename\n Dir[glob].first if exists?\n end", "title": "" }, { "docid": "1578968ccc632b8809b2b109029f2ad8", "score": "0.63560474", "text": "def find_header_file(header)\n filename = nil\n header_include_paths.each do |path|\n maybe_filename = \"#{path}/#{header}\"\n if File.exists?(maybe_filename)\n filename = maybe_filename\n break\n end\n end\n filename\nend", "title": "" }, { "docid": "ec823965939ceeb0b99fceac8ba9b41c", "score": "0.6335724", "text": "def find_by_filename(filename)\n result = @@coll.find(:filename => filename).to_a\n \n if result.count > 1\n result.map! { |r| find(r['_id']) }\n else\n result.blank? ? [] : [find(result.first['_id'])]\n end\n end", "title": "" }, { "docid": "b5f75469c7461039f70cdba2f1a0e503", "score": "0.62896323", "text": "def find_file(name)\n if (explicit = folder/name.to_s).file?\n explicit\n else\n folder.glob(\"#{name}.*\").find{|f| f.file?}\n end\n end", "title": "" }, { "docid": "85e6d8aa23c25784b10fa42d59d9150f", "score": "0.6275312", "text": "def find_exist_first_file\n if !(local_webs = ENV[\"APP_LOCAL_WEBS\"].split.find_all { |dir| File.basename(dir) == params[:level1] }).empty?\n File.join(local_webs.first, \"index.html\")\n else\n params_path = params.map(&:first).grep(/level/).sort.map(&params.method(:fetch)).join(\"/\")\n ENV[\"APP_LOCAL_WEBS\"].split.concat([ENV[\"APP_ROOT_PATH\"]])\n .map { |dir| File.join(dir, params_path) }\n .find_all(&File.method(:file?)).first\n end\n end", "title": "" }, { "docid": "b00be5addad6e3b6cc282b41cb35454f", "score": "0.6266083", "text": "def file_matching_path\n !!container.stored_files.where(file_name: file_name, path: path).first\n end", "title": "" }, { "docid": "5c6849bca8f06b0ac4a77be3463bf832", "score": "0.6256224", "text": "def find_filename_for_todo(id)\n for filename in Dir.entries(TODOS_DIRECTORY)\n if filename.start_with?(id)\n return filename\n end\n end\nend", "title": "" }, { "docid": "72e86daa49f87a96830ea059717ea183", "score": "0.62514925", "text": "def find_file_of(element)\n return @metadata['path'] if element == self\n\n name = element.full_name\n candidates = @metadata['includes'].flat_map do |file_name, root_names|\n root_names.map do |n|\n match = (name == n) || name.start_with?(\"#{n}::\")\n [file_name, n] if match\n end.compact\n end\n\n if (match = candidates.max_by { |_, name| name.size })\n match[0]\n else\n @metadata['path']\n end\n end", "title": "" }, { "docid": "3ed9e238ac822140088e28e44d543efe", "score": "0.6215001", "text": "def existing\n select { |fn| File.exist?(fn) }.uniq\n end", "title": "" }, { "docid": "5cfca8c8fd9c7665e3d3f07a2db4c507", "score": "0.6206216", "text": "def first(match, *opts)\n flags = 0\n opts.each do |opt|\n case opt when Symbol, String\n flags += ::File.const_get(\"FNM_#{opt}\".upcase)\n else\n flags += opt\n end\n end\n file = ::Dir.glob(::File.join(self.to_s, match), flags).first\n file ? self.class.new(file) : nil\n end", "title": "" }, { "docid": "e07dd8ca2cb28f10af309bb1a749d9fb", "score": "0.61869293", "text": "def search_file(dirs, filename)\n findings = dirs.collect do |dir|\n abs_path = File.join(File.expand_path(dir), filename)\n if File.exist?(abs_path)\n abs_path\n end\n end\n findings.delete(nil)\n findings\n end", "title": "" }, { "docid": "58f626144b2d6d29c7a3f9d6a906a54d", "score": "0.61779034", "text": "def find_nth_file(basename, index = T.unsafe(nil)); end", "title": "" }, { "docid": "a6d17d3346abac02ea93a6918d3eba46", "score": "0.6108691", "text": "def file_from_request(file_request)\n files = @request_to_files[file_request]\n\n if files.empty? && file_request.only_one\n begin\n path = @source_finder.find_file(file_request.source_pattern, groups: file_request.group)\n file = file_with_source_path(path)\n\n unless file.nil?\n @request_to_files[file_request] = file\n files = [file]\n end\n rescue FileFinders::FileNotFoundError, FileFinders::MultipleFilesFoundError\n # noop\n end\n end\n\n if file_request.only_one\n files.first # @request_to_files always returns array, see #initialize method\n else\n files\n end\n end", "title": "" }, { "docid": "3ac641b3f4e0967a6dcad0300649af6c", "score": "0.6086594", "text": "def select(files, context, path)\n files = get_paths(files, context)\n files.each_with_index do |f, i|\n file = path ? File.join(path, f) : f\n if exists(file, context)\n return f\n # If \"file.html || none\" is passed, fail gracefully\n elsif i == files.size - 1\n return f.downcase == 'none' ? false : f\n end\n end\n end", "title": "" }, { "docid": "f003edfd8549e25f8d731f4ddfb82d73", "score": "0.6042416", "text": "def find_one(selector = nil)\n metadata = files_collection.find(selector).first\n return nil unless metadata\n chunks = chunks_collection.find(:files_id => metadata[:_id]).sort(:n => 1)\n Grid::File.new(chunks.to_a, metadata)\n end", "title": "" }, { "docid": "a9a032ed9639bdc23a257c75d5be259b", "score": "0.60247", "text": "def find_match_index (fileArray, match_string)\n fileArray.each_index {|index|\n if fileArray[index].include?(match_string)\n return index # no error checking, SO MAKE SURE THE MATCH EXISTS IN YOUR FILE\n end}\nend", "title": "" }, { "docid": "165f5448bac1a1b3c4f3d6babe335de7", "score": "0.6021447", "text": "def find_file(file_name, dir)\n Dir.foreach(dir) do |item|\n next if item == '.' or item == '..'\n regexp = Regexp.new(Regexp.escape(file_name))\n if item =~ regexp\n return item\n end\n end\n return false\n end", "title": "" }, { "docid": "3d39e1c6266b1ce787ee464296b8043c", "score": "0.6013331", "text": "def search_image(file)\n Dir.glob(File.join(@default_dir_images, file) + '.{png,gif,jpg}').first\n end", "title": "" }, { "docid": "8fa21c52f9d1e9032e7f388f637f70b6", "score": "0.6008295", "text": "def find_single( glob )\n candidates = Pathname.glob container + glob\n raise None, \"No restore files found for #{glob}\" if candidates.size == 0\n raise \"too many #{candidates.inspect} for #{glob}\" if candidates.size > 1\n candidates.first\n end", "title": "" }, { "docid": "f768be0cffdaa480732ec00d96051317", "score": "0.6005314", "text": "def get_file_for_url(url, params)\n selected_files = params[\"selected_files\"].values\n return unless selected_files.map { |a| a[\"url\"] }.include?(url)\n selected_files.select { |a| a[\"url\"] == url }.first[\"file_name\"]\n end", "title": "" }, { "docid": "2e849af6f166798e581f9a30149d0954", "score": "0.5992589", "text": "def find_files( path )\n file_paths.each_with_object([]) do |search_path,obj|\n found = File.join( search_path, path )\n obj << found if File.exist? found\n end.reverse.uniq\n end", "title": "" }, { "docid": "798e43698c474e08181dbef8c68531db", "score": "0.5984459", "text": "def find_file_named name\n @files_hash[name]\n end", "title": "" }, { "docid": "bbebaf29ff9a860e220a97dff982532c", "score": "0.593952", "text": "def get_first_peps(out_files)\n out_files.each do |outf|\n if outf.num_hits > 0\n return outf.hits\n end\n end\n return nil\n end", "title": "" }, { "docid": "a7f2fca9e52c330bde9034fa16d862d5", "score": "0.59352416", "text": "def try_files(*files)\n try_sources(files, :files)\n end", "title": "" }, { "docid": "f2dc9f55552251525ad59674e7ecad3f", "score": "0.5910803", "text": "def find_include_file(name)\n to_search = [File.dirname(@input_file_name)].concat @include_path\n to_search.each do |dir|\n full_name = File.join(dir, name)\n stat = File.stat(full_name) rescue next\n return full_name if stat.readable?\n end\n nil\n end", "title": "" }, { "docid": "e1193e5bd72412c68ea0efa31628bf28", "score": "0.59047765", "text": "def file\n @files.first ? @files.first[0] : nil\n end", "title": "" }, { "docid": "e1193e5bd72412c68ea0efa31628bf28", "score": "0.59047765", "text": "def file\n @files.first ? @files.first[0] : nil\n end", "title": "" }, { "docid": "4f088528ba29c45301e97c705b1871a3", "score": "0.5863362", "text": "def findFile(file)\n file = file.to_s\n\n # check if absolute and exists\n if Pathname.new(file).absolute?\n if File.exist?(file)\n return OpenStudio::OptionalPath.new(OpenStudio.toPath(file))\n end\n\n # absolute path does not exist\n return OpenStudio::OptionalPath.new\n end\n\n absoluteFilePaths.each do |file_path|\n result = File.join(file_path.to_s, file)\n if File.exist?(result)\n return OpenStudio::OptionalPath.new(OpenStudio.toPath(result))\n end\n end\n OpenStudio::OptionalPath.new\n end", "title": "" }, { "docid": "e92464f915c83b644f67c140c5966e23", "score": "0.5851504", "text": "def search_for_file(path_suffix)\n path_suffix += \".rb\" unless path_suffix.ends_with?(\".rb\")\n\n autoload_paths.each do |root|\n path = File.join(root, path_suffix)\n return path if File.file? path\n end\n nil # Gee, I sure wish we had first_match ;-)\n end", "title": "" }, { "docid": "db1ec39c88e7057910e3bdf488841b8b", "score": "0.58448505", "text": "def test_file # :nodoc:\n val = test_files and val.first\n end", "title": "" }, { "docid": "5e100aa25e1ac209cdb7c75bba3ef5aa", "score": "0.5837764", "text": "def get_file(file_id)\n raise ArgumentError, \"Only one file id allowed for this method\" if file_id.is_a?(Array)\n get_files(file_id).first\n end", "title": "" }, { "docid": "930a37daa23a70725ebb51ade8174ae2", "score": "0.583452", "text": "def _find_(type, filename, extnames=nil)\n if type.nil? || filename.nil?\n return nil\n end\n\n if absolute?(filename)\n return File.exists?(filename) ? filename : nil\n end\n\n path(type).each do |dir|\n each_full_path(dir, filename, extnames) do |full_path|\n if File.exists?(full_path) && subpath?(dir, full_path)\n return full_path\n end\n end\n end\n\n nil\n end", "title": "" }, { "docid": "0d43d09c97ebd018bc01036dc30c81a5", "score": "0.5823865", "text": "def find_original_file(file_set:)\n find_exactly_one_file_by_use(\n file_set: file_set,\n use: Hyrax::FileMetadata::Use::ORIGINAL_FILE\n )\n end", "title": "" }, { "docid": "147ad9065a1a46c5bd126eb7a6cc4f24", "score": "0.5811826", "text": "def find_file( dirs, lang, name, exts, hidden = false )\n glob_files( dirs, lang, name, exts, hidden ) { |file,base,ext| return file }\n nil\n end", "title": "" }, { "docid": "6ba425ccef0048aa42a02f0fce67a988", "score": "0.5798424", "text": "def find_include_file(name)\n to_search = [ File.dirname(@input_file_name) ].concat @include_path\n to_search.each do |dir|\n full_name = File.join(dir, name)\n stat = File.stat(full_name) rescue next\n return full_name if stat.readable?\n end\n nil\n end", "title": "" }, { "docid": "8afcb78f076f4cc7252e95b1601cf3d4", "score": "0.5797665", "text": "def find(*patterns)\n selection = nil\n patterns.each do |pattern|\n selection = Dir.glob(File.join(path, pattern)).first\n break if selection\n end\n FileObject[selection] if selection\n end", "title": "" }, { "docid": "7de30887c8b6fadac36e314242f705f4", "score": "0.57800233", "text": "def filename\n # just checking the first file (which is the file where an object\n # is first declared)\n files.first\n end", "title": "" }, { "docid": "c444fb1595464ba22937ee8f512b311a", "score": "0.5773044", "text": "def findFile(name, dirs, regex)\n\t\tdirs.each { |dn|\n\t\t\tif(dn.directory?)\n\t\t\t\tdn.opendir { |dir|\n\t\t\t\t\tregex.each { |r|\n\t\t\t\t\t\tdir.each { |ff|\n\t\t\t\t\t\t\tif(ff != \".\" && ff != \"..\" && ff[0...name.length] == name)\n\t\t\t\t\t\t\t\text = ff[name.length..-1]\n\t\t\t\t\t\t\t\tif(ext =~ r)\n\t\t\t\t\t\t\t\t\treturn dn + ff\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tend\n\t\t}\n\t\traise \"No file `#{name}' found\"\n\tend", "title": "" }, { "docid": "01aad30fd0e0e9b9635a5f9798612c9d", "score": "0.57526433", "text": "def find_file(*path)\n f = File.join(path)\n if File.exists?(f)\n yield f\n end\n end", "title": "" }, { "docid": "c0121cf51061a967b5c2b073550afd95", "score": "0.5744178", "text": "def primary_file_spec\n @file_specs[:primary] || @file_specs[@file_specs.keys.first]\n end", "title": "" }, { "docid": "c0121cf51061a967b5c2b073550afd95", "score": "0.5744178", "text": "def primary_file_spec\n @file_specs[:primary] || @file_specs[@file_specs.keys.first]\n end", "title": "" }, { "docid": "0cf66db57187830b3756b1f7691c61cd", "score": "0.5741658", "text": "def find_first(*paths)\n xpath(*paths).first\n end", "title": "" }, { "docid": "0db6f20469cfa278fc2ec550373d4299", "score": "0.5735902", "text": "def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end", "title": "" }, { "docid": "86860f211d8d52cfcbaeef28e7c5f7e3", "score": "0.57293135", "text": "def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end", "title": "" }, { "docid": "6ef116bf7796ba9cb736f33d11687ec3", "score": "0.57222754", "text": "def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end", "title": "" }, { "docid": "6ef116bf7796ba9cb736f33d11687ec3", "score": "0.57222754", "text": "def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end", "title": "" }, { "docid": "280322e2f154872a9e632cfc5e497123", "score": "0.5721799", "text": "def find_first_match(options)\n return unless options[:in_file]\n\n open(File.join(base_dir, options[:in_file])) do |file|\n regexp = options[:matching] || Regexp.new(\"^#{options[:starting_with]}\")\n regexp.match(file.read)\n end\n end", "title": "" }, { "docid": "b6e552e694468ae710e759dc549408e6", "score": "0.57135814", "text": "def have_tdp_file\n @tdp_files.each do |fn|\n if File.exist?(fn)\n others = Dir.glob(fn, File::FNM_CASEFOLD)\n return others.size == 1 ? others.first : fn\n elsif fn == ''\n return fn\n end\n end\n return nil\n end", "title": "" }, { "docid": "b3fa906377bc54d3fd59966dee17a70e", "score": "0.5703476", "text": "def find_matching_file_set(hash_key_for_file)\n filename = Array(params[hash_key_for_curation_concern][hash_key_for_file]).first.original_filename\n curation_concern.file_sets.select {|fs| fs.label == filename }.first\n end", "title": "" }, { "docid": "83b246ec3f16d0e8571e0ac5c9ac33c9", "score": "0.5699236", "text": "def search_for_file_with_singular(path_suffix)\n search_for_file_without_singular(path_suffix) || begin\n path_suffix_singular = path_suffix.singularize + '.rb' unless path_suffix.ends_with? '.rb'\n load_paths.each do |root|\n path = File.join(root, path_suffix_singular)\n return path if File.file? path\n end\n nil\n end\n end", "title": "" }, { "docid": "5925f9993952268a4da2a9131432fec0", "score": "0.56914085", "text": "def find id\n gist_id, filename = *id.split('/', 2)\n files.find_all do |file|\n file.gist_id == gist_id &&\n (filename.nil? || (filename == file.filename))\n end\n end", "title": "" }, { "docid": "88a3cad0593e9b0cea9e779c85f7e6e7", "score": "0.56679344", "text": "def least_covered_file\n min_by(&:covered_percent).filename\n end", "title": "" }, { "docid": "40f5967e98c36b13b2bbdef79049e676", "score": "0.5661169", "text": "def find_file_matching_pattern(search_dirs, pattern)\n search_dirs = [search_dirs] unless search_dirs.is_a?(Array)\n\n search_dirs.each do |d|\n matches = Dir.glob(File.join(d, pattern))\n return matches.first if matches.size > 0\n end\n return nil\n end", "title": "" }, { "docid": "05f0c7575c880d04b0dd13855058c41a", "score": "0.5660132", "text": "def full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end", "title": "" }, { "docid": "0fd814cc034feae38d5b06579f61a697", "score": "0.56463677", "text": "def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend", "title": "" }, { "docid": "b6400f3ef30f850c48ad059919bb84a7", "score": "0.56391454", "text": "def find(file, paths)\n if(Pathname.new(file).absolute?)\n return unless (timestamp = mtime(file))\n @logger.debug(\"Found #{file}\")\n [ file, timestamp ]\n else\n paths.each do |path|\n fullpath = File.expand_path((File.join(path, file)))\n next unless (timestamp = mtime(fullpath))\n @logger.debug(\"Found #{file} in #{fullpath}\")\n return([ fullpath, timestamp ])\n end\n return(nil)\n end\n end", "title": "" }, { "docid": "7e65eb11743f730079405318277a2aa8", "score": "0.56233007", "text": "def ffind(sname)\n listx = []\n flistf().each do |i|\n if fexistv i, sname\n listx.push i\n end\n end\n return listx\nend", "title": "" }, { "docid": "2b652eaa9ad088d48f0a514b7cc6504e", "score": "0.56180274", "text": "def find_path_with_base(f)\n Dir.glob(f + \"*\").first || \"\" # don't return nil; makes for bad spec error messages\nend", "title": "" }, { "docid": "d1e135bc15327346f1c7bae1611ba648", "score": "0.5608632", "text": "def find_requirable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = \"#{root}/#{lib}/#{file}\"\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end", "title": "" }, { "docid": "5dd9a73307d7997ceb805358aa1ded06", "score": "0.56016934", "text": "def find_a_source_file\n # find a file in source dir with the proper file extension.\n end", "title": "" }, { "docid": "f3c9b4926a5fdb5433837242726e087d", "score": "0.56010526", "text": "def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end", "title": "" }, { "docid": "4794003266bf3319aa3205eec1bc913a", "score": "0.5598587", "text": "def find_files(*paths)\n Find.find(*paths).select do |path|\n File.file?(path)\n end\n end", "title": "" }, { "docid": "6ea189610f3766a7a9422a25b6711023", "score": "0.55916345", "text": "def file(fname)\n @file_list[fname]\n end", "title": "" }, { "docid": "1d4574a17221695daf7540fa9f85cf88", "score": "0.55915654", "text": "def file\n file_names[x]\n end", "title": "" }, { "docid": "0ea232836fac8c0644c95a16dda3949c", "score": "0.5587859", "text": "def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end", "title": "" }, { "docid": "af92ec95a0d357fad9715bfef2241c02", "score": "0.55820066", "text": "def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end", "title": "" }, { "docid": "6548fbda89675fca745d6c1d20adbf6b", "score": "0.5575158", "text": "def extract_files(files)\n return RubyLint::FileList.new.process(files)\n\n rescue Errno::ENOENT => error\n abort error.message\n end", "title": "" }, { "docid": "5ffccf44562d88bc2ab36ac77ac48a15", "score": "0.5547671", "text": "def find_file( filename )\r\n dir = @autoload_dirs.find { |dir|\r\n exist?( File.join(dir,filename) )\r\n }\r\n\r\n if dir\r\n return File.join(dir,filename)\r\n else\r\n return nil\r\n end\r\n end", "title": "" }, { "docid": "5fe73c7a9baab80c2207c0ae86e0194e", "score": "0.5547566", "text": "def find filename\n return filename if File.exists? filename\n filename = \"./haml/\"+filename\n return filename if File.exists? filename\n filename = @src_folder+\"/\"+filename\n return filename if File.exists? filename\n throw \"Could not find file: #{filename}\"\nend", "title": "" }, { "docid": "6b217e00b78c0e408a6b0b8c487ba6c3", "score": "0.55463445", "text": "def search_sound(file)\n Dir.glob(File.join(@default_dir_images, file) + '.{mp3,wma,wav}').first\n end", "title": "" }, { "docid": "723ee9a41bfa03cde9effd6a2f03d3fc", "score": "0.5538023", "text": "def read_by_filename(filename)\n result = find_by_filename(filename)\n \n if result.count > 1\n result.map! { |r| read(r['_id']) }\n else\n result.blank? ? [] : [read(result.first['_id'])]\n end\n end", "title": "" }, { "docid": "6e11002d645d728b4f1a2e646d21e49d", "score": "0.5532085", "text": "def existent(path)\n expanded(path).select { |f| File.exist?(f) }\n end", "title": "" }, { "docid": "8b6d299ef46543d942faf1384f183b94", "score": "0.5530166", "text": "def files() = files_path.glob('**/*')", "title": "" }, { "docid": "e19ca41bcbb2dbb1fc33aaaa75b7f090", "score": "0.55157346", "text": "def find(basename)\n list.include?(basename) ?\n self.read_from_disk(basename) :\n throw('Not Found')\n end", "title": "" }, { "docid": "fe612d01d3e2620118c414dc8dc1ee42", "score": "0.55072725", "text": "def find(path)\n @gemspecs.each do |spec|\n return spec if matching_file(spec, path)\n end\n nil\n end", "title": "" }, { "docid": "d9a37653d62698bafda380aca20c2ccf", "score": "0.55049175", "text": "def guess_file_specs(proj_dir)\n\n\t\t\t#TODO: Link to src dir list.\n\t\t\tpossible_src_dirs = ['src','source']\n\n\t\t\tsrc_dir = \"\"\n\t\t\tfs = []\n\n\t\t\tpossible_src_dirs.each do |d|\n\n\t\t\t\tsrc_dir = proj_dir + '/' + d\n\n\t\t\t\tif File.exist?(src_dir)\n\n\t\t\t\t\tDir.foreach(src_dir) do |f|\n\t\t\t\t\t\tfs << src_dir + '/' + f if f =~ /\\.(as|mxml)$/\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\treturn fs[0] if fs.size == 1\n\n\t\tend", "title": "" }, { "docid": "7d74e57f5a71b1951910334588b664fb", "score": "0.54940146", "text": "def latest_version_file\n sorted_files.first\n end", "title": "" }, { "docid": "12da502b51cda2627f97a1c65cc2a23c", "score": "0.5490742", "text": "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "title": "" }, { "docid": "ec345ca138267ec7c8916f0d20425314", "score": "0.54735005", "text": "def test_using_first_of\n @filelist = nil\n sublist = first_of( self.filelist ) \n results = test_using_sublist( sublist )\n output.puts \"Test Using First Of\".center(72)\n output.puts \"=\" * 72\n report_results( results )\n end", "title": "" }, { "docid": "ec71dd34ddffc52f97dad9fe1f1adcb2", "score": "0.5471526", "text": "def find_location(filename)\n Find.find(path) do |element| \n if element.include? filename\n candidate = Pathname.new(element)\n yield candidate.dirname.to_s\n end \n end\n end", "title": "" }, { "docid": "d7cd4e867fd525b2ca290bc746801945", "score": "0.5468668", "text": "def search_ext(file)\n fs = @s3.list_objects_v2 bucket: ENV.fetch(\"AWS_BUCKET\"), prefix: \"#{file}.\"\n fs.contents.first&.key\n end", "title": "" }, { "docid": "ba8244660d2e90e2bd371e744d63e152", "score": "0.5467071", "text": "def files_list(path_list: '', name_list: '')\n # Check\n path_list = [path_list] if path_list.class == String # transform String in Array\n name_list = [name_list] if name_list.class == String # transform String in Array\n path_list.uniq! # Remove duplicate\n name_list.uniq! # Remove duplicate\n (@log.fatal {'FileManager.files_list() : no path given'}; exit ) if :path_list.size == 0\n (@log.fatal {'FileManager.files_list() : no file list given'}; exit ) if :name_list.size == 0\n # Init\n file_array = []\n # Create the list\n for path in path_list\n for file in name_list\n files = Dir.glob(path + '/' + file)\n file_array = file_array + files\n @log.info {\" FileManager search for \\\"#{path}/#{file}\\\" => found : #{Dir.glob(path + '/' + file).size} file(s)\"}\n end\n end\n # Something wrong ?\n if file_array.size == 0\n @log.fatal {\"FileManager : no Input Files found by files_list().path_list : #{path_list.to_s} name_list #{name_list.to_s}\"}; exit\n else\n return file_array\n end\n end", "title": "" }, { "docid": "7608ca47552f212d62daa593cb4ece91", "score": "0.54659253", "text": "def random_media_file_from_list(filename_list)\n filename_list.shuffle.each do |filename|\n puts \"Drop \" + + \". No media filename\" if !is_media_file(filename)\n return filename\n end\n raise \"No media file found in list of files.\"\nend", "title": "" }, { "docid": "fbcd83e23acca248f121269058c7b7ef", "score": "0.5463818", "text": "def first_page\n # TODO are there cases where main_page = 'README' for 'lib/README'?\n if @options.main_page && (main_file = @all_files.find { |f| f.full_name == @options.main_page })\n main_file\n elsif (file = @simple_files.first)\n file\n elsif (cm = @unique_classes_and_modules.find { |k| !k.comment.empty? })\n cm\n elsif (file = @files_with_comment.first)\n file\n elsif !@unique_classes_and_modules.empty?\n @unique_classes_and_modules.find { |k| k.any_content } or\n @unique_classes_and_modules.first\n else\n @all_files.first\n end\n end", "title": "" }, { "docid": "2cf791e4e37c9e3c9ed3bc5cd4376a22", "score": "0.54562753", "text": "def include?(file)\n @file_list.include?(file.basename)\n end", "title": "" }, { "docid": "9aac77422236e9c88ab4d889fb687672", "score": "0.54543144", "text": "def find_text_page file_name\n @text_files_hash.each_value.find do |file|\n file.full_name == file_name\n end\n end", "title": "" }, { "docid": "ac9eb6058ba6e2cc0f16adc3fde14f0e", "score": "0.5451012", "text": "def file_by_type_preference(*types)\n return nil if types.size == 0\n types.each {|type| return file_by_type type if has_type type}\n nil\n end", "title": "" }, { "docid": "5c2181fe395eef9eff293b4b13a11e4d", "score": "0.54383105", "text": "def source_files\n @source_files ||= find_files( @source_search_paths, @source_file_extension ).uniq\n @source_files\n end", "title": "" } ]
0e4a2608042b65130f15f5fdb4b60eb7
used for writing to
[ { "docid": "0667de02375f6fec992f3c6711fa71a0", "score": "0.0", "text": "def position_of_param(param)\n case param[:mode]\n when 0\n param[:param]\n when 2\n @relative_base + param[:param]\n end\n end", "title": "" } ]
[ { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.82376385", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.82376385", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.82376385", "text": "def write; end", "title": "" }, { "docid": "4e46df3ef92ad5471d34672757e2ed94", "score": "0.78282595", "text": "def write\n\nend", "title": "" }, { "docid": "8abed3da7e49fa1318c3338ec048df6a", "score": "0.7607633", "text": "def written; end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.7404328", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.7404328", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.7404328", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.7404328", "text": "def write(data); end", "title": "" }, { "docid": "e0f0c967ffd015f74d0fc00eb27caf60", "score": "0.7378165", "text": "def write?; end", "title": "" }, { "docid": "56f515a35df197b2955b075491d03637", "score": "0.73270655", "text": "def write(data)\n end", "title": "" }, { "docid": "0adfc5697bae54f91a985472e56ab995", "score": "0.7202844", "text": "def written=(_arg0); end", "title": "" }, { "docid": "26d0c705e6a206471a5739f660bfcb50", "score": "0.7165611", "text": "def write\n raise 'The write method has to be overridden'\n end", "title": "" }, { "docid": "20cc64e2487c9bb4d040d524b8524a18", "score": "0.7150068", "text": "def _write(obj)\n obj.Write()\n end", "title": "" }, { "docid": "4f219422057963d9fffa2b61a1819389", "score": "0.70984626", "text": "def write(data)\n end", "title": "" }, { "docid": "519504174d21c9f30cf34016e5c9c78d", "score": "0.7089293", "text": "def _write(obj)\n obj.Write()\n end", "title": "" }, { "docid": "46c5851934bc99d9a15b1a082ec9e484", "score": "0.7077787", "text": "def writable; end", "title": "" }, { "docid": "46c5851934bc99d9a15b1a082ec9e484", "score": "0.7077787", "text": "def writable; end", "title": "" }, { "docid": "1c895cbe7562822359710e38fa395472", "score": "0.706997", "text": "def write_to(io)\n end", "title": "" }, { "docid": "a8c71f9f6e78835253c36a9482d5fbd6", "score": "0.6939855", "text": "def write(io); end", "title": "" }, { "docid": "a8c71f9f6e78835253c36a9482d5fbd6", "score": "0.6939855", "text": "def write(io); end", "title": "" }, { "docid": "7c198a9a304670ce0ca64e0b6f98ebcc", "score": "0.69259983", "text": "def write=(_arg0); end", "title": "" }, { "docid": "edcfe487ace54345b951f0645eaa6190", "score": "0.6910422", "text": "def write(dest); end", "title": "" }, { "docid": "30695c68a70cb80493663aa4fffe0c30", "score": "0.6867817", "text": "def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end", "title": "" }, { "docid": "54bd8ae7e61c3888e6e778d601d1d9d1", "score": "0.68102473", "text": "def write_to(path,str);end", "title": "" }, { "docid": "54bd8ae7e61c3888e6e778d601d1d9d1", "score": "0.68102473", "text": "def write_to(path,str);end", "title": "" }, { "docid": "54f76a31d085a61e1b530671f30e1d62", "score": "0.6799077", "text": "def write(file); end", "title": "" }, { "docid": "0c5ea82e8c3ca25d56a74b7441d4e196", "score": "0.6782196", "text": "def write_path=(w);@@write_path=w;end", "title": "" }, { "docid": "2a4c0e14908a52897c2722b661c34a7d", "score": "0.676471", "text": "def write(content); end", "title": "" }, { "docid": "479869f298335ebe12113df3a22f9a53", "score": "0.6749053", "text": "def close_write; end", "title": "" }, { "docid": "26bb5ed490810a5983f553bd496ab273", "score": "0.67223537", "text": "def write\n write_file\n end", "title": "" }, { "docid": "f0f88bcec92cf094f95cc4c840290628", "score": "0.67208004", "text": "def native_write_to(io, encoding, options)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f4b86399ab68bf16b222b94f9d2fbc23", "score": "0.66849405", "text": "def write(arg); p.write(self, arg); end", "title": "" }, { "docid": "fc87ccefe49c2342aabe9f5683d636c6", "score": "0.6670952", "text": "def write(s) end", "title": "" }, { "docid": "62cd1088102c29cde5067becc5bd7a48", "score": "0.6646318", "text": "def write(fileName)\n\tend", "title": "" }, { "docid": "d3e9cc065d104d6ec2ffaefb90e3c7cc", "score": "0.6627512", "text": "def write_state; end", "title": "" }, { "docid": "d3e9cc065d104d6ec2ffaefb90e3c7cc", "score": "0.6627512", "text": "def write_state; end", "title": "" }, { "docid": "1a685453b1f62ee826f56ec750393a74", "score": "0.6620123", "text": "def write(*args)\n end", "title": "" }, { "docid": "f09c2eb24f06d330bf6da8cb1ab78756", "score": "0.6579925", "text": "def write_data\n raise NotImplementedError\n end", "title": "" }, { "docid": "58cabc814787ef7784e0acd1e1a51ba9", "score": "0.6569698", "text": "def write_init; end", "title": "" }, { "docid": "ed91aa0b4ab70efa5ea09860260eee82", "score": "0.65507054", "text": "def writer(record); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.6544873", "text": "def write(chunk); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.6544873", "text": "def write(chunk); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.6544873", "text": "def write(chunk); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.6544873", "text": "def write(chunk); end", "title": "" }, { "docid": "7feeffb0fa21e038a34eea2e0afbeef3", "score": "0.65309", "text": "def write(handle, offset, data); end", "title": "" }, { "docid": "2c0176aae545438aed2050d3434c8540", "score": "0.6501415", "text": "def write(trans)\n end", "title": "" }, { "docid": "3dbb16804956109868e40e861150684e", "score": "0.6498606", "text": "def write\n write_pending\n end", "title": "" }, { "docid": "b7ff2bd707c201c650d3f0049764b0a6", "score": "0.6479639", "text": "def out_stream; end", "title": "" }, { "docid": "6a2aea3297d52bad1a36b95d371b5bd0", "score": "0.6477282", "text": "def write(to_write)\n return @file.syswrite(to_write) \n end", "title": "" }, { "docid": "c32fa8c67a829f9ab7624fa4356bf6ee", "score": "0.646126", "text": "def syswrite(p0) end", "title": "" }, { "docid": "87aa72f2f5506e78d75cab333421a0d6", "score": "0.6447276", "text": "def write(_str); end", "title": "" }, { "docid": "f1cf3433f5643fdcb569b6abd519c4aa", "score": "0.644454", "text": "def write output, target; end", "title": "" }, { "docid": "b1a01277d0e3fd6cd01f8197ba4c1e36", "score": "0.64268184", "text": "def write\n Vedeu.direct_write(writable_data)\n end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.6380049", "text": "def write_to(filename); end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.6380049", "text": "def write_to(filename); end", "title": "" }, { "docid": "a1f4473955ea5c188db096a0a9eb048e", "score": "0.6379672", "text": "def write\n command :write\n end", "title": "" }, { "docid": "64a1e5451416d6e8b6dd1674888761a1", "score": "0.6372351", "text": "def write(string); end", "title": "" }, { "docid": "16cc9c5d46faf808ce2df4590508e08b", "score": "0.6368953", "text": "def write(value)\n current[row(value)][column(value)] = value\n end", "title": "" }, { "docid": "18e8e6b3acfe915702ae3443491c7b56", "score": "0.63628405", "text": "def lo_write( lo_desc, buffer )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "46094c00ac4027f3bbfecbc77b29a8b9", "score": "0.6339109", "text": "def native_write(chunk, last_chunk)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "46094c00ac4027f3bbfecbc77b29a8b9", "score": "0.6339109", "text": "def native_write(chunk, last_chunk)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f58ddb773aafc2a5b68d910308eae0bd", "score": "0.63276047", "text": "def syswrite(buf)\n\t\tself.filed.write(buf)\n\tend", "title": "" }, { "docid": "86659b1289029264d4fb74caa00d95a7", "score": "0.6309541", "text": "def write_to(_write_io)\n raise \"abstract method '#{__callee__}' called\"\n end", "title": "" }, { "docid": "5af68b6e9f19d74f5148ce81b0c79b96", "score": "0.6294613", "text": "def write(str)\n end", "title": "" }, { "docid": "fadb2b1a80237da0c5e64f586cfa696a", "score": "0.6282659", "text": "def to_file; end", "title": "" }, { "docid": "fdfdbf86fb709a0fce605fd2479e0270", "score": "0.62763894", "text": "def write(io, constraints = T.unsafe(nil)); end", "title": "" }, { "docid": "4d84a0a20e71d0abc27ad50ce3565a4d", "score": "0.627625", "text": "def write_set_object_to_this\n @file.puts 'push argument 0'\n @file.puts 'pop pointer 0'\n end", "title": "" }, { "docid": "f5d5d0d88686b5683e62cdea61e338a0", "score": "0.6269896", "text": "def []=(*args)\n super\n write\n end", "title": "" }, { "docid": "e96e75572a65a6d61e1f0b9d5f2a8664", "score": "0.62656647", "text": "def write(str); end", "title": "" }, { "docid": "e96e75572a65a6d61e1f0b9d5f2a8664", "score": "0.62656647", "text": "def write(str); end", "title": "" }, { "docid": "f646b664442fa60e725ea9820c0475a2", "score": "0.6235904", "text": "def write(*)\n raise \"abstract method invoked: #write.\"\n end", "title": "" }, { "docid": "ea78a88effafc200953c09af9f238bde", "score": "0.62273157", "text": "def raw_write(path,off,sz,buf,raw=nil);end", "title": "" }, { "docid": "ea78a88effafc200953c09af9f238bde", "score": "0.62273157", "text": "def raw_write(path,off,sz,buf,raw=nil);end", "title": "" }, { "docid": "b0ee5c1bc8bc277596d83ea0973d8c7d", "score": "0.6222183", "text": "def flush ; end", "title": "" }, { "docid": "b0ee5c1bc8bc277596d83ea0973d8c7d", "score": "0.6222183", "text": "def flush ; end", "title": "" }, { "docid": "8fd180258353fda358d1493d0f8bfa76", "score": "0.62195617", "text": "def write_data\n @s.write @tmpfile, \"w+\"\n end", "title": "" }, { "docid": "845d74cb9624bad4cfaf51cd7a71851b", "score": "0.62193114", "text": "def writeable?; end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.62104315", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.62104315", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.62104315", "text": "def write(filename); end", "title": "" }, { "docid": "8a75de424d6ace2a0201daffdaa0fb08", "score": "0.61996263", "text": "def write2(file, data:, mode: \"rw\")\n dump_object(file)\n dump_object(data)\n dump_object(mode)\n puts \"===========================\"\nend", "title": "" }, { "docid": "c25973dfddcfa375a21b7f0f3d06e25a", "score": "0.6194114", "text": "def write_to_buf #Make this memoized\n @buf.seek @factory.hdr.new.num_bytes #Leave space for header.\n #this is pretty bad\n progbits\n interp \n note\n dynamic\n write_headers\n end", "title": "" }, { "docid": "880e6607cb8d055ef6e81b8cc28f3638", "score": "0.61879057", "text": "def <<(obj)\n @write << obj\n end", "title": "" }, { "docid": "0ca4889b84aee04d1a0b4a9982482212", "score": "0.6157729", "text": "def Write path,data\n\n File.open(path,'w') do |f|\n\n f.puts data\n\n end\n \n true\n\nend", "title": "" }, { "docid": "1b690d21ff27245c3fa376e968c30f72", "score": "0.6150354", "text": "def write(datum)\n writer.write(datum)\n end", "title": "" }, { "docid": "de3921433415dbe692fac0b3eee28f7f", "score": "0.6142941", "text": "def write\n __gc\n __serialize @object\n end", "title": "" }, { "docid": "8e14500c43c62472cfbd6d67fbd65065", "score": "0.61346996", "text": "def writable?; end", "title": "" }, { "docid": "8e14500c43c62472cfbd6d67fbd65065", "score": "0.61346996", "text": "def writable?; end", "title": "" }, { "docid": "36d815e21f83a8eccb8d336592279571", "score": "0.6133578", "text": "def writer(records); end", "title": "" }, { "docid": "ed7a9159acf7052543149b17bef5c833", "score": "0.6132569", "text": "def out; end", "title": "" }, { "docid": "ed7a9159acf7052543149b17bef5c833", "score": "0.6132569", "text": "def out; end", "title": "" }, { "docid": "03812fbe894a867f2d5923ac742ca576", "score": "0.61286354", "text": "def after_write_transform; end", "title": "" }, { "docid": "4b8ef12ec89caf230351e2ceda3e66b7", "score": "0.61280173", "text": "def writeFile name, data\n end", "title": "" }, { "docid": "86ccf8e6d8412bec35de0fcfb11287a4", "score": "0.61278504", "text": "def write(data)\n @written += data\n end", "title": "" }, { "docid": "2d4835d21b4b4d134532a9f3606242d6", "score": "0.6126042", "text": "def put_copy_data\n end", "title": "" }, { "docid": "4ebe187edf9dd85a414b9762d0024cd8", "score": "0.6102647", "text": "def write(val, io)\n raise NotImplementedError, \"implement in including class\"\n end", "title": "" }, { "docid": "4ebe187edf9dd85a414b9762d0024cd8", "score": "0.61007327", "text": "def write(val, io)\n raise NotImplementedError, \"implement in including class\"\n end", "title": "" }, { "docid": "be972ed6ad12bea6b859350817458045", "score": "0.6094369", "text": "def flush; end", "title": "" }, { "docid": "be972ed6ad12bea6b859350817458045", "score": "0.6094369", "text": "def flush; end", "title": "" }, { "docid": "be972ed6ad12bea6b859350817458045", "score": "0.6094369", "text": "def flush; end", "title": "" } ]
86f6c90379891059cda9c59ae94f92eb
To view the details for a single zone, make a request using that zone's permalink: Spree.zone("azone") do |zone| ... end You may also query by the zone's id attribute: Spree.zone("id") do |zone| ... end Note that the API will attempt a permalink lookup before an ID lookup.
[ { "docid": "09dd1ef4b3eead857262119af21a0408", "score": "0.7921592", "text": "def zone(id, &block)\n object_query(Spree::Zone, zone_uri(id), &block)\n end", "title": "" } ]
[ { "docid": "9dfb93a24ec66c64c85282635adb4f6d", "score": "0.7479883", "text": "def show\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "46f50a83be97eb4238b6031756519405", "score": "0.73830986", "text": "def zone(zone)\n raise NSOne::MissingParameter, \"zone cannot be blank\" if blank?(zone)\n perform_request(HTTP_GET, \"/zones/#{zone}\")\n end", "title": "" }, { "docid": "0619843d80713e6776c47ec9a653985f", "score": "0.7129458", "text": "def show\n @zone = Zone.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone }\n end\n end", "title": "" }, { "docid": "ec1dfcf5ba559bde9187dff44ddb5ca9", "score": "0.706935", "text": "def zone\n Zone.find(self.zone_id)\n end", "title": "" }, { "docid": "0aa03a35cb22b7a672d8cd33568e0e3f", "score": "0.7045531", "text": "def show\n @zone = @shop.zones.find params[:id]\n\n respond_to do |format|\n format.html\n format.json { render json: @zone }\n end\n end", "title": "" }, { "docid": "1c1f9cfd9330b7355bccc14432294d15", "score": "0.70254", "text": "def zone zone_id\n ensure_connection!\n resp = connection.get_zone zone_id\n if resp.success?\n Zone.from_gapi resp.data, connection\n else\n nil\n end\n end", "title": "" }, { "docid": "f26642c17fe67309ea28e280fce622ae", "score": "0.69887596", "text": "def get_zone(zone=nil) \n zone ||= @zone\n get(\"Zone/#{zone}\")\n end", "title": "" }, { "docid": "d4e26cccdc8897a9e3df5c8091fe85d7", "score": "0.69770044", "text": "def details\n data = Storm::Base::SODServer.remote_call '/Network/Zone/details',\n :id => @id\n self.from_hash data\n end", "title": "" }, { "docid": "15e6c06016d0cad1a0903150be0d70f3", "score": "0.6943495", "text": "def info(zone_id)\n call('domain.zone.info', zone_id)\n end", "title": "" }, { "docid": "8c6ae87168ac744bf5224d9797000830", "score": "0.69193226", "text": "def get_zone(zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Bluebox::GetZone.new,\n :path => \"/api/domains/#{zone_id}.xml\"\n )\n end", "title": "" }, { "docid": "47e35531a428745631f1f2401dc9d6cc", "score": "0.6918509", "text": "def show\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone }\n end\n end", "title": "" }, { "docid": "47e35531a428745631f1f2401dc9d6cc", "score": "0.6918509", "text": "def show\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone }\n end\n end", "title": "" }, { "docid": "d22a17eca0e5b8b08fe8ddcfd24b3089", "score": "0.6842875", "text": "def zone\n Spree::Zone.find_each do |zone|\n return zone if zone.members.detect { |member| member.zoneable.try(:iso).eql?(country_code) }\n end\n end", "title": "" }, { "docid": "aa40e665afeddda1808d9d826264f987", "score": "0.6838156", "text": "def zones(&block)\n collection_query(\"zones\", Spree::Zone, Spree.zones_uri, &block)\n end", "title": "" }, { "docid": "2c60bb0a8b1f267acf4b47472ea5c66d", "score": "0.67602974", "text": "def details\n data = Storm::Base::SODServer.remote_call \\\n '/Network/DNS/Zone/details', :id => @id\n self.from_hash data\n end", "title": "" }, { "docid": "6688547778bff7041c293b5193c76ed8", "score": "0.6742781", "text": "def get_zone hash\n self.client.get_hosted_zone hash\n end", "title": "" }, { "docid": "0ce2ed87f9d4b742e554c3b98ed12e9f", "score": "0.67104316", "text": "def show\n @zone_entry = ZoneEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone_entry }\n end\n end", "title": "" }, { "docid": "0d162116eba098f9ab976a5ec0d03e6f", "score": "0.66791284", "text": "def show(id:)\n raise 'railgun id required' if id.nil?\n cf_get(path: \"/zones/#{zone_id}/railguns/#{id}\")\n end", "title": "" }, { "docid": "d9f1dd50725d7e62f04f7f199069735c", "score": "0.66762257", "text": "def find(zone_id)\n new(call('domain.zone.info', zone_id))\n end", "title": "" }, { "docid": "f882f85fcf57eab301bcc4b6ba3fa0a8", "score": "0.6671027", "text": "def show\n\t\t@zone = Zone.find(params[:id])\n \trespond_to do |format|\n \t\t format.html # show.html.erb\n \t\t\tformat.xml { render :xml => @zones }\n \tend\n\tend", "title": "" }, { "docid": "aad44180b2b7a92bf18a4c0906d442c2", "score": "0.6628084", "text": "def zone\n fetch('games.sonic_the_hedgehog.zone')\n end", "title": "" }, { "docid": "969b44f0c5d11ceb2b353eb1bf6b9709", "score": "0.65714204", "text": "def get_zone(name)\n params = {\n 'command' => 'listZones',\n 'available' => 'true'\n }\n json = send_request(params)\n\n networks = json['zone']\n return nil unless networks\n\n networks.each { |z|\n if name.is_uuid? then\n return z if z['id'] == name\n else\n return z if z['name'] == name\n end\n }\n nil\n end", "title": "" }, { "docid": "696d2cc614de78f4eb187bdee0c8f245", "score": "0.65713066", "text": "def zone\n if @zone\n @zone\n elsif !self[Place.zone_predicate].empty?\n @zone = Zone.find(self[Place.zone_predicate].first)\n else\n nil\n end\n end", "title": "" }, { "docid": "8138d78ad5139c804fa67ab964127b4c", "score": "0.6568045", "text": "def zone zone_id\n ensure_service!\n gapi = service.get_zone zone_id\n Zone.from_gapi gapi, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "title": "" }, { "docid": "eac0f2548b11e8fb5b298f19796bf3d6", "score": "0.6518416", "text": "def show(id:)\n id_check('dns record id', id)\n cf_get(path: \"/zones/#{zone_id}/dns_records/#{id}\")\n end", "title": "" }, { "docid": "9f565f5beeea69b34e9b3e8c224b2964", "score": "0.65082735", "text": "def show\n @zone = Zone.find(params[:id])\n checkaccountobject(\"zones\",@zone)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone }\n end\n end", "title": "" }, { "docid": "a76d7e2841ff84145779b3f43214c669", "score": "0.64231247", "text": "def fetch_zone\n route53 = Fog::DNS.new(connection_params)\n @zone = route53.zones.get(@current_resource.zone_id)\nend", "title": "" }, { "docid": "5d752e7bb2c0597eda833f49c2ffca7b", "score": "0.63655", "text": "def zone_summary options={}\n request :get, \"/#{self.company_alias}/zones.json/summary?#{options.to_q}\"\n end", "title": "" }, { "docid": "49202d0da683d80c7d9db5eb7c8c4c31", "score": "0.6310511", "text": "def get_zone_id\n uri = URI.parse(@cf_uri)\n params = \"name=#{@zone}\"\n request = \"Net::HTTP::Get.new(uri.path+'?'+params, headers)\"\n response = \"json.fetch('result').first['id']\"\n make_request(params, uri, request, response)\n end", "title": "" }, { "docid": "75f063e26cb501d4852098390e41b278", "score": "0.6306111", "text": "def show\n @where_zone = WhereZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @where_zone }\n end\n end", "title": "" }, { "docid": "7c30539a550b0e249907da4e0f61c8c3", "score": "0.62705076", "text": "def zone_name\n caz_data['name']\n end", "title": "" }, { "docid": "6f59460b4d50934b80041aff5e5788f6", "score": "0.62582165", "text": "def show\n @zone_kind = ZoneKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone_kind }\n end\n end", "title": "" }, { "docid": "338c35a672ea55fd686900537d8306ac", "score": "0.62525237", "text": "def zone(uuid, headers = {})\n Resources::Zone.new(self, get_zone(uuid, headers).body)\n end", "title": "" }, { "docid": "338c35a672ea55fd686900537d8306ac", "score": "0.62525237", "text": "def zone(uuid, headers = {})\n Resources::Zone.new(self, get_zone(uuid, headers).body)\n end", "title": "" }, { "docid": "80dbc9fdd3cc5b5532ceb8740c7d88c1", "score": "0.6235335", "text": "def show\n @breadcrumb = 'read'\n @zone = Zone.find(params[:id])\n @offices = @zone.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @zone.zone_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone }\n format.xml\n end\n end", "title": "" }, { "docid": "0f44f604ca7fa8350a1a0b53a59ff3b9", "score": "0.6231875", "text": "def fetch_zone(zone)\n case node[:dns][:zone_strategy]\n when 'hybrid'\n zone_data = hybrid_zone zone\n when 'bags'\n zone_data = bag_zone zone\n else\n zone_data = attr_zone zone\n end\n zone_data\n end", "title": "" }, { "docid": "4a1ef85381b8090956c2ee310a69ec6a", "score": "0.6221711", "text": "def get_zone(id)\n return $data.mapinfos[id].name if $data.mapinfos[id].name.include?('@')\n return map_zone_or_nil(id)\n end", "title": "" }, { "docid": "190f3ebca765588f7264e5277bada540", "score": "0.6221485", "text": "def zones_list zID: nil, zgID: nil \n call_adglare_api 'zones_list', {zId: zID, zgID: zgID}\n end", "title": "" }, { "docid": "5fdae8ef4857d3846185af6271e81b6e", "score": "0.6204303", "text": "def zone_name\n @name\n end", "title": "" }, { "docid": "3325b0cbf40e524551973f23f67d8619", "score": "0.62030125", "text": "def zone_id\n route_53_client.\n list_hosted_zones[:hosted_zones].\n each.\n select { |z| z[:name] == zone }.\n map {|z| z[:id] }.\n first\n end", "title": "" }, { "docid": "d9f0de57be167a2503e5dce98b656eb1", "score": "0.6188552", "text": "def zone\n self\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "af9615ff1a24be39ce6a741cc2fd1e8a", "score": "0.6179886", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "50f7e9a17925665d55e01ee875554e07", "score": "0.61704093", "text": "def zones\n client.list_zones(secrets['compartment_id']).data.map(&:name)\n end", "title": "" }, { "docid": "41aba791debae6342b7910d0333a2654", "score": "0.6156835", "text": "def show\n @hosted_zone = HostedZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hosted_zone }\n end\n end", "title": "" }, { "docid": "8b1724ad8e1e66d6a4a41bccef510a66", "score": "0.6119795", "text": "def show\n respond_with @zone\n end", "title": "" }, { "docid": "d7e0fd7fd7d7c56ba971594116bc99e6", "score": "0.61151576", "text": "def by_name name\n begin\n self.get_zone( :id => \n list_zones.find { |z| z[:name] == name }[:id]\n )\n rescue NoMethodError\n puts '='*80 + \"\\n Failed to find hosted DNS zone by name: #{name}\\n\" +'='*80\n nil\n end\n end", "title": "" }, { "docid": "59c8871f485274f907a7913adec8f4ab", "score": "0.61133605", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "59c8871f485274f907a7913adec8f4ab", "score": "0.61133605", "text": "def set_zone\n @zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "dfa9e317c412394cc5fb732653c65d5e", "score": "0.61004096", "text": "def show\n @hr_zone = HrZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hr_zone }\n end\n end", "title": "" }, { "docid": "c10f4f8e4ff922714468feb173b8f2ab", "score": "0.6098725", "text": "def show(id:)\n id_check('id', id)\n\n cf_get(path: \"/zones/#{zone_id}/custom_hostnames/#{id}\")\n end", "title": "" }, { "docid": "6d17cdfbb914b5e7757a8d8d577dd28a", "score": "0.6092146", "text": "def zone( force_refresh = false )\n @zone = Zone.find(self.zone_id) if @zone.nil? || force_refresh\n @zone\n end", "title": "" }, { "docid": "17fb60f4f538cce49e3d1187646d62f3", "score": "0.6088701", "text": "def show\n @ad_zone = AdZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_zone }\n end\n end", "title": "" }, { "docid": "ff219d2c7b6ab32c608720403d380bcd", "score": "0.608639", "text": "def get_record zone, name\n rec_load_all(zone)['response']['recs']['objs'].each do |rec|\n return rec if rec['display_name'] == name && rec['zone_name'] == zone\n end rescue NoMethodError\n nil\n end", "title": "" }, { "docid": "abf487412f650911b2b4d87b77652048", "score": "0.6084823", "text": "def get_pull_zone zone_id, options={}\n request :get, \"/#{self.company_alias}/zones/pull.json/#{zone_id}?#{options.to_q}\"\n end", "title": "" }, { "docid": "b4ecac8de48ed2b6ac0620663b6d8716", "score": "0.60784954", "text": "def show\n @power_zone = PowerZone.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @power_zone }\n end\n end", "title": "" }, { "docid": "f8d683a649662963d796141df311da00", "score": "0.60772645", "text": "def info(session, id)\n read_task('rvpe.zone.info', session) do\n zone = Zone.find_by_id(id)[0]\n raise \"Zone[#{id}] is not found.\" unless zone\n\n zone_e = zone.to_xml_element(session)\n doc = REXML::Document.new\n doc.add(zone_e)\n\n [true, doc.to_s]\n end\n end", "title": "" }, { "docid": "fc6152f01868daaac5a8a11e7b5c3fbc", "score": "0.6074801", "text": "def seats_in_zone(zone)\n self.zones[zone.short_name]\n end", "title": "" }, { "docid": "0619c902905c745a672635c1fe71d125", "score": "0.60597473", "text": "def zones\n query!(:zones)\n respond_value_for(results.last, :zones).map do |zone_hash|\n Zone.new(zone_hash)\n end\n end", "title": "" }, { "docid": "d8444bb5d48c0fefffff9a58b660ccfe", "score": "0.6052824", "text": "def athlete_zones(options = {})\n Strava::Models::Zones.new(get('athlete/zones', options))\n end", "title": "" }, { "docid": "7e9cff3ed5b620c415b008a7a5f66ca7", "score": "0.6044205", "text": "def zone_template\n @zone_template ||= ZerigoDNS::ZoneTemplate.find(zone_template_id)\n end", "title": "" }, { "docid": "892fd81302d659890c13996b6ca21f81", "score": "0.6033552", "text": "def quote\n fetch('games.world_of_warcraft.zone')\n end", "title": "" }, { "docid": "c0534d48b51563f2fced1e0e40983b7e", "score": "0.60279685", "text": "def index\n @zones = Zone.all\n end", "title": "" }, { "docid": "c0534d48b51563f2fced1e0e40983b7e", "score": "0.60279685", "text": "def index\n @zones = Zone.all\n end", "title": "" }, { "docid": "c0534d48b51563f2fced1e0e40983b7e", "score": "0.60279685", "text": "def index\n @zones = Zone.all\n end", "title": "" }, { "docid": "c0534d48b51563f2fced1e0e40983b7e", "score": "0.60270625", "text": "def index\n @zones = Zone.all\n end", "title": "" }, { "docid": "fc0f4f7e1c11a75cbda509fe8a13ff6e", "score": "0.6012179", "text": "def zones_delete zID: \n call_adglare_api 'zones_delete', {zID: zID}\n end", "title": "" }, { "docid": "cf986c4421f5e34cda8122a351d24a8c", "score": "0.6011639", "text": "def show\n @zone_level = ZoneLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zone_level }\n end\n end", "title": "" }, { "docid": "9f8ea68801bf433251651c6f2261d065", "score": "0.600721", "text": "def get_zone_stats(zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetZoneStats.new,\n :path => \"/api/1.1/zones/#{zone_id}/stats.xml\"\n )\n end", "title": "" }, { "docid": "8fd5cd8a0eec05faf4cd1e487299dc9c", "score": "0.59601486", "text": "def edit\n\t\t@zone = Zone.find(params[:id])\n\tend", "title": "" }, { "docid": "b846b8ce464d9c86a3470e8b78f74faa", "score": "0.5943274", "text": "def show\n @zone_act = ZoneAct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @zone_act }\n end\n end", "title": "" }, { "docid": "74cf25474b251fe4839bb825e17af0c1", "score": "0.5931353", "text": "def show\n @zonal_area = ZonalArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zonal_area }\n end\n end", "title": "" }, { "docid": "1daab0dac8375a6539b5b6eba9893451", "score": "0.59258306", "text": "def list_zones(headers = {})\n get!(\"zones\", {}, headers)\n end", "title": "" }, { "docid": "0710e099ee8d2a2e67e811e8ae4dedeb", "score": "0.5920086", "text": "def zone\n end", "title": "" }, { "docid": "5123bf37bd3b0857aa541073c2c648c2", "score": "0.5894273", "text": "def set_zona\n @zona = Zona.find(params[:id])\n end", "title": "" }, { "docid": "5123bf37bd3b0857aa541073c2c648c2", "score": "0.5894273", "text": "def set_zona\n @zona = Zona.find(params[:id])\n end", "title": "" }, { "docid": "5123bf37bd3b0857aa541073c2c648c2", "score": "0.5894273", "text": "def set_zona\n @zona = Zona.find(params[:id])\n end", "title": "" }, { "docid": "40672c347ee64644d69d1a237e41960e", "score": "0.5884385", "text": "def set_zone\n @zone = Zone.find_by(identifier: params[:identifier])\n end", "title": "" }, { "docid": "8aeb3f038bdfc90ab21a873a87d02a6f", "score": "0.58548105", "text": "def ec2_zone\n Zonify.tree(Zonify.zone(instances, load_balancers))\n end", "title": "" }, { "docid": "9b3ac65823ffebaaa16350356932f0bb", "score": "0.5817777", "text": "def zone_identifier; end", "title": "" }, { "docid": "86d193ac37054c6d6e2e838027a4d21b", "score": "0.5815889", "text": "def set_zone\n\t\t\t@zone = Zone.find(zone_params[:id])\n\t\tend", "title": "" }, { "docid": "ae973cb8e7cbf43e9c13aa12ff108aae", "score": "0.58107454", "text": "def show\n @zone = Zone.find(params[:id])\n\t\t@beamers = @zone.beamers\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zone }\n end\n end", "title": "" }, { "docid": "1b9569f39ce94754513b1fa5efbf8d8a", "score": "0.58042765", "text": "def zone\n @rdatelist.getTzid.getID\n end", "title": "" }, { "docid": "757aeac2de0724f8cbf9e01ff26444a2", "score": "0.58001995", "text": "def show\n @where_zone_factor = WhereZoneFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @where_zone_factor }\n end\n end", "title": "" }, { "docid": "16cd90c246eb074e9937d1c46aed73de", "score": "0.5784402", "text": "def show\n @ad_zone_status = AdZoneStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_zone_status }\n end\n end", "title": "" }, { "docid": "7eb9a940f1726809a46ba0dee6498982", "score": "0.5775401", "text": "def list(opts = {})\n call('domain.zone.list', opts)\n end", "title": "" }, { "docid": "d608b521ca5eb0880d5cb49372f594ef", "score": "0.57711995", "text": "def instance_zone\n result = lookup_metadata \"instance\", \"zone\"\n result.nil? ? nil : result.split(\"/\").last\n end", "title": "" }, { "docid": "79e5abba61cc3664882efb00108b93dc", "score": "0.5766664", "text": "def path\n \"/hostedzone/#{id}\"\n end", "title": "" }, { "docid": "2f04dc7ca3fb8703afb48b6a26834bd0", "score": "0.57548463", "text": "def index\n @admin_zones = AdminZone.all\n end", "title": "" }, { "docid": "84ca840bb5380239953f043a4ef94411", "score": "0.57542", "text": "def get(name_or_id)\n if zone = service.get_managed_zone(name_or_id).to_h\n new(zone)\n end\n rescue ::Google::Apis::ClientError => e\n raise e unless e.status_code == 404\n nil\n end", "title": "" }, { "docid": "891df47499aafa63f4098984982ccbb5", "score": "0.57498044", "text": "def find(shipping_zone_id)\n path = \"/shipping-zones/#{shipping_zone_id}\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "56769235f9c75449aa79fb54b5721fca", "score": "0.57476157", "text": "def set_admin_zone\n @admin_zone = Zone.find(params[:id])\n end", "title": "" }, { "docid": "fd0afafd04a04b781b50e93815a8e84b", "score": "0.5742147", "text": "def zone_name\n @data.env.current_zone_name\n end", "title": "" }, { "docid": "461fd763c96766f4fcb94543cac010c3", "score": "0.57411456", "text": "def ec2_zone\n Zonify.tree(Zonify.zone(instances))\n end", "title": "" }, { "docid": "f88b6e62329fdbe46a23a9a6d5a603ba", "score": "0.5735793", "text": "def show\n @room_zone = RoomZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room_zone }\n end\n end", "title": "" } ]
35de8ea0e65d1c246489b844a6e1dd61
DELETE /mcontacts/:id DELETE /mcontacts/:id.js DELETE /mcontacts/:id.xml DELETE /mcontacts/:id.json
[ { "docid": "da7bb9c6e6bd7493b9988c23d83a7e6c", "score": "0.0", "text": "def destroy\n respond_to do |format|\n if @mcontact.destroy\n flash[:notice] = \"Mcontact was successfully destroyed.\"\n format.html { redirect_to(mcontacts_url) }\n format.js # destroy.js.rjs\n format.xml { head :ok }\n format.json { head :ok }\n else\n flash[:error] = \"Mcontact could not be destroyed.\"\n format.html { redirect_to(mcontact_url(@mcontact)) }\n format.js # destroy.js.rjs\n format.xml { head :unprocessable_entity }\n format.json { head :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "db31580cc47cc5b92920ab8f13760712", "score": "0.8145437", "text": "def destroy # DELETE /contacts/:id\n @contact = Contact.find(params[:id])\n @contact.destroy\n end", "title": "" }, { "docid": "71d108a327f14d15aa6e122f03f03f90", "score": "0.7904226", "text": "def destroy\n standard_destroy(ContactMethod, params[:id])\n end", "title": "" }, { "docid": "4f433c32fad1fdd7ed50ecb90e87028f", "score": "0.7900119", "text": "def destroy\n @m_contact = MContact.find(params[:id])\n @m_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7ec6c83b41da2525aad7cadcbece0c83", "score": "0.7825442", "text": "def destroy\n @contacts = Contact.find(params[:id].split(\",\"))\n\n @contacts.each do |contact|\n contact.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contato removido com sucesso.' }\n format.json { render json: {\"msg\": \"Contato removido com sucesso\"} }\n end\n end", "title": "" }, { "docid": "17bbac4c2997ecb6a6d6dceb6947218c", "score": "0.7792862", "text": "def destroy\n puts \"delete contact\"\n contact = Contact.find(params[:id])\n contact.destroy\n render json: contact\n end", "title": "" }, { "docid": "37906737f9cd0315d7af2ce5d7cf777c", "score": "0.77499014", "text": "def delete\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n format.mobile { render :layout => 'mobile'}\n end\n end", "title": "" }, { "docid": "126ae804bd53d8fdd62697fec51c7e7f", "score": "0.7741792", "text": "def destroy\n #@contact = Contact.find(params[:id])\n @contact = @p.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d9486e12967c9421c6d1191c681264ea", "score": "0.77327853", "text": "def delete\n Rho::RhoContact.destroy(@params['id'])\n redirect :action => :index\n end", "title": "" }, { "docid": "03d3dbb939364d03719344b01235015c", "score": "0.77251244", "text": "def destroy\n @r_contact.destroy\n respond_to do |format|\n format.html { redirect_to r_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "80bf0dab6e6311f983dd328a762fd07a", "score": "0.7711021", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Deleted Contact #{@contact.id}\", :data => []}}\n end\n end", "title": "" }, { "docid": "c140bb4bd134f54aedab6cedc4581acf", "score": "0.7678677", "text": "def destroy\n @contact.destroy\n\n render json: @contact, status: :ok\n end", "title": "" }, { "docid": "e4bd87a28a9e0d53819594498d128c9c", "score": "0.7671281", "text": "def destroy\n # DELETE\n # DELETE FROM contacts WHERE id = 5;\n end", "title": "" }, { "docid": "66f9485d859e2116ba8513117d2bda4a", "score": "0.7664411", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5ba849fcd98d513aa3f06b03125c4ba6", "score": "0.7645859", "text": "def contacts_delete(contacts=[],http_request_options={},api_key=nil)\n options = {\n :path => \"#{config.base_path}/contacts/delete\",\n :params => {:contacts => contacts},\n :http_request_options => http_request_options,\n :api_key => api_key\n }\n request = Knowtify::Request.new(options)\n handler.post(request)\n end", "title": "" }, { "docid": "2473105befe8971be3485d9a2be847ec", "score": "0.76424915", "text": "def destroy\n @contact.destroy\n \n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc759a54eb893f47efc2e74139e74b20", "score": "0.7631329", "text": "def destroy\n @s_contact.destroy\n respond_to do |format|\n format.html { redirect_to s_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bbfa614e2d7786ac129c3fe6d12b75f2", "score": "0.7618731", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n \n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de5edb5e5d52d3f789cdd95e5db121bb", "score": "0.76154417", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "352a5226be265f2753dc8e24b09f371e", "score": "0.7613669", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d86cc3a446314d446c2af5b0e567c62", "score": "0.76056504", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "200400621e50aed8c7672e0e42ffbfa6", "score": "0.7597553", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "200400621e50aed8c7672e0e42ffbfa6", "score": "0.7597553", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "200400621e50aed8c7672e0e42ffbfa6", "score": "0.7597553", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "845907f4c8d4834f9353d75df894dc95", "score": "0.75877553", "text": "def delete(options={})\n post('deleteContact', options)\n end", "title": "" }, { "docid": "22ac1a1a687129f1ba82208b77d9c0b4", "score": "0.75844646", "text": "def destroy\n contact=Contact.find_by_id(params[:id])\n if contact != nil\n if contact.destroy\n head 204\n end\n else\n head 404\n end\n end", "title": "" }, { "docid": "c54cb0b74caba42b4db2ffbcec0087cf", "score": "0.75802606", "text": "def destroy\n puts \" --------- #{params}\"\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6dad58b99fd8c04ef8eff167bdffb05e", "score": "0.756517", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6dad58b99fd8c04ef8eff167bdffb05e", "score": "0.756517", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa6cadbc28cab3708ec147259e985e9a", "score": "0.7562797", "text": "def destroy\n respond_with Contact.destroy params[:id]\n end", "title": "" }, { "docid": "ee97171c9715ec5df3a82f61cd85a0e5", "score": "0.75611764", "text": "def destroy\n @contact.destroy\n\n respond_to do |format|\n format.json {\n render nothing: true, status: 200\n }\n\n format.html {\n redirect_to contacts_url, notice: t('common.destroyed').capitalize\n }\n end\n\n end", "title": "" }, { "docid": "27d3e03b3d480826ff6f44c204c4971d", "score": "0.7561077", "text": "def destroy\n @my_contact.delete\n respond_to do |format|\n format.html { redirect_to my_contacts_url, notice: 'My contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb76f3ccc7c40eab829c077312f78d1d", "score": "0.7552788", "text": "def destroy\n @contact = Contact.where(:id => params[:id]).where(:user_id => current_user).first\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "637feb224441b067690935d1703a840d", "score": "0.7545683", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "109c5a803942e2cf0a8d5a5e3d22b8dd", "score": "0.7544389", "text": "def destroy\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_group_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9eef9e2862ce08995faf439b95ec034b", "score": "0.75300336", "text": "def destroy\n\t @contact = Contact.find(params[:id])\n\t @contact.destroy\n\t \n\t respond_to do |format|\n\t format.html { redirect_to contacts_url }\n\t format.json { head :no_content }\n\t end\n\t end", "title": "" }, { "docid": "118b8893f64c32a582c6d3ccf09028b8", "score": "0.7526314", "text": "def destroy\n @edit_contact.destroy\n respond_to do |format|\n format.html { redirect_to edit_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3b4f16893ef06e8dbc93e9d75706e2b", "score": "0.7519134", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to user_contacts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "5679aa59afa6eb7ebed7a34820cc3aa9", "score": "0.7509708", "text": "def destroy\n standard_destroy(ContactType, params[:id])\n end", "title": "" }, { "docid": "a2ab84e6d3cada83610cfbd1ddf6ab5f", "score": "0.7501032", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to backend_contacts_url, notice: 'Contacto eliminado.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "175cd8c5f8bf70a412671d491d3d26dc", "score": "0.74995273", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n #logger.info \"temps_url\"\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "979599433326445639a3491b2f91876f", "score": "0.74974936", "text": "def destroy\n @contact.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "979599433326445639a3491b2f91876f", "score": "0.74974936", "text": "def destroy\n @contact.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "979599433326445639a3491b2f91876f", "score": "0.74974936", "text": "def destroy\n @contact.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "979599433326445639a3491b2f91876f", "score": "0.74974936", "text": "def destroy\n @contact.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "00ad6e5d6ac84846052ee60bed537bd7", "score": "0.74963516", "text": "def destroy\n @customer_contact = CustomerContact.find(params[:id])\n @customer_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5835499577593bf2e70b19e5a25e61c9", "score": "0.7495682", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n destruction(format, contacts_url)\n end\n end", "title": "" }, { "docid": "1c80b23bcadd89f0bc1f002b8c6543f9", "score": "0.74929476", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: I18n.t('messages.destroyed') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3ced4dae85e68c31476f44bd8d2c7ad3", "score": "0.7491469", "text": "def destroy\n @contactum.destroy\n respond_to do |format|\n format.html { redirect_to contacta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c66fcc387027dd3544c9b683e84d00db", "score": "0.7479765", "text": "def destroy\n @client_contact = ClientContact.find(params[:id])\n @client_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to client_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "24475c22aca6f079b4e8c0e02d2e96bd", "score": "0.74765337", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "24475c22aca6f079b4e8c0e02d2e96bd", "score": "0.74765337", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b80c3cffcc7b81b3a206212c95fa5631", "score": "0.7474174", "text": "def destroy\n @contact = current_user.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b80c3cffcc7b81b3a206212c95fa5631", "score": "0.7474174", "text": "def destroy\n @contact = current_user.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4558291168cd77f46131969205b78409", "score": "0.74682426", "text": "def destroy\n @contact = @business.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to business_contacts_url(@business) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "571ab37f87e8069c550d3a1e1383c665", "score": "0.7463123", "text": "def destroy\n @contact = set_contact\n \n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6ea29fd8ecf18e014320a5bcc581c9a8", "score": "0.7460939", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6ea29fd8ecf18e014320a5bcc581c9a8", "score": "0.7460939", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c220abaff5cd7f0681c6b27890108f06", "score": "0.7451971", "text": "def destroy\n @contact = @company.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(company_contacts_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6fc923b6d1224a8b43dc168fc76c1c22", "score": "0.74508", "text": "def destroy\n @personal_contact = PersonalContact.find(params[:id])\n @personal_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(personal_contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9fffa644e58f4b6e9531bcfb1ddf4847", "score": "0.74422795", "text": "def destroy\n contact = Contact.find(params[:id])\n contact.destroy\n redirect_to(\"/contacts\")\n end", "title": "" }, { "docid": "d46f5b89f1af2ea6c62d86c0fd461e83", "score": "0.7434847", "text": "def delete_contact(id)\n delete \"contacts/#{id}\"\n end", "title": "" }, { "docid": "7efde633eb20a5c0463e98b15c1233ec", "score": "0.7434726", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.js\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eef6b8cdb2cd7ae50e7334dc76ed1405", "score": "0.74289095", "text": "def destroy\n @contact = Contact.find(:first, :conditions => {:id => params[:id], :user_id => current_user})\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9a8432edaeb369e9fd7aa8d32fcfd90f", "score": "0.7421419", "text": "def destroy\n @sole_contact = SoleContact.find(params[:id])\n @sole_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to sole_contacts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "bbcdad3b5a7d124e1a5f75023588c45c", "score": "0.74165094", "text": "def delete_contact(contact_id)\n request :delete,\n \"/v3/contacts/#{contact_id}.json\"\n end", "title": "" }, { "docid": "86880b2a6c19b9679d1d9880d85b65c8", "score": "0.7416343", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n flash[:success] = 'Кнтакты удалены.'\n format.html { redirect_to contacts_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c9cc735c80df5877ce51b306c22ea8f4", "score": "0.7407942", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to after_destroy_url, notice: 'Se eliminó con exito.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "777b292e1bfa2ac54752b88ac36a124a", "score": "0.74026823", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "eb928e7d0bf10b175ba6aee65f4aa3f6", "score": "0.73986214", "text": "def destroy\n @person_has_contact.destroy\n respond_to do |format|\n format.html { redirect_to person_has_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
a06ad62edcdd50304568c28b4e4444a9
the beginning of the original string. The return value should be arranged in order from shortest to longest substring. Examples: substrings_at_start('abc') == ['a', 'ab', 'abc'] substrings_at_start('a') == ['a'] substrings_at_start('xyzzy') == ['x', 'xy', 'xyz', 'xyzz', 'xyzzy'] PEDAC: Understand the Problem: > Input: string > Output: array > Requirements: must take a string > minimum length of string is 1 substring needs to create array with every substring beginning with leading letter, in order does not need to find substrings beyond those starting with leading letter > Rules: array must be returned Examples: substrings_at_start('abc') substrings_at_start('a') substrings_at_start('xyzzy') substring_at_start('philadelphia') Data Structures: we can use the string to iterate through create the array to contain the resulting values for a number of times == string.length add string[0]..string[i] to the array return the array Algorithm: > Pseudo: START DEFINE substrings_at_start(string) SET substrings =[] FOR string.length.times |i| substrings << string.slice(0, i) END END Code with Intent:
[ { "docid": "2fdd52b6669dcdd23c0c1cc08f96c784", "score": "0.81948626", "text": "def substrings_at_start(string)\n substrings = []\n string.length.times { |i| substrings << string.slice(0, i + 1)}\n substrings\nend", "title": "" } ]
[ { "docid": "aaaf2b38460142e7d258a7e86f676a32", "score": "0.8571486", "text": "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str.slice(0..idx) }\nend", "title": "" }, { "docid": "aaaf2b38460142e7d258a7e86f676a32", "score": "0.8571486", "text": "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str.slice(0..idx) }\nend", "title": "" }, { "docid": "aaaf2b38460142e7d258a7e86f676a32", "score": "0.8571486", "text": "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str.slice(0..idx) }\nend", "title": "" }, { "docid": "18f4b44c492a86ab189cc4be490c7097", "score": "0.8512811", "text": "def substrings_at_start(string)\n string.chars.map.with_index { |_, idx| string[0..idx] }\nend", "title": "" }, { "docid": "18f4b44c492a86ab189cc4be490c7097", "score": "0.8512811", "text": "def substrings_at_start(string)\n string.chars.map.with_index { |_, idx| string[0..idx] }\nend", "title": "" }, { "docid": "0223dfaf26264792c896d3614b3651bd", "score": "0.85055596", "text": "def substrings_at_start(str)\n str.chars.map.with_index { |_,index| str[0..index] }\nend", "title": "" }, { "docid": "7d0731d96b9fdad6d90e41685e3978ed", "score": "0.85023075", "text": "def substrings_at_start(string)\n string.chars.map.with_index do |_, idx|\n string[0..idx]\n end\nend", "title": "" }, { "docid": "2e31f9ca87f00a7b8793f949d674157f", "score": "0.8491005", "text": "def substrings_at_start(string)\n result = []\n 1.upto(string.length) do |position|\n result << string[0, position]\n end\n result\nend", "title": "" }, { "docid": "470b44796e14400f99937b45969e60aa", "score": "0.84884113", "text": "def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend", "title": "" }, { "docid": "ccc1327168f986d277296d663bfa69a5", "score": "0.847876", "text": "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend", "title": "" }, { "docid": "f4b3bbbb2b98ee344214bd13a12e3c9c", "score": "0.8466866", "text": "def substrings_at_start(str)\n substrings = []\n str.chars.each_with_index { |_, index| substrings << str[0..index] }\n substrings\nend", "title": "" }, { "docid": "f4b3bbbb2b98ee344214bd13a12e3c9c", "score": "0.8466866", "text": "def substrings_at_start(str)\n substrings = []\n str.chars.each_with_index { |_, index| substrings << str[0..index] }\n substrings\nend", "title": "" }, { "docid": "326dfc15f9ddd9fdfb45ae83fce02a8b", "score": "0.8451535", "text": "def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend", "title": "" }, { "docid": "4e4df280451e9c2b246e16e57c4475bf", "score": "0.8424777", "text": "def substrings_at_start(str)\r\n results = []\r\n str.chars.each_index { |idx| results << str[0..idx] }\r\n results\r\nend", "title": "" }, { "docid": "508f283403db35c02e93d3132b46c9e3", "score": "0.8423997", "text": "def substrings_at_start(string)\n \n new_array = []\n 1.upto(string.size) do |idx|\n new_array << string.slice(0, idx)\n end\n new_array\nend", "title": "" }, { "docid": "7d5974331e0837421fbfd83a84b044e8", "score": "0.84219027", "text": "def substrings_at_start(string)\r\n array = []\r\n substring = string.chars[0]\r\n string.each_char do |x|\r\n if array.empty?\r\n array << x\r\n else\r\n substring += x\r\n array << substring\r\n end\r\n end\r\n array\r\nend", "title": "" }, { "docid": "7d5974331e0837421fbfd83a84b044e8", "score": "0.84219027", "text": "def substrings_at_start(string)\r\n array = []\r\n substring = string.chars[0]\r\n string.each_char do |x|\r\n if array.empty?\r\n array << x\r\n else\r\n substring += x\r\n array << substring\r\n end\r\n end\r\n array\r\nend", "title": "" }, { "docid": "7d5974331e0837421fbfd83a84b044e8", "score": "0.84219027", "text": "def substrings_at_start(string)\r\n array = []\r\n substring = string.chars[0]\r\n string.each_char do |x|\r\n if array.empty?\r\n array << x\r\n else\r\n substring += x\r\n array << substring\r\n end\r\n end\r\n array\r\nend", "title": "" }, { "docid": "7d5974331e0837421fbfd83a84b044e8", "score": "0.84219027", "text": "def substrings_at_start(string)\r\n array = []\r\n substring = string.chars[0]\r\n string.each_char do |x|\r\n if array.empty?\r\n array << x\r\n else\r\n substring += x\r\n array << substring\r\n end\r\n end\r\n array\r\nend", "title": "" }, { "docid": "03afc1eeb39aad2f5f47997c2aad90dc", "score": "0.8413828", "text": "def substrings_at_start(string)\n substrings = []\n 1.upto(string.length) do |index|\n substrings << string.slice(0, index)\n end\n substrings\nend", "title": "" }, { "docid": "9678cba9b561c58087164b84351d7fe3", "score": "0.84135413", "text": "def substrings_at_start(str)\n result_array = []\n 1.upto(str.size) { |x| result_array << str[0, x] }\n result_array\nend", "title": "" }, { "docid": "508705491004035a2078366402f60884", "score": "0.8395808", "text": "def substrings_at_start(str)\n results = []\n\n str.each_char.with_index do |_, idx|\n results << str[0..idx]\n end\n results\nend", "title": "" }, { "docid": "44dc6fc8f5f243c6dc35c537e71f415e", "score": "0.8394688", "text": "def substrings_at_start(string)\n substrings = []\n string.chars.each_with_index do | _, idx |\n substrings << string.slice(0..idx)\n end\n substrings\nend", "title": "" }, { "docid": "aa07aaa24f30fd4c81980c5cbf812066", "score": "0.8377932", "text": "def substrings_at_start(string)\n out = []\n str_to_array = string.chars\n str_to_array.each_with_index { |_, i| out << str_to_array[0..i].join }\n out\nend", "title": "" }, { "docid": "6d7600210bdeb20b29c76b47f4771e86", "score": "0.83756727", "text": "def substrings_at_start(string)\n array_of_strings = []\n split_string = string.split('')\n substring = ''\n split_string.each_index do |position|\n substring += split_string[position]\n array_of_strings << substring\n end\n array_of_strings\nend", "title": "" }, { "docid": "6d7600210bdeb20b29c76b47f4771e86", "score": "0.83756727", "text": "def substrings_at_start(string)\n array_of_strings = []\n split_string = string.split('')\n substring = ''\n split_string.each_index do |position|\n substring += split_string[position]\n array_of_strings << substring\n end\n array_of_strings\nend", "title": "" }, { "docid": "643fb5ad6a9af81f5c52f1c912b916f2", "score": "0.83715326", "text": "def substrings_at_start(string)\n array_substring = []\n index = 0\n while string[index]\n index += 1\n array_substring << string.slice(0, index)\n end\n array_substring\nend", "title": "" }, { "docid": "643fb5ad6a9af81f5c52f1c912b916f2", "score": "0.83715326", "text": "def substrings_at_start(string)\n array_substring = []\n index = 0\n while string[index]\n index += 1\n array_substring << string.slice(0, index)\n end\n array_substring\nend", "title": "" }, { "docid": "643fb5ad6a9af81f5c52f1c912b916f2", "score": "0.83715326", "text": "def substrings_at_start(string)\n array_substring = []\n index = 0\n while string[index]\n index += 1\n array_substring << string.slice(0, index)\n end\n array_substring\nend", "title": "" }, { "docid": "8f8bb49da903432ca1482f79e05ac03a", "score": "0.8342455", "text": "def substrings_at_start(str)\n str.split(//).map.with_index { |_, idx| str[0..idx] }\nend", "title": "" }, { "docid": "b1901ca074d2c3cb6f28e522c72d5fd8", "score": "0.8336523", "text": "def substrings_at_start(str)\n results = []\n substring = ''\n \n str.chars.each do |char|\n substring += char\n results << substring\n end\n \n results\nend", "title": "" }, { "docid": "4ed88113ecd3816fedee58bbb9477f1c", "score": "0.83353287", "text": "def substrings_at_start(string)\n substrings = []\n\n string.chars.each_index do |index|\n substrings << string[0..index]\n end\n\n substrings\nend", "title": "" }, { "docid": "4ed88113ecd3816fedee58bbb9477f1c", "score": "0.83353287", "text": "def substrings_at_start(string)\n substrings = []\n\n string.chars.each_index do |index|\n substrings << string[0..index]\n end\n\n substrings\nend", "title": "" }, { "docid": "7478e8a54e55cabaf163ccaf85b386ba", "score": "0.83347774", "text": "def substrings_at_start(string)\n array = []\n counter = 0\n loop do\n array.push(string[0..counter])\n counter += 1\n break if counter == string.length\n end\n array\nend", "title": "" }, { "docid": "0c30970639d59db467f25b4a28ebd1ff", "score": "0.8332663", "text": "def substrings_at_start(string)\n substrings = []\n 1.upto(string.length) do |int|\n substrings << string.slice(0, int)\n end\n substrings\nend", "title": "" }, { "docid": "09272a61624a33f181615557a227cd3e", "score": "0.8332028", "text": "def substrings_at_start(str)\n results = []\n 1.upto(str.size) do |length|\n results << str.slice(0, length)\n end\n results\nend", "title": "" }, { "docid": "fc97cc1c90779f487bc597edf4a2070c", "score": "0.8331229", "text": "def substrings_at_start(str)\n substr_arr = []\n 1.upto(str.length) do |n|\n substr_arr << str.slice(0, n)\n end\n substr_arr\nend", "title": "" }, { "docid": "fc97cc1c90779f487bc597edf4a2070c", "score": "0.8331229", "text": "def substrings_at_start(str)\n substr_arr = []\n 1.upto(str.length) do |n|\n substr_arr << str.slice(0, n)\n end\n substr_arr\nend", "title": "" }, { "docid": "26f8e371193a761bd87f2e69a3ab914d", "score": "0.8329887", "text": "def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend", "title": "" }, { "docid": "a698d4317ee23730482f69c813e9abdc", "score": "0.8327937", "text": "def substrings_at_start(string)\n (0...string.size).map do |length|\n string[0..length]\n end\nend", "title": "" }, { "docid": "1859b33c098249d9efbe34e152b62e08", "score": "0.8323681", "text": "def substrings_at_start(string)\n array = []\n counter = 0\n loop do\n array.push(string.slice(0..counter))\n counter += 1\n break if counter == string.length\n end\n array\nend", "title": "" }, { "docid": "a38aa4baa1b99ab60f5fbd5f6675899f", "score": "0.83235484", "text": "def substrings_at_start(str)\n (1..str.length).inject([]) { |arr, num| arr << str[0,num] }\nend", "title": "" }, { "docid": "c678cb9465ef1793c8f014e8fbf763c1", "score": "0.8321657", "text": "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend", "title": "" }, { "docid": "de01831d864b26adc58f2a40fd1b6c97", "score": "0.830854", "text": "def substrings_at_start(string)\n substrings = []\n char_arr = string.chars\n until char_arr.empty? do\n substrings.unshift(char_arr.join)\n char_arr.pop\n end\n substrings\nend", "title": "" }, { "docid": "6218141e41e102a1186e49d08f10af8d", "score": "0.83044475", "text": "def substrings_at_start(str)\n arr = []\n (0...str.size).each { |ndx| arr << str[0..ndx] }\n arr\nend", "title": "" }, { "docid": "6218141e41e102a1186e49d08f10af8d", "score": "0.83044475", "text": "def substrings_at_start(str)\n arr = []\n (0...str.size).each { |ndx| arr << str[0..ndx] }\n arr\nend", "title": "" }, { "docid": "6218141e41e102a1186e49d08f10af8d", "score": "0.83044475", "text": "def substrings_at_start(str)\n arr = []\n (0...str.size).each { |ndx| arr << str[0..ndx] }\n arr\nend", "title": "" }, { "docid": "e5bf299c5879e7aa2efcfdaf1d620a47", "score": "0.8299902", "text": "def substrings_at_start(string)\n string.split(\"\").map.with_index do |_, index|\n string[0..index]\n end\nend", "title": "" }, { "docid": "fd0d0879bd55099f9c88231947f30202", "score": "0.8293486", "text": "def substrings_at_start(string)\n array = []\n for i in (0...string.length)\n array << string[0..i]\n end\n array\nend", "title": "" }, { "docid": "d5260414179a29e6f34c9fe165ea58b7", "score": "0.82907665", "text": "def substrings_at_start(str)\n chars = str.chars\n substrings = []\n chars.length.times do\n if substrings.empty?\n substrings << chars.shift\n else\n substrings << substrings.last + chars.shift\n end\n end\n substrings\nend", "title": "" }, { "docid": "821c20c403002ac8972f22a22e17f184", "score": "0.8287542", "text": "def substrings_at_start(str)\n substrings = []\n 0.upto(str.length - 1) { |i| substrings.push(str[0..i]) }\n substrings\nend", "title": "" }, { "docid": "821c20c403002ac8972f22a22e17f184", "score": "0.8287542", "text": "def substrings_at_start(str)\n substrings = []\n 0.upto(str.length - 1) { |i| substrings.push(str[0..i]) }\n substrings\nend", "title": "" }, { "docid": "b0d07ab12a16d6f3d127ce26404809e4", "score": "0.8277306", "text": "def substrings_at_start(string)\n result = []\n sub_string = ''\n string.each_char do |char|\n sub_string = sub_string + char\n result << sub_string\n end\n result\nend", "title": "" }, { "docid": "b0d07ab12a16d6f3d127ce26404809e4", "score": "0.8277306", "text": "def substrings_at_start(string)\n result = []\n sub_string = ''\n string.each_char do |char|\n sub_string = sub_string + char\n result << sub_string\n end\n result\nend", "title": "" }, { "docid": "c4973412daf4fe432b8cec0756a92eda", "score": "0.82747155", "text": "def substrings_at_start(str)\n substrings = []\n 1.upto(str.size) do |index|\n substrings << str[0..index-1]\n end\n substrings\nend", "title": "" }, { "docid": "960ce0f08d9d0c180c8cdc8a271f0fb8", "score": "0.8270987", "text": "def substrings_at_start(string)\n (1..string.size).each.with_object([]) { |count, arr| arr << string[0, count] }\nend", "title": "" }, { "docid": "960ce0f08d9d0c180c8cdc8a271f0fb8", "score": "0.8270987", "text": "def substrings_at_start(string)\n (1..string.size).each.with_object([]) { |count, arr| arr << string[0, count] }\nend", "title": "" }, { "docid": "e32325b4788cc3a0de9f08c664a4f58c", "score": "0.8268319", "text": "def substrings_at_start(str)\n result = []\n 0.upto(str.length - 1) do |i|\n result << str[0..i]\n end\n result\nend", "title": "" }, { "docid": "fac33da2cf9aa9c8385facfb4d434841", "score": "0.8266667", "text": "def substrings_at_start(input)\n\n new_string = []\n \n input.chars.each_with_index do |_, idx|\n new_string << input.slice(0, idx+1)\n end\n \n new_string\nend", "title": "" }, { "docid": "b5a3f4c97188637fd7025f831fb29427", "score": "0.8262188", "text": "def substrings_at_start(string)\n substrings = []\n characters = string.split('')\n size = characters.size\n counter = 0\n\n while counter < size\n substring = characters[0..counter].join\n substrings.push(substring)\n\n counter += 1\n end\n\n substrings\nend", "title": "" }, { "docid": "a5f90850bdaa75c6cd17156be176c8f8", "score": "0.8260504", "text": "def substrings_at_start(input)\n\n new_string = []\n\n input.chars.each_with_index do |_, idx|\n new_string << input.slice(0, idx+1)\n end\n new_string\nend", "title": "" }, { "docid": "8b68a9fc1564729bef68266b69ebea7e", "score": "0.82588357", "text": "def substrings_at_start(string)\n array = []\n\n string.length.times do |index|\n array << string[0..index]\n end\n array\nend", "title": "" }, { "docid": "0ffa0b20dac90f17d658015e0a406e6b", "score": "0.8256855", "text": "def substrings_at_start(string)\n characters_array = []\n characters_string = ''\n\n string.chars.each do |char|\n characters_string += char\n characters_array << characters_string\n end\n characters_array\nend", "title": "" }, { "docid": "039811097f4deb6372bb7e836a4f4d20", "score": "0.82558596", "text": "def substrings_at_start(str)\n substr = []\n 0.upto(str.length - 1) do |i|\n substr << str[0..i]\n end\n substr\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "609e0806bea42bd0c1bf710ee7269595", "score": "0.8251789", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "6b016d65d01c207c36b40e71c2bfaa62", "score": "0.8247529", "text": "def substrings_at_start(str)\n substrings = []\n\n 0.upto(str.length-1) do |len|\n substrings << str[0..len]\n end\n\n substrings\nend", "title": "" }, { "docid": "6b016d65d01c207c36b40e71c2bfaa62", "score": "0.8247529", "text": "def substrings_at_start(str)\n substrings = []\n\n 0.upto(str.length-1) do |len|\n substrings << str[0..len]\n end\n\n substrings\nend", "title": "" }, { "docid": "6b016d65d01c207c36b40e71c2bfaa62", "score": "0.8247529", "text": "def substrings_at_start(str)\n substrings = []\n\n 0.upto(str.length-1) do |len|\n substrings << str[0..len]\n end\n\n substrings\nend", "title": "" }, { "docid": "93ad62501028e093328492afcd7960bd", "score": "0.82472396", "text": "def substrings_at_start(string)\n string_array = string.split('')\n substrings_array = []\n string_array.each_index do |idx|\n (idx..string_array.length-1).each do |sec_idx|\n substrings_array << string_array[idx..sec_idx].join('')\n end\n end\n substrings_array\nend", "title": "" }, { "docid": "41438a27a6beae3a85ac262199ce5149", "score": "0.8244945", "text": "def substrings_at_start(string)\n return_array = []\n counter = 0\n while counter < string.size\n return_array << string.slice(0..counter)\n counter += 1\n end\n return_array\nend", "title": "" }, { "docid": "5bf03233727cb011050b71ff431a296f", "score": "0.8241372", "text": "def substrings_at_start(string)\n new_arry = []\n 1.upto(string.size) do |p|\n new_arry << string.slice(0,p)\n end\n new_arry\nend", "title": "" }, { "docid": "5bf03233727cb011050b71ff431a296f", "score": "0.8241372", "text": "def substrings_at_start(string)\n new_arry = []\n 1.upto(string.size) do |p|\n new_arry << string.slice(0,p)\n end\n new_arry\nend", "title": "" }, { "docid": "80716f075667dded4de568235a500956", "score": "0.8239877", "text": "def substrings_at_start(string)\n output = []\n (1..string.size).each do |count|\n output << string[0, count]\n end\n output\nend", "title": "" }, { "docid": "1b26f26c1dd58312cec3d8d19dd8c6fe", "score": "0.8239694", "text": "def substrings_at_start(string)\n\tlen = string.length\n\tnew_array = []\n\tcharacter = string.chars\n\tlen.times do |x|\n\t\tnew_array << character.slice(0..x).join(\"\")\n\tend\n\tnew_array\nend", "title": "" }, { "docid": "3ff4572bfe2fe757cd24467ed0c37eed", "score": "0.8238875", "text": "def substrings_at_start(string)\nnew_arr = []\n0.upto(string.size - 1) do |index|\nnew_arr << string[0..index]\nend\nnew_arr\t\nend", "title": "" }, { "docid": "3ff4572bfe2fe757cd24467ed0c37eed", "score": "0.8238875", "text": "def substrings_at_start(string)\nnew_arr = []\n0.upto(string.size - 1) do |index|\nnew_arr << string[0..index]\nend\nnew_arr\t\nend", "title": "" }, { "docid": "b38fca52f83b551bd4c7208a83d3e7c8", "score": "0.82369447", "text": "def substrings_at_start(string)\n result_array = []\n 0.upto(string.size - 1) do |index|\n result_array << string.slice(0..index)\n end\n result_array\nend", "title": "" }, { "docid": "b38fca52f83b551bd4c7208a83d3e7c8", "score": "0.82369447", "text": "def substrings_at_start(string)\n result_array = []\n 0.upto(string.size - 1) do |index|\n result_array << string.slice(0..index)\n end\n result_array\nend", "title": "" }, { "docid": "ee16c8f9586ea3a718272096c1508df8", "score": "0.82367665", "text": "def substrings_at_start(string)\n substring_arr = []\n 0.upto(string.size - 1) do |index|\n substring_arr << string.slice(0..index)\n end\n\n substring_arr\nend", "title": "" }, { "docid": "8d86d1e868d8984b4d2163ee82ff34ac", "score": "0.8233467", "text": "def substrings_at_start(str)\n result = []\n index = 0\n while index < str.size\n result << str[0..index]\n index += 1\n end\n result\nend", "title": "" }, { "docid": "bdaa0f619d61aff1d66d1618edf2ef86", "score": "0.8222485", "text": "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index| \n result << string[0..index]\n end\n result\nend", "title": "" }, { "docid": "d1976af407d6e3881bd0745554364205", "score": "0.82178277", "text": "def substrings_at_start(str)\n subs = []\n str.size.times { |i| subs << str[0..i] }\n subs\nend", "title": "" }, { "docid": "d1976af407d6e3881bd0745554364205", "score": "0.82178277", "text": "def substrings_at_start(str)\n subs = []\n str.size.times { |i| subs << str[0..i] }\n subs\nend", "title": "" }, { "docid": "fd05bf763af7a3cdb08b1b1a7aa3c219", "score": "0.8215982", "text": "def substrings_at_start(str)\n result = []\n (0..str.length-1).each do |i|\n result << str[0..i]\n end\n result\nend", "title": "" }, { "docid": "41b64f045547814be59a43dce9707edb", "score": "0.82102996", "text": "def substrings_at_start(string)\nnew_arr = []\n0.upto(string.size - 1) do |index|\n\tnew_arr << string[0..index]\nend\nnew_arr\t\nend", "title": "" }, { "docid": "d8f511d318c28a20a4723d1dbb1d8230", "score": "0.82099015", "text": "def substrings_at_start(string)\n result = []\n index = 0\n while index < string.size\n result << string[0..index]\n index += 1\n end\n result\nend", "title": "" }, { "docid": "d8f511d318c28a20a4723d1dbb1d8230", "score": "0.82099015", "text": "def substrings_at_start(string)\n result = []\n index = 0\n while index < string.size\n result << string[0..index]\n index += 1\n end\n result\nend", "title": "" }, { "docid": "07a0671bc8a942e961cbe3b483001d10", "score": "0.8206918", "text": "def substrings_at_start(string)\n substrings = []\n 1.upto(string.size) do |num|\n substrings << string[0, num]\n end\n substrings\nend", "title": "" }, { "docid": "854020cc596e13687f5cb45aec402818", "score": "0.8204272", "text": "def substrings_at_start(str)\n counter = 1\n array = str.chars\n return_array = []\n\n loop do\n break if counter > array.size\n return_array << array.take(counter).join\n counter += 1\n end\n return_array\nend", "title": "" }, { "docid": "854020cc596e13687f5cb45aec402818", "score": "0.8204272", "text": "def substrings_at_start(str)\n counter = 1\n array = str.chars\n return_array = []\n\n loop do\n break if counter > array.size\n return_array << array.take(counter).join\n counter += 1\n end\n return_array\nend", "title": "" }, { "docid": "9e05c238e2e78e8bd89816be9b662547", "score": "0.8192193", "text": "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "title": "" }, { "docid": "e94ae094f6dd42228af48a8fc2af1bc9", "score": "0.8188244", "text": "def substrings_at_start(string)\n result_array = []\n 1.upto(string.size) do |count|\n result_array << string.slice(0, count)\n end\n result_array\nend", "title": "" }, { "docid": "53198d22c85f07cdf3bcca1fbd86e1f5", "score": "0.81871575", "text": "def substrings_at_start(string)\n result = []\n counter = 1\n \n while counter < (string.length + 1)\n result << string.slice(0,counter)\n counter += 1\n end\n result\nend", "title": "" }, { "docid": "53198d22c85f07cdf3bcca1fbd86e1f5", "score": "0.81871575", "text": "def substrings_at_start(string)\n result = []\n counter = 1\n \n while counter < (string.length + 1)\n result << string.slice(0,counter)\n counter += 1\n end\n result\nend", "title": "" }, { "docid": "53198d22c85f07cdf3bcca1fbd86e1f5", "score": "0.81871575", "text": "def substrings_at_start(string)\n result = []\n counter = 1\n \n while counter < (string.length + 1)\n result << string.slice(0,counter)\n counter += 1\n end\n result\nend", "title": "" } ]
044f70709219efbfd0251f91b990f5aa
PATCH/PUT /quizzes/1 PATCH/PUT /quizzes/1.json
[ { "docid": "77ba31427286b6f42c143439984b3804", "score": "0.6332713", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "d9b91c48c9b090e424e3cb9e2c5ec912", "score": "0.6749494", "text": "def update\n respond_to do |format|\n if @quizzes_question.update(quizzes_question_params)\n if params[:commit] =~ /add/i\n format.html { redirect_to edit_quiz_question_path(@question.quiz, @question) }\n else\n format.html { redirect_to quiz_questions_path(@question.quiz), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @quizzes_question }\n end\n else\n format.html { render :edit }\n format.json { render json: @quizzes_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d9d5eda045bdcaba4e153c645edca8a", "score": "0.6695233", "text": "def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "7712b1b54d6e570f1fbe8eb1f6ce56f1", "score": "0.65578073", "text": "def update\n @quiz = Quiz.find(params[:id])\n \n respond_to do |format|\n if @quiz.update_attributes(params[:quiz])\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "841776772d8528a364e5a37355687c67", "score": "0.65207505", "text": "def set_quizz\n @quizz = Quizz.find(params[:id])\n end", "title": "" }, { "docid": "5a3e008c1f5edc24b9a809c4f9d47bef", "score": "0.65057135", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to quizzes_path, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a3e008c1f5edc24b9a809c4f9d47bef", "score": "0.65057135", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to quizzes_path, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b357f8653377d79da76e1f297ab04b6b", "score": "0.64918226", "text": "def update\n respond_to do |format|\n if @quizzes_answer.update(quizzes_answer_params)\n format.html { redirect_to quiz_assessments_path(@quizzes_answer.assessment.quiz) }\n format.json { render :show, status: :ok, location: @quizzes_answer }\n else\n format.html { render :edit }\n format.json { render json: @quizzes_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6119d5f658ad3d47fb4fbe1c9998785d", "score": "0.64502496", "text": "def set_quizz\n @quizz = Quizz.find(params[:id])\n end", "title": "" }, { "docid": "b9fb46368bb32919281bf3ab60776755", "score": "0.64186954", "text": "def update\n respond_to do |format|\n if @fizzbuzz.update(fizzbuzz_params)\n format.html { redirect_to @fizzbuzz, notice: 'Fizzbuzz was successfully updated.' }\n format.json { render :show, status: :ok, location: @fizzbuzz }\n else\n format.html { render :edit }\n format.json { render json: @fizzbuzz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36d6974188417f2bda3e9fb31803ffab", "score": "0.6257243", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36d6974188417f2bda3e9fb31803ffab", "score": "0.6257243", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36d6974188417f2bda3e9fb31803ffab", "score": "0.6257243", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7bbf8b4f2871950ac33128586c553f7", "score": "0.62245405", "text": "def update\n respond_to do |format|\n if @quack.update(quack_params)\n format.html { redirect_to @quack, notice: 'Quack was successfully updated.' }\n format.json { render :show, status: :ok, location: @quack }\n else\n format.html { render :edit }\n format.json { render json: @quack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3dc69b027ad3c5de87c9bc3069fd7950", "score": "0.6211282", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to current_user, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00caa976d11c58bc8cbd0280f0cf244b", "score": "0.61953795", "text": "def update\n @quiz = Quiz.find(params[:id])\n\n if @quiz.update(published: params[:quiz_status])\n head :no_content\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5b308e3941bc47b6e42d200d175669a1", "score": "0.6183931", "text": "def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end", "title": "" }, { "docid": "6d37378ce5ecf2472bb955258a1f4119", "score": "0.6160681", "text": "def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "title": "" }, { "docid": "6f95f40d248ce0f1fff60dab15ed0dca", "score": "0.61025155", "text": "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end", "title": "" }, { "docid": "3b1af6b89a0e0f1659059190f1c5b6ae", "score": "0.60931325", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a95fc8d9cbd8a040fc9280b75596b75", "score": "0.6032725", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77b85db09878da4a819580ee404c6419", "score": "0.60067165", "text": "def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "717fcef10aea342e6f13cc1d3a60a8f8", "score": "0.5998254", "text": "def update\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n if @quartet.update_attributes(params[:quartet])\n format.html { redirect_to @quartet, notice: 'Quartet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quartet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fdaf46ea4ec4df6362adc952aed6f6a", "score": "0.5994978", "text": "def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5154984cbb051383f7a6686a97d4aa2b", "score": "0.59836084", "text": "def update\n respond_to do |format|\n if @questions_quiz.update(questions_quiz_params)\n format.html { redirect_to @questions_quiz, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @questions_quiz.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84f990713e90f2f8cc2a2006ab9bdf4b", "score": "0.5976678", "text": "def update\n respond_to do |format|\n if @survey_quiz.update(survey_quiz_params)\n format.html { redirect_to @survey_quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_quiz }\n else\n format.html { render :edit }\n format.json { render json: @survey_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fecd2c820d58345b1a359707c25dcac", "score": "0.59749407", "text": "def update\n @q = Q.find_by_unique_id(params[:id])\n\n respond_to do |format|\n if @q.update_attributes(params[:q])\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff27b464b79d3829afa2fd746685ea2d", "score": "0.59691644", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "910550a1b2835d80d619a94374f4389c", "score": "0.596211", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit, @current_usuario => current_usuario }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "496c2796ef049221622ff21443bd82d3", "score": "0.5959343", "text": "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c141900d966697e2194e82f8ab34d9de", "score": "0.59384143", "text": "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html {\n redirect_to discipline_topic_quiz_path(@discipline, @topic, @quiz), notice: 'Quiz was successfully updated.'\n }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15605b3ebabcc6a2e2225c95c57fae6a", "score": "0.59357846", "text": "def update\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_quiz.update_attributes(params[:recommend_recommend_quiz])\n format.html { redirect_to @recommend_recommend_quiz, notice: 'Recommend quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "def059fffda213c6f53708b2092bd0d4", "score": "0.59306705", "text": "def single_quiz_update\r\n #allow receiving all parameters\r\n params.permit!\r\n #response format pre-defined\r\n result = {\"str_id\" => nil, :status => \"\", :message => \"\" }\r\n begin\r\n current_quiz = Mongodb::BankQuizQiz.find_by(id: params[:str_id])\r\n current_quiz.save_quiz(params)\r\n result[:str_id]=current_quiz._id\r\n flash[:notice] = I18n.t(\"quizs.messages.update.success\" , :id => current_quiz._id)\r\n result[:status] = 200\r\n result[:message] = I18n.t(\"quizs.messages.update.success\", :id => current_quiz._id)\r\n rescue Exception => ex\r\n result[:status] = 500\r\n result[:message] = I18n.t(\"quizs.messages.update.fail\", :id => current_quiz._id)\r\n ensure\r\n render json: result.to_json\r\n end\r\n end", "title": "" }, { "docid": "8c0bc7be457ac0959966804a13deac2f", "score": "0.59286475", "text": "def update\n @faq.update(faqs_params)\n json_response(@faq)\n end", "title": "" }, { "docid": "e6fa9f8e2663a080d36f763dabda4998", "score": "0.590627", "text": "def update\n respond_to do |format|\n if @quatum.update(quatum_params)\n format.html { redirect_to @quatum, notice: 'Quatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quatum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36ded39610442f7ec9ac295b64d3fc3e", "score": "0.5903368", "text": "def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36ded39610442f7ec9ac295b64d3fc3e", "score": "0.5903368", "text": "def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c106fda5e2d13dde37983dcb7cf8f8a4", "score": "0.58901095", "text": "def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end", "title": "" }, { "docid": "753506a4bcc8af9e4cfcc404ea0ed659", "score": "0.58876836", "text": "def update\n @question = @quiz.questions.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(quiz_questions_path(@quiz)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4d027a943110d9976e87ecd20aad026", "score": "0.5871103", "text": "def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8e2d068dab2790062343b8a26c8a447", "score": "0.58638513", "text": "def update\n respond_to do |format|\n if @quandary.update(quandary_params)\n format.html { redirect_to @quandary, notice: 'Quandary was successfully updated.' }\n format.json { render :show, status: :ok, location: @quandary }\n else\n format.html { render :edit }\n format.json { render json: @quandary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "277328711721901aeacc0a26a06326c4", "score": "0.5861827", "text": "def update\n respond_to do |format|\n if @quiz_answer.update(quiz_answer_params)\n format.html { redirect_to @quiz_answer, notice: 'Quiz answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiz_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2e55661f6c415d15db1cc734f6e0738", "score": "0.5859592", "text": "def update\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n if @quiniela.update_attributes(params[:quiniela])\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e8503786e60b18cc73a66b78e6e81dd", "score": "0.58587533", "text": "def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end", "title": "" }, { "docid": "57b2fcf3f9169db2065e426ff7408643", "score": "0.5856577", "text": "def set_quizzes_answer\n @quizzes_answer = Quizzes::Answer.find(params[:id])\n end", "title": "" }, { "docid": "062b908182eced92ce300e8d7ba50c9e", "score": "0.5851977", "text": "def update\n @question = Question.find(params[:id])\n @quiz = Quiz.find(params[:id])\n if @quiz.update(quiz_params)\n flash[:success] = \"Quiz updated\"\n redirect_to @quiz\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "576f27e4c99d0868b0454fedc7deba0c", "score": "0.58390474", "text": "def update # PATCH\n raise NotImplementedError\n end", "title": "" }, { "docid": "a95824e8b6e30029af9b0f218cac9bc1", "score": "0.5835384", "text": "def update\n @quize = Quize.find(params[:id])\n\n respond_to do |format|\n if @quize.update_attributes(params[:quize])\n format.html { redirect_to @quize, notice: 'Quize was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "381699bcd90cc84f10fea5e82b08efc3", "score": "0.5820695", "text": "def update\n respond_to do |format|\n if @quartet.update(quartet_params)\n format.html { redirect_to @quartet, notice: 'Quartet was successfully updated.' }\n format.json { render :show, status: :ok, location: @quartet }\n else\n format.html { render :edit }\n format.json { render json: @quartet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7d21e047bf8a8754a51b13ba9355488", "score": "0.5818011", "text": "def update\n @quartier = Quartier.find(params[:id])\n\n respond_to do |format|\n if @quartier.update_attributes(params[:quartier])\n format.html { redirect_to @quartier, notice: 'Quartier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quartier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ca96d71b0cdb38d3f527d32598f6791", "score": "0.58122724", "text": "def update\n respond_to do |format|\n if @quize.update(quize_params)\n format.html { redirect_to @quize, notice: 'Quize was successfully updated.' }\n format.json { render :show, status: :ok, location: @quize }\n else\n format.html { render :edit }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "764e7c5e0b458d3db8bcda5d479e1efa", "score": "0.5804821", "text": "def update\n respond_to do |format|\n if @add_quizid_to_quesiton.update(add_quizid_to_quesiton_params)\n format.html { redirect_to @add_quizid_to_quesiton, notice: 'Add quizid to quesiton was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_quizid_to_quesiton }\n else\n format.html { render :edit }\n format.json { render json: @add_quizid_to_quesiton.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c42455391fc8db497fcaa119cf531a3", "score": "0.57981396", "text": "def update\n respond_to do |format|\n if @qux.update(qux_params)\n format.html { redirect_to @qux, notice: 'Qux was successfully updated.' }\n format.json { render :show, status: :ok, location: @qux }\n else\n format.html { render :edit }\n format.json { render json: @qux.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b445ae8f8b604b99227b50d807e80fc8", "score": "0.57960033", "text": "def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "12e92c65d0662f5651bc8ada4d5f3270", "score": "0.57929796", "text": "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "title": "" }, { "docid": "8dde6b1da22ba07ed45aba837b00f119", "score": "0.5789279", "text": "def update\n respond_to do |format|\n if @q.update(q_params)\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23c3f18e1a025d5b5870f11340955179", "score": "0.57778686", "text": "def update\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n if @qa.update_attributes(params[:qa])\n format.html { redirect_to @qa, notice: 'Qa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67061ca54d98fa013bd76f2c6c6f096c", "score": "0.57698905", "text": "def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97887b6ee508cd8e6a8cb82047e7ca42", "score": "0.57632846", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9dbedd61443003015323dd8b9a425981", "score": "0.57395756", "text": "def quizz_params\n params.require(:quizz).permit(:title, :description, :difficulty)\n end", "title": "" }, { "docid": "b655c3e98e1f831340b84e44c39fe8f6", "score": "0.57332623", "text": "def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cd4656b161fa58aa9f59abf31d8fd20", "score": "0.5731668", "text": "def update\n @quiz = Quiz.find(params[:id])\n\n if @quiz.update_attributes(params[:quiz])\n redirect_to @quiz, notice: 'Quiz was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "title": "" }, { "docid": "c85825dbde05d1aefaf83c671cb1bd6f", "score": "0.5729751", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c85825dbde05d1aefaf83c671cb1bd6f", "score": "0.5729751", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c85825dbde05d1aefaf83c671cb1bd6f", "score": "0.5729751", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c85825dbde05d1aefaf83c671cb1bd6f", "score": "0.5729751", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c85825dbde05d1aefaf83c671cb1bd6f", "score": "0.5729751", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fafab269da114b7afa0c8b34c421c389", "score": "0.5729692", "text": "def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18ade210f20e64bc8cb1ab5a477e966f", "score": "0.5723433", "text": "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4df8bc84a9d46c93b8c1774c99e21fcb", "score": "0.5717652", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4df8bc84a9d46c93b8c1774c99e21fcb", "score": "0.5717652", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4df8bc84a9d46c93b8c1774c99e21fcb", "score": "0.5717652", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54f95a361000b6219275e377b8bf4555", "score": "0.5716951", "text": "def update options={}\n client.put(\"/#{id}\", options)\n end", "title": "" }, { "docid": "903ea6414b0289e62090727cc8aa3fdf", "score": "0.5713786", "text": "def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"polls__question__ is required\" if polls__question__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id,\n :polls__question__ => polls__question__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "title": "" }, { "docid": "c15733f41d6b36aa8f87db7bfe3c5efd", "score": "0.57121074", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4798b54f55d5679b9ec891a80e224c2d", "score": "0.5711431", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43b55fe20efcdec3c2c9ded86ac0515f", "score": "0.5703461", "text": "def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "ef439ec973a89ac171b2b635b8715a60", "score": "0.5701371", "text": "def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cca714dabb3f471a53e174c24f14c01", "score": "0.5693855", "text": "def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend", "title": "" }, { "docid": "409f7672727bd65849a44bab39b9201f", "score": "0.56912255", "text": "def update\n @quay = Quay.find(params[:id])\n\n respond_to do |format|\n if @quay.update_attributes(params[:quay])\n flash[:notice] = 'Quay was successfully updated.'\n format.html { redirect_to(@quay) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quay.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "141a2ad732f885a00510e7a2cf0c25a1", "score": "0.56893986", "text": "def update\n @quarter = Quarter.find(params[:id])\n\n respond_to do |format|\n if @quarter.update_attributes(params[:quarter])\n format.html { redirect_to @quarter, notice: 'Quarter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quarter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c366e8dc2a2a7e52a1129efdc61fdae", "score": "0.5674975", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "386f0c78b1f6d617f570e8e5aa5cbd15", "score": "0.56747556", "text": "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to new_question_path(practice_id: @practice.id), notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50a57588cea0cca86808ee07456b9119", "score": "0.56657547", "text": "def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "855f81d29ee8ff100cfefb3479cedcdd", "score": "0.5660882", "text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "title": "" }, { "docid": "1e33f86ac557356895aad3268f2bf137", "score": "0.5648021", "text": "def update\n respond_to do |format|\n if @questionfife.update(questionfife_params)\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionfife }\n else\n format.html { render :edit }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f83e347f68fdc220f1c623a35dcc928e", "score": "0.5642291", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26c4fa94ebfe31103169e2bdbfe61ae1", "score": "0.5642217", "text": "def update\n respond_to do |format|\n if @quiz_default.update(quiz_default_params)\n format.html { redirect_to @quiz_default, notice: 'Quiz default was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz_default }\n else\n format.html { render :edit }\n format.json { render json: @quiz_default.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bff06569785a9a72d32b5ec486cbb43", "score": "0.5637173", "text": "def update\n @quiz_center_quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n if @quiz_center_quiz.update_attributes(params[:quiz])\n format.html { redirect_to [:quiz_center,@quiz_center_quiz], notice: 'Quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiz_center_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c63210f33ac8742d04ebcc6f69438a6", "score": "0.5630043", "text": "def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db75479c5e9fdc40d1d25336a7bb861f", "score": "0.5628792", "text": "def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.56276166", "text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "title": "" }, { "docid": "0e5c418da61915129af2835afe73f888", "score": "0.56254095", "text": "def update\n respond_to do |format|\n if @slot.update(slot_params)\n format.html { redirect_to practice_path(@practice), notice: 'Slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @slot }\n else\n format.html { render :edit }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0da717edfd6045dbb0e58d02395761c2", "score": "0.56195927", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df6f528d1b882d5f23686970c3fc7d39", "score": "0.561117", "text": "def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65e334cc76fd1d76dcc80b97c5664300", "score": "0.56045043", "text": "def update\n if current_user.admin?\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_url, notice: \"Sorry, you need to sign in first.\"\n end\n end", "title": "" }, { "docid": "4238d6d8820be0065be9e7eb86734e07", "score": "0.56023896", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4238d6d8820be0065be9e7eb86734e07", "score": "0.56023896", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4238d6d8820be0065be9e7eb86734e07", "score": "0.56023896", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4238d6d8820be0065be9e7eb86734e07", "score": "0.56023896", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4238d6d8820be0065be9e7eb86734e07", "score": "0.56023896", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
0ca2c7b42f15ee516b09574009689dd4
Creates a new, unique uuid for a user
[ { "docid": "44a3102e743a4d408895f976d17186b2", "score": "0.0", "text": "def create_unique_uuid(conn)\n loop do\n uuid = SecureRandom.uuid\n break uuid unless uuid_exists?(conn, uuid)\n end\n end", "title": "" } ]
[ { "docid": "6be9ed1a3d9dacfee30708ae7e6ec082", "score": "0.73285884", "text": "def create_uuid\n self.uuid = SecureRandom.hex(12)\n end", "title": "" }, { "docid": "b1a20a6c6a2aa9bc879a0780f80e93ba", "score": "0.7156173", "text": "def create\n @user = User.where(uuid: user_params[:uuid]).first_or_initialize\n @user.update user_params\n\n if @user.save\n render action: 'show', status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5c0af1e01af21f20b9f05ec95a186b6f", "score": "0.7014261", "text": "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "title": "" }, { "docid": "06508e85e78716a52c42b5f9ef2aa823", "score": "0.7002246", "text": "def create_uuid\n SecureRandom.uuid\n end", "title": "" }, { "docid": "ad52b360cbe7e07264531625dc2554b1", "score": "0.68508565", "text": "def create_uuid\n if self.uuid.nil?\n valid_uid = false\n until valid_uid\n self.uuid = format_uuid(SecureRandom.hex(5))\n valid_uid = Voucher.find_by_uuid(self.uuid).nil?\n self.slug = self.uuid\n end\n end\n end", "title": "" }, { "docid": "71d2628b73eaf1eee0878fe2814888b5", "score": "0.68240094", "text": "def create_password\n self.uuid = TempPassword.get_uuid\n self.hashed_uuid = Digest::SHA1.hexdigest(uuid)\n end", "title": "" }, { "docid": "c9d03b46a26fde8ba50950f7a152a98c", "score": "0.6799044", "text": "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "title": "" }, { "docid": "1763644e3d7c4f9dafe90e4b46bbc313", "score": "0.67861944", "text": "def create(user)\n # If the caller has already set an id, trust it.\n user.assign_id!(new_uuid) unless user.id\n user.update_timestamps!\n user.last_updated_by!(requester_authz_id)\n\n validate_before_create!(user)\n\n # If you say you know the authz id, then we trust that it already exists\n user.create_authz_object_as(requester_authz_id) unless user.authz_id\n user_side_create(user)\n user.persisted!\n user\n rescue Sequel::DatabaseError => e\n log_exception(\"User creation failed\", e)\n self.class.query_failed!(e.message)\n end", "title": "" }, { "docid": "710d6c6e047537342e45cfdf9519e16e", "score": "0.6714289", "text": "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "title": "" }, { "docid": "be23804b3fb12825b6841640c2fe9ad3", "score": "0.66982836", "text": "def create\n fix_password_params(params)\n @user = User.new(params[:user])\n @user.uuid = \"urn:uuid:#{SecureRandom.uuid}\"\n set_roles(@user, params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, 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", "title": "" }, { "docid": "587ff93117f127905877bd42b7c2d2c9", "score": "0.66975754", "text": "def create_user(attributes = {})\n elektron_identity.post(\"users\") { { user: attributes } }.body[\"user\"]\n end", "title": "" }, { "docid": "16bbb9a951bc090cb9561dc9e0dc006c", "score": "0.66735864", "text": "def create(user_id:, email: nil, phone: nil, password: nil, name: nil)\n path = '/users'\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n userId: user_id,\n email: email,\n phone: phone,\n password: password,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "title": "" }, { "docid": "2665e2dc10b4925054fcdb391ba1ba7e", "score": "0.6647762", "text": "def create_sha_user(user_id:, email:, password:, password_version: nil, name: nil)\n path = '/users/sha'\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if email.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"email\"')\n end\n\n if password.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"password\"')\n end\n\n params = {\n userId: user_id,\n email: email,\n password: password,\n passwordVersion: password_version,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "title": "" }, { "docid": "928f2759ebbd272628eb25ce71301b9a", "score": "0.66412586", "text": "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "title": "" }, { "docid": "808135375b38d1dca67591c4e04fe4ee", "score": "0.66055536", "text": "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "title": "" }, { "docid": "808135375b38d1dca67591c4e04fe4ee", "score": "0.6605461", "text": "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "title": "" }, { "docid": "72992c18119c011fec4a47d0904c6d0d", "score": "0.6584429", "text": "def add_uuid\n self.uuid ||= UUIDTools::UUID.timestamp_create().to_s\n end", "title": "" }, { "docid": "852aeb4f0d81fdee75741586d7847df7", "score": "0.6583117", "text": "def create\n if current_user.admin?\n\n @uuid = Uuid.new(uuid_params)\n\n respond_to do |format|\n if @uuid.save\n format.html { redirect_to @uuid, notice: 'Uuid was successfully created.' }\n format.json { render :show, status: :created, location: @uuid }\n else\n format.html { render :new }\n format.json { render json: @uuid.errors, status: :unprocessable_entity }\n end\n end\n else \n render_404\n end\n\n end", "title": "" }, { "docid": "dc92577147e090ba15a8db292eef2134", "score": "0.65827084", "text": "def create_guest_user\n uuid = rand(36**64).to_s(36)\n temp_email = \"guest_#{uuid}@guest_user.com\"\n u = User.create(name: \"GUEST\", username: \"Guest #{User.guests.size}\", email: temp_email, lazy_id: uuid)\n cookies[:uuid] = { value: uuid, path: '/', expires: 5.years.from_now }\n u.save(validate: false)\n u\n end", "title": "" }, { "docid": "c1066e995e0ea9970ffbd9fa54014041", "score": "0.6566277", "text": "def generate_uuid\n if [nil, \"\"].include?(uuid)\n self.uuid = Vidibus::Uuid.generate\n end\n end", "title": "" }, { "docid": "b6aeb17c9f32dd8dd9a26bd3750d1f4c", "score": "0.6557716", "text": "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "title": "" }, { "docid": "177e164c5684580ef9bc51553b67f146", "score": "0.6550275", "text": "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "title": "" }, { "docid": "f6e0b1042b010dcceb914c6da708bcfd", "score": "0.6542529", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end", "title": "" }, { "docid": "b823c88c5b42ed8ffdb5131ab82db7d1", "score": "0.6540325", "text": "def create_authy_id\n authy = Authy::API.register_user(\n email: current_user.email,\n cellphone: current_user.phone_number,\n country_code: current_user.country_code\n )\n\n current_user.update(\n authy_id: authy.id\n )\n end", "title": "" }, { "docid": "08271349d810217416ac0277753726d9", "score": "0.65395766", "text": "def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end", "title": "" }, { "docid": "db319351f7f5396a479054bd93edaae8", "score": "0.65376985", "text": "def create_argon2_user(user_id:, email:, password:, name: nil)\n path = '/users/argon2'\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if email.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"email\"')\n end\n\n if password.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"password\"')\n end\n\n params = {\n userId: user_id,\n email: email,\n password: password,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "title": "" }, { "docid": "409432483c13a76ef217eb813de66415", "score": "0.6520677", "text": "def create_guest_user\n u = User.create(email: \"guest_#{Time.now.to_i}#{rand(99)}@example.com\")\n #u.skip_confirmation!\n u.save!(validate: false)\n u\n end", "title": "" }, { "docid": "909b3b079b21535bc9a68e920959a9d2", "score": "0.65191686", "text": "def register_user(attributes)\n user = User.new(attributes)\n user.save\n user\n end", "title": "" }, { "docid": "9001a1e7cf8986de1cac261f343d1d34", "score": "0.6511913", "text": "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "title": "" }, { "docid": "53d0afd5e0dc03415f1457ddfd08ea81", "score": "0.65094477", "text": "def add_user(name, is_admin, building_id, notify_new_request= false, notify_new_listing=false)\n user_id = User.create(\n first_name: name,\n last_name: 'LNU',\n email: 'jack+' + name + '@jackmgill.com',\n password: 'foo',\n is_admin: is_admin,\n building_id: building_id,\n notify_new_request: notify_new_request,\n notify_new_listing: notify_new_listing\n ).id\n return user_id\nend", "title": "" }, { "docid": "625fbea1cfe46f333fae7dcf7c551e0f", "score": "0.65082866", "text": "def generate_user_id\n # ap(generate_user_id: {})\n @user_data.insert({}).to_s\n end", "title": "" }, { "docid": "22b4d85b13fab71cdccc222b125ec721", "score": "0.6502507", "text": "def raw\n command = \"create_uuid\"\n end", "title": "" }, { "docid": "39f6b65322779db295b5292d6996fc49", "score": "0.6498355", "text": "def create_guest_user\n u = User.create(name: 'guest', email: \"guest_#{Time.current.to_i}#{rand(99)}@example.com\")\n # u.skip_confirmation!\n u.save!(validate: false)\n u\n end", "title": "" }, { "docid": "b865b892e9508db19eb03813fda11ed9", "score": "0.64958113", "text": "def create_user(email, pass, login = nil, id = nil, cui = nil)\n send_req({\n act: :user_create,\n cloudflare_email: email,\n cloudflare_pass: pass,\n cloudflare_username: login,\n unique_id: id,\n clobber_unique_id: cui\n })\n end", "title": "" }, { "docid": "3abf846a8ed6e1c37e0d426a1746934e", "score": "0.6493528", "text": "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "title": "" }, { "docid": "3abf846a8ed6e1c37e0d426a1746934e", "score": "0.6493528", "text": "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "title": "" }, { "docid": "74fcebaa9c2dcb758fa9ad5fd6aa2434", "score": "0.6491879", "text": "def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end", "title": "" }, { "docid": "4484aa913ed25cb50887173ef7b8b9f2", "score": "0.6480659", "text": "def create_guest_user!\n # bah, this may not be entirely guaranteed to be unique\n # but it would be hard for it to collide, good enough. Actually\n # if the rails session id isn't unique, it's gonna cause problems\n # for more than just us, we should be good with just that even.\n unique_token = \"#{request.session_options[:id]}_#{(Time.now.to_f * 1000.0).to_i}_#{Process.pid}\"\n\n new_user = User.new.tap do |u|\n u.login = \"GUEST_USER_#{unique_token}\"\n u.guest = true\n u.save!\n end\n end", "title": "" }, { "docid": "68a316bea6dc51677ee0e0b9b11c3e92", "score": "0.64700603", "text": "def create_uuid_for_id\n if self.id.nil?\n self.id = SecureRandom.uuid\n #self.id = SecureRandom.uuid.gsub('-','').upcase\n end\n end", "title": "" }, { "docid": "0927acfce3cd5d3993b72242a24ff836", "score": "0.64608985", "text": "def create\n require 'digest/md5'\n @user.device_id= Digest::MD5.hexdigest(User.random_string(10)).upcase\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(@user), :notice => @controller_name +t(:message_success_insert)}\n format.json { render :json => @user, :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", "title": "" }, { "docid": "2cc1ecbd7422ac2bbd77cab2b9268a48", "score": "0.6453525", "text": "def identity_create\n # Potential threat of overlap\n identity = Identity.create(uid:rand(100000000..9999999999), provider: 'registration')\n identity.user_id = resource.id\n identity.name = params['user']['name'] #Looks very ugly\n identity.email = resource.email\n identity.save\n end", "title": "" }, { "docid": "860eefe073dc63850cf3080407883e47", "score": "0.644459", "text": "def create_user(username, uuid, superuser)\n uid = LoginUserManager.uuid_to_uid(uuid)\n\n if uid_exists?(uid, ['rightscale'])\n username = uid_to_username(uid)\n elsif !uid_exists?(uid)\n username = pick_username(username)\n add_user(username, uid)\n manage_group('rightscale', :add, username) if group_exists?('rightscale')\n else\n raise SystemConflict, \"A user with UID #{uid} already exists and is \" +\n \"not managed by RightScale\"\n end\n\n action = superuser ? :add : :remove\n manage_group('rightscale_sudo', action, username) if group_exists?('rightscale_sudo')\n\n username\n end", "title": "" }, { "docid": "1cd0e6af37e272cd70a31bf2acb41b00", "score": "0.64357275", "text": "def create_user(description= {})\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/user\", nil, description, true)\n end", "title": "" }, { "docid": "b66dcd633e7f55f4596a630752a7da9d", "score": "0.64305586", "text": "def populate_uuid\n self.uuid = SecureRandom.uuid()\n end", "title": "" }, { "docid": "51e55bef367031e89473e6df8a3e1ec5", "score": "0.6425371", "text": "def create_user(attributes)\n user = User.new(id: attributes.delete(:id))\n\n mapper.update(user, attributes)\n end", "title": "" }, { "docid": "89a520c3a97cabaca7e2fb6fb9d692db", "score": "0.64132994", "text": "def create_new_user(session_id, user_name, user_password, version)\n $tracer.trace(\"GameStopAccountServiceDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n if user_name == 'register'\n this = [('a'..'z'), ('A'..'Z'), (1..10)].map { |i| i.to_a }.flatten\n idnew = (0...10).map { this[rand(this.length)] }.join\n\n user_name = \"svc_autogen#{idnew}@qagsecomprod.oib.com\"\n $tracer.report(\"#{__method__} : #{user_name}\")\n end\n\n user_password = \"T3sting!\" if user_password.nil?\n\n user_password = $global_functions.password_generator(10) if user_password == \"generate\"\n\n register_req = self.get_request_from_template_using_global_defaults(:register_account, AccountServiceRequestTemplates.const_get(\"REGISTER_ACCOUNT#{version}\"))\n\n register_data = register_req.find_tag(\"register_account_request\").at(0)\n register_data.username.content = user_name\n $tracer.trace(user_name)\n $tracer.report(\"#{__method__} : #{user_name}\")\n register_data.password.content = user_password\n $tracer.trace(user_password)\n register_data.session_id.content = session_id\n register_data.user_id.content = generate_guid\n\n register_rsp = self.register_account(register_req.xml)\n register_rsp.code.should == 200\n\n register_result = register_rsp.http_body.find_tag(\"register_account_result\").at(0)\n register_result.register_account_status.content.should == \"Successful\"\n userid_rsp = register_result.user_id.content\n\n\n $tracer.trace(register_rsp.http_body.get_received_message)\n $tracer.trace(register_rsp.http_body.formatted_xml)\n\n return user_name, user_password\n end", "title": "" }, { "docid": "6c59e0279d578a349de0c313121fc145", "score": "0.6406379", "text": "def new_unique_user\n puts '>>> params:'\n puts params.inspect\n user = User.find_or_initialize_by_email(params[:user][:email])\n puts '>>> created?'\n puts user.new_record?\n\n if user.new_record?\n created = true\n \n #use_password default to false\n user.use_password = false\n \n if user.save\n success = true\n else\n success = false\n end\n else\n created = false\n success = true\n end\n \n response = { :success => success, :created => created }\n \n puts '>>> User:'\n puts user.inspect\n puts '>>> response'\n puts response.inspect\n \n render json: response\n end", "title": "" }, { "docid": "79c79e08399c9c31ddc1df35c234678f", "score": "0.63830733", "text": "def create_user(username, options = {})\n payload = {\n \"username\" => username,\n \"email\" => \"#{username}@opscode.com\",\n \"first_name\" => username,\n \"last_name\" => username,\n \"display_name\" => username,\n \"password\" => \"foobar\"\n }\n\n users_url = \"#{@server}/users\"\n\n r = post(users_url, @superuser, :payload => payload)\n if r.code == 409\n puts \"The user #{username} already exists... regenerating a key for it now\"\n payload[\"private_key\"] = true\n r = put(\"#{users_url}/#{username}\", @superuser, :payload => payload)\n end\n\n private_key = parse(r)[\"private_key\"]\n\n # The \"admin\" and \"associate\" options here are more of a metadata\n # than actually creating an admin or associating. This allows\n # Pedant tests to succeed even if the users config table has changed.\n Pedant::User.new(username, private_key, platform: self, preexisting: false, admin: options[:admin], associate: options[:associate])\n end", "title": "" }, { "docid": "67a066c73730a986193d2ff38108f3d3", "score": "0.6378821", "text": "def create\n if user_params[:password_confirmation]\n user = User.create!(user_params)\n\n session[:user_id] = user.id\n session[:expiration_time] = Time.now + 6*60*60 # 6 hours until expiration\n \n response = { message: Message.account_created }\n json_response(response, :created)\n else\n response = { message: Message.password_confirmation_missing}\n json_response(response, :not_acceptable)\n end\n end", "title": "" }, { "docid": "202a2ec5884e8441a48a2d281bac8172", "score": "0.637814", "text": "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "title": "" }, { "docid": "501afdaed83731e0843777bc654d28b3", "score": "0.63766456", "text": "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "title": "" }, { "docid": "282f5de721718ccb91b7815916b2da5c", "score": "0.63662374", "text": "def create\n user = User.new(user_params)\n if user.save\n payload = { user_id: user.id }\n\n hmac_secret = 'my$ecretK3ys'\n\n auth_token = JWT.encode(payload, hmac_secret)\n\n render json: { message: 'Account created successfully', auth_token: auth_token }\n else\n render json: { message: 'Something went wrong', errors: user.errors }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4de75418a2da214f7fce0acfc6968da8", "score": "0.63659936", "text": "def create_guid\n self.guid = SecureRandom.uuid\n end", "title": "" }, { "docid": "8b420d5aceeebba5cd1d235b61f74752", "score": "0.6364131", "text": "def create_guest_user\n email = \"guest_#{Time.now.to_i}#{rand(99)}@example.com\"\n u = User.create(:email => email)\n u.save!(:validate => false)\n session[:guest_user_id] = u.id\n u\n end", "title": "" }, { "docid": "72013a14d5f9856be3630244abfbc46d", "score": "0.6362576", "text": "def create\n user = User.create(user_params)\n if user.valid?\n token = generate_token(user)\n render json: { success: true, token: token }.to_json, status: 200\n else\n render json: { success: false, message: \"Username Taken\" }\n end\n end", "title": "" }, { "docid": "dae49f8e7c3c6217474cb26f8cf2ee06", "score": "0.63623536", "text": "def create_guest_user\n u = User.new(:name => \"guest\", :email => \"guest_#{Time.now.to_i}#{rand(100)}@example.com\", :guest => true)\n u.save!(:validate => false)\n session[:guest_user_id] = u.id\n u\n end", "title": "" }, { "docid": "3ee4a97335dc8198aa96a057bf6be69f", "score": "0.6360076", "text": "def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end", "title": "" }, { "docid": "3863c9164261d5695df93f09f4b3372e", "score": "0.63419265", "text": "def create_user(name, email, password)\n\n # Password is hashed automatically\n user = User.new(name: name, email: email, password: password)\n user.save!\n end", "title": "" }, { "docid": "66f3869cb989d23e4c1541f8ec6d5dc6", "score": "0.6339447", "text": "def create_user_account\n Account.cache_or_create_by! @current_user\n rescue => e\n log_error(e, account: 'cannot_create_unique_account_record')\n end", "title": "" }, { "docid": "ca0338ec5540d6218048150b384b6be0", "score": "0.6338946", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "cc577a3da4056f022699372dd91e39b2", "score": "0.63376576", "text": "def create\n user = User.find_by(email: user_params['email'])\n if !user\n dataToRegister = {\n username: user_params['username'],\n balance: user_params['balance'],\n password: Base64.decode64(user_params['password']),\n password_confirmation: Base64.decode64(user_params['password_confirmation']),\n email: user_params['email'],\n }\n user = User.create!(dataToRegister)\n auth_token = AuthenticateUser.new(user.email, Base64.encode64(user.password)).call\n response = {\n data: {\n message: Message.account_created,\n token: auth_token,\n user: {\n username: user.username,\n email: user.email\n }\n }\n }\n json_response(response, :created)\n\n else\n raise(ExceptionHandler::AuthenticationError, Message.email_Already_used)\n end\n end", "title": "" }, { "docid": "b6516385cfee22bbaa14698337cefa1a", "score": "0.6328221", "text": "def set_uuid\n self.id = SecureRandom.uuid\n end", "title": "" }, { "docid": "70c96b45c3220e7cbaff277048854197", "score": "0.6327801", "text": "def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end", "title": "" }, { "docid": "888f5b33308d3164e21eedc749f789e2", "score": "0.63267505", "text": "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "title": "" }, { "docid": "474fd989096545817ed493c7fe557085", "score": "0.6322115", "text": "def get_new_uuid\n uuid = UUID.new\n return uuid.generate\n end", "title": "" }, { "docid": "ba3646495a2d1ca5bfdda3f35e599bae", "score": "0.631521", "text": "def create_new_user_and_identity(auth, params)\n user = User.create!(\n first_name: auth.info[:first_name],\n last_name: auth.info[:last_name],\n email: auth.info[:email],\n oauth_signup: true,\n # referred_by_user_id => params.andand[\"rid\"]\n )\n user.confirm!\n create_new_identity(user, auth)\n end", "title": "" }, { "docid": "71d4ce23424967b5aa36dcaa1b2da993", "score": "0.6314062", "text": "def create_user\n User.create name: \"test\", email: \"[email protected]\", password: \"123456\"\n end", "title": "" }, { "docid": "5cc195cf29d54ada32999c2002c3b4ef", "score": "0.63091666", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "5cc195cf29d54ada32999c2002c3b4ef", "score": "0.63091666", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "5cc195cf29d54ada32999c2002c3b4ef", "score": "0.63091666", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "6006988fcd8216b90e0eb732ce448cf7", "score": "0.6307388", "text": "def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end", "title": "" }, { "docid": "3eed1402a3a291541595fb942b50895c", "score": "0.6305325", "text": "def create_a_user!(username = \"foo\")\n User.create! :username => username, :email => \"foo@bar\", :id => 4, :password => \"zot\"\n end", "title": "" }, { "docid": "862cac6f52e9eecfd76924fb02b6ec55", "score": "0.62989146", "text": "def create_user\n User.create name: 'test', email: '[email protected]', password: '123456'\n end", "title": "" }, { "docid": "af13df481930df945a7fd899945dca6f", "score": "0.62976116", "text": "def create(params = {})\n response = Tiptaplab.api.make_call('users', {:user => params}, 'POST')\n dup_params = params.dup\n dup_params[:ttl_id] = response['id']\n u = self.new(dup_params)\n end", "title": "" }, { "docid": "e6c4fcfa2572cb75f5a40d3b55055ed4", "score": "0.6286474", "text": "def new_uuid\n UUIDTools::UUID.timestamp_create.hexdigest\n end", "title": "" }, { "docid": "ffecf21578b5c3a13103c9111e0c655a", "score": "0.6284462", "text": "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "title": "" }, { "docid": "6f321ee7f345cf86a59139084e41bb19", "score": "0.6279496", "text": "def create_guest_user\n user = User.new { |user| user.role = 'guest' }\n user.email = \"guest_#{Time.now.to_i}#{rand(99)}@example.com\"\n user.save(validate: false)\n user\n end", "title": "" }, { "docid": "0b19e6daa9d74be5920165f5dc93bc63", "score": "0.62735546", "text": "def create_user\n User.create name: 'test', email: '[email protected]', password: '123456'\n end", "title": "" }, { "docid": "834a3de9bf3c2e184e60b76edc8372af", "score": "0.62717205", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "9057a97cf9a1f347310d32bb331848bd", "score": "0.62583274", "text": "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end", "title": "" }, { "docid": "52c1e11a58d69f883faa4e06148cb3c3", "score": "0.6255203", "text": "def create\n user = User.new(user_params)\n if user.save\n logger.info \"User Created....\"\n puts user.id\n user_id = user.id\n auth_token = AuthenticateUser.new(user.email, user.password).call()\n render json: { auth_token: auth_token.result, user_id: user.id.to_s }\n else\n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end\n end", "title": "" }, { "docid": "98aa0b0c9997dbaccbb2dd813ba123f4", "score": "0.6250491", "text": "def create_user(**args)\n params = parameters(args) do\n required_params :name, :email, :active_flag\n optional_params :name, :email, :active_flag\n end\n request(:post, 'users', params)\n end", "title": "" }, { "docid": "1ea23a456b6447ead9a5f77702507098", "score": "0.62489307", "text": "def create_user(uid, params={})\n params.merge!(default_params)\n params['pio_uid'] = uid\n extract_latlng(params)\n @connection.post(:users, params).body\n end", "title": "" }, { "docid": "ca4bab0639b1dc2b049ef2f9b99d01ed", "score": "0.62411374", "text": "def new_user(name)\n User.create(name: name)\nend", "title": "" }, { "docid": "458ad6cafd26f1d1b895914c727bd038", "score": "0.6238832", "text": "def create_user\n # first insert into user_secrets and use it's id in users table\n @user_secret = UserSecret.using_client_shard(client: @client).create!(login_salt: @login_salt_hash[:ciphertext_blob])\n\n password_e = User.using_client_shard(client: @client).get_encrypted_password(@password, @login_salt_hash[:plaintext])\n\n @user = User.using_client_shard(client: @client).new(\n client_id: @client_id,\n email: @email,\n password: password_e,\n user_secret_id: @user_secret.id,\n status: GlobalConstant::User.active_status,\n last_logged_in_at: Time.now.to_i\n )\n\n @user.send(\"set_\" + GlobalConstant::User.doptin_mail_sent_property) if @client.is_verify_page_active_for_client?\n @user.save!\n end", "title": "" }, { "docid": "d007be5bde1ef1c08817b510d15deb53", "score": "0.62380844", "text": "def create_user(input)\n User.create(name: input)\n end", "title": "" }, { "docid": "83b051fa40b82e70e621af0d23c79b31", "score": "0.6237402", "text": "def create_user(body)\n post 'create_user', body\n end", "title": "" }, { "docid": "3550b2fe49b47f530c491080593f1a3b", "score": "0.6236855", "text": "def create_user(user_id, password=nil)\n Credential.new(call(CMD_CRE_USER % [user_id, password]))\n end", "title": "" }, { "docid": "28024810fc31ffb6c62cf708ba430bdb", "score": "0.62312716", "text": "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "title": "" }, { "docid": "28024810fc31ffb6c62cf708ba430bdb", "score": "0.62312716", "text": "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "title": "" }, { "docid": "ee311fd0b2b1ad2bb3bdd0151e9e500c", "score": "0.6225296", "text": "def create\n @user = User.create(user_params)\n if @user.valid?\n payload = { id: @user.id}\n token = JWT.encode(payload, 'my$ecretK3y', 'HS256')\n render json: { id: @user.id, username: @user.username, token: token }\n else\n render json: { error: 'failed to create user' }, status: :not_acceptable\n end\n end", "title": "" }, { "docid": "b1612b7c07465cf218c734563a7701a8", "score": "0.62244445", "text": "def create_user\n return @user.send_confirmation_instructions if @user\n\n @user = User.create!(new_agent_params.slice(:email, :name, :password, :password_confirmation))\n end", "title": "" }, { "docid": "0d563a66905a9c55587e7978bfcf0888", "score": "0.6223912", "text": "def uuid() = @uuid ||= SecureRandom.uuid", "title": "" }, { "docid": "229c3905ebe7a65b8883d8291559887a", "score": "0.6223383", "text": "def create\n @user = User.create(user_params)\n if @user.valid?\n @token = encode_token(user_id: @user.id)\n render json: { user: @user, jwt: @token}, status: :created\n # render json: { user: UserSerializer.new(@user), jwt: @token}, status: :created\n else \n render json: { error: 'That username already exists. Try again.' }, status: :not_acceptable\n end\n end", "title": "" }, { "docid": "219fec10ed93cc1dbfeef54c2b90f01c", "score": "0.6222045", "text": "def register\n @user = User.new(user_id: params[:user_id], password: params[:password])\n @user.save\n end", "title": "" }, { "docid": "f19cbc99a3411ad7b78117ce027ccfd2", "score": "0.6219467", "text": "def create(id, password)\n params = {:id => id, :password => password}\n response = @client.post(\"/users\", params)\n # TODO: strip protocol and host from uri\n User.new(@client, params.merge(:uri => response.headers['location'].first))\n end", "title": "" }, { "docid": "4ec5173f3d747f57b0726b3343690040", "score": "0.6211341", "text": "def create_user(user_id, user_email)\n \n puts user_id\n puts user_email\n new_user = User.first_or_create( {:googleuniqueid => user_id},{\n :googleuniqueid => user_id,\n :googleemail => user_email,\n :useralias => user_email,\n });\n new_user.save\n return new_user\nend", "title": "" }, { "docid": "1a6af4d0dccc62fa112f7864b75910c8", "score": "0.6210126", "text": "def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end", "title": "" }, { "docid": "384063f5f90c44aed83155ab9d013488", "score": "0.62026227", "text": "def generate_uuid\n return Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\"\nend", "title": "" }, { "docid": "1c144d6d4afcee131a439affe0c4bd5e", "score": "0.6191418", "text": "def create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end", "title": "" }, { "docid": "38513bdc445779b2c7eca1d93f536596", "score": "0.61873126", "text": "def create\n logger.info \" -------- user/create : #{user_params}\"\n logger.info \" -------- phoneNumber : #{user_params[:phoneNumber]}\"\n @user = User.find_by_phoneNumber(user_params[:phoneNumber])\n\n unless @user.nil?\n # If user already exists then return conflict error.\n # If client registration id is different then\n # update it.\n if @user.clientRegistrationId != user_params[:clientRegistrationId]\n @user.update_column(:clientRegistrationId, user_params[:clientRegistrationId])\n end\n respond_to do |format|\n error_msg = { :error => \"User(#{user_params[:phoneNumber]}) is already registered with ETA\" }\n format.json { render json: error_msg, status: :conflict }\n end\n else \n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @user }\n format.json { head :created } \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", "title": "" } ]
f1f4f64002559912b2e131a0d14fa2be
This method subtracts the payment.amount to the register.credit_extended
[ { "docid": "6be92e80a6322d9eed5a41cb74238b9b", "score": "0.87313026", "text": "def subtract_payment_from_register\n \tregister = Register.where(:creditor_id => receiver_id, :debtor_id => user_id).first\n \t\n credit_extended = register.credit_extended - self.total_amount\n register.update_attributes(:credit_extended => credit_extended)\n end", "title": "" } ]
[ { "docid": "dc5f5b6f8f8def5ba37f7f301f73118e", "score": "0.7212982", "text": "def deduct_from_credit\n if self.account.has_credit? && self.payment_method != Charge::COMPED_PAYMENT\n credit_amount_string = ActionController::Base.helpers.number_to_currency(self.account.credit)\n charge_amount_string = ActionController::Base.helpers.number_to_currency(self.amount)\n\n # credit > charge\n # subtract charge amount from credit amount, pay charge completely\n if self.account.credit >= self.amount\n self.update_attribute(:payment_method, Charge::COMPED_PAYMENT)\n self.update_attribute(:paid_at, Time.now)\n self.update_attribute(:description, self.description + \" (#{charge_amount_string} paid by lab credit)\")\n self.account.update_attribute(:credit, self.account.credit - self.amount)\n\n\n # charge > credit: \n # split charge into two charges -- covered by credit and not covered\n # pay charge covered by credit\n else\n paid_amount = self.account.credit \n unpaid_amount = self.amount - self.account.credit\n\n self.account.update_attribute(:credit, 0)\n\n Charge.create(amount: paid_amount, \n payment_method: Charge::COMPED_PAYMENT,\n paid_at: Time.now,\n charge_type: self.charge_type,\n account: self.account,\n description: \"Parital lab credit payment (original charge #{charge_amount_string}, #{credit_amount_string} paid by lab credit)\" \n )\n\n self.update_attribute(:amount, unpaid_amount)\n self.update_attribute(:description, self.description + \" (original charge #{charge_amount_string}, #{credit_amount_string} paid by lab credit)\")\n end\n end\n end", "title": "" }, { "docid": "7c5c5c1222245b4d243922d183d72154", "score": "0.6840247", "text": "def deduct_credit\n\t\t# self.user.profile.credit -= AppConfiguration::UNSHARE_CREDIT\n\t\t# self.user.profile.save\n\t\t# self.user.debit_transactions.create(:message => AppConfiguration::UNSHARED_BOOK,:book_id => self.book.id,:credit => AppConfiguration::UNSHARE_CREDIT)\n\tend", "title": "" }, { "docid": "26db673e8fc5bfd35fd4f50f4d83f1b3", "score": "0.6694261", "text": "def payment(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "d89ad219c1f6d7c95b6cc0712f65283b", "score": "0.66574794", "text": "def subtract_account_credit(amount, payment = nil, univ_months = nil)\n\n # clean up inputs\n #\n amount ||= 0.0\n univ_months ||= 0\n\n # clean up current state\n #\n if account_credit.nil?\n self.account_credit = AccountCredit.create!(:amount => 0.0, :univ_months => 0)\n end\n\n raise \"can't deduct #{amount.currency} from #{account_credit.amount.currency}\" if account_credit.amount < amount\n raise \"can't deduct #{univ_months} months from #{account_credit.univ_months} months\" if account_credit.univ_months < univ_months\n \n # nothing to do\n return if amount == 0.0 && univ_months == 0\n \n # Subtract the amount\n account_credit.amount -= amount\n account_credit.univ_months -= univ_months\n \n # Track the transaction individually\n transaction = AccountCreditTransaction.new(:amount => amount * -1.0,\n :univ_months => univ_months * -1.0,\n :payment => payment,\n :transaction_type => payment ? 'Payment' : 'CashDebit')\n account_credit.account_credit_transactions << transaction\n \n # Note: We raise an error here on failed saves since this is used\n # during checkout; also, that's why we don't use a transaction\n \n account_credit.save!\n save!\n \n end", "title": "" }, { "docid": "19608096cec537e648d14cb0699a66a4", "score": "0.66337514", "text": "def difference\n debit - credit\n end", "title": "" }, { "docid": "e7efc28950c51a9aaa1d6d6f0ab20b53", "score": "0.65911156", "text": "def deduct_amount(amount)\n raise \"You don't have enough amount in yuor card. Please top up your card\" if @balance < @journey.basic_fare\n @balance -= amount\n end", "title": "" }, { "docid": "910988985cd2d2f07b2abb5c2472d4cd", "score": "0.6490397", "text": "def credit_amount\n self.amount_received_till_date - self.total_adjusted_bill_amount\n end", "title": "" }, { "docid": "64d3f7a545f5c032a9a9acc6d8181654", "score": "0.6478753", "text": "def remove_credit\n get_oldest_payment_with_credit_to_use.increment!(:used_credit)\n self.user.update_credits!\n end", "title": "" }, { "docid": "d1a3d98d764ef5abf76a860dba7ecdcf", "score": "0.6440252", "text": "def make_payment(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "9b7392f08ae72ddb64c80e052f3bbb58", "score": "0.6340913", "text": "def deduct(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "83846a2a38689bf31c0450426b886cee", "score": "0.62779784", "text": "def add_credit\n get_oldest_payment_with_credit_to_return.decrement!(:used_credit)\n self.user.update_credits!\n end", "title": "" }, { "docid": "4fd1128a187155fb03a44d25780016ca", "score": "0.6219354", "text": "def subtract(amount)\n @money -= amount\n transactions << \"[#{date_str(Date.today)}]subtracted:#{amount}\"\n end", "title": "" }, { "docid": "7bd0b4cf63fe874e482a28d9b1712d36", "score": "0.62093866", "text": "def deduct_invite_credit(size)\n spree_referral_credit.update_attributes(credit: (spree_referral_credit.credit - size))\n end", "title": "" }, { "docid": "8e3d0f369970993c4a148f4be9670926", "score": "0.62065876", "text": "def amount\n debit\n end", "title": "" }, { "docid": "445206805ddddfc7d2ce5682a5b3d702", "score": "0.6151193", "text": "def unpaid_amount\n gross_amount - paid_amount\n end", "title": "" }, { "docid": "f0494ac8db58854ab8b1fc2258cd8fd4", "score": "0.6140845", "text": "def deduct_money_from_account(balance_to_deduct)\n self.balance -= balance_to_deduct\n self.save\n end", "title": "" }, { "docid": "f011fe94ecf9635d6f5fbe816c062330", "score": "0.6129134", "text": "def deduct(money) #as deduct provides functionality for touch_out it is no longer needed in the public method\n @balance -= money # same as balance = balance - money (therefore deducting it)\n end", "title": "" }, { "docid": "41b07267a4afb8ff68acd5834dbfa4af", "score": "0.6097184", "text": "def direct_debit()\n @amount -= 50 if @type == \"personal\"\n @amount -= 100 if @type == \"business\"\n end", "title": "" }, { "docid": "9930a17d5448353bbca406d49ac2e4c8", "score": "0.6089093", "text": "def remove_credit(amount_to_remove)\n sql = \"UPDATE store_credits SET amount = (amount - #{amount_to_remove.to_f.round_at(2)}) WHERE id = #{self.id}\"\n ActiveRecord::Base.connection.execute(sql)\n end", "title": "" }, { "docid": "764479a9f0142c23aa7ff8211b6f1a3a", "score": "0.6083147", "text": "def remove_funding amount, related = nil\n hot = Finance::Asset.find_by name: 'Hot'\n user_liability = self.find_account :liability, :user_liability\n transaction = Finance::Transaction.build(\n related: related,\n transaction_type: :deposit_cancellation,\n debits: [\n {account: user_liability, amount: amount}\n ],\n credits: [\n {account: hot, amount: amount}\n ]\n )\n transaction.save!\n end", "title": "" }, { "docid": "ce6053f1c77821cbef975c0bf0780177", "score": "0.6079929", "text": "def subtract_bankroll(amount)\n end", "title": "" }, { "docid": "00b1cb1961b67e70f7213439096fec06", "score": "0.60622233", "text": "def deposit(credit)\n @balance = credit + @balance\n return @balance\n end", "title": "" }, { "docid": "021b8887f0285f81552d7241a4f7f9fc", "score": "0.60430366", "text": "def surcharge_amount\r\n extra_cost = self.cost.to_f.amount_of(self.surcharge*100)\r\n end", "title": "" }, { "docid": "863e6e44f7e72a9161e5a057eb6c26f2", "score": "0.60223913", "text": "def credit(val1)\n cred = Account.find(val1.to_i)\n cred.update_attributes(:balance => cred.balance - self.amount)\n cred.save!\n end", "title": "" }, { "docid": "f1ab90503a1c15c8e3b3bc3f2f7286f4", "score": "0.6009484", "text": "def add_you_owe_me_to_register\n \tregister = Register.where(:creditor_id => creditor_id, :debtor_id => debtor_id).first\n \tregister ||= Register.new(:creditor_id => creditor_id, :debtor_id => debtor_id)\n\n credit_extended = register.credit_extended + self.amount\n register.update_attributes(:credit_extended => credit_extended)\n end", "title": "" }, { "docid": "f93720d85ec82df21f52db0bb9c43ca3", "score": "0.60071886", "text": "def subtract_money(amount)\n\t\t@money -= amount\n\t\t@money = 0 if @money < 0\n\t\treturn @money\n\tend", "title": "" }, { "docid": "c0bad82d877710650f00d396fb9cb5a8", "score": "0.5999319", "text": "def add_credit(transaction)\n if transaction.type == 'Expense'\n @credit -= transaction.quantity.to_f\n else\n @credit += transaction.quantity.to_f\n end\n self.update()\n\n end", "title": "" }, { "docid": "e8b2e9dd619c55d893dcc5dbc070c07d", "score": "0.59878683", "text": "def net_amount; debit; end", "title": "" }, { "docid": "2fb340876d3bb16c5d1752afa9b388e8", "score": "0.5979868", "text": "def debit_funds(amount)\n account = Account.find_by(investor_id: self.id)\n account.balance -= amount\n account.save\n puts \"\\n\\nYour account balance is now: $#{account.balance.round(2)}\"\n end", "title": "" }, { "docid": "3b9d44a9ecd91ec101f943eff499c078", "score": "0.59718686", "text": "def withdrawl(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "54bd79e42ca3ef65cd3d6785441fafa1", "score": "0.59461725", "text": "def payment_amount\n amount - tax\n end", "title": "" }, { "docid": "9cdc0a123714c0e0e6425b0ea9d64baa", "score": "0.5942167", "text": "def debit(account, amount)\n account.balance -= amount\n end", "title": "" }, { "docid": "2c2a25464901ff8ced487be005062472", "score": "0.59349895", "text": "def debit\n if(account.balance - amount >= account.minBalance)\n account.balance -= amount\n else\n raise \"Minnimum balance crossed, hence transaction failed.\"\n end\n end", "title": "" }, { "docid": "c94f6a2e9b2d5e37b355a8fe8263e05a", "score": "0.5922676", "text": "def withdrawl (amount)\n @balance -= amount\n end", "title": "" }, { "docid": "fca91595d5ce933e90dcea3700e089bd", "score": "0.59130496", "text": "def debt\n owed_total - payment.to_f\n end", "title": "" }, { "docid": "1099f1a2c43d30a0f55abde4987cc3cb", "score": "0.5912141", "text": "def negateAmount\n if self.paymentType == \"REVERSAL\"\n if self.manualPayment\n self.amount = -self.amount.to_f.abs\n else\n self.amount = -self.amount.to_i.abs\n end\n end\n end", "title": "" }, { "docid": "5347ac94b9b8c62b97b56dd398d32c4d", "score": "0.5873546", "text": "def deduct\n # @balance = @balance - 200\n @balance -= 200\n # puts @@all\n puts Account.all\n end", "title": "" }, { "docid": "06cc56bd6b75d7286b571923211ec73c", "score": "0.58632666", "text": "def amount\n credit_entry.amount.abs\n end", "title": "" }, { "docid": "57eb0bb83b240f89363b01ab143132dd", "score": "0.58275676", "text": "def guest_pays(fee)\n @guest_cash -= fee\n end", "title": "" }, { "docid": "7e793f8b0bf4f17f72ef2ec07620f55c", "score": "0.5817198", "text": "def pay_installment\n @payment = Payment.find(params[:id])\n [email protected]('paid_amount')\n @[email protected]_amount - paid_amount\n end", "title": "" }, { "docid": "1706e8cfaed180b2a311027e4fcd091b", "score": "0.5805744", "text": "def -(other)\n Money.new(amount - other.amount)\n end", "title": "" }, { "docid": "a3d8c73906f6002fb05127c21cb25799", "score": "0.57977957", "text": "def deduct(value)\n @balance -= value\n end", "title": "" }, { "docid": "7b64d72019da8bad2a91fe1c3143154d", "score": "0.5794559", "text": "def remove_money\n\t\taccount = Account.where(id: @transaction.sender_id).first\n\t\taccount.update_attribute(:money, account.money - @money)\n\tend", "title": "" }, { "docid": "e5c87cf2b7bc2c722f03b6eaafa376f0", "score": "0.57892424", "text": "def deduct(amount) #deduct method defined which taked 1 string argument\n @balance -= amount #balance instance variable negatively incremented by amount passed into the argument\n end", "title": "" }, { "docid": "4614d2dfacb06300b83d15f426d52239", "score": "0.5788396", "text": "def remaining_balance\n remaining_invoice_balance - wallet_balance\n end", "title": "" }, { "docid": "97ea0435ef43ea3ad3c6b840e0a68749", "score": "0.57827723", "text": "def balance\n debits.sum(:amount) - credits.sum(:amount)\n end", "title": "" }, { "docid": "558b8fe0a48ced78c8540230c71c7eab", "score": "0.5772467", "text": "def restock(amount)\n @sales -= amount\n end", "title": "" }, { "docid": "3fbc32309ec637fc0bdff78ec28eab9e", "score": "0.5772192", "text": "def total_amount\n\t\tcredit_total.to_f + debit_total.to_f\n\tend", "title": "" }, { "docid": "1568fcf429703d984b587c677ff154f2", "score": "0.57642746", "text": "def calculateBalance\n \n self.accountBalance = self.amountPaid.to_f - amountWithTax\n \n end", "title": "" }, { "docid": "7d321f414f3e0907654fab9c89b0d6f9", "score": "0.57471436", "text": "def deduct(amout)\n business.deduct_from_balance(amount)\n end", "title": "" }, { "docid": "62b0ca59d6e887743215ed3679ffe7a4", "score": "0.5746753", "text": "def remaining_balance_after_charge_account\n balance = remaining_balance\n bills = $USER.bills\n\n bills.each do |bill|\n if bill.status == \"paid\"\n balance = balance - bill.amount\n end\n end\n balance\n end", "title": "" }, { "docid": "eeeadf57fc3b4fd05cae5cd9d1f15c13", "score": "0.5746101", "text": "def remaining_money\n (total_money-paid_back)\n end", "title": "" }, { "docid": "69a5ca33082df37b94ed4b9fe25075bb", "score": "0.5745138", "text": "def payment_amount\n end", "title": "" }, { "docid": "e4c30a0b2c272b5576bb949dd7cbf81c", "score": "0.57400405", "text": "def credit\n account.balance += amount\n end", "title": "" }, { "docid": "e6b408ef2e9cabb9cc64ac4ad6a8ad4e", "score": "0.5737313", "text": "def refund\n # refund payment to Passenger\n end", "title": "" }, { "docid": "d36569e5571def5469a5d32aef2cdca6", "score": "0.57283556", "text": "def -(other)\n other = other.convert_to(currency)\n Money.new(amount - other.amount, currency)\n end", "title": "" }, { "docid": "85dfd39e0ee8bc6d70009c07eb6af0f6", "score": "0.57143587", "text": "def deduct_extra_savings( saving_amount, saving_entry_code, saving_transaction_entry )\n self.create_saving( saving_amount, saving_entry_code, SAVING_ACTION_TYPE[:credit], saving_transaction_entry , true )\n end", "title": "" }, { "docid": "49d81254aaf5602c62429aafd1ebdb0c", "score": "0.5704596", "text": "def add_extra_credit()\n raise \"unimplemented\"\n end", "title": "" }, { "docid": "64e62461cbf76869eca50d968a4be254", "score": "0.57023555", "text": "def create\n\n\n @credit = Credit.new(params[:credit])\n @credit.assigned_by = current_user.email\n\n\n if current_user.try(:admin?) \n else\n @credit.merchant_id = current_user.merchant_id\n end\n\n @total_credit = Credit.where(:user_id => @credit.user_id, :merchant_id => @credit.merchant_id).sum(:amount)\n\n\n case session[:credit_type]\n when \"add\"\n @credit.convertion_rate = Merchant.find(@credit.merchant_id).convertion_rate\n @credit.amount = @credit.purchase_amount * @credit.convertion_rate\n @credit.expires_on = Date.today + Merchant.find(@credit.merchant_id).days_to_expire\n\n\n when \"remove\"\n @credit.amount = [email protected]\n \n end\n \n\n case session[:credit_type]\n when \"add\"\n respond_to do |format|\n if @credit.save\n\n UserMailer.new_credit_email(@credit).deliver\n\n format.html { redirect_to profile_path(@credit.user_id), notice: 'Puntos generados exitosamente. Se envio un mail de notificacion al usuario.' }\n format.json { render json: @credit, status: :created, location: @credit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @credit.errors, status: :unprocessable_entity }\n end\n end\n\n when \"remove\"\n if @credit.amount.abs <= @total_credit\n respond_to do |format|\n if @credit.save\n format.html { redirect_to profile_path(@credit.user_id), notice: 'Puntos descontados exitosamente. Se envio un mail de notificacion al usuario.' }\n format.json { render json: @credit, status: :created, location: @credit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @credit.errors, status: :unprocessable_entity }\n end\n end\n \n else\n respond_to do |format|\n format.html { redirect_to profile_path(@credit.user_id), notice: 'El saldo de puntos no es suficiente.' }\n format.json { render json: @credit, status: :created, location: @credit }\n end\n end \n end\n end", "title": "" }, { "docid": "ad01d7076f5f75476eb1bba10caf5e7e", "score": "0.570116", "text": "def charge_cost_to_my_account\n self.my_account.debit(self.aircrafttype.cost)\n end", "title": "" }, { "docid": "27520bb13b45ac3f4664c13ebc115926", "score": "0.56919307", "text": "def debit amount, appears_on_statement_as=nil, meta={}, description=nil\n self.account.debit(amount, appears_on_statement_as, meta, description, self.uri)\n end", "title": "" }, { "docid": "fab8f2445c75e8ab665e0105c7aec24c", "score": "0.56909746", "text": "def withdraw(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "75b843ae1937655944f7d3674d087101", "score": "0.5684864", "text": "def original_amount() nil end", "title": "" }, { "docid": "3ce0856dc4e57cccc875beb72e0ee034", "score": "0.5677639", "text": "def deduct_credits!(amount_in_cents)\n return false unless self.amount_cents >= amount_in_cents\n self.amount_cents -= amount_in_cents\n self.save!\n end", "title": "" }, { "docid": "f9eaad9cad7eaba821b0ffc56cda9799", "score": "0.5674783", "text": "def uncredit_hours\n old_attendee_hours = self.attendee.hours\n old_group_hours = self.group.hours\n membership = related_membership\n old_membership_hours = membership.hours\n attendee.update_attributes(hours: (old_attendee_hours - hours))\n group.update_attributes(hours: (old_group_hours - hours))\n membership.update_attributes(hours: (old_membership_hours - hours))\n end", "title": "" }, { "docid": "59e14af4472dc9780424806ce759d394", "score": "0.5674524", "text": "def cash_difference\n cash_supposed = self.cash_supposed\n cash_difference = self.cash - cash_supposed\n end", "title": "" }, { "docid": "f633ed25d35829379ce9db7f23e5ad39", "score": "0.56629336", "text": "def withdraw(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "f633ed25d35829379ce9db7f23e5ad39", "score": "0.56629336", "text": "def withdraw(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "f633ed25d35829379ce9db7f23e5ad39", "score": "0.56629336", "text": "def withdraw(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "ada4063e0df255b1db7b252b57e95fbd", "score": "0.5661425", "text": "def debit_from( amount )\n is_percentage? ? ( 1 - @right_side ) * amount : amount -= @right_side\n end", "title": "" }, { "docid": "1bb693075c9483f2969cd0a9a3bcdac0", "score": "0.5655281", "text": "def debits_balance\n debit_amounts.balance\n end", "title": "" }, { "docid": "f0a566a27b2d789ee9b42de9a4e086c1", "score": "0.5653497", "text": "def leftover\n return @cash - self.spent\n end", "title": "" }, { "docid": "281e40635f2185e4c9ba300e6d81c7e3", "score": "0.5642364", "text": "def credit\n account_credit ? account_credit.amount : BigDecimal('0.0')\n end", "title": "" }, { "docid": "3f97b7acf76707b89241145ce51b39b6", "score": "0.56337976", "text": "def capture amount=nil, appears_on_statement_as=nil, meta={}, description=nil\n amount ||= self.amount\n self.account.debit(amount, appears_on_statement_as, self.uri, meta, description)\n end", "title": "" }, { "docid": "554ae67f9dfcd61b7a5ff14d5283a9e9", "score": "0.563334", "text": "def balance\n\t\ttotal.to_f - amount_payments.to_f\n\tend", "title": "" }, { "docid": "69834aab81cf4d5e422d3d8d8408f4ef", "score": "0.56317633", "text": "def update_credit\n total_available_balance = @current_balance + params[:deposite_account][:last_transaction_amount].to_i\n update_deposite_account(total_available_balance)\n redirect_to deposite_accounts_index_path\n end", "title": "" }, { "docid": "4e6891c1cfa73cedb079fd3a912d39c7", "score": "0.56304497", "text": "def dues\n dues_amount - paid_amount\n end", "title": "" }, { "docid": "5157c29441a04aca58b33dca6a8662f3", "score": "0.5626687", "text": "def finalize_with_gift_card!\n # finalize_without_gift_card!\n # Record any gift card redemptions.\n self.adjustments.where(source_type: 'Spree::GiftCard').each do |adjustment|\n gift_card = adjustment.source\n amount = adjustment.amount\n unless gift_card.line_item.currency == self.currency\n amount = Currency.new.get_price_for_other_currency(amount, self.currency, gift_card.line_item.currency)\n end\n # Truncate amount to two digits after decimal\n amount = Integer(amount * 100) / Float(100)\n adjustment.source.debit(amount, self)\n end\nend", "title": "" }, { "docid": "7d126a06056c2529691951536318392b", "score": "0.56158805", "text": "def _credit_helper(amount)\n\n status = 1\n\n begin\n # subtract the current balance by the new amount\n new_balance = self.get_balance() - amount.to_i\n\n # hard to think this could happen, but it's a defensive check\n if new_balance > @limit\n lg(\"ERROR: Card(#{self.get_number()}) Overcredited(#{new_balance}) Limit(#{@limit})\", 0)\n else\n\n # if the balance is a valid amount, assign the new balance\n status = set_balance(new_balance)\n dlg(\"Credit Card(#{self.get_number()}) Balance(#{self.get_balance()})\", 5)\n return 0\n end\n rescue Exception => e\n lg(\"ERROR: Failed to Credit Card(#{self.get_number()}) with Ex(#{e.message})\", 0)\n end\n\n return status\n end", "title": "" }, { "docid": "b26dced60c1ccc259cc904571868e4ce", "score": "0.560164", "text": "def difference\n self.total - self.shop_pay\n end", "title": "" }, { "docid": "359d892d338ab493151b7b31d24105c6", "score": "0.5586529", "text": "def calc_total_credit\n if self.plus_percentage > 0\n # Sum the plus percentaje from the formation type\n self.total_credit = self.hours + ( self.hours * (self.plus_percentage / 100 + 1))\n else\n self.total_credit = self.hours\n end\n end", "title": "" }, { "docid": "a4dc97f49422158060b1dd59d5c3a984", "score": "0.5583445", "text": "def payment_amount\n\t\t\t\t\treturn self.amount\n\t\t\t\tend", "title": "" }, { "docid": "ebe560d849647e4d0899ed49640af892", "score": "0.55743295", "text": "def debit_amount\n debit_amount_cents / 100.00 if debit_amount_cents\n end", "title": "" }, { "docid": "2fcb66a1d364f5bb0c18c2c13772fd3a", "score": "0.55703324", "text": "def wallet_balance\n payment_receipts_balance + remaining_credit_balance\n end", "title": "" }, { "docid": "63c6deb4dd06015326dcdc332fd02d7a", "score": "0.55673414", "text": "def bet(amount)\n\t\t@funds -= amount\n\t\treturn amount\n\tend", "title": "" }, { "docid": "d03517092414dfcb3373371384b907a4", "score": "0.55649257", "text": "def debt\n subtotal - _normed_balance\n end", "title": "" }, { "docid": "cfda870a3f0c0c0467915f7a6e7d1548", "score": "0.5562783", "text": "def down_payment\n self.dig_for_decimal(\"downPayment\")\n end", "title": "" }, { "docid": "3abb039f2e0859627dcf6884eb0598d3", "score": "0.5561491", "text": "def remaining_credit_balance\n credit_notes.includes(:credit_note_items, :coupon).to_a.sum(&:remaining_cost)\n end", "title": "" }, { "docid": "74bf709bca04612ded7d0460c1bb90be", "score": "0.5550072", "text": "def total_balance\n total -= total_price\n end", "title": "" }, { "docid": "dc8926e7d6b2ab14becdba43b146d05f", "score": "0.55461705", "text": "def non_operating_funds\n amount - operating_funds\n end", "title": "" }, { "docid": "ec2aa1587cb70983975be1215c88b028", "score": "0.5541992", "text": "def -(other_money)\n other_money = other_money.convert_to(currency)\n self.class.new(amount - other_money.amount, currency)\n end", "title": "" }, { "docid": "ef092e2f3df745e7adc9ef7497925931", "score": "0.55408514", "text": "def update_credit\n\t\tself.update_attribute(:credit, determine_new_credit)\n\tend", "title": "" }, { "docid": "5edba711d5d3af2f0f7a259154ad4910", "score": "0.5538394", "text": "def total_payment \n self.cash_amount + self.voluntary_savings_withdrawal_amount \n end", "title": "" }, { "docid": "bd05b74770ad6071975845ae974599f4", "score": "0.5532656", "text": "def debit_entry\n transaction.debit_entry\n end", "title": "" }, { "docid": "1d004b1cc4532cd6b5bf49f38c45f946", "score": "0.5531832", "text": "def refund!\n response = $gateway.credit(self.amount, authorization.transaction_id, :card_number => authorization.last_four_digits )\n if response.success?\n self.transaction_id = response.authorization\n else\n errors.add_to_base response.message\n return false\n end\n end", "title": "" }, { "docid": "72126b2b635ca03ba941dfcbfa49e24c", "score": "0.55229825", "text": "def charge_cost_to_my_account\n self.my_account.debit(self.airport.terminal_cost_new)\n end", "title": "" }, { "docid": "b6e12b0b173b4d0153933011eea4b078", "score": "0.5521962", "text": "def debitar(valor_para_debitar)\n @valor -= valor_para_debitar\n # Verificando a logica de operadores de #valor saldo com valor debito\n # A operacao acima foi fatorado, mas #pode ser entendito @valor = @valor - #valor\n #poderia usar self.valor informa direto objeto, mas nao esta instanciado\n end", "title": "" }, { "docid": "94a3bc5343c551342e63b57f020e90b8", "score": "0.5519854", "text": "def credit amount, description=nil, meta={}\n self.account.credit(amount, description, meta, self.uri)\n end", "title": "" }, { "docid": "0017a117ec02fffa4555d2c926665730", "score": "0.5515673", "text": "def rollback\n giver_wallet.credit(transfered_amount) # it's assumed it did a debit before\n taker_wallet.debit(converted_amount) # it's assumed ot dod a credit before\n [giver_wallet, taker_wallet]\n end", "title": "" }, { "docid": "ce769c1a0edb62eb73b8284e004c3aae", "score": "0.5510018", "text": "def charge_with_credits(account_id, amount, transaction_type)\r\n if amount <= 0\r\n return amount\r\n end\r\n\r\n # Get the latest credit record\r\n @latest_credit = Credit.where(account_id: account_id).order(updated_at: :desc).first\r\n \r\n # If there are no credits entered for this user, return the same amount\r\n if @latest_credit == nil or @latest_credit.total_credit == 0\r\n return amount\r\n end\r\n \r\n credit_total = @latest_credit.total_credit\r\n credits_to_use = [credit_total, amount].min\r\n\r\n # add credit with the new total and reduced amount\r\n Credit.create(total_credit: (credit_total - credits_to_use), transaction_credit: (-1 * credits_to_use), transaction_type: transaction_type, account_id: account_id)\r\n return (amount - credits_to_use)\r\n end", "title": "" } ]
8e6d14596ff41177cb5eb9831114a8d8
create Split a running Pattern.create block into multiple patterns. The output that has been generated up until the point where this is called will be written and a new pattern will be opened to contain the remainder of the pattern content generated by the block. Each additional pattern section created by calling this method will have '_partN' appended to the original pattern name.
[ { "docid": "35558f1d17805cc2315622d8fb3f2904", "score": "0.5578119", "text": "def split(options = {})\n split_name = options.delete(:name) || ''\n pattern_close(options.merge(call_shutdown_callbacks: false))\n job.inc_split_counter(split_name)\n pattern_open(options.merge(call_startup_callbacks: false))\n end", "title": "" } ]
[ { "docid": "006cdd1c1aba3bef5fc09455c3aee0ff", "score": "0.6383661", "text": "def create_parts\n return unless @index < @source.size\n char = @source.getbyte(@index).chr\n case char\n when '('\n idx = @index + 1\n if idx < @source.size and @source.getbyte(idx).chr == '?'\n process_group\n else\n push_current_character!\n end\n else\n push_current_character!\n end\n create_parts\n end", "title": "" }, { "docid": "2dd8472f79fa536b0dc67de57bfb9926", "score": "0.59751356", "text": "def pattern(**params, &block)\n options = { bpm: bpm, bars: bars, sequence: self }.merge(params)\n @_patterns << Pattern.define(**options, &block)\n end", "title": "" }, { "docid": "9169c36e4e570784f66eee095a9821d4", "score": "0.5830402", "text": "def begin_pattern_ext(*args)\n Handle::Pattern.create(super(*args), self)\n end", "title": "" }, { "docid": "1eb388a2b9b65682b40dc2bef82f9e9e", "score": "0.57899314", "text": "def create_blocks(count)\n (0...count).to_a.map { create_block }\n end", "title": "" }, { "docid": "b26369687c95c829d86261c187cf81ca", "score": "0.5770795", "text": "def create\n text = pattern_params[\"text\"] \n @pattern = Pattern.new(pattern_params)\n\n while !(opening_bracket_index = text.index('{')).nil?\n closing_bracket_index = text.index('}')\n if closing_bracket_index.nil?\n raise \"unbalanced parenthesis\"\n end\n if !text[opening_bracket_index+1, closing_bracket_index-opening_bracket_index].index('{').nil?\n slc = text.slice(closing_bracket_index+1..-1)\n closing_bracket_index_diff = slc.index('}')\n if closing_bracket_index_diff.nil?\n raise \"unbalanced parenthesis\"\n end\n closing_bracket_index = closing_bracket_index + closing_bracket_index_diff + 1\n end\n json = JSON.parse(text[opening_bracket_index,closing_bracket_index-opening_bracket_index+1])\n json.each_key { |key|\n @pattern.send(key+\"=\",1)\n }\n text = text.slice(closing_bracket_index+1..-1)\n end\n\n respond_to do |format|\n if @pattern.save\n format.html { redirect_to [:manager, @pattern], notice: 'Pattern was successfully created.' }\n format.json { render :show, status: :created, location: @pattern }\n else\n format.html { render :new }\n format.json { render json: @pattern.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ecb4f57523554690736afa3e8e9507e", "score": "0.55755746", "text": "def build_parts(buffer, parameters); end", "title": "" }, { "docid": "7231405cf6c3270a07ff03e3bf64092e", "score": "0.5553416", "text": "def define_pattern(name, block)\n pattern_node = TmGrammar::Pattern.new(node, block).evaluate\n pattern_node.name = name\n node.add_pattern(pattern_node)\n end", "title": "" }, { "docid": "dbd6c306421d1febec85fc86ad7abf2d", "score": "0.5538471", "text": "def define_pattern(name, block)\n pattern_node = TmGrammar::Pattern.new(grammar, block).evaluate\n pattern_node.name = name\n node.add_pattern(pattern_node)\n end", "title": "" }, { "docid": "1db7971bcfc488782ef61be403a9e462", "score": "0.5494126", "text": "def pattern(name = nil, &block)\n pattern_object.define_pattern(name, block)\n end", "title": "" }, { "docid": "970b60a1f0273be597ae60e096221f13", "score": "0.5489408", "text": "def _build_parts(buffer, parameters); end", "title": "" }, { "docid": "f6ba7bdc7e24884b71ef768fd962a636", "score": "0.5461771", "text": "def build_pattern(block_symbols)\n start, stop = WLang::Template::BLOCK_SYMBOLS[block_symbols]\n start, stop = Regexp.escape(start), Regexp.escape(stop)\n s = '([\\\\\\\\]{0,2}('\n i=0\n @rules.each_key do |tag|\n s << '|' if i>0\n s << '(' << Regexp.escape(tag) << ')'\n i += 1\n end\n s << \")#{start})|[\\\\\\\\]{0,2}#{start}|[\\\\\\\\]{0,2}#{stop}\"\n Regexp.new(s)\n end", "title": "" }, { "docid": "cd306eac8b0c83b89327815cf70257bf", "score": "0.5434995", "text": "def content_for_pattern\n # Get the base content to start from.\n existing_content = if ::File.exist?(@new_resource.path)\n IO.read(@new_resource.path)\n else\n # Pretend the file is empty if it doesn't already exist.\n ''\n end\n\n # If we were given a proc, use it.\n if @new_resource.pattern.is_a?(Proc)\n return @new_resource.pattern.call(existing_content, @new_resource)\n end\n\n # Build the pattern.\n pattern = if @new_resource.pattern.is_a?(Regexp)\n # Should this dup the pattern because weird tracking stuff?\n @new_resource.pattern\n else\n # Deal with newlines at the end of a line because $ matches before\n # newline, not after.\n pattern_string = if @new_resource.content.end_with?(\"\\n\")\n @new_resource.pattern.gsub(/\\$\\Z/, \"$\\n?\")\n else\n @new_resource.pattern\n end\n # Ruby will show a warning if trying to add options to an existing\n # Regexp instance so only use that if it's a string.\n Regexp.new(pattern_string, Regexp::MULTILINE)\n end\n\n # Run the pattern operation.\n case @new_resource.pattern_location.to_s\n when 'replace'\n # Overwrite the matched section.\n existing_content.gsub!(pattern, @new_resource.content) || existing_content\n when 'replace_or_add'\n # Overwrite the pattern if it matches otherwise append.\n existing_content.gsub!(pattern, @new_resource.content) || (existing_content << @new_resource.content)\n when 'before'\n # Insert the content before the pattern if it doesn't already exist.\n match = pattern.match(existing_content)\n if match\n if match.pre_match.end_with?(@new_resource.content)\n existing_content\n else\n '' << match.pre_match << @new_resource.content << match[0] << match.post_match\n end\n else\n existing_content\n end\n when 'after'\n # Insert the content after the pattern if it doesn't already exist.\n match = pattern.match(existing_content)\n if match\n if match.post_match.start_with?(@new_resource.content)\n existing_content\n else\n '' << match.pre_match << match[0] << @new_resource.content << match.post_match\n end\n else\n existing_content\n end\n else\n raise ArgumentError.new(\"Unknown file pattern location #{@new_resource.pattern_location.inspect}\")\n end\n end", "title": "" }, { "docid": "95eb79cf5ab99733ef08b97e3f8e3d4e", "score": "0.537174", "text": "def createCommentContaining(text)\n\t\n\t\tline = Regexp.new( @@LCOM_HEAD_S + @@LCOM_BODY_S + text.to_s() + @@LCOM_BODY_S + @@LCOM_TAIL_S )\n\t\t\n\t\tblock = Regexp.new( @@BCOM_HEAD_S + @@BCOM_BODY_S + text.to_s() + @@BCOM_BODY_S +@@BCOM_TAIL_S)\n\n\t\tputs \"-------- comment \" + text.to_s() + \" created ------------\"\n\t\tputs \"line pattern: \"\n\t\tp line\n\t\tputs \"block pattern\"\n\t\tp block\n\t\n\t\treturn Regexp.union(line, block)\n\tend", "title": "" }, { "docid": "6e331a5cba63076dc93c392a384fbcac", "score": "0.53710246", "text": "def make_part(component)\n case component[:type]\n when TWEET\n logger.info 'Creating tweet part'\n TweetPattern.new component\n else\n logger.warn \"Unknown part type: #{component[:type]}\"\n end\n end", "title": "" }, { "docid": "5091ce9d1612e841fcaa4c92dad9eea7", "score": "0.53671306", "text": "def split3(aPattern,aOccurence=0)\n\t\t\taString = self\n\t\t\tmatches = aString.scan_md(aPattern)\n\t\t\tmatch = matches[aOccurence]\n\t\t\tparts = (match ? [match.pre_match,match.to_s,match.post_match] : [aString,nil,''])\n\n\t\t\tif !block_given?\t# return head,match,tail\n\t\t\t\tparts\n\t\t\telse\t\t\t\t\t\t# return string\n\t\t\t\tparts[1] = yield *parts if match\n\t\t\t\tparts.join\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "f853a3ed1c792539d69b8998b8b55981", "score": "0.53572184", "text": "def create(pattern_)\n tokenizer = TreePatternLexer.new(pattern_)\n parser = TreePatternParser.new(tokenizer, self, @adaptor)\n t = parser.pattern\n return t\n end", "title": "" }, { "docid": "4640d7e7c4c7286d6fb0e00d7b176474", "score": "0.53451604", "text": "def create_chunks\n chunks = Array.new\n for w0 in find_match_words(@index)\n index0 = @index + w0.length\n if index0 < @chars.length\n for w1 in find_match_words(index0)\n index1 = index0 + w1.length\n if index1 < @chars.length\n for w2 in find_match_words(index1)\n if w2.type == Word::TYPES[:unrecognized]\n chunks << [w0, w1]\n else\n chunks << [w0, w1, w2]\n end\n end\n elsif index1 == @chars.length\n chunks << [w0, w1]\n end\n end\n elsif index0 == @chars.length\n chunks << [w0]\n end\n end\n\n chunks\n end", "title": "" }, { "docid": "e84a570a8424979cf22cdab28b48bc2f", "score": "0.53409535", "text": "def initialize pattern, &block\n @pattern = pattern\n @block = block\n end", "title": "" }, { "docid": "e84a570a8424979cf22cdab28b48bc2f", "score": "0.53409535", "text": "def initialize pattern, &block\n @pattern = pattern\n @block = block\n end", "title": "" }, { "docid": "de3dd9ac92ca14f66148b3801c2debe5", "score": "0.5324058", "text": "def split3(aPattern,aOccurence=0)\n\t\taString = self\n\t\tmatches = aString.scan_md(aPattern)\n\t\tmatch = matches[aOccurence]\n\t\tparts = (match ? [match.pre_match,match.to_s,match.post_match] : [aString,nil,''])\n\n\t\tif !block_given?\t# return head,match,tail\n\t\t\tparts\n\t\telse\t\t\t\t\t\t# return string\n\t\t\tparts[1] = yield *parts if match\n\t\t\tparts.join\n\t\tend\n\tend", "title": "" }, { "docid": "12108979d214b46f081f8d43533bd7d1", "score": "0.5257061", "text": "def pattern(name = nil, &block)\n grammar.define_pattern(name, block)\n end", "title": "" }, { "docid": "b3ce2a09aacc3e92551cd4d62c856d45", "score": "0.52421397", "text": "def build_blocks\n new_blocks = []\n self.blocks.each do |block|\n actor = spawn :block\n actor.x = block[0] * BLOCK_SIZE + self.x\n actor.y = block[1] * BLOCK_SIZE + self.y\n actor.grid_offset_x = block[0]\n actor.grid_offset_y = block[1]\n actor.image = self.image\n\n new_blocks << actor\n end\n\n # Destroy ourselves, leaving only the blocks behind\n remove_self\n\n new_blocks\n end", "title": "" }, { "docid": "7e0d7c971b1660306b49fec33ebe1255", "score": "0.5174878", "text": "def create\n if element.dataset.parent_type == \"Blocks::Repeater\"\n repeater = @post.blocks.find(element.dataset.parent_id)\n repeater.update(content: permitted_params.require(:content))\n\n group = repeater.blocks.create(type: \"Blocks::Group\", parent_id: repeater.id, post_id: @post.id)\n\n repeater.content.split(\" \").map do |type|\n group.blocks.create(type: type, post_id: @post.id)\n end\n\n else\n @post.blocks.create(permitted_params.to_h)\n end\n end", "title": "" }, { "docid": "d12c6f8d12630296563458d248666665", "score": "0.51613396", "text": "def pattern(name = nil, &block)\n capture.define_pattern(name, block)\n end", "title": "" }, { "docid": "10bb31d631051714802abe60981ee4a5", "score": "0.5138405", "text": "def create\n @pattern = Pattern.new(pattern_params)\n parsers = Parser.all\n parser_names = []\n parts = @pattern[:text].split(/[\\s|\\/]/)\n @recognized = true\n @unknown = ''\n\n parsers.each do |parser|\n parser_names << parser.name\n end\n\n parts.each do |part|\n unless parser_names.include? part.gsub(/[\\{\\}\\%]/, '')\n @unknown = part\n @recognized = false\n end\n end\n\n respond_to do |format|\n if @uknown == ''\n if @pattern.save\n format.html { redirect_to '/patterns', notice: 'Pattern was successfully created.' }\n format.json { render :show, status: :created, location: @pattern }\n else\n format.html { redirect_to '/patterns/new', notice: 'Pattern is already present in the database.' }\n format.json { render json: @pattern.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to '/patterns/new', notice: 'Unknown parser for '+ @unknown }\n end\n end\n end", "title": "" }, { "docid": "733ab38b92ca69b65ae58709a281d2f3", "score": "0.51284426", "text": "def makeBlocks(days, startTimeString, endTimeString, info)\n\tblocks = []\n\tdays.split(\"\").each do |d|\n\t\tb = Block.new(d, startTimeString, endTimeString, info)\n\t\tblocks << b\n\tend\n\t(blocks)\nend", "title": "" }, { "docid": "8a20f110888e0e043ff8a1e1171345c1", "score": "0.5125917", "text": "def pattern_elements\n @pattern_elements||=pattern.collect { |match| [PatternElement.new(match, :rule_variant => self, :pattern_element => true), delimiter_pattern] }.flatten[0..-2]\n end", "title": "" }, { "docid": "20b66bcb96c5b9b5f4c446ebd0530125", "score": "0.51081324", "text": "def layout(&blk)\n # Create base output file\n @fd = File.open(@name, File::RDWR | File::BINARY | File::CREAT | File::TRUNC)\n # this is inefficient for large files, optimize by building\n # larger blocks (1KiB maybe) in memory and writing that out\n # as a chunk.\n @size.times { @fd.putc @fill }\n @fd.rewind\n\n begin\n # Run user-specified commands\n yield\n rescue Exception => error\n # Delete output file if unsuccessful\n @fd.close\n File.unlink(@name)\n\n # Pass exception up the stack\n raise error\n ensure\n # Clean up\n @fd.close unless @fd.closed?\n end\n end", "title": "" }, { "docid": "54eff73476895aabe929c081806b440e", "score": "0.51026237", "text": "def copy_pattern_file\n template \"#{pattern_name}.rb\", generated_file_path\n end", "title": "" }, { "docid": "66c1b3db5dc2770795b7792e42a28690", "score": "0.50692487", "text": "def test_pattern_block_side_effects\n assert_equal \"require 'foo'\\nfoo\", build_pattern_block('', \"=beginblah\\nrequire 'foo'\\nfoo\\n=end\")[1]\n end", "title": "" }, { "docid": "66c1b3db5dc2770795b7792e42a28690", "score": "0.50692487", "text": "def test_pattern_block_side_effects\n assert_equal \"require 'foo'\\nfoo\", build_pattern_block('', \"=beginblah\\nrequire 'foo'\\nfoo\\n=end\")[1]\n end", "title": "" }, { "docid": "80ece3838f45ed3c3ba7f86a024bae1c", "score": "0.50599915", "text": "def partition(pattern=nil)\n return super() if pattern == nil && block_given?\n\n if pattern.kind_of? Regexp\n if m = pattern.match(self)\n return [m.pre_match, m.to_s, m.post_match]\n end\n else\n pattern = StringValue(pattern)\n if i = index(pattern)\n post_start = i + pattern.length\n post_len = size - post_start\n\n return [substring(0, i),\n pattern.dup,\n substring(post_start, post_len)]\n end\n end\n\n # Nothing worked out, this is the default.\n return [self, \"\", \"\"]\n end", "title": "" }, { "docid": "3ea4dfae17a4642eea25fa8d8280406b", "score": "0.50594914", "text": "def shading_pattern(*args)\n Handle::Pattern.create(super(*args), self)\n end", "title": "" }, { "docid": "c2d5350460b001bcebbc1c7c1090c85b", "score": "0.5056879", "text": "def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end", "title": "" }, { "docid": "c1797898d033c38117c68979a55a26b9", "score": "0.50536263", "text": "def pattern_maker pattern_width\n count = 0\n final_pattern = []\n x = 0\n y = 0 \n square_size = 20\n #this takes @pattern_length from above and repeats our pattern until it is even (no odd length rows at the end)\n while count < @pattern_length \n #step through each character in the binary string\n @binary_pattern.each_char do |pattern|\n #this is our row-maker, reset x when we get to the end of the row and increment y\n if count % pattern_width == 0\n x = 0\n y += square_size\n \n final_pattern << \"\\n\"\n end\n ten_rows = 10*square_size\n if y % ten_rows == 0\n square_color = 'yellow'\n else\n square_color = 'white'\n end\n case pattern\n when \"0\"\n final_pattern << \"K\"\n Square.new( # Draws a black square...\n size: square_size,\n x: x,\n y: y,\n color: 'black'\n ) \n Square.new( #...then draws a slightly smaller white square over it, leaving a black border.\n size: square_size-1,\n x: x+1,\n y: y+1,\n color: square_color\n )\n x += square_size\n when \"1\"\n final_pattern << \"P\"\n Square.new(\n size: square_size,\n x: x,\n y: y,\n color: 'black'\n )\n Square.new(\n size: square_size-1,\n x: x+1,\n y: y+1,\n color: square_color\n )\n Circle.new( # Traditionally, a small dot represents a purl stitch, while an empty square represents a knit stitch.\n x: x+(square_size/2), \n y: y+(square_size/2),\n radius: 2,\n sector: 4,\n color: 'black',\n z:2\n ) \n x += square_size\n end\n count += 1 \n end\n end\n return final_pattern\nend", "title": "" }, { "docid": "c4936ba82f6a604f42ff602718a0aed5", "score": "0.501583", "text": "def create_monster\n magick.reset\n magick.background #{ |cf| cf.clut(@ct.color(:background,1),120,120)}\n @parts.each do |part,num,color|\n num_parts = NUM_PARTS[part]\n if num_parts\n num = num % num_parts + 1\n color = @ct.color(part,num,color)\n magick.composite(choose_file(part,num)){|cf| cf.bclut(color) }\n end\n end\n magick.run\n end", "title": "" }, { "docid": "6bff285a4dd47402747ff60b3b6a98cc", "score": "0.5012283", "text": "def test_chunks(part_number = @part_number)\n chunks = []\n chunk_index = -1\n data_lines(part_number).each do |line|\n if line[0] == '#'\n chunk_index += 1\n chunks[chunk_index] = [line[1..-1].strip, []]\n elsif chunk_index >= 0\n chunks[chunk_index][1] << line\n end\n end\n chunks\n end", "title": "" }, { "docid": "394d92c2c9d2abfc1f1138af8b8552b1", "score": "0.50079536", "text": "def initialize(pattern)\n\t\t# Duplication of data, but this lets us return everything in the exact\n\t\t# order it was received.\n\t\t@pattern = pattern\n\t\t@entries = []\n\t\t@entries_with_lines = {}\n\t\t@lines = []\n\tend", "title": "" }, { "docid": "cbfbac28454282cbfc587daace791ac1", "score": "0.4996432", "text": "def pattern_iterator\n yield Origen.generator.create_iterator\n end", "title": "" }, { "docid": "2e138921ab219ed9b3506c48027a6619", "score": "0.4995495", "text": "def pattern\n @image ||= ::Swt::Image.new(Shoes.display, load_file_image_data(@dsl.path))\n @pattern ||= ::Swt::Pattern.new(Shoes.display, @image)\n cleanup_temporary_files\n\n @pattern\n end", "title": "" }, { "docid": "0651a962cf987fb79be37186ae0294c9", "score": "0.49920604", "text": "def split()\n split_songs = {}\n track_names = track_names()\n \n track_names.each do |track_name|\n new_song = copy_ignoring_patterns_and_flow()\n \n @patterns.each do |name, original_pattern|\n new_pattern = new_song.pattern(name)\n \n if original_pattern.tracks.has_key?(track_name)\n original_track = original_pattern.tracks[track_name]\n new_pattern.track(original_track.name, original_track.wave_data, original_track.rhythm)\n else\n new_pattern.track(track_name, [], \".\" * original_pattern.tick_count())\n end\n end\n \n new_song.flow = @flow\n \n split_songs[track_name] = new_song\n end\n \n return split_songs\n end", "title": "" }, { "docid": "2bbc92ac91104bbaed57a99a933ca33a", "score": "0.49811372", "text": "def new_chunk(n)\n chunk = { :_id => BSON::ObjectId.new,\n :files_id => @files_id,\n :n => n,\n :data => '' }\n @chunks.insert([ chunk ])\n chunk\n end", "title": "" }, { "docid": "b4b65d285e10c822873a0c939cafd3b3", "score": "0.49786985", "text": "def gen_ticket_pattern\n begin\n ticket_pattern = Array.new(3) { gen_row_pattern }\n end until valid_ticket_pattern? ticket_pattern\n ticket_pattern\nend", "title": "" }, { "docid": "f62e5c175de8d75878de7f19eb63acd8", "score": "0.4968973", "text": "def add_pattern(input)\n last_node = @pattern_tree\n input.split(',').each do |new_node_value|\n existing_node = last_node.children[new_node_value]\n if existing_node\n last_node = existing_node\n else\n new_node = PathFinder::Node.new(new_node_value)\n # If newNodeValue = '*' then we put it last on the tree\n #so it is searched last\n last_node.children[new_node_value] = new_node\n\n # Next part should be a child of this\n last_node = new_node\n end\n end\n end", "title": "" }, { "docid": "2c09e0bcab0865c00a7aa4017974f2b0", "score": "0.49631464", "text": "def generate_with_pattern\n event_time = 0\n event = nil\n rate = generate_rate\n num_steps = @player.steps.generate.to_i.constrain(1..16)\n accent_on = (@player.accent_on.generate * (num_steps-1)).to_i\n \n # iterator to make events (# steps)\n num_steps.times do |i|\n \n # make individual event, set duration\n event = make_event :note, :at => event_time, :options => {\n num_steps => num_steps,\n :step_num => i,\n :accent => accent_on == i\n }, :data => {\n :duration => rate\n }\n event_time = event.end_at\n end\n\n make_event :done, :at => event_time\n \n return self\n end", "title": "" }, { "docid": "432693e39d86701d78c5fc984889747c", "score": "0.4959619", "text": "def pattern(name)\n @patterns[name] = Pattern.new(name)\n return @patterns[name]\n end", "title": "" }, { "docid": "432693e39d86701d78c5fc984889747c", "score": "0.4959619", "text": "def pattern(name)\n @patterns[name] = Pattern.new(name)\n return @patterns[name]\n end", "title": "" }, { "docid": "432693e39d86701d78c5fc984889747c", "score": "0.4959619", "text": "def pattern(name)\n @patterns[name] = Pattern.new(name)\n return @patterns[name]\n end", "title": "" }, { "docid": "1b846d15c0b60474e3c3ba284f7c443f", "score": "0.49136475", "text": "def create_extend(name, &block)\n new_extend = RbiGenerator::Extend.new(\n generator,\n name: name,\n &block\n )\n move_next_comments(new_extend)\n children << new_extend\n new_extend\n end", "title": "" }, { "docid": "401db85a3d10e837b513cabcf67a8891", "score": "0.49069047", "text": "def pattern(name, tracks=[])\n @patterns[name] = Pattern.new(name, tracks)\n end", "title": "" }, { "docid": "fe7ef54d9ba1d02f2e53987ef85356dc", "score": "0.49062178", "text": "def create_layout\n b = binding\n layout = File.join('lib', 'templates', 'chapter_template.erb')\n filename = File.join('source', 'partials', 'chapters', \"_#{@name}.erb.markdown\")\n ERB.new(File.read(layout), 0, '', '@output').result b\n File.open(filename, 'w+') { |f| f.write(@output) }\n end", "title": "" }, { "docid": "f4dc44d55ad18250c0f27928dc259cc9", "score": "0.49026105", "text": "def pattern_generate\n @values.clear\n hash = JSON.parse(pattern, :symbolize_names => true)\n hash.each do |p|\n case p[:type]\n when INCLUDE_RANGE\n get_range_values(p).each { |value|\n @values.push(value) unless @values.include?(value) }\n when EXCLUDE_RANGE\n get_range_values(p).each { |value|\n @values.delete(value) if @values.include?(value) }\n when INCLUDE_LIST\n p[:list].each { |list|\n @values.push(list) unless @values.include?(list) }\n when EXCLUDE_LIST\n p[:list].each { |list|\n @values.delete(list) if @values.include?(list) }\n end\n end\n end", "title": "" }, { "docid": "e8982b5827e77e87f0783d5c2f4d234f", "score": "0.49024922", "text": "def initialize pattern\n @pattern = pattern\n end", "title": "" }, { "docid": "e8982b5827e77e87f0783d5c2f4d234f", "score": "0.49024922", "text": "def initialize pattern\n @pattern = pattern\n end", "title": "" }, { "docid": "4f07f37d7ed8768d22dc01e6e98f91c2", "score": "0.49006903", "text": "def generate(pattern)\n pattern.background = Background.new(image: generate_background, preset: preset, color: color, generator: self.class)\n\n self\n end", "title": "" }, { "docid": "634b8d2a4dc611627e1205a4ce4d615c", "score": "0.4896906", "text": "def splitBlock(text, blockNum)\n newblock = text[blockNum].split(/[|:]/)\n end", "title": "" }, { "docid": "7606360e8950db66886447f3f98338c1", "score": "0.48945022", "text": "def split_n(n)\n lines = File.read(@path).split(\"\\n\")\n\n ranges = generate_ranges(lines.size, n)\n parts = ranges.map do |range|\n lines[range[0]..range[1]]\n end\n\n basename = File.basename(@path)\n filenames = (1..n).to_a.map { |k| basename + \".part.#{k}\" }\n paths = filenames.map { |name| File.join(@tmpdir, name) }\n \n filenames.each_with_index do |filename, i|\n File.open(paths[i], 'w') do |f|\n f.write(parts[i].join(\"\\n\"))\n end\n end\n\n paths\n end", "title": "" }, { "docid": "3b24aac5d848fc705a37c76b2b2abdd4", "score": "0.48896375", "text": "def add_pattern(klass, pattern, priority, &block)\n @patterns[klass] ||= {}\n @patterns[klass][priority] ||= []\n @patterns[klass][priority].delete_if { |p, _| p == pattern }\n @patterns[klass][priority] << [pattern, block]\n end", "title": "" }, { "docid": "1dfdf5e93b25a335b06e182bfa10fd0f", "score": "0.4887202", "text": "def new_pool\n\t\tputs \"[Pool] Generating new pool ...\"\n\t\t@i = 0\n\t\t(0...@pool_size).each do |j|\n\t\t\t@blocks[j] = f.next_block\n\t\tend\n\t\tputs \"[Pool] Done\"\n\tend", "title": "" }, { "docid": "e6e9281ee5a6ec8d214e4158aa39627b", "score": "0.48806855", "text": "def split_lines\n old_tabs = 0\n @template.each_with_index do |line, index|\n @line = index + 1\n \n # TODO: Allow comments appended to the end of lines,\n # find some way to make url(http://www.google.com/) work\n unless line[0..1] == COMMENT_STRING # unless line is a comment\n tabs = count_tabs(line)\n \n if tabs # if line isn't blank\n if tabs - old_tabs > 1\n raise SyntaxError.new(\"Illegal Indentation: Only two space characters are allowed as tabulation.\", @line) \n end\n @lines << [line.strip, tabs]\n\n old_tabs = tabs\n end\n end\n end\n @line = nil\n end", "title": "" }, { "docid": "2d985d1960c4d5763aed3907d1c92e57", "score": "0.48723024", "text": "def pattern_generate\n available.clear\n hash = JSON.parse(pattern, :symbolize_names => true)\n hash.each do |p|\n case p[:type]\n when INCLUDE_RANGE\n get_range_values(p).each { |value|\n available.push(value) unless available.include?(value) }\n when EXCLUDE_RANGE\n get_range_values(p).each { |value|\n available.delete(value) if available.include?(value) }\n when INCLUDE_LIST\n p[:list].each { |list|\n available.push(list) unless available.include?(list) }\n when EXCLUDE_LIST\n p[:list].each { |list|\n available.delete(list) if available.include?(list) }\n end\n end\n available.sort!\n available.each { |parameter| parameters.push(parameter) }\n end", "title": "" }, { "docid": "acd46cf24c92b969771734903e489fc4", "score": "0.48642537", "text": "def split()\n split_songs = {}\n track_names = track_names()\n \n track_names.each do |track_name|\n new_song = copy_ignoring_patterns_and_flow()\n \n @patterns.each do |name, original_pattern|\n new_pattern = new_song.pattern(name)\n \n if original_pattern.tracks.has_key?(track_name)\n original_track = original_pattern.tracks[track_name]\n new_pattern.track(original_track.name, original_track.rhythm)\n else\n new_pattern.track(track_name, \".\" * original_pattern.step_count)\n end\n end\n \n new_song.flow = @flow\n \n split_songs[track_name] = new_song\n end\n \n return split_songs\n end", "title": "" }, { "docid": "4b64bd2d618959220d2f6a9b1df732af", "score": "0.48528975", "text": "def add_block(pattern, feedback)\n @guesses << pattern\n @feedback << feedback\n end", "title": "" }, { "docid": "e991ad56c45d3768cad244c526c3c17e", "score": "0.48516598", "text": "def pattern_definition\n pattern_definitions[pattern_definition_filename] ||= begin\n m = platform::PatternDefinition.new(manually_register: true)\n name = \"#{pattern_definition_filename}_pattdef.csv\"\n if Origen.config.program_prefix\n unless name =~ /^#{Origen.config.program_prefix}/i\n name = \"#{Origen.config.program_prefix}_#{name}\"\n end\n end\n m.filename = name\n m.id = pattern_definition_filename\n m\n end\n end", "title": "" }, { "docid": "9eb257aa9dcc61b5dac6c8e04c4c58a9", "score": "0.48437905", "text": "def fetch_pattern(type, indentation)\n if type == :ul\n case indentation\n when 1 then %r/^( {0}[+*-])(#{PATTERN_TAIL})/o\n when 2 then %r/^( {0,1}[+*-])(#{PATTERN_TAIL})/o\n when 3 then %r/^( {0,2}[+*-])(#{PATTERN_TAIL})/o\n else %r/^( {0,3}[+*-])(#{PATTERN_TAIL})/o\n end\n elsif type == :ol\n case indentation\n when 1 then %r/^( {0}\\d+\\.)(#{PATTERN_TAIL})/o\n when 2 then %r/^( {0,1}\\d+\\.)(#{PATTERN_TAIL})/o\n when 3 then %r/^( {0,2}\\d+\\.)(#{PATTERN_TAIL})/o\n else %r/^( {0,3}\\d+\\.)(#{PATTERN_TAIL})/o\n end\n elsif type == :dl\n case indentation\n when 1 then %r/^( {0}:)(#{PATTERN_TAIL})/o\n when 2 then %r/^( {0,1}:)(#{PATTERN_TAIL})/o\n when 3 then %r/^( {0,2}:)(#{PATTERN_TAIL})/o\n else %r/^( {0,3}:)(#{PATTERN_TAIL})/o\n end\n end\n end", "title": "" }, { "docid": "7f04905c21f90d601f0d9a07558cb95f", "score": "0.48393005", "text": "def create_block(line)\r\n # Gather variables\r\n elements = line.split('|')\r\n line_num = elements[0]\r\n last_hash = elements[1]\r\n transactors = elements[2]\r\n time_val = elements[3]\r\n end_hash = elements[4]\r\n # Return Block made with variables\r\n Block.new(line_num, last_hash, transactors, time_val, end_hash)\r\n end", "title": "" }, { "docid": "a2402cbe4954fa7672c44fff606f3cac", "score": "0.4828124", "text": "def template\n [\n 'some text before',\n '<!-- @@SECTION1@@ -->',\n '<div>stuff1</div>',\n '<!-- @@SECTION2@@ -->',\n '<div>@@field1@@</div>',\n '<!-- @@SECTION4@@ -->',\n '<div>stuff4</div>',\n '<div>@@field3@@</div>',\n '<div>stuff5</div>',\n '<!-- @@SECTION4@@ -->',\n '<div>@@field4@@</div>',\n '<!-- @@SECTION2@@ -->',\n '<div>stuff2</div>',\n '<!-- @@SECTION3@@ -->',\n '<div>@@field2@@</div>',\n '<!-- @@SECTION3@@ -->',\n '<div>stuff3</div>',\n '<!-- @@SECTION1@@ -->',\n 'some text after'\n ]\n end", "title": "" }, { "docid": "a0eab5847db2297dbf52f08b9c922256", "score": "0.48231614", "text": "def split\n split_songs = {}\n track_names = track_names()\n\n track_names.each do |track_name|\n new_song = copy_ignoring_patterns_and_flow\n\n @patterns.each do |pattern_name, original_pattern|\n if original_pattern.tracks.has_key?(track_name)\n new_track = original_pattern.tracks[track_name]\n else\n new_track = Track.new(track_name, Track::REST * original_pattern.step_count)\n end\n\n new_song.pattern(pattern_name, [new_track])\n end\n\n new_song.flow = @flow\n\n split_songs[track_name] = new_song\n end\n\n split_songs\n end", "title": "" }, { "docid": "f4838e8bba0e42739b1f7fc93496e3b9", "score": "0.48203552", "text": "def test_pattern_block_no_handle\n assert_equal \"require 'foo'\\nfoo\", build_pattern_block('', \"=begin\\nrequire 'foo'\\nfoo\\n=end\")[1]\n end", "title": "" }, { "docid": "f4838e8bba0e42739b1f7fc93496e3b9", "score": "0.48203552", "text": "def test_pattern_block_no_handle\n assert_equal \"require 'foo'\\nfoo\", build_pattern_block('', \"=begin\\nrequire 'foo'\\nfoo\\n=end\")[1]\n end", "title": "" }, { "docid": "6663b4a6f3d4707304067c4a6b38cd69", "score": "0.48130915", "text": "def create_data\n @data = [free_space]\n counter = 0\n groups.each do |group|\n @data << group\n 15.times { @data << \">#{counter += 1}\" }\n end\n end", "title": "" }, { "docid": "2f6cb1b69c77c5e62e8467d3dc5b498e", "score": "0.4808026", "text": "def create_extend(type, &block)\n new_extend = RbsGenerator::Extend.new(\n generator,\n type: type,\n &block\n )\n move_next_comments(new_extend)\n children << new_extend\n new_extend\n end", "title": "" }, { "docid": "8b3d0773505088464fe9fa06638d1022", "score": "0.4806018", "text": "def show_pattern(pattern)\n raise if pattern.length > 10\n\n c = @colors\n\n Blink1.open do |b|\n pattern.each_with_index do |pattern_line, i|\n time = pattern_line.time\n color = c[pattern_line.color]\n\n b.write_pattern_line(time, *color, i)\n end\n\n # reset other pattern lines (necessary???)\n (pattern.length..10).each do |i|\n b.write_pattern_line(0, *c[:black], i)\n end\n\n b.play(0)\n end\n end", "title": "" }, { "docid": "97f74fde49e07f3ed135bc28a5e04e21", "score": "0.4803772", "text": "def each(&block)\n @patterns.each(&block)\n end", "title": "" }, { "docid": "4916f651e080e6e7242b4dfb5457c5a5", "score": "0.48009256", "text": "def patternType; end", "title": "" }, { "docid": "d4798dec4745c2cee203505031982ab4", "score": "0.47951892", "text": "def <<(pattern)\n @patterns << Pattern.from(pattern)\n self\n end", "title": "" }, { "docid": "fd9974dd24609e0029a75dadb77312cf", "score": "0.47937003", "text": "def splitByFile\n legacy = false\n outfile = nil\n stream = open(@filename, 'rb')\n until (stream.eof?)\n line = stream.readline\n\n # we need to create a new file\n if (line =~ /^Index: .*/) == 0\n # patch includes Index lines\n # drop into \"legacy mode\"\n legacy = true\n if (outfile)\n outfile.close_write\n end\n filename = getFilename(line)\n filename << \".patch\"\n outfile = createFile(filename)\n outfile.write(line)\n elsif (line =~ /--- .*/) == 0 and not legacy\n if (outfile)\n outfile.close_write\n end\n #find filename\n filename = getFilename(line)\n filename << \".patch\"\n outfile = createFile(filename)\n outfile.write(line)\n else\n if outfile\n outfile.write(line)\n end\n end\n end\n end", "title": "" }, { "docid": "7916b20ec14d1f43423d06824aecd653", "score": "0.4790731", "text": "def initialize name, pattern\n @name = name\n @pattern = pattern\n end", "title": "" }, { "docid": "3cd17b4d87d8e32c5d3536b4f9827c9b", "score": "0.47898316", "text": "def find_segments\n @begin_pattern, options = get_begin_pattern\n log_debug \"Pattern to find: #{@begin_pattern.inspect}\"\n @has_to_check_begin_pattern = self.respond_to?(:check_begin_pattern)\n # Parse options\n @max_regexp_size = 32\n @offset_inc = 1\n @begin_pattern_offset_in_segment = 0\n if (options != nil)\n @max_regexp_size = options[:max_regexp_size] if (options[:max_regexp_size] != nil)\n @offset_inc = options[:offset_inc] if (options[:offset_inc] != nil)\n @begin_pattern_offset_in_segment = options[:begin_pattern_offset_in_segment] if (options[:begin_pattern_offset_in_segment] != nil)\n end\n @metadata = {}\n @missing_previous_data = false\n foreach_begin_pattern do |begin_pattern_offset|\n next decode(begin_pattern_offset)\n end\n end", "title": "" }, { "docid": "8474244494f8069e8e08838e82446963", "score": "0.47846022", "text": "def createBlocks(aString)\n\ti = 0\n\tarrOfBlocks = []\n\twhile i < aString.length\n\t\tarrOfBlocks << aString[i..(i+2)]\n\t\ti = i + 3\n\tend\n\treturn arrOfBlocks\nend", "title": "" }, { "docid": "24d70908ac1ae0f06e36023e812028d9", "score": "0.47824612", "text": "def addPattern(pattern)\n node = @node0\n\n pl = pattern.length\n pl.times do |index|\n ch = pattern[index]\n if([email protected]?(ch))\n raise \"Search pattern contains elements, which are not in the alphabet.\"\n end\n aItem = AlphabetItem.new(ch)\n trs = node.getTransitionsFor(aItem)\n if(trs == nil)\n desc = NodeDescriptor.new\n desc.add(Label.new(@nodeCtr))\n @nodeCtr += 1\n newNode = addNode(Node.new(desc))\n node.addTransition(Transition.new(aItem, newNode))\n else\n newNode = trs[0].targetNode\n end\n node = newNode\n end\n node.finalPattern = pattern\n \n end", "title": "" }, { "docid": "98019039823bf91d1da039a166d639a0", "score": "0.47743675", "text": "def pattern\n #PHI-BLAST\n if !defined?(@pattern) and defined?(@pattern_in_database) then\n @pattern = nil\n @pattern_positions = []\n @f0message.each do |r|\n sc = StringScanner.new(r)\n if sc.skip_until(/^ *pattern +(.+)$/) then\n @pattern = sc[1] unless @pattern\n sc.skip_until(/^ at position +(\\d+)/)\n @pattern_positions << sc[1].to_i\n end\n end\n end\n @pattern\n end", "title": "" }, { "docid": "d04b4fd1304d1a74959e5fe2fda76f7c", "score": "0.47698843", "text": "def apply_patterns\n cached_result = Rails.cache.read(digest)\n if cached_result\n @lines_patterns = cached_result[:lines_patterns]\n @matched_patterns_to_lines = cached_result[:matched_patterns_to_lines]\n return\n end\n\n @lines_patterns = []\n line_count = 0\n consecutive_line_break_count = 0\n @matched_patterns_to_lines = Hash.new {|h, k| h[k] = {}}\n @reader.pages.each do |page|\n page.text.each_line do |line|\n # consecutive_line_break_count += 1 if line == \"\\n\"\n # next if should_skip_line?(line)\n\n line_count += 1\n matched_patterns = Set.new\n PATTERNS.each do |pattern|\n if pattern[:description] == 'preceded by multiple linebreaks'\n matched_patterns.add(pattern[:description]) if pattern[:proc].call(consecutive_line_break_count)\n else\n matched_patterns.add(pattern[:description]) if pattern[:proc].call(line)\n end\n end\n\n @lines_patterns.push({\n line_number: line_count,\n line_content: line,\n patterns: matched_patterns\n })\n\n consecutive_line_break_count = 0\n\n next if matched_patterns.empty?\n\n matched_content = line.split(DELIMITER_REGEX)[0].strip\n next if matched_content.empty? or matched_content.size > 25\n\n if @matched_patterns_to_lines[matched_patterns].has_key?(matched_content)\n @matched_patterns_to_lines[matched_patterns][matched_content] += 1\n else\n @matched_patterns_to_lines[matched_patterns][matched_content] = 1\n end\n\n end\n end\n Rails.cache.write(digest, {lines_patterns: @lines_patterns, matched_patterns_to_lines: @matched_patterns_to_lines.to_a.to_h})\n end", "title": "" }, { "docid": "35d82bcfbef49fd8039a681850981d2f", "score": "0.47688216", "text": "def parts\n part_urls() if last_part == 0\n\n if block_given?\n @parts.each do |i|\n yield \"#{@part_base}/#{i}\"\n end\n else\n # I want you Object#tap\n tmp = []\n parts {|part| tmp << part }\n tmp\n end\n end", "title": "" }, { "docid": "2f3ca40cd683058b17ae89846c6d0fae", "score": "0.47614768", "text": "def create(options = {}, &block)\n # Patch for Windows operation since the path can start with something like \"C:/\"\n if caller[0] =~ /(:(\\/|\\\\))/\n orig_separator = Regexp.last_match(1)\n file, line = *caller[0].sub(/:(\\/|\\\\)/, '_ORIG_SEPARATOR_').split(':')\n file = file.sub('_ORIG_SEPARATOR_', orig_separator)\n else\n file, line = *caller[0].split(':')\n end\n OrigenTesters::Flow.callstack << file\n flow_comments, comments = *_extract_comments(OrigenTesters::Flow.callstack.last, line.to_i)\n OrigenTesters::Flow.comment_stack << comments\n OrigenTesters::Flow.ht_comments = {}\n comments.each do |src_line, com_array|\n flow_src_line = src_line + com_array.size\n OrigenTesters::Flow.ht_comments[flow_src_line] = com_array\n end\n if OrigenTesters::Flow.flow_comments\n top = false\n name = options[:name] || Pathname.new(file).basename('.rb').to_s.sub(/^_/, '')\n Origen.interface.flow.group(name, description: flow_comments) do\n orig_create(options, &block)\n end\n else\n OrigenTesters::Flow.flow_comments = flow_comments\n if options.key?(:unique_ids)\n OrigenTesters::Flow.unique_ids = options.delete(:unique_ids)\n else\n OrigenTesters::Flow.unique_ids = true\n end\n top = true\n orig_create(options, &block)\n end\n OrigenTesters::Flow.callstack.pop\n OrigenTesters::Flow.comment_stack.pop\n OrigenTesters::Flow.flow_comments = nil if top\n end", "title": "" }, { "docid": "32804238bffaa878bdc1184f42c91797", "score": "0.47559795", "text": "def on_block(start_pattern, end_pattern, &action)\n\t\t\ton(start_pattern) do |env, start_match|\n\t\t\t\tindent = env.scopes.last.indent\n\t\t\t\tblock = []\n\t\t\t\twhile true\n\t\t\t\t\tline = env.lines.shift.chomp\n\t\t\t\t\tline = line[indent.size..-1]\n\t\t\t\t\tline = line || \"\"\n\t\t\t\t\tbreak if line.match(end_pattern)\n\t\t\t\t\tblock << line\n\t\t\t\tend\n\t\t\t\tend_match = $?\n\t\t\t\taction.call(env, block, start_match, end_match)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "ec9393594d6dda1459df7563b1918bdc", "score": "0.47511595", "text": "def split\n connect unless connected?\n child = self.class.new(host, user, pass, {:session => session, :parent => self}.merge(options))\n child.line_terminator = line_terminator\n children.push(child)\n child.on(:closed) do\n children.delete(child)\n fire(:childless).tap{ info(\"fired :childless\") } if children.empty?\n end\n fire(:split, child)\n block_given? ? yield(child).tap { child.close } : child\n end", "title": "" }, { "docid": "58bcad41d5c3fb06217ec1c182228a68", "score": "0.47469077", "text": "def pattern\n @@pattern ||= /(?:#{ patterns.map {|p| p.body.to_s}.join('|') })+/\n end", "title": "" }, { "docid": "e6a583bb4ef0557f89adf3a274880ecd", "score": "0.4740237", "text": "def new\n @parts = Part.new\n end", "title": "" }, { "docid": "a8bf236b3f3517e17fe9833b8d2eb2c8", "score": "0.47337714", "text": "def generate_grids\n return if @all_patterns.size > 0\n\n # all 9 bit patterns which have 5 bits set\n patts = []\n (0..4).each do |b1|\n (b1+1..5).each do |b2|\n (b2+1..6).each do |b3|\n (b3+1..7).each do |b4|\n (b4+1..8).each do |b5|\n patts << ((1<<b1)|(1<<b2)|(1<<b3)|(1<<b4)|(1<<b5))\n end\n end\n end\n end\n end\n raise \"Sanity error\" if patts.size != 126\n\n # try all combinations of three row patterns\n patts.each do |p1|\n patts.each do |p2|\n pp = p1 | p2\n patts.each do |p3|\n next unless pp | p3 == 0x1ff\n p = ((p1 << 18) | (p2 << 9) | p3)\n @all_patterns << p\n\n # Now index this pattern by category\n cat = p1.to_s(2).to_i(32) +\n p2.to_s(2).to_i(32) +\n p3.to_s(2).to_i(32)\n @cats[cat] ||= []\n @cats[cat] << p\n end\n end\n end\n end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" }, { "docid": "a21cf0b33f1bcab37cea597f763657c9", "score": "0.47311455", "text": "def pattern; end", "title": "" } ]
3571fc33958e4fe218a7535cce04a60d
This method fetch all closed issues pull requests (GitLab uses the term "merge requests")
[ { "docid": "0c0e75b1c43478fb1184065a04b54662", "score": "0.8453449", "text": "def fetch_closed_issues_and_pr\n issues = []\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n options = { state: \"closed\", scope: :all }\n @client.issues(@project_id, DEFAULT_REQUEST_OPTIONS.merge(options)).auto_paginate do |issue|\n issue = stringify_keys_deep(issue.to_hash)\n issue[\"body\"] = issue[\"description\"]\n issue[\"html_url\"] = issue[\"web_url\"]\n issue[\"number\"] = issue[\"iid\"]\n issues.push(issue)\n end\n\n print_empty_line\n GitHubChangelogGenerator::Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n [issues.map { |issue| stringify_keys_deep(issue.to_hash) }, fetch_closed_pull_requests]\n end", "title": "" } ]
[ { "docid": "6edbd9627af7d4a9466727f3c3e41e55", "score": "0.8732524", "text": "def fetch_closed_pull_requests\n pull_requests = []\n options = { state: \"merged\", scope: :all }\n\n @client.merge_requests(@project_id, options).auto_paginate do |new_pr|\n new_pr = stringify_keys_deep(new_pr.to_hash)\n # align with Github naming\n new_pr[\"number\"] = new_pr[\"iid\"]\n new_pr[\"html_url\"] = new_pr[\"web_url\"]\n new_pr[\"merged_at\"] = new_pr[\"updated_at\"]\n new_pr[\"pull_request\"] = true\n new_pr[\"user\"] = { login: new_pr[\"author\"][\"username\"], html_url: new_pr[\"author\"][\"web_url\"] }\n # to make it work with older gitlab version or repos that lived across versions\n new_pr[\"merge_commit_sha\"] = new_pr[\"merge_commit_sha\"].nil? ? new_pr[\"sha\"] : new_pr[\"merge_commit_sha\"]\n pull_requests << new_pr\n end\n\n print_empty_line\n\n GitHubChangelogGenerator::Helper.log.info \"Pull Request count: #{pull_requests.count}\"\n pull_requests.map { |pull_request| stringify_keys_deep(pull_request.to_hash) }\n end", "title": "" }, { "docid": "79dee8bba5a09449b1d0144b03459647", "score": "0.82468754", "text": "def fetch_closed_pull_requests\n pull_requests = []\n begin\n response = if @options[:release_branch].nil?\n @github.pull_requests.list @options[:user],\n @options[:project],\n state: \"closed\"\n else\n @github.pull_requests.list @options[:user],\n @options[:project],\n state: \"closed\",\n base: @options[:release_branch]\n end\n page_i = 0\n count_pages = response.count_pages\n response.each_page do |page|\n page_i += PER_PAGE_NUMBER\n log_string = \"Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\"\n print_in_same_line(log_string)\n pull_requests.concat(page)\n end\n print_empty_line\n rescue Github::Error::Forbidden => e\n Helper.log.warn e.error_messages.map { |m| m[:message] }.join(\", \")\n Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG\n end\n\n Helper.log.info \"Fetching merged dates: #{pull_requests.count}\"\n pull_requests\n end", "title": "" }, { "docid": "95fcbfc3e5dfb0c24dd6a447e2ddc307", "score": "0.822464", "text": "def closed_pull_requests\n OctocatHerder::PullRequest.find_closed_for_repository(owner_login, name, connection)\n end", "title": "" }, { "docid": "1e6423e391b93a8083e9e89a7f27f49e", "score": "0.80218124", "text": "def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n\n begin\n response = @github.issues.list user: @options[:user],\n repo: @options[:project],\n state: \"closed\",\n filter: \"all\",\n labels: nil\n page_i = 0\n count_pages = response.count_pages\n response.each_page do |page|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(page)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n rescue Github::Error::Forbidden => e\n Helper.log.warn e.error_messages.map { |m| m[:message] }.join(\", \")\n Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG\n end\n\n # separate arrays of issues and pull requests:\n issues.partition do |x|\n x[:pull_request].nil?\n end\n end", "title": "" }, { "docid": "d3681ee972b2d7b529a77defea474a5f", "score": "0.7976159", "text": "def fetch_opened_pull_requests\n opened_pull_requests = []\n @client.pull_requests(@repository).each do |pr|\n opened_pull_requests.push(pr[:number])\n end\n opened_pull_requests\n end", "title": "" }, { "docid": "bffd206eb0da064f3353a5dc0d285025", "score": "0.79505104", "text": "def open_pull_requests\n return [] if static? || MAIN_BRANCHES.include?(@reference)\n org = @repo.split(\"/\", 2).first\n GITHUB.pull_requests(@repo, head: \"#{org}:#{@reference}\").map(&:number)\n rescue Octokit::Error, Faraday::ConnectionFailed => e\n Rails.logger.warn \"Failed fetching pull requests for branch #{@reference}:\\n#{e}\"\n []\n end", "title": "" }, { "docid": "a407cc92a1472fd7ef6a9c32d47289d8", "score": "0.79398936", "text": "def fetch_closed_pull_requests; end", "title": "" }, { "docid": "1e3cb1c7d36512c696338031770d9c35", "score": "0.7824064", "text": "def pull_requests(repo_name)\n org_name = org_name_from(repo_name)\n\n unless @block\n if @org_name == org_name\n print '-'\n else\n puts ''\n print \"#{org_name} -\"\n @org_name = org_name\n end\n end\n\n issues = @client.issues(repo_name, creator: @login, state: 'open').\n select { |issue| issue.pull_request }\n issues.concat @client.issues(repo_name, creator: @login, state: 'closed').\n select { |issue| issue.pull_request }\n\n @block.call(repo_name, issues) if @block\n\n issues\n rescue Octokit::ClientError\n rescue => e\n puts e\n end", "title": "" }, { "docid": "5c5c9a29af81d491cc057eb7e5aefde1", "score": "0.7807776", "text": "def pull_issues\n GithubApi.pull_issues(self)\n end", "title": "" }, { "docid": "4b0eee647067648ebb8cc633ac41d491", "score": "0.78074044", "text": "def closed_pull_requests(github_api)\n\t\tclosed_pull_requests = github_api.pull_requests(full_name, 'closed')\n\t\tclosed_pull_requests.collect do |pr|\n\t\t\twas_merged = !!(pr['merged_at'])\n\t\t\tclosed = (pr['state'] == 'closed')\n\t\t\topen_time = (Chronic.parse(pr['created_at'])).to_time\n\t\t\tclose_time = (Chronic.parse(pr['closed_at'])).to_time\n\n\t\t\tuser = pr['user']\n\t\t\t# Ensure that the user exists before trying to continue\n\t\t\tnext unless user\n\t\t\tlogin = user['login']\n\t\t\tfrom_community = !(github_api.organization_member?('puppetlabs', login))\n\n\t\t\tHash[\"pr_number\" => pr['number'],\n\t\t\t\t\t \"repo_id\" => id,\n\t\t\t\t\t \"merge_status\" => was_merged,\n\t\t\t\t\t \"time_closed\" => close_time,\n\t\t\t\t\t \"time_opened\" => open_time,\n\t\t\t\t\t \"from_community\" => from_community,\n\t\t\t\t\t \"closed_v_open\" => closed]\n\t\tend\n\tend", "title": "" }, { "docid": "cc35b88d2a5bb34481acf5ed01623d79", "score": "0.7480842", "text": "def fetch_closed_issues_and_pr; end", "title": "" }, { "docid": "e9a5703447563ca664d403aa65cfd35c", "score": "0.7437797", "text": "def get_closed_issues\n issues = []\n path = \"/repos/#@user/#@repo/issues?state=closed&per_page=100&sort=updated&direction=asc\"\n page = 1\n headers = {'Authorization' => \"Basic #{Base64.strict_encode64(\"#@user:#@token\")}\"}\n\n http = Net::HTTP.start(\"api.github.com\", 443, nil, nil, nil, nil, use_ssl: true)\n\n loop do\n notify \"Retrieving page #{page}...\"\n\n resp = http.get(path, headers)\n new_issues = JSON.parse(resp.body)\n\n unless Array === new_issues then\n abort \"bad response: %p\" % new_issues\n end\n\n issues += new_issues\n\n # Pagination\n if resp['Link'] and resp['Link'].match(/<https:\\/\\/api\\.github\\.com(\\/[^>]+)>; rel=\"next\",/)\n path = $1\n page = path.match(/&page=(\\d+)/)[1]\n else\n http.finish\n break\n end\n end\n\n cutoff_date = (Date.today - @old_days).iso8601\n\n issues.reject do |issue|\n issue[\"locked\"] or\n issue[\"closed_at\"] > cutoff_date\n end\n end", "title": "" }, { "docid": "3e0aa1e53042a0c4026c2c21cbc13ff1", "score": "0.74360335", "text": "def get_repo_close_issues\n # 'state' => 'closed' is the parameters of 'get' default is 'opend'\n res = get \"/repos/#{load_current_repo}/issues\", 'state' => 'closed'\n if res.is_a?(Array)\n res.map do |issue|\n { 'name' => \"#{issue['title']}[closed]\", 'url' => issue['html_url'] }\n end\n else\n []\n end\n end", "title": "" }, { "docid": "b09371fb886afb30f03c3dd5f40ac772", "score": "0.7402711", "text": "def open_pull_requests\n OctocatHerder::PullRequest.find_open_for_repository(owner_login, name, connection)\n end", "title": "" }, { "docid": "bb86bf47a0d63aa9ad80db1c560c23b1", "score": "0.73701507", "text": "def pull_requests\n client.pull_requests(repository)\n end", "title": "" }, { "docid": "482d7781809c32cdc87394f27c1bfce1", "score": "0.7280954", "text": "def get_pull_requests_comments_for_repo(repo_full_name)\n return_array = []\n\n page = 1\n prs = []\n\n begin\n loop {\n prs_ = @gh_client.pull_requests(repo_full_name, :per_page => @per_page,\n :state => 'closed', :page => page)\n prs.concat(prs_)\n page += 1\n break if prs_.size < @per_page\n }\n page = 1\n loop {\n prs_ = @gh_client.pull_requests(repo_full_name, :per_page => @per_page,\n :state => 'open', :page => page)\n prs.concat(prs_)\n page += 1\n break if prs_.size < @per_page\n }\n rescue Exception => e\n puts(\"Unable to get pull requests for #{repo_full_name} #{e}\")\n return return_array\n end\n\n prs.sort_by! { |p| p.number }\n\n if (prs.size == 0)\n puts(\"#{repo_full_name} has no pull requests\")\n end\n\n cnt = 1\n prs.each { |pr|\n # if we don't have contiguous pull request numbers we'll create\n # a dummy to keep our pull request numbers equal from github to gitlab\n # this happens if an issue was created in github which was not\n # an actual pull request. We're only migrating pull requests here.\n while (pr.number > cnt)\n puts(\"making dummy #{pr.number} #{cnt}\")\n current_pull_hash = {}\n current_pull_hash[:number] = cnt\n current_pull_hash[:title] = \"Dummy issue\"\n current_pull_hash[:body] = \"\"\n current_pull_hash[:commits] = []\n current_pull_hash[:comments] = []\n return_array.push(current_pull_hash)\n cnt += 1\n end\n puts(\"getting #{repo_full_name}##{pr.number} #{cnt}\")\n cnt += 1\n\n current_pull_hash = {}\n current_pull_hash[:number] = pr.number\n current_pull_hash[:title] = pr.title\n current_pull_hash[:body] = pr.body\n\n # COMMITS ----------------------------------------\n page = 1\n #commits = []\n #loop {\n commits = @gh_client.pull_request_commits(repo_full_name, pr.number,\n :per_page => @per_page, :page => page)\n #commits.concat(commits_)\n #page += 1\n #break if commits_.size < @per_page\n #}\n\n current_pull_hash[:commits] = []\n commits.each { |c|\n commit_hash = {}\n user = c.commit.author.email\n user = user[0,(user.rindex('@')||user.length)]\n commit_hash[:username] = user\n commit_hash[:sha] = c.sha[0,7]\n commit_hash[:date] = c.commit.author.date\n commit_hash[:message] = c.commit.message\n current_pull_hash[:commits].push(commit_hash)\n }\n\n # COMMENTS ----------------------------------------\n page = 1\n comments = []\n #loop {\n comments.concat(@gh_client.pull_request_comments(\n repo_full_name, pr.number, :per_page => @per_page, :page => page))\n comments.concat(@gh_client.issue_comments(repo_full_name, pr.number,\n :per_page => @per_page, :page => page))\n #:per_page => @per_page, :page => page)\n #comments.concat(comments_)\n #page += 1\n #break if comments_.size < @per_page\n #}\n current_pull_hash[:comments] = []\n comments.each { |c|\n comment_hash = {}\n comment_hash[:username] = c.user.login\n comment_hash[:date] = c.created_at\n comment_hash[:body] = c.body\n current_pull_hash[:comments].push(comment_hash)\n }\n return_array.push(current_pull_hash)\n }\n return_array\n end", "title": "" }, { "docid": "38b7b9a417fcaeff8185e7428a214d5e", "score": "0.7237896", "text": "def query_pull_requests\n pull_requests = github_query(@client) { @client.pull_requests(@repository, :state=>\"open\") }\n\n @pull_request_details = []\n\n\n pull_requests.each { |p| \n\n issue = github_query(@client) { @client.issue(@repository, p.number) }\n\n $logger.debug(\"Issue loaded: #{issue}\")\n\n\n notification_users = Set.new()\n\n if issue.assignee\n notification_users << issue.assignee.login\n end\n\n if p.user.login\n notification_users << p.user.login\n end\n\n aging_pull_requests_notification = true\n aging_pull_requests_numdays = 7\n\n begin\n pb = PotentialBuild.new(@client, @token, p.head.repo.full_name, nil, p.head.sha, p.head.ref, p.head.user.login, nil, nil, p.number, p.base.repo.full_name, p.base.ref)\n configed_notifications = pb.configuration.notification_recipients\n if !configed_notifications.nil?\n $logger.debug(\"Merging notifications user: #{configed_notifications}\")\n notification_users.merge(configed_notifications)\n end\n\n aging_pull_requests_notification = pb.configuration.aging_pull_requests_notification\n aging_pull_requests_numdays = pb.configuration.aging_pull_requests_numdays\n\n if p.head.repo.full_name == p.base.repo.full_name\n $logger.info(\"Skipping pullrequest originating from head repo\")\n else\n @potential_builds << pb\n end\n rescue => e\n $logger.info(\"Skipping potential build: #{e} #{e.backtrace} #{p}\")\n end\n\n @pull_request_details << { :id => p.number, :creator => p.user.login, :owner => (issue.assignee ? issue.assignee.login : nil), :last_updated => issue.updated_at, :repo => @repository, :notification_users => notification_users, :aging_pull_requests_notification => aging_pull_requests_notification, :aging_pull_requests_numdays => aging_pull_requests_numdays }\n }\n end", "title": "" }, { "docid": "fb9096e71b332444bea563691df501f3", "score": "0.7192721", "text": "def pulls\n items = Github.get(\"repos/#{REPO}/pulls\")\n puts \"#{items.length} pull requests\"\n items.each do |i|\n puts \"_\" * 80\n puts color(\"\\##{i['number']} #{i['title']}\", :green)\n puts i['html_url']\n puts \"#{word_wrap(i['body'])}\" if i['body'] && !i['body'].empty?\n puts \"_\" * 80\n puts \"\"\n end\n end", "title": "" }, { "docid": "c889e7756eaa7667e0f6606457e6d345", "score": "0.71542823", "text": "def get_issues_pulls(repository)\n issues = @octokit.list_issues(repository, state: 'all')\n pulls = @octokit.pull_requests(repository, state: 'all')\n issues_open = 0\n issues_closed = 0\n pulls_open = 0\n pulls_closed = 0\n pulls_merged = 0\n issues.each do |i|\n issues_open += 1 if i['state'] == 'open'\n issues_closed += 1 if i['state'] == 'closed'\n end\n pulls.each do |p|\n pulls_open += 1 if p['state'] == 'open'\n if p['state'] == 'closed'\n pulls_merged += 1 unless p['merged_at'].nil?\n pulls_closed += 1 if p['merged_at'].nil?\n end\n end\n\n {\n issues: {\n closed: issues_closed,\n open: issues_open\n },\n pulls: {\n closed: pulls_closed,\n open: pulls_open,\n merged: pulls_merged\n }\n }\n end", "title": "" }, { "docid": "82b7317e2cf72b0aaa3c64329750e627", "score": "0.71022993", "text": "def clean_up_closed_pull_requests\n pull_requests_to_clean = @pull_requests.list_closed\n clean_up_pull_request_docker_resources(pull_requests_to_clean)\n clean_up_pull_request_site_export(pull_requests_to_clean)\n end", "title": "" }, { "docid": "3995fed6698bd6d8c388b2ea455388fe", "score": "0.7034362", "text": "def open_pull_requests(repo_full_name: nil, branches: nil)\n all_open_pull_requests = []\n github_action do\n all_open_pull_requests = client.pull_requests(repo_full_name, state: \"open\").map do |pr|\n GitHubOpenPR.new(\n current_sha: pr.head.sha,\n branch: pr.head.ref,\n repo_full_name: pr.head.repo.full_name,\n clone_url: pr.head.repo.clone_url\n )\n end\n end\n\n # if no specific branch, return all open prs\n return all_open_pull_requests if branches.nil? || branches.count == 0\n\n branch_set = branches.to_set\n all_open_pull_requests_on_branch = all_open_pull_requests.select do |pull_request|\n branch_set.include?(pull_request.branch)\n end\n\n # we want only the PRs whose latest commit was to one of the branches passed in\n pr_count = all_open_pull_requests.count\n logger.debug(\"Returning all open prs from: #{repo_full_name}, branches: #{branches}, pr count: #{pr_count}\")\n\n return all_open_pull_requests_on_branch\n end", "title": "" }, { "docid": "b4f515387a8345c29ee72fceaa8098c4", "score": "0.70298797", "text": "def fetchPullRequests(repository, conservative = false)\n\tbegin\n\t\topenRequests = []\n\t\t#get all open pull requests for the repository.\n\t\trawPullReqs = Octokit.pull_requests(repository)\n\t\t#iterate through each request and create a GitRequest object and populate it with files obtained through a pull_requests_files call.\n\t\trawPullReqs.each do |rawPull|\n\t\t\trawFiles = Octokit.pull_request_files(repository, rawPull[:number])\n\t\t\topenRequests << GitRequest.new(rawPull, rawFiles, conservative)\n\t\tend\n\t\treturn openRequests\n\trescue Octokit::Error => e\n\t\traise e\n\t\t#I'm going to let other errors slide for now.\n\tend\nend", "title": "" }, { "docid": "dbf3fb9006e9b54c01cf11838ffc4fc4", "score": "0.6975488", "text": "def update_all_open_prs_without_status_to_pending_status!(repo_full_name: nil, status_context: nil)\n open_pr_commits = open_pull_requests(repo_full_name: repo_full_name)\n updated_commits = []\n\n open_pr_commits.each do |open_pull_request|\n sha = open_pull_request.current_sha\n repo_full_name = open_pull_request.repo_full_name\n statuses = statuses_for_commit_sha(\n repo_full_name: repo_full_name,\n sha: sha\n )\n next unless statuses.count == 0\n\n if remote_status_updates_disabled?\n logger.debug(\"Remote status updates are disabled, remote status not updated for #{repo_full_name}, #{sha}\")\n else\n set_build_status!(\n repo: repo_full_name,\n sha: sha,\n state: \"pending\",\n status_context: status_context\n )\n end\n\n updated_commits << sha\n end\n\n return updated_commits\n end", "title": "" }, { "docid": "bdd4bd7b20204456aef535cd086079fb", "score": "0.6972131", "text": "def process_pull_requests\n raise RuntimeError,\n \"Github client is not available\" if @github_client.nil?\n\n raise RuntimeError, \n \"Github client is not ready\" unless @github_client.ready\n\n pulls_requiring_build = []\n\n start_time = Time.now.to_f\n $stderr.puts(\"Starting Github inspection...\") if @debug\n pulls_json = @github_client.pull_requests\n\n # Parse the JSON into JSON Objects\n pulls = JenkinsPullover::Github::Model.parse_github_json(pulls_json)\n\n if pulls.kind_of?(Hash) && pulls.has_key?(:message)\n raise RuntimeError,\n \"Github responded with error: #{pulls[:message]}\"\n end\n\n pulls.select {|pull| pull[:state] == \"open\"}.each do |pull|\n # Check the base branch matches\n next unless check_pull_base_branch(pull)\n\n # Examine the comments to detect whether build required\n if build_required(pull)\n $stderr\n .puts(\" => Build required on pull #{pull[:number]}\") if @debug\n \n pulls_requiring_build << pull\n end\n end\n\n epoc = (Time.now.to_f - start_time).round\n $stderr.puts(\"Completed Github inspection in #{epoc}s\") if @debug\n\n pulls_requiring_build\n end", "title": "" }, { "docid": "65055b16cc5bf2d044bd297489fcb910", "score": "0.695707", "text": "def open_issues\n @log.debug \"Listing issues ..\"\n issues_and_prs = client.issues(\n @repo,\n direction: 'desc',\n sort: 'created',\n state: 'open'\n )\n @log.debug format(\"%d open issues and PRs\", issues_and_prs.length)\n issues = issues_and_prs.reject { |i| i.key?(:pull_request) }\n @log.debug format(\"%d open issues (max %d)\", issues.length, MAX_ISSUES)\n issues.to_a.take(MAX_ISSUES).map { |resource| # Sawyer::Resource\n Issues::Factory.new.build(resource.to_h)\n }\n end", "title": "" }, { "docid": "64b04b31fb01a0a82c390fe5c6d83815", "score": "0.6946602", "text": "def get_issues_info\n closed_issues = []\n stop = false\n page = 1\n\n until stop\n issue_fetch = HTTParty.get(@GITHUB_API_BASE_URL + \"/issues?state=closed&page=#{page}&access_token=#{@access_token}\", headers: {\n \"User-Agent\" => @user_agent\n })\n\n if issue_fetch.is_a?(Hash) && issue_fetch['message'] === 'Not Found'\n break\n end\n\n if issue_fetch.count === 0\n stop = true\n end\n\n\n issue_fetch.each do |issue|\n closed_issues << {\n 'number' => issue['number'],\n 'created_at' => issue['created_at'],\n 'closed_at' => issue['closed_at'],\n 'duration' => (Date.parse(issue['closed_at']) - Date.parse(issue['created_at'])).to_i\n }\n end\n\n page += 1\n end\n\n closed_issues.reverse!\n end", "title": "" }, { "docid": "b2fd47d49f676c46960140fae70e0dc7", "score": "0.6912751", "text": "def filter_merged_pull_requests(pull_requests)\n print \"Fetching merged dates...\\r\" if options[:verbose]\n closed_pull_requests = @fetcher.fetch_closed_pull_requests\n\n pull_requests.each do |pr|\n fetched_pr = closed_pull_requests.find do |fpr|\n fpr[\"number\"] == pr[\"number\"]\n end\n if fetched_pr\n pr[\"merged_at\"] = fetched_pr[\"merged_at\"]\n closed_pull_requests.delete(fetched_pr)\n end\n end\n\n pull_requests.reject! do |pr|\n pr[\"merged_at\"].nil?\n end\n\n pull_requests\n end", "title": "" }, { "docid": "6f6f4698fb934b7886a5d30b430e269e", "score": "0.6891134", "text": "def pull_request_commits\n return [] if pull_requests.nil? || pull_requests.empty?\n\n access_token = ENV['GITHUB_ACCESS_TOKEN']\n puts \"GITHUB_ACCESS_TOKEN not present in the environment. Requests will be rate-limited.\" unless access_token\n\n client = Octokit::Client.new(access_token: access_token)\n commits = pull_requests.collect do |link|\n pr = link.gsub('https://github.com/', '').split('/pull/')\n repo = pr[0]\n number = pr[1]\n\n pr = client.pull_request(repo, number)\n\n {\n 'revision' => pr['merge_commit_sha'],\n 'comments' => pr['title']\n }\n end\n\n commits.flatten\n end", "title": "" }, { "docid": "190a8e9e4be8c225a258800962d07476", "score": "0.6862989", "text": "def fetch_issues(state)\n if state == :all\n fetch_issues(:closed).to_a + fetch_issues(:open).to_a\n else\n options = {\n user: organization, \n repo: name, \n state: state.to_s\n }\n result = []\n @github.issues.list(options).each_page { |page| result << page.to_a }\n result.flatten\n end\n end", "title": "" }, { "docid": "36957f30a207dfb881e126afe303db34", "score": "0.67976743", "text": "def filter_merged_pull_requests(pull_requests); end", "title": "" }, { "docid": "ff12e3b10343119da92418d28699ba2f", "score": "0.6797664", "text": "def cache_merge_requests_closing_issues\n @project.merge_requests.where(source_branch: @push.branch_name).each do |merge_request|\n merge_request.cache_merge_request_closes_issues!(@current_user)\n end\n end", "title": "" }, { "docid": "ec1ab3a83e2cf774dae8838c746d8108", "score": "0.6785839", "text": "def pull_all\n repositories.map(&method(:pull)).reduce(:+)\n end", "title": "" }, { "docid": "2d848054dc27f9d5dd3e957443a5f8c7", "score": "0.6776627", "text": "def merge_requests(label, state)\n Retriable.with_context(:api) do\n ReleaseTools::GitlabClient\n .client\n .user_merge_requests(scope: 'all', labels: label, state: state)\n .auto_paginate\n end\n rescue Gitlab::Error::Error => ex\n logger.warn(\n 'Failed to fetch release pressure',\n label: label,\n state: state,\n error: ex.message\n )\n\n []\n end", "title": "" }, { "docid": "a006a3d0160bde2bb809911becc7aecc", "score": "0.67572516", "text": "def issues_and_pulls(include_closed = false)\n @_issues_and_pulls ||= {}\n\n @_issues_and_pulls[include_closed] ||=\n IssueCollection.new(\n paginator_for_status(include_closed).to_a.flat_map do |gh|\n Issue.from_gh(org: @org, repo: @repo, gh: gh)\n end,\n )\n end", "title": "" }, { "docid": "4f2d80aa1bbefc0ec4bf69ff302a76eb", "score": "0.6750958", "text": "def update(state = 'open')\n @current_requests = @github.pull_requests(source_repo, state)\n repos = @current_requests.collect do |request|\n repo = request.head.repository\n \"#{repo.owner}/#{repo.name}\" if repo\n end\n repos.uniq.compact.each do |repo|\n git_call \"fetch [email protected]:#{repo}.git +refs/heads/*:refs/pr/#{repo}/*\"\n end\n end", "title": "" }, { "docid": "3c69587a25277f9516591fedd85fd6d7", "score": "0.6731086", "text": "def pull_requests(repo, options = T.unsafe(nil)); end", "title": "" }, { "docid": "799a49a53a426a3481339d888568cddf", "score": "0.6730372", "text": "def process_pull_requests(only_id=nil)\n pull_requests = []\n mergeability_in_flux = false\n $repo_to_pull_regex.keys.each do |repo|\n $stderr.puts \"Processing repo '#{repo}'\"\n list_pull_requests(repo).each do |req|\n id = req['number']\n next if Properties['oldest_pr'] and id.to_i < Properties['oldest_pr']\n\n $stderr.puts \"Analyzing pull request ##{id}\"\n next if only_id && id.to_i != only_id.to_i\n \n branch = req['base']['ref']\n \n if $branches.include?(branch) || $branches.include?('*') \n\n login = req['user']['login']\n\n # Skip if it's not mergeable\n mergeable = is_mergeable?(id, repo)\n $stderr.puts \"Mergeable #{mergeable}\"\n if mergeable\n set_mergeable(id, repo, login)\n else\n if set_not_mergeable(req, id, repo, login)\n mergeability_in_flux = true\n end\n next\n end\n\n statuses = get_statuses(req['head']['sha'], repo)\n comments = get_comments(id, repo)\n updated_at, changed_after_eval = get_updated_at(req)\n\n permission_denied = Array.new(Properties['settings'].length, false)\n # Has a merge or test been requested by a trusted user?\n Properties['settings'].values.each_with_index do |settings, i|\n trigger_regex = /\\[#{settings['name']}\\]/i\n if req['title'] =~ trigger_regex || req['body'] =~ trigger_regex || settings['run_without_trigger']\n if user_trusted?(login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, statuses, comments, settings]\n permission_denied[i] = false\n next\n else\n $stderr.puts \"User '#{login}' not trusted\"\n permission_denied[i] = true\n end\n end\n\n comments = sort_comments(comments)\n comments.each do |comment|\n if comment['body'] =~ trigger_regex\n comment_login = comment['user']['login']\n if user_trusted?(comment_login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, statuses, comments, settings]\n permission_denied[i] = false\n break\n else\n $stderr.puts \"User '#{comment_login}' not trusted\"\n permission_denied[i] = true\n end\n end\n end\n end\n if permission_denied.include? true\n add_status(req['head']['sha'], repo, 'pending', Properties['jenkins_url'], ACTION_NOT_TEAM)\n end\n else\n #add_status(req['head']['sha'], repo, 'error', Properties['jenkins_url'], ACTION_UNSUPPORTED_BRANCH)\n end\n end\n end\n \n if mergeability_in_flux\n $stderr.puts \"Waiting till next run to see if mergeability is in flux\"\n exit\n end\n\n sorted_pull_requests = pull_requests.sort_by do |req_info|\n req_info[1]\n end\n\n skipped_count = {}\n $branches.each do |branch|\n skipped_count[branch] = {}\n end\n sorted_pull_requests.each do |req_info|\n # Process the pull request\n req = req_info[0]\n updated_at = req_info[1]\n changed_after_eval = req_info[2]\n statuses = req_info[3]\n comments = req_info[4]\n settings = req_info[5]\n process_pull_request(req, updated_at, changed_after_eval, statuses, comments, settings)\n \n branch = req['base']['ref']\n\n submitted_tests = submitted_tests_for_branch(branch)\n if !settings['allow_multiple'] && submitted_tests[settings['name']]\n bot_status = get_status_with_prefix(req['head']['sha'], req['base']['repo']['name'], Properties['jenkins_url'])\n if bot_status && (bot_status['description'] =~ /^Waiting/)\n skipped_count_branch = skipped_count[branch] ? skipped_count[branch] : skipped_count['*'] \n skipped_count_branch[settings['name']] = 0 if skipped_count_branch[settings['name']].nil?\n skipped_count_branch[settings['name']] += 1\n queued_desc = \"Waiting: You are in the build queue at position: #{skipped_count_branch[settings['name']].to_s}\"\n add_status(req['head']['sha'], repo, 'pending', Properties['jenkins_url'], queued_comment)\n $stderr.puts \"Pull ##{req['number']} in repo '#{req['base']['repo']['name']}' is at build position ##{skipped_count_branch[settings['name']]}\"\n end\n end\n end\n end", "title": "" }, { "docid": "c4e128eb8cc966841e8621865c28f5b4", "score": "0.66728276", "text": "def merge_request_closes_issues(project_id, merge_request_iid)\n get(\"/projects/#{project_id}/merge_requests/#{merge_request_iid}/closes_issues\")\n end", "title": "" }, { "docid": "ed84a3b4349017757aafd1b3f4a7d896", "score": "0.6669182", "text": "def github_closed_issues(user, repo, milestone)\n issues = Github::Issues.new(user: user, repo: repo)\n mid = github_milestone_for(issues, user, repo, milestone)\n\n return nil if mid == -1\n\n options = { user: user, repo: repo, milestone: mid.to_s, state: 'closed', per_page: 100 }\n\n full_list = []\n 1.upto(1_000_000) do |i|\n options[:page] = i\n page = issues.list(options).map do |issue|\n ['#' + issue.number.to_s, issue.title, issue.html_url]\n end\n return full_list if page.size == 0\n full_list.concat page\n end\n full_list\nend", "title": "" }, { "docid": "1db7e4a53b9e59111e811731dab15a8e", "score": "0.6655081", "text": "def close_existing\n prs = @gh_conn.pull_requests(@repo.name)\n\n # find any open PRs by cookstyle bot\n prs.filter! { |x| x[:user][:login] == \"cookstyle[bot]\" && x[:state] == \"open\" }\n\n # We only want to close out the oldest PR if there's 2 or more\n return unless prs.count >= 2\n\n # sort by created date, drop the last one (current), and then close each old one why not\n # just assume there's only a new and old? Well what if someone reopens it or something\n # odd happens and the old one is never closed? Might as well assume 2+ to close\n old_prs = prs.sort_by { |pr| pr[:created_at] }\n old_prs.pop\n old_prs.each do |old_pr|\n @gh_conn.add_comment(@repo.name, old_pr[:number], \"Closing this pull request as it has been superseded by https://github.com/#{@repo.name}/pull/#{@number}, which was created with Cookstyle #{Cookstyle::VERSION}.\")\n @gh_conn.close_pull_request(@repo.name, old_pr[:number])\n end\n end", "title": "" }, { "docid": "117bdbcb790be7655d60056e9e75ca10", "score": "0.6633241", "text": "def merge_request_closes_issues(project_id, merge_request_iid)\n get(\"/projects/#{url_encode project_id}/merge_requests/#{merge_request_iid}/closes_issues\")\n end", "title": "" }, { "docid": "c9e3db3efdddf41c0cb98eba7182b22d", "score": "0.6619689", "text": "def fetch_pull_data()\n if CURRENT_BRANCH.include? \"/\"\n return open_json(\"#{REPO_URL}/pulls/#{CURRENT_BRANCH.split(\"/\")[1]}\")\n end\n return {}\nend", "title": "" }, { "docid": "3f729106c5405d4a6b40aa54b669867e", "score": "0.6613185", "text": "def sort_pull_requests(pull_requests)\n added_pull_requests = []\n pull_requests.each do |pr|\n added = false\n\n pr[\"labels\"].each do |label|\n break if @lmap[label[\"name\"]].nil?\n @smap[@lmap[label[\"name\"]]].issues << pr\n added_pull_requests << pr\n added = true\n\n break if added\n end\n end\n added_pull_requests.each { |req| pull_requests.delete(req) }\n @sections\n end", "title": "" }, { "docid": "e16a702aacb51325976656c318b437a7", "score": "0.65948355", "text": "def issues(include_closed = false)\n issues_and_pulls(include_closed).true_issues\n end", "title": "" }, { "docid": "b161e377280d0091d2fdf5acad8bfb19", "score": "0.6555583", "text": "def repo_pull_request_ranges(repo)\n client.pull_requests(repo, 'closed')\n .reject {|request| request.merged_at.nil? }\n .map do |request|\n {\n base: request.base.sha,\n head: request.head.sha,\n pr_number: request.number\n }\n end\n end", "title": "" }, { "docid": "de55dbb4c4f42f34e788d4ac9977ba0b", "score": "0.65323055", "text": "def rectify\n if local_merge_requests?\n closed_merge_requests.each do |closed_merge_request|\n Lita::GithubPrList::MergeRequest.new({ id: closed_merge_request.id, state: 'not_open', redis: redis }).handle\n end\n end\n end", "title": "" }, { "docid": "88160719d8c1f3620b4131c9ffa6af9a", "score": "0.64896625", "text": "def get_issues\n \n offset = 0\n issues = []\n begin\n json = RestClient.get(REDMINE_URL+\"/issues\", {:params => {:format => :json, :status_id => '*', :limit => 100, :offset => offset}})\n result = JSON.parse(json)\n issues << [*result[\"issues\"]]\n offset = offset + result['limit']\n print '.'\n end while offset < result['total_count']\n puts\n\n puts \"Retreived redmine issue index.\"\n issues.flatten!\n\n #puts \"Getting comments\"\n #issues.map! do |issue|\n # get_comments(issue)\n #end\n #puts \"Retreived comments.\"\n\n self.redmine_issues = issues.reverse!\n end", "title": "" }, { "docid": "25f4f2df74cbfa6701a9253d6877e255", "score": "0.6471934", "text": "def merged_with(owner, repo, build)\n #0. Merged with Github?\n q = <<-QUERY\n\t select prh.id as merge_id\n from pull_request_history prh\n\t where prh.action = 'merged'\n and prh.pull_request_id = ?\n QUERY\n r = db.fetch(q, build[:pull_req_id]).first\n unless r.nil?\n return :merge_button\n end\n\n #1. Commits from the pull request appear in the project's main branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n and prc.pull_request_id = ?\n QUERY\n db.fetch(q, build[:pull_req_id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return :commits_in_master\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[build[:pull_req]].nil?\n sha = @closed_by_commit[build[:pull_req]]\n unless @all_commits.select { |x| sha.start_with? x }.empty?\n return :fixes_in_commit\n end\n end\n\n comments = mongo['issue_comments'].find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => build[:pull_req_id].to_i},\n {:fields => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => :asc}}\n ).map{|x| x}\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :commit_sha_in_comments\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return :commit_sha_in_comments\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :merged_in_comments\n end\n end\n\n :unknown\n end", "title": "" }, { "docid": "375baec20952570d5fbd37e5a35dfeec", "score": "0.64685804", "text": "def merged_with(owner, repo, build)\n #0. Merged with Github?\n q = <<-QUERY\n\t select prh.id as merge_id\n from pull_request_history prh\n\t where prh.action = 'merged'\n and prh.pull_request_id = ?\n QUERY\n r = db.fetch(q, build[:pull_req_id]).first\n unless r.nil?\n return :merge_button\n end\n\n #1. Commits from the pull request appear in the project's main branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n and prc.pull_request_id = ?\n QUERY\n db.fetch(q, build[:pull_req_id]).each do |x|\n unless all_commits.select { |y| x[:sha].start_with? y }.empty?\n return :commits_in_master\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless closed_by_commit[build[:pull_req]].nil?\n sha = closed_by_commit[build[:pull_req]]\n unless all_commits.select { |x| sha.start_with? x }.empty?\n return :fixes_in_commit\n end\n end\n\n comments = mongo['issue_comments'].find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => build[:pull_req_id].to_i},\n {:projection => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => 1}}\n ).map { |x| x }\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :commit_sha_in_comments\n else\n # Commit appears in master branch\n unless all_commits.select { |y| x[0].start_with? y }.empty?\n return :commit_sha_in_comments\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :merged_in_comments\n end\n end\n\n :unknown\n end", "title": "" }, { "docid": "20f3af2a5045f98b3f549130db90639e", "score": "0.64678264", "text": "def prev_pull_requests(pr, action, proj_related = true)\n\n if action == 'merged' and proj_related\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from reduced_pull_request_history prh, reduced_pull_requests pr\n where prh.action = 'opened'\n and prh.created_at < ?\n and prh.actor_id = ?\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = ?;\n QUERY\n pull_reqs = db.fetch(q, pr[:created_at], pr[:pr_creator_id], pr[:project_id]).all\n pull_reqs.reduce(0) do |acc, pull_req|\n if not close_reason[pull_req[:pullreq_id]].nil? and close_reason[pull_req[:pullreq_id]][1] != :unknown # this means that the commits in pr are merged\n acc += 1\n end\n acc\n end\n elsif action == 'merged' and !proj_related\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from reduced_pull_request_history prh, reduced_pull_requests pr\n where prh.action = 'opened'\n and prh.created_at < ?\n and prh.actor_id = ?\n and prh.pull_request_id = pr.id\n QUERY\n pull_reqs = db.fetch(q, pr[:created_at], pr[:pr_creator_id]).all\n pull_reqs.reduce(0) do |acc, pull_req|\n if not close_reason[pull_req[:pullreq_id]].nil? and close_reason[pull_req[:pullreq_id]][1] != :unknown # this means that the commits in pr are merged\n acc += 1\n end\n acc\n end\n elsif action != 'merged' and proj_related\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from reduced_pull_request_history prh, reduced_pull_requests pr\n where prh.action = ?\n and prh.created_at < ?\n and prh.actor_id = ?\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = ?\n QUERY\n db.fetch(q, action, pr[:created_at], pr[:pr_creator_id], pr[:project_id]).all.size\n else\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from reduced_pull_request_history prh, reduced_pull_requests pr\n where prh.action = ?\n and prh.created_at < ?\n and prh.actor_id = ?\n and prh.pull_request_id = pr.id\n QUERY\n db.fetch(q, action, pr[:created_at], pr[:pr_creator_id]).all.size\n end\n end", "title": "" }, { "docid": "7edcf161d81812e7af2b9b6ae349d3b4", "score": "0.64326584", "text": "def open_newer_prs\n prs = @client.pull_requests(@repo, state: 'open').select do |pr|\n pr_last_update_less_than(pr, @options[:changed_since])\n end\n print_pr_resume(prs)\n prs\n end", "title": "" }, { "docid": "fe983f3fc25c926f5c541cb9837c52ee", "score": "0.6423575", "text": "def pull_requests(merges)\n merges.map do |line|\n line.match(/Auto merge of #(\\d+) - ([^,]+)/) do |m|\n {\n pr_number: m[1].to_i,\n joiner: \"-\",\n name: Git.safe_name(m[2])\n }\n end || line.match(/pull request #(\\d+) from (.*)$/) do |m|\n {\n pr_number: m[1].to_i,\n joiner: \"-\",\n name: Git.safe_name(m[2])\n }\n end || line.match(/(\\w+)\\s+(.*)\\(\\#(\\d+)\\)/) do |m|\n {\n pr_number: m[3].to_i,\n joiner: \"S\",\n name: m[2]\n }\n end\n end.compact\n end", "title": "" }, { "docid": "50aedd6920f535787702c87971bca9d3", "score": "0.6422441", "text": "def prev_pull_requests(pr, action)\n\n if action == 'merged'\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from pull_request_history prh, pull_requests pr\n where prh.action = 'opened'\n and prh.created_at < (select min(created_at) from pull_request_history prh1 where prh1.pull_request_id = ? and prh1.action = 'opened')\n and prh.actor_id = (select min(actor_id) from pull_request_history prh1 where prh1.pull_request_id = ? and prh1.action = 'opened')\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = (select pr1.base_repo_id from pull_requests pr1 where pr1.id = ?);\n QUERY\n\n pull_reqs = db.fetch(q, pr[:id], pr[:id], pr[:id]).all\n pull_reqs.reduce(0) do |acc, pull_req|\n if not @close_reason[pull_req[:pullreq_id]].nil? and @close_reason[pull_req[:pullreq_id]][1] != :unknown\n acc += 1\n end\n acc\n end\n else\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from pull_request_history prh, pull_requests pr\n where prh.action = ?\n and prh.created_at < (select min(created_at) from pull_request_history prh1 where prh1.pull_request_id = ?)\n and prh.actor_id = (select min(actor_id) from pull_request_history prh1 where prh1.pull_request_id = ? and action = ?)\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = (select pr1.base_repo_id from pull_requests pr1 where pr1.id = ?);\n QUERY\n db.fetch(q, action, pr[:id], pr[:id], action, pr[:id]).all.size\n end\n end", "title": "" }, { "docid": "fb48ac890598f79f9906181fd2e42d48", "score": "0.64203805", "text": "def open_merge_requests\n headers = { 'PRIVATE-TOKEN': token }\n merge_requests = []\n group_ids.each do |id|\n endpoint = \"#{api_url}/groups/#{id}/merge_requests?state=opened\"\n response = HTTParty.get(endpoint, headers: headers)\n merge_requests += JSON.parse(response.body)\n end\n merge_requests.map! { |mr| map_to_merge_request(mr) }\n merge_requests.reject!(&:wip?)\n merge_requests.sort! { |a, b| b.waiting_days <=> a.waiting_days }\n end", "title": "" }, { "docid": "588989817c98be6e1497f6e1fe50d739", "score": "0.64011955", "text": "def strip_pull_requests_from_issues(issues)\n issues.select { |issue| issue.pull_request.nil? }.compact\n end", "title": "" }, { "docid": "d29f42b345ee0b034bcd1fc5a53d6982", "score": "0.6400729", "text": "def get_filtered_pull_requests(pull_requests); end", "title": "" }, { "docid": "b2e485c6758970298c50bb3d55c0a7a1", "score": "0.63859636", "text": "def pull_repositories\n @pull_repositories\n end", "title": "" }, { "docid": "9543cb605e51cd6b847debae0678ecf5", "score": "0.6372009", "text": "def get_issues\n repos_meta = HTTParty.get(@GITHUB_API_BASE_URL + \"?access_token=#{@access_token}\", headers: {\n \"User-Agent\" => @user_agent\n })\n\n if repos_meta.is_a?(Hash) && repos_meta['message'] === 'Not Found'\n issues = nil\n else\n issues = repos_meta['open_issues_count']\n end\n\n issues\n end", "title": "" }, { "docid": "22f8c79d9c4323918c81faad6cbcece8", "score": "0.63713807", "text": "def pull_commits(repo, number, options = T.unsafe(nil)); end", "title": "" }, { "docid": "38dc14ad8e146ab2cf67398b8d6b3195", "score": "0.6366536", "text": "def issues\n @issues ||= Octokit.\n org_issues('everydayhero', filter: 'all', direction: 'asc').\n sort_by { |issue| issue.created_at }.\n select { |issue| issue.pull_request.rels[:html] }\n end", "title": "" }, { "docid": "0f733f98c23e7c02e1f256b8293401fd", "score": "0.63041127", "text": "def contribs_prs(repo:, since:)\n contributions = []\n commits = Set.new\n\n options = {\n sort: :created,\n state: :closed,\n direction: :desc,\n per_page: MAX_PRS\n }\n\n @client.pull_requests(repo, options).each do |pr|\n date = pr[:created_at].utc.to_datetime\n break if date < since\n\n @client.pull_commits(repo, pr[:number], per_page: MAX_COMMITS).map(&:sha).each do |commit|\n commits.add commit\n end\n\n description = pr[:title]\n author = pr[:user][:login]\n url = pr[:html_url]\n\n contributions << Contribution.new(\n author: author,\n description: description,\n date: date,\n url: url\n )\n end\n\n [contributions, commits]\nend", "title": "" }, { "docid": "4a385dab5e605d7b647c16a0844b714c", "score": "0.6301698", "text": "def reload_merge_requests\n merge_requests = @project.merge_requests.opened\n .by_source_or_target_branch(@push.branch_name).to_a\n\n # Fork merge requests\n merge_requests += MergeRequest.opened\n .where(source_branch: @push.branch_name, source_project: @project)\n .where.not(target_project: @project).to_a\n\n filter_merge_requests(merge_requests).each do |merge_request|\n if branch_and_project_match?(merge_request) || @push.force_push?\n merge_request.reload_diff(current_user)\n elsif merge_request.includes_any_commits?(push_commit_ids)\n merge_request.reload_diff(current_user)\n end\n\n merge_request.mark_as_unchecked\n end\n\n # Upcoming method calls need the refreshed version of\n # @source_merge_requests diffs (for MergeRequest#commit_shas for instance).\n merge_requests_for_source_branch(reload: true)\n end", "title": "" }, { "docid": "3a922099275a1b5c18ca9e9222ecc0e1", "score": "0.63014454", "text": "def issues\n @issues ||= Retriable.with_context(:api) do\n GitlabClient.issues(PRODUCTION, state: 'opened', labels: labels)\n .select { |issue| filter(issue) }\n end\n end", "title": "" }, { "docid": "62b041d7556894de66f7a67f475115a3", "score": "0.63005006", "text": "def fetch_events_async(issues)\n i = 0\n threads = []\n options = {}\n return if issues.empty?\n\n options[:target_type] = issues.first[\"merged_at\"].nil? ? \"issue\" : \"merge_request\"\n issue_events = []\n @client.project_events(@project_id, options).auto_paginate do |event|\n event = stringify_keys_deep(event.to_hash)\n # gitlab to github\n event[\"event\"] = event[\"action_name\"]\n issue_events << event\n end\n\n issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|\n issues_slice.each do |issue|\n threads << Thread.new do\n issue[\"events\"] = []\n issue_events.each do |new_event|\n if issue[\"id\"] == new_event[\"target_id\"]\n if new_event[\"action_name\"].eql? \"closed\"\n issue[\"closed_at\"] = issue[\"closed_at\"].nil? ? new_event[\"created_at\"] : issue[\"closed_at\"]\n end\n issue[\"events\"] << new_event\n end\n end\n print_in_same_line(\"Fetching events for #{options[:target_type]}s: #{i + 1}/#{issues.count}\")\n i += 1\n end\n end\n threads.each(&:join)\n threads = []\n end\n\n # to clear line from prev print\n print_empty_line\n\n GitHubChangelogGenerator::Helper.log.info \"Fetching events for issues and PR: #{i}\"\n end", "title": "" }, { "docid": "f8db7eecb446b282ef690f63c4f82823", "score": "0.6296316", "text": "def fetch_events_for_issues_and_pr\n print \"Fetching events for issues and PR: 0/#{@issues.count + @pull_requests.count}\\r\" if options[:verbose]\n\n # Async fetching events:\n @fetcher.fetch_events_async(@issues)\n @fetcher.fetch_events_async(@pull_requests)\n end", "title": "" }, { "docid": "7e5028c7627f7547aa8147b45624ce4a", "score": "0.6293395", "text": "def index\n @pull_requests = PullRequest.all\n end", "title": "" }, { "docid": "ab15c727bd00ee12dc8227487c2dffe3", "score": "0.6280952", "text": "def detect_actual_closed_dates(issues)\n print \"Fetching closed dates for issues...\\r\" if @options[:verbose]\n\n max_thread_number = 50\n issues.each_slice(max_thread_number) do |issues_slice|\n threads = []\n issues_slice.each do |issue|\n threads << Thread.new { find_closed_date_by_commit(issue) }\n end\n threads.each(&:join)\n end\n puts \"Fetching closed dates for issues: Done!\" if @options[:verbose]\n end", "title": "" }, { "docid": "c7ade6ceaa55ab96502dfa204a9ff4b1", "score": "0.6265941", "text": "def write_pull_requests_to_database\n \trepositories = Repository.all\n repositories.each do |repo|\n pull_requests = repo.closed_pull_requests(github_api)\n pull_requests.each do |pull_request|\n if pull_request.nil?\n warn \"Encounter nil pull request, skipping database entry\"\n else\n PullRequest.from_github(pull_request)\n end\n end\n end\n end", "title": "" }, { "docid": "063ea75b012b3dd3b4054191a14cc3d3", "score": "0.625923", "text": "def pulls(repo, options = T.unsafe(nil)); end", "title": "" }, { "docid": "1d32f0bbc9c4b3b367feafbdaad60d3b", "score": "0.6256238", "text": "def merged_with(pr)\n #0. Merged with Github?\n q = <<-QUERY\n\t select prh.id as merge_id\n from reduced_pull_request_history prh\n\t where prh.action = 'merged'\n and prh.pull_request_id = ?\n QUERY\n r = db.fetch(q, pr[:id]).first\n unless r.nil?\n return :merge_button\n end\n\n #1. Commits from the pull request appear in the project's main branch\n q = <<-QUERY\n\t select c.sha\n from reduced_pull_request_commits prc, reduced_commits c\n\t where prc.commit_id = c.id\n and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).all.each do |x|\n unless all_commits.select { |y| x[:sha].start_with? y }.empty?\n return :commits_in_master\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch (actually it's the default branch, not all the projects' default branch is master branch)\n sha = closed_by_commit[pr[:github_id]]\n unless sha.nil?\n if all_commits.include? sha\n return :fixes_in_commit\n end\n end\n\n # should take all kinds of comments into consideration (issue_comments/pull_request_comments/commit_comments)\n issue_comments = issue_comments(pr)\n\n # query pull_request_comments\n pull_request_comments = pr_comments(pr)\n\n # query commit_comments\n commit_comments = commit_comments(pr)\n\n comments = issue_comments.reverse.take(3)\n .concat(pull_request_comments.reverse.take(3))\n .concat(commit_comments.reverse.take(3))\n\n comments.map { |x| x[:body] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :commit_sha_in_comments\n else\n # Commit appears in master branch\n unless all_commits.select { |y| x[0].start_with? y }.empty?\n return :commit_sha_in_comments\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or\n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i)\n return :merged_in_comments\n end\n end\n\n :unknown\n end", "title": "" }, { "docid": "a44bb40c511ae55681d8be21c2211c7a", "score": "0.6233445", "text": "def issues_to_close(project)\n close_ticket_timeout = config.jira.close_ticket_timeout.to_i\n jql = \"PROJECT = '#{project}' AND status in ('Open', 'In Progress', 'Code Review')\n AND component = 'errors' AND updated <= -#{close_ticket_timeout}d\n ORDER BY updated DESC, key ASC, summary ASC\"\n ret = fetch_issues(jql)\n return ret\n end", "title": "" }, { "docid": "e0f13ed6a9389d12c10e071d3b652dfe", "score": "0.62278694", "text": "def fetch_multiple_pull_requests(pr_numbers)\n\t\tpull_requests = []\n\n\t\tpr_numbers.each { |id| pull_requests.push(fetch_pull_request(id)) }\n\n\t\treturn pull_requests\n\tend", "title": "" }, { "docid": "73f7783e27f9b14a04fa830c45b2bfbe", "score": "0.6225413", "text": "def get_repo_issues\n res = get \"/repos/#{load_current_repo}/issues\"\n if res.is_a?(Array)\n res.map do |issue|\n { 'name' => issue['title'], 'url' => issue['html_url'] }\n end\n else\n []\n end\n end", "title": "" }, { "docid": "3cad7ac1156fcbcf227e62545d8bae84", "score": "0.6217677", "text": "def retrieve_pull_request_data(pull_links)\n pull_links.each do |hyperlink|\n submission_hyperlink_tokens = hyperlink.split('/')\n hyperlink_data = {}\n hyperlink_data[\"pull_request_number\"] = submission_hyperlink_tokens.pop\n submission_hyperlink_tokens.pop\n hyperlink_data[\"repository_name\"] = submission_hyperlink_tokens.pop\n hyperlink_data[\"owner_name\"] = submission_hyperlink_tokens.pop\n github_data = get_pull_request_details(hyperlink_data)\n @gitVariable[:head_refs][hyperlink_data[\"pull_request_number\"]] = {\n head_commit: github_data[\"data\"][\"repository\"][\"pullRequest\"][\"headRefOid\"],\n owner: hyperlink_data[\"owner_name\"],\n repository: hyperlink_data[\"repository_name\"]\n }\n parse_github_pull_request_data(github_data)\n end\n end", "title": "" }, { "docid": "5e2f38e333bc20b42170705d6a99e4cf", "score": "0.62060124", "text": "def get_repos_from_details(details)\n repos = []\n details.each do |detail|\n prs = detail['pullRequests'] # Array\n $LOG.info(\"Found #{prs.size} pull requests\")\n prs.each do |pr|\n pr_url = pr['url']\n extract_github_pr_regex = %r{\\S+github\\.com\\/([\\w-]+)\\/([\\w-]+)\\/pull\\/([^\\/]+)}\n user, repository, pr_id = pr_url.match(extract_github_pr_regex).captures\n $LOG.info('Found pull request with, user: %s, repository: %s, pr_id: %s' % [user, repository, pr_id])\n repos << repository\n end\n end\n repos\nend", "title": "" }, { "docid": "6c5a53ac39db6644d917bdaa3e16b1cf", "score": "0.6194586", "text": "def git_fetch_and_pull(repo_set_spec)\n compute_repo_paths(repo_set_spec).each { |repo_path|\n cmd = %(cd #{ repo_path } && git remote update && git pull --all)\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n exit_status = wait_thr.value\n if exit_status.success?\n puts \" - Fetched and pulled #{ repo_path }\"\n else\n msg = %(Could not fetch and pull #{ repo_path }:\\n\\n).color(:red)\n puts(msg + stderr.read)\n end\n end\n }\n end", "title": "" }, { "docid": "8a8b965a91524fc97afb9f32a3dd16e4", "score": "0.6193846", "text": "def issues\n Bugly.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Bugly::Issue.new(i) }\n end", "title": "" }, { "docid": "d3d0b405478a6ede7fcec36d495e4fac", "score": "0.61884755", "text": "def jira_closed_issues(project, version, options)\n client = JIRA::Client.new(options)\n query = %Q{project = #{project} AND fixVersion = \"#{version}\" AND status = Resolved ORDER BY priority DESC}\n url = \"#{options[:site]}browse/\"\n\n client.Issue.jql(query).inject([]) do |list, issue|\n attrs = issue.attrs\n list << [attrs['key'], attrs['fields']['summary'], url + attrs['key']]\n list\n end\nend", "title": "" }, { "docid": "687f894d71a8c8f0eb202742d40d8601", "score": "0.61848956", "text": "def find_issues\n # count = 0\n # issues = github.list_issues(\"#{options[:user]}/#{options[:repository]}\", request_params)\n # issues.each{ |issue| count+= 1 if !issue.key?(:pull_request) }\n\n begin\n initial_issues = self.github_client.list_issues(\"#{user}/#{repository}\", request_params)\n rescue StandardError => e\n initial_issues = []\n\n if self.slack_command?\n return slack_format(true, nil, slack_user, slack_all_issues, nil, only_sender)\n end\n end\n\n last_page = find_last_page(initial_issues.size)\n return last_page unless self.slack_command?\n\n return slack_format(false, initial_issues, slack_user, slack_all_issues, last_page, only_sender)\n end", "title": "" }, { "docid": "a39e687e7092d3d736c1cca2e779463a", "score": "0.61841935", "text": "def pull_requests_merged\n search_criteria_present!\n\n query = \"q=type:pr+is:merged+org:#{org}+author:#{username}+updated:>=#{datetime}\"\n url = \"#{SEARCH_ENDPOINT}?#{results_size}&#{query}\"\n response = HTTParty.get url, options\n\n handle! response\n end", "title": "" }, { "docid": "9a0d21fb07e95ca03cd798a2ff641721", "score": "0.6184042", "text": "def open_bugs\n issues.find_all {|issue| issue.state == \"open\" and issue.labels.include?(\"bug\") }\n end", "title": "" }, { "docid": "643c72dc61b6cbd8ce58be60a029e4e4", "score": "0.6183432", "text": "def pull\n @project = Project.find params[:id]\n @pull = PullRequest.find params[:pull_id]\n @comments = Comment.where(polycomment_type: \"pull\", polycomment_id: @pull.id)\n end", "title": "" }, { "docid": "1c9195804ffb5e8db09213610d814c67", "score": "0.6158642", "text": "def pull_all(pulls)\n view.update_many(\"$pullAll\" => collect_operations(pulls))\n end", "title": "" }, { "docid": "cfd383dcdc3f0e30eec100a494334a1a", "score": "0.6154678", "text": "def pull_request_commits(owner, repo, number)\n get \"/repos/#{owner}/#{repo}/pulls/#{number}/commits\"\n end", "title": "" }, { "docid": "e30bad3ad146df02d603315994541ec2", "score": "0.615024", "text": "def cache_all_close_issues_for_repo\n issues = get_repo_close_issues\n File.open(ALL_ISSUE_CACHE_FILE, 'w') do |f|\n f.write issues.to_json\n end\n\n issues\n end", "title": "" }, { "docid": "2ec8e46273f28418b5e8bbf0595bc84a", "score": "0.6141624", "text": "def lock_old_closed_issues issues\n headers = {'Accept' => 'application/vnd.github.the-key-preview+json', # required for new lock API\n 'Content-Length' => '0', # required for PUT with no body\n 'Authorization' => \"Basic #{Base64.strict_encode64(\"#@user:#@token\")}\",\n 'Content-Type' => \"application/x-www-form-urlencoded\",\n }\n\n Net::HTTP.start(\"api.github.com\", 443, nil, nil, nil, nil, use_ssl: true) do |http|\n total = issues.length\n\n issues.each_with_index do |issue, i|\n number = issue['number']\n locking number, i, total\n\n _, _, _, _, _, path, * = URI.split issue[\"url\"]\n response = http.put(\"#{path}/lock\", '', headers)\n\n if response.code == \"204\" # 204 means it worked, apparently\n locked\n else\n error response.inspect\n end\n end\n end\n end", "title": "" }, { "docid": "9f52dadc1b0b4cd60ff5ac97be6e3b09", "score": "0.6140285", "text": "def issues\n id = 10000\n ISSUES.map do |i|\n id += 1\n i.merge(\n :id => id,\n :self => \"#{@jira_url}/rest/api/2/issue/#{id}\",\n :fields => i[:fields].merge(\n :status => i[:fields][:status].merge(\n :self => \"#{@jira_url}/rest/api/2/status/#{i[:fields][:status][:id]}\"\n )\n )\n )\n end\n end", "title": "" }, { "docid": "ac467209c26658ea224eea1340896c0b", "score": "0.6115112", "text": "def all(state = :all)\n if state == :all\n all(:open) + all(:closed)\n else\n @repository.load(:list, state, :issues).map do |fields| \n issue = Github::Issue.new(fields)\n issue.repository = @repository\n issue\n end\n end\n end", "title": "" }, { "docid": "1292646c2b6589e93178af130b7eac7f", "score": "0.6112741", "text": "def pull_request_commits\n @pull_request_commits ||= @octokit.pull_request_commits(\n @repository.full_name,\n @pull_request.number\n )\n end", "title": "" }, { "docid": "948580534d75274d95efe31ec2a711b9", "score": "0.61110604", "text": "def pull_requests\n Qapi::Github::PullRequestQuery.new(self)\n end", "title": "" }, { "docid": "40b9296b95e336c473cea7fcadf75c72", "score": "0.610629", "text": "def detect_actual_closed_dates(issues)\n print \"Fetching closed dates for issues...\\r\" if options[:verbose]\n\n i = 0\n issues.each do |issue|\n find_closed_date_by_commit(issue)\n i += 1\n end\n puts \"Fetching closed dates for issues: #{i}/#{issues.count}\" if options[:verbose]\n end", "title": "" }, { "docid": "194222d1d23782310cdf3991a4413253", "score": "0.6102796", "text": "def index\n load_suggestions\n @current_user = current_user\n @issues = []\n repos = github_client.repositories\n # magical API batch consoldiation\n repos.each do |repo|\n if repo.open_issues_count != 0\n issue_data = github_client.list_issues(\"#{repo.owner.login}/#{repo.name}\")\n issue_data.each do |collect| \n collect.repo = repo.name\n end\n @issues.push(issue_data)\n end\n end\n end", "title": "" }, { "docid": "ad678e2da8e44eaeee1d314d1d9306f0", "score": "0.60999113", "text": "def pull_request(owner, repo, number)\n get \"/repos/#{owner}/#{repo}/pulls/#{number}\"\n end", "title": "" }, { "docid": "e2ada42d6b6f7e31d6f7a76b99e22626", "score": "0.6092295", "text": "def get_changed_files!\n client = self.project.github_client\n client.pull_request_files(self.project.full_name, self.pull_id)\n end", "title": "" }, { "docid": "507a623692480b9c288a922de19ee9e0", "score": "0.60920227", "text": "def pull_request_comments\n @pull_request_comments ||= client.issue_comments(\n repository[:full_name],\n pull_request[:number]\n ).sort_by(&:created_at)\n end", "title": "" }, { "docid": "825f9bf67425b6868a1c654ab335a461", "score": "0.6086611", "text": "def merged_pull_requests!\n update_or_create_stats!('pull_requests_merged', merged: true)\n end", "title": "" }, { "docid": "6ac7a899dfe77c9489ac5d49c7904743", "score": "0.6081178", "text": "def each_issue_for_commits project_name, hashlist, &block\n hashlist.each do |revhash|\n repo = get_repo()\n\n debug \"Fetching issues for #{revhash}\"\n\n commit = repo.lookup(revhash)\n diff = commit.parent.diff(commit)\n diff.each_patch do |patch|\n\n # Get the added lines\n lines = Set.new\n patch.each_hunk do |hunk|\n hunk.each_line do |line|\n if line.addition?\n lines << line.new_lineno\n end\n end\n end\n\n # Get the current issues for the file\n delta = patch.delta\n filename = delta.new_file[:path]\n\n debug \"Fetching issues for file '#{filename}'\"\n\n sonar_resource_name = project_name + ':' +\n filename.sub(SRC_PREFIX_REGEX, '') \\\n .sub(/.java$/, '') \\\n .gsub('/', '.')\n\n # http://docs.codehaus.org/pages/viewpage.action?pageId=231080558#WebService/api/issues-GetaListofIssues\n url = \"http://sonar.zoo.lan:9000/api/issues/search?components=#{sonar_resource_name}\"\n # exclude already fixed issues:\n url += \"&statuses=OPEN,REOPENED,CONFIRMED\"\n debug \"Fetching JSON from '#{url}'\"\n issues_json = Net::HTTP.get_response(URI.parse(url)).body\n all_issues = JSON.parse(issues_json)\n\n new_issues = all_issues['issues'].select do |issue|\n included = lines.include? issue['line']\n debug \"#{issue} is #{included ? 'NOT ' : ''}included\"\n included\n end\n\n # print the result\n new_issues.each &block\n end\n end\nend", "title": "" }, { "docid": "44be1395fcb5bd69ab96c7063e394f61", "score": "0.6061952", "text": "def pull_request_commits\n @octokit.pull_request_commits(@repository.full_name, @pull_request.number)\n end", "title": "" }, { "docid": "1153f6c1a6bb5e939c83a59490bea0e1", "score": "0.6051703", "text": "def pull_reqs(project, github_id = -1)\n q = <<-QUERY\n select u.login as login, p.name as project_name, pr.id, pr.pullreq_id as github_id,\n a.created_at as created_at, b.created_at as closed_at, c.sha as base_commit,\n\t\t\t (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id\n and prh1.action='merged' limit 1) as merged_at,\n timestampdiff(minute, a.created_at, b.created_at) as lifetime_minutes,\n\t\t\ttimestampdiff(minute, a.created_at, (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id and prh1.action='merged' limit 1)\n ) as mergetime_minutes\n from pull_requests pr, projects p, users u,\n pull_request_history a, pull_request_history b, commits c\n where p.id = pr.base_repo_id\n\t and a.pull_request_id = pr.id\n and a.pull_request_id = b.pull_request_id\n and a.action='opened' and b.action='closed'\n\t and a.created_at < b.created_at\n and p.owner_id = u.id\n and c.id = pr.base_commit_id\n and p.id = ?\n QUERY\n\n if github_id != -1\n q += \" and pr.pullreq_id = #{github_id} \"\n end\n q += 'group by pr.id order by pr.pullreq_id desc;'\n\n db.fetch(q, project[:id]).all\n end", "title": "" }, { "docid": "06cbbca46e3d295e13427500bf372525", "score": "0.60511523", "text": "def too_many_open_pull_requests?\n pull_requests_to_review.size == GH_API_PER_PAGE && client.last_response.rels[:next].present?\n end", "title": "" } ]
e2d7f3f8f4074a799174ec9c3f570d9d
User returning a book
[ { "docid": "4de1c00cbc839c2904018ecb653a2a1d", "score": "0.68087184", "text": "def return\n @book = Book.find(params[:book_id])\n @book.is_borrowed = false\n @book.user = nil\n @book.save\n redirect_to request.referrer, notice: \"You're being redirected\"\n end", "title": "" } ]
[ { "docid": "14db97ca2136382dbde0938718a602f9", "score": "0.7613581", "text": "def retrieve_book\n @book = Book.find(params[:book_id])\n end", "title": "" }, { "docid": "772f01bff230b04c26f89cdcfbfca073", "score": "0.7500451", "text": "def book\n fetch('harry_potter.books')\n end", "title": "" }, { "docid": "f77547767b632e9c3ffc33028195a001", "score": "0.7476924", "text": "def return_book\n\t\tselect = make_selection.to_i\n\t\tselect = verify_book_exists(select)\n\t\tb = Book.find(select)\n\t\tpatron_id = nil\n\t\tb.update_attributes(patron_id: patron_id)\nend", "title": "" }, { "docid": "64de668d6ea1adbf410ce5ac8b795f3e", "score": "0.7427544", "text": "def get_book\n @book = Book.where(id: params[:book_id]).first\n end", "title": "" }, { "docid": "c2de7e8c7caa3f8d76d57db38a2f0e60", "score": "0.7387757", "text": "def returnbook\n @books = Book.all \n end", "title": "" }, { "docid": "6c925694ee32435701c1e6d397e153c9", "score": "0.72547805", "text": "def return_book(book)\n\t\tif self.books.include?(book)\n\t\t\tputs \"Returned #{book.title}\"\n\t\t\tself.books.delete(book)\n\t\telse\n\t\t\tputs \"#{self.name} could not return this book as they no longer have it!\"\n\t\tend\n\tend", "title": "" }, { "docid": "01ce57137b5921eceb3561175b9d7456", "score": "0.724573", "text": "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", "title": "" }, { "docid": "a62d42d22adb9d6d077d5287d65aa29c", "score": "0.71007186", "text": "def book\n @books=Book.all\n @book=Book.find(params[:id])\n end", "title": "" }, { "docid": "0c9f9f7f50d5d8f2757a42efe90c4dbc", "score": "0.7039296", "text": "def return_user_books(input)\n @books = GoogleBooks::API.search(@input, :count => 5)\n @books.each do |book|\n if !(book.title.nil? || book.authors.nil? || book.publisher.nil?)\n puts book.title, book.authors, book.publisher, \"\\n\"\n end\n end\n\n def save_book_title\n puts \"If you would like to save a book to your reading list, please type the title of the book you'd like to save.\" .blue\n get_user_book_input(@input)\n book_input = @input\n if book_to_save = @books.find{|book| book.title == book_input }\n GoogleLib::Google_library.all << book_input\n else\n puts \"Please enter a valid title\"\n save_book_title\n end\n end\n end", "title": "" }, { "docid": "c80f0d9d0c11d69aa82c8fe376b72f11", "score": "0.702928", "text": "def find_book\n\t@book = Book.find(params[:id])\nend", "title": "" }, { "docid": "ad4a7b7b62ad02e7e0b8fcb979aa34fa", "score": "0.6975033", "text": "def return_book(title)\n # find book instance by title\n searched_book = Book.find_by(title: title)\n # change book.available to true\n searched_book.update_column(:available, true)\n # checks to see if title is in checkouts and .checked_out == true then changes checkout.checked_out to false\n self.checkouts.find{|checkout| checkout.book.title == title && checkout.checked_out == true}.update_column(:checked_out, false)\n end", "title": "" }, { "docid": "6b79a63ce219cc8110f5d506e616dc93", "score": "0.69531417", "text": "def get_books()\n @books_out\n end", "title": "" }, { "docid": "6b79a63ce219cc8110f5d506e616dc93", "score": "0.69531417", "text": "def get_books()\n @books_out\n end", "title": "" }, { "docid": "d05a5592eb9683ac64abd3864be56bd6", "score": "0.69267166", "text": "def book\n sql = \"SELECT * FROM books WHERE books.id = $1\"\n values = [@book_id]\n book_data = SqlRunner.run(sql, values)\n book = Book.map_items(book_data).first\n return book\n end", "title": "" }, { "docid": "1fe43974270e9b1ebd3eb417e770e2b0", "score": "0.6908896", "text": "def index\n @book = Book.find(params[:book_id])\n end", "title": "" }, { "docid": "117f18c53bc43f106e760903dd713f9b", "score": "0.6906682", "text": "def new\n\n @user = User.find(current_user.id)\n @book = Book.new\n @book.user_id = @user.id\n\n @book = Book.new(:title => params[:rtitle],:author => params[:rauthor], :isbn => params[:risbn])\n # @book = Book.find_by_user_id(@user.id)\n\n isbn = @book.isbn\n user_id = @user.id\n books = Book.find_by_isbn_and_user_id(isbn,user_id)\n if books.nil?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n else\n redirect_to \"/books/search\"\n flash[:alert] = \"the book '#{@book.title}' already exist - please search for another book!!!\"\n end\n end", "title": "" }, { "docid": "8fdffa082f7b5ee0e5a1c5fc3c609921", "score": "0.6843599", "text": "def borrowBook()\n puts \"Enter the user name: \"\n user_name = gets.chomp\n\n # check if the user name is valid\n if isUserValid?(user_name)\n then\n # check if the user's book limit is exceeded\n if !isUserBookLimitExceeded?(user_name)\n then\n puts \"\\nEnter the book to be borrowed: \"\n book_name = gets.chomp\n # check if the requested book is available\n if isBookAvailable?(book_name)\n then\n puts \"The book is available!\\n\"\n # add the book to the user's list of borrowed books\n updateUserBooks(user_name, book_name)\n # decrement the number of available copies\n updateBookCopies(book_name)\n # display the details\n displayLibraryDetails()\n else\n # error message\n puts \"Sorry! This book is not available!\"\n end\n else\n # error message\n puts \"Book limit exceeded!\"\n end\n else\n # error message\n puts \"Invalid user!!\"\n end\n end", "title": "" }, { "docid": "37f129e626cf1921755bb8c82b9ee35a", "score": "0.6833453", "text": "def show\n\t\t@book=Book.find(params[:id])\n\tend", "title": "" }, { "docid": "41c5dfd459fe60381d7e69b0a72329c7", "score": "0.68287975", "text": "def get_book(book_isbn)\n plsql.books.first :book_isbn => book_isbn\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "0bebc4cca536ccf77401412b435917da", "score": "0.68206954", "text": "def show\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "36af8e7f046e993c991ba8096da1a97c", "score": "0.68111503", "text": "def load_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "f57ea006d4a63dd8cc7e2239ecd7a510", "score": "0.6713898", "text": "def books \n @books\n end", "title": "" }, { "docid": "136cb3e0ba17f189cb38f71940f8b2fb", "score": "0.6709444", "text": "def show\n @book = Book.find params[:id]\n end", "title": "" }, { "docid": "fcb1822c1f7e05d09555b0392cadb933", "score": "0.67070985", "text": "def get_book\n return input_title = @inventory\n end", "title": "" }, { "docid": "8ced5ebd2244fbb9169320e9b38dccd5", "score": "0.6691757", "text": "def show\n @book=Book.find(params[:id])\n\n end", "title": "" }, { "docid": "03ebf28de8c23911edebc1dd213b18eb", "score": "0.66806537", "text": "def show\n @book = Book.find(params[:id])\nend", "title": "" }, { "docid": "ac1c669612a9e8f902ae65b61a57b64c", "score": "0.66771483", "text": "def get_book(book_num)\n return @books_list[book_num]\n end", "title": "" }, { "docid": "06c96ae234cf6b12bb4ee54230e65550", "score": "0.665941", "text": "def display_resource(book)\n book.title\n end", "title": "" }, { "docid": "41dbdd0d58e121d8e5f10fde62db969a", "score": "0.6657245", "text": "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "title": "" }, { "docid": "97e6394566082a7ee69b3cb68797e001", "score": "0.6647291", "text": "def index\n @books = Book.get_avaible_books\n end", "title": "" }, { "docid": "d517b01c87f3c2c168fca14be470b595", "score": "0.6620466", "text": "def booker_new\n end", "title": "" }, { "docid": "d1af4e58ed731257650a60385ab63bc9", "score": "0.6599449", "text": "def show\n @book = Book.where(id: params[:id]).first\n end", "title": "" }, { "docid": "0377192c7a5ff631908baf80dce80c20", "score": "0.6592029", "text": "def show\n @books = Book.find(params[:id])\n puts @book\n end", "title": "" }, { "docid": "a040f26a4426fd24b6f21851fa73b104", "score": "0.65779823", "text": "def set_book\n @book = current_user.books.find(params[:id])\n end", "title": "" }, { "docid": "046447c59671a92d1b60fc8164bd696a", "score": "0.65515924", "text": "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return Book.new( item )\n end\n return nil\n end", "title": "" }, { "docid": "a260c060e40b91823227ecbc1945a65a", "score": "0.65290105", "text": "def current_book\n @current_book ||= books.find_by!(:slug => params[:book_slug] || params[:book_book_slug])\n end", "title": "" }, { "docid": "f9a5f5771b7029f6ca35fca1944f49cc", "score": "0.65060264", "text": "def books\n\t\tif params[:id].nil? || params[:id].to_i.eql?(@current_user.id) \n\t\t\t@user = current_user\n\t\telse\n\t\t\t@user = User.find(params[:id])\n\t\tend\n\t\t@books = @user.books\n\tend", "title": "" }, { "docid": "2f339958f446933375430b62c2839fab", "score": "0.64887697", "text": "def return_books(books, user)\n\t\tif @users.include? user then\t\t\t\n\t\t\t(@records.select {|record| !record.has_return && record.user_id.eql?(user.id)}).each do |record|\n\t\t\t\tbooks.uniq.each do |book|\n\t\t\t\t\tif book.isbn == record.book_isbn then\n\t\t\t\t\t\tinventory[book] += 1\n\t\t\t\t\t\trecord.has_return = true\n\t\t\t\t\t\tputs \"Successfully return <#{book.title}> to the library\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tcheck_records(user)\n\t\tend\n\tend", "title": "" }, { "docid": "e0d68ce2f0f8e81136eaca53d05c38a6", "score": "0.6488258", "text": "def loan\n # retrieve the book objet to be loaned\n @book = Book.friendly.find(params[:id])\n # check if the book is available\n if @book.available?\n @book.status = Book.statuses[:borrowed]\n @book.save\n # redirect to book show page with a success message\n redirect_to store_show_path, notice: 'You have successfully borrowed this book'\n else\n # redirect to book show page with an error message\n redirect_to store_show_path, alert: 'This book is not available, you can not borrow this'\n end\n end", "title": "" }, { "docid": "2ea4e1c16592efbe57c3a6fb9d22edbf", "score": "0.6486338", "text": "def get_publisher #returns for a specific object/instance of type Book\n puts \"I'm in the get publisher instance method\"\n end", "title": "" }, { "docid": "f567bf1eb238a3d314418c96cd57e20b", "score": "0.6482276", "text": "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end", "title": "" }, { "docid": "5865ac2a8017dccb2a689d903b1226fa", "score": "0.64792985", "text": "def show\n @book = Book.find(params[:id]) # Find Book instance from id in params\n @userbook = UserBook.find_by(user_id: current_user.id, book_id: @book.id) # Find UserBook instance associated with current user and book to display the current user's book activity\n end", "title": "" }, { "docid": "61e294739b8859b877b67958d41b25e5", "score": "0.6478996", "text": "def title\n\t\t@book\n\tend", "title": "" }, { "docid": "fdde6801366541aee4812d571abe7303", "score": "0.64763856", "text": "def new\n @book = Book.new\n\n do_response @book\n end", "title": "" }, { "docid": "586d53bb7f7fdab51d496d5eccd02784", "score": "0.6474397", "text": "def user_books\n @title = \"My Books\"\n @user = User.find(params[:id])\n @books = @user.book_lists.paginate(page: params[:page])\n render 'user_books'\n end", "title": "" }, { "docid": "2aba333e0e03ec60e5a9a41e07ea5147", "score": "0.64732736", "text": "def book(params)\n Ciirus::Commands::Booking.new(credentials).call(params)\n end", "title": "" }, { "docid": "bb48c0142eb5867d6c76d53f35a35048", "score": "0.646959", "text": "def set_book\n @book = current_author.books.friendly.find(params[:id])\n end", "title": "" }, { "docid": "6418d88a2487b173131693c28b92edc8", "score": "0.64668703", "text": "def set_book\n if Book.exists?(params[:id])\n @book = Book.find(params[:id])\n else\n redirect_to \"/books\", alert: \"there's no SUCH book\"\n end\n end", "title": "" }, { "docid": "53b252824ce58ecea653f677cb7146b2", "score": "0.6466238", "text": "def index\n @books = current_user.books\n end", "title": "" }, { "docid": "065b7d30cefb0742cb3f7929f6bff4ac", "score": "0.64640945", "text": "def book(params)\n fetcher = THH::Commands::Booking.new(credentials)\n raw_booking = fetcher.call(params)\n\n if !raw_booking.success? && raw_booking.error.code == :not_available\n return not_available\n end\n return raw_booking unless raw_booking.success?\n\n reservation = build_reservation(params, raw_booking.value)\n Result.new(reservation)\n end", "title": "" }, { "docid": "260c919f72b34fc3efd3dcff3dbf464d", "score": "0.64628524", "text": "def find_book\n choice = self.prompt.select(\"Please provide me with the title, author, or ISBN of the book you are searching for: \", [\"Title\", \"Author\", \"ISBN\", \"Back to main menu\"])\n if choice != \"Back to main menu\"\n find_book_open_posts(choice)\n end\n self.main_menu\n end", "title": "" }, { "docid": "0dbe44314d2756846c083db667afc594", "score": "0.6461148", "text": "def get_book\n @book_series = BookSeries.find(params[:book_series_id])\n @book_series_1 = BookSeries.first\n @collection = @book_series.collections.find(params[:collection_id])\n @book = @collection.books.find(params[:book_id])\n end", "title": "" }, { "docid": "0dbe44314d2756846c083db667afc594", "score": "0.6461148", "text": "def get_book\n @book_series = BookSeries.find(params[:book_series_id])\n @book_series_1 = BookSeries.first\n @collection = @book_series.collections.find(params[:collection_id])\n @book = @collection.books.find(params[:book_id])\n end", "title": "" }, { "docid": "a44117f267d9569bbb5907a42a3f4330", "score": "0.6460227", "text": "def show\n @book = Book.find(params[:id])\n flash[:msg] = \"Show Successful\"\n end", "title": "" }, { "docid": "72c4ace44587b4e113d92394a61ddc2c", "score": "0.6459036", "text": "def get_books\n # clears the screen\n system(\"clear\")\n puts \"Please enter what you are looking for today: \"\n puts \"\"\n query = gets.chomp.downcase\n results = Api.call_api(query)\n\n add_book_to_reading_list(results)\n end", "title": "" }, { "docid": "7bd4ca7d1ae242b9db05a612e2eaacd7", "score": "0.64573026", "text": "def first_book\n Book.find(:first)\n end", "title": "" }, { "docid": "4776192e39aed61cb10401f97e3ba770", "score": "0.64541674", "text": "def index\n @books = Book.of_user current_user\n end", "title": "" }, { "docid": "a4086a2327e0efeaa718f30ca2620b05", "score": "0.64524806", "text": "def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end", "title": "" }, { "docid": "68a24c32d0c4244a01f41db7a5ff080e", "score": "0.6451435", "text": "def show\n @user = User.find(params[:id])\n @books = @user.books\n end", "title": "" }, { "docid": "5d837f4e7f7493a1b332ed9d8b26eeaf", "score": "0.6447628", "text": "def index\n if params[:book_id]\n @book = Book.where(isbn: params[:book_id]).first\n if [email protected]?\n @reviewings = @book.reviewings \n end\n end\n end", "title": "" }, { "docid": "9def848aa2d95578e23089f50f316a40", "score": "0.64443755", "text": "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "title": "" }, { "docid": "5dfd22d1acd14e6777732958ffc3f12a", "score": "0.64420223", "text": "def my_books\n @books = current_user.books\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.64399534", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8d8088e5773c7a21af290ce35ce701bc", "score": "0.6439635", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "8f603207d7d364594246445cc80be359", "score": "0.6430569", "text": "def new\n\n\t \t@book = Book.new\n\t \tif params[:book]\n\n\t \t\t@book = Book.new(book_params)\n\n\t \t\t# lay id nguoi dang logi ngan vao owner_id de xac nhan chinh chu\n\t \t\t@book[:owner_id] = current_user.id\n\n\t \t\tif @book.save\n\n\t \t\t\tflash[:success] = \"Saved book!\"\n\t \t\t\tredirect_to '/books'\n\t \t\tend\n\t \tend\n \tend", "title": "" }, { "docid": "987a046a5b9a6fbee6653355545e262d", "score": "0.6414825", "text": "def books\n @books ||= current_user.books\n end", "title": "" }, { "docid": "574a27d9cbabe7047e42a03d9d6b6e12", "score": "0.6408463", "text": "def show\n \t@books = Book.find_all_by_title(params[:book_name])\n end", "title": "" }, { "docid": "8c838185c67c5dfd33979e010e60e4ab", "score": "0.63984424", "text": "def new\n @book = Book.find(params[:book_id])\n render :new\n end", "title": "" }, { "docid": "f9eb855cfac5165bb5d406aa6b9b26e3", "score": "0.63978744", "text": "def create\n @book = Book.new(params[:book])\n @book.user_id = current_user.id\n if @book.asin.blank? # if current_user didn't enter an ASIN, then look it up\n @book.asin = get_book_asin(@book.title + \" \" + @book.author) \n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ff213f4461cea3e4b54e5ee36b43d76", "score": "0.63919437", "text": "def set_book\n @book = Book.find(params[:id])\n end", "title": "" }, { "docid": "d321216312b4d44f2996c1b5a42f6831", "score": "0.6384804", "text": "def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end", "title": "" }, { "docid": "b153397013735506b024cbbd8d04fa0d", "score": "0.63695794", "text": "def new\n @book = params[:book_id]\n render :new\n end", "title": "" }, { "docid": "48666caef223489edce989cca385a139", "score": "0.6365523", "text": "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :response_group => 'Large,Reviews,Similarities' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return parse_item( item )\n end\n end", "title": "" } ]
15c925fe1f72d62e74b47344cff6c2ee
If we are creating a new dynamic model referring to a table that already exists, setup the options YAML text with DB column types from the database.
[ { "docid": "3b3d66839289482301e75e96350b435a", "score": "0.61839825", "text": "def set_field_types_from_columns(force: nil)\n return unless Admin::MigrationGenerator.table_or_view_exists? table_name\n\n # Ensure the new options have reloaded\n option_configs\n return if !force && db_columns.present?\n\n dbc = {}\n table_columns.each do |col|\n dbc[col.name.to_s] = {\n type: col.type.to_s\n }\n dbc[col.name.to_s][:array] = true if col.array?\n end\n\n return if dbc.empty?\n\n hash = { '_db_columns' => dbc }\n prepend_to_options(hash)\n end", "title": "" } ]
[ { "docid": "5f06330028e6465fbfefc464910dc9e9", "score": "0.6400341", "text": "def update_config_from_table\n set_field_list_from_table force: true\n set_comments_from_table force: true\n set_field_types_from_columns force: true\n option_configs\n end", "title": "" }, { "docid": "6bafc93242ed0e46cfff17df37fe51d0", "score": "0.6306678", "text": "def setup_fields_from_config\n self.fields = {}\n position = 0\n\n tcs = dynamic_model.table_columns\n tcs.each do |col|\n name = col.name\n next unless name.in?(column_variable_names)\n\n v = Dynamic::DynamicModelField.new(self, name, col.type, position: position)\n fields[name] = v\n position += 1\n end\n end", "title": "" }, { "docid": "a396e203383d8767558d667d3894289c", "score": "0.6198045", "text": "def db_add_column(definition) \n encoder = definition.encoder\n sql = \"INSERT INTO dynamic_attributes (`class_type`,`name`,`type`,`length`,`required`,`default`,`created_at`,`updated_at`) VALUES ('%{class_type}','%{name}', '%{type}', %{length}, %{required}, %{default},'%{created_at}','%{updated_at}');\"\n definition.required = definition.required ? 1 : 0\n definition.default = definition.default.nil? ? 'NULL' : \"'#{encoder.encode(definition.default)}'\" \n ActiveRecord::Base.connection.execute(sql % definition.to_hash.merge(:created_at => Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"), :updated_at => Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")))\n end", "title": "" }, { "docid": "67c6d56e4a8a211316d63c96bb3529db", "score": "0.59555775", "text": "def dynamic_model_columns\n @dynamic_model_columns ||= dynamic_model.table_columns\n end", "title": "" }, { "docid": "816143d303635006ad25e72c84fecb3f", "score": "0.58865833", "text": "def gen_field_configs_code\n begin\n lookups = Hash.new\n lines = Array.new\n lines.push \"\\t field_configs = []\"\n field_index = 0\n \n @model_settings.table_columns.each do |column|\n next if ['created_at', 'updated_at'].include? column[:field_name]\n type = nil\n field_name = column[:field_name]\n puts \"type is: \" + column[:type]\n puts \"field name is: \" + field_name\n if field_name!= \"id\"\n if field_name.index(\"_id\")!= nil\n type = \"DropDownField\"\n else\n case column[:type]\n # most types will be text fields, the only exceptions are: date types and bit types\n when \"date\"\n type = \"PopupDateSelector\"\n when \"timestamp\"\n type = \"PopupDateTimeSelector \"\n when \"boolean\",\"bool\",\"bit\"\n type = \"CheckBox\"\n else\n type = \"TextField\"\n end\n end\n #add basic info- same for all field types\n \n \t #add additional info, for special types\n \t \n \t if type == \"DropDownField\" # && @model_settings.associated_tables && @model_settings.associated_tables[field_name] # Uncomment this to generate despite lack of associated model.\n \t \n \t \n \t raise \"There is no associated model for #{field_name}.\" unless @model_settings.associated_tables && @model_settings.associated_tables[field_name]\n \t assoc_table = @model_settings.associated_tables[field_name]\n \t #generate a set of field_defs-one per key in the related index\n \t if assoc_table[:index_fields]!= nil\n \t puts \"index fields not nil\"\n \t assoc_table = @model_settings.associated_tables[field_name]\n \t lines.push \"#\\t----------------------------------------------------------------------------------------------\"\n \t lines.push \"#\\tCombo fields to represent foreign key (\" + field_name + \") on related table: \" + assoc_table[:table_name] \n \t lines.push \"#\\t----------------------------------------------------------------------------------------------\"\n \t \n \t index_fields = assoc_table[:index_fields]\n \t index_fields.each do |index_field|\n \t #field_def = \"\\tfield_configs[\" + field_index.to_s + \"] = {:field_type => '\" + type + \"',\\n\" \n \t field_def = \"\\tfield_configs << {:field_type => '\" + type + \"',\\n\" \n \t combo_field_def = field_def + \"\\t\\t\\t\\t\\t\\t:field_name => '\" + index_field + \"',\\n\"\n \t combo_field_def += \"\\t\\t\\t\\t\\t\\t:settings => {:list => \" + Inflector.pluralize(index_field) + \"},\\n\"\n \t \n \t if index_field != index_fields[index_fields.length()-1] #last item doesn't get observer\n \t combo_field_def += \"\\t\\t\\t\\t\\t\\t:observer => \" + index_field + \"_observer}\"\n \t else\n \t combo_field_def = combo_field_def.slice(0, combo_field_def.length() -2) + \"}\"\n \t end\n \t field_index += 1\n \t lines.push(combo_field_def) \n \t lines.push \" \"\n \t end\n else #for related single-field lookup\n puts \"index fields is nil\"\n lookup_field = find_lookup_field(@model_settings.associated_tables[field_name])\n if lookup_field != nil\n \t lines.push \"#\\t----------------------------------------------------------------------------------------------------\"\n \t lines.push \"#\\tCombo field to represent foreign key (\" + field_name + \") on related table: \" + assoc_table[:table_name] \n \t lines.push \"#\\t-----------------------------------------------------------------------------------------------------\"\n field_def = \"\\tfield_configs << {:field_type => '\" + type + \"',\\n\" \n \t field_def += \"\\t\\t\\t\\t\\t\\t:field_name => '\" + lookup_field + \"',\\n\"\n \t field_def += \"\\t\\t\\t\\t\\t\\t:settings => {:list => \" + Inflector.pluralize(lookup_field) + \"}}\\n\"\n \t \n \t field_index += 1\n \t lines.push(field_def) \n \t lines.push \" \"\n \t end\n end\n else\n #any field that is part of a composite foreign key must be ignored here\n \n if is_fkey_field(field_name) == false\n puts \"normal field: \" + field_name\n field_def = \"\\tfield_configs << {:field_type => '\" + type + \"',\\n\"\n field_def += \"\\t\\t\\t\\t\\t\\t:field_name => '\" + field_name + \"'}\\n\" \n lines.push(field_def)\n field_index += 1\n \n end\n end\n end\n end\n puts \"returning\"\n return lines\n rescue\n raise \"method: 'gen_field_configs_code' failed. Reported exception :\\n\" + $! \n end\n end", "title": "" }, { "docid": "0971f78717b05840712fd691cea636f0", "score": "0.58445853", "text": "def setup_schema\n end", "title": "" }, { "docid": "b561a6a612875fc8560e3f64ea10cde3", "score": "0.5838068", "text": "def initialize_schema_information_with_engine_additions\n initialize_schema_information_without_engine_additions\n\n # create the plugin schema stuff. \n begin\n execute <<-ESQL\n CREATE TABLE #{Engines::Plugin::Migrator.schema_info_table_name} \n (plugin_name #{type_to_sql(:string)}, version #{type_to_sql(:integer)})\n ESQL\n rescue ActiveRecord::StatementInvalid\n # Schema has been initialized\n end\n end", "title": "" }, { "docid": "ad30e62ae8d9b3041baa8947d7bf1fb1", "score": "0.5833673", "text": "def automatic_translation_fields\n globalize_options[:translated_attributes].inject({}) do |cols, field| \n cols[field] = columns_hash[field.to_s].type\n cols\n end\n end", "title": "" }, { "docid": "967c6168c79b3d90e9f55a6c852c53db", "score": "0.58318794", "text": "def schema_post_process(_)\n super.each do |a|\n h = a[1]\n db_type = h[:db_type]\n if @pg_multirange_schema_types[db_type] && h[:default] =~ /\\A#{db_type}\\(.*\\)\\z/\n h[:ruby_default] = get(Sequel.lit(h[:default])) \n end\n end\n end", "title": "" }, { "docid": "52a223dff25a78429491ce61d2a879e5", "score": "0.58277184", "text": "def dynamic_options\n # should be overridden by including in model\n {}\n end", "title": "" }, { "docid": "d23bace0905f6f64afe66ac819323e93", "score": "0.58200365", "text": "def column_defaults \n { :type => :string }\n end", "title": "" }, { "docid": "24792db4f4c4a793dfe4148967e4f1cd", "score": "0.581111", "text": "def call\n case @model\n when Collection\n [\n ActiveDynamic::FieldDefinition.new('identifier', is_vocabulary: 0, column_type: 4, default: 1, help_text:'', source_type: 'Collection' ),\n ActiveDynamic::FieldDefinition.new('creator', is_vocabulary: 0, column_type: 4, default: 1, help_text:'', source_type: 'Collection' ),\n ActiveDynamic::FieldDefinition.new('link', is_vocabulary: 0, column_type: 6, default: 1, help_text:'', source_type: 'Collection' ),\n ActiveDynamic::FieldDefinition.new('date_span', is_vocabulary: 0, column_type: 4, default: 1, help_text:'', source_type: 'Collection'),\n ActiveDynamic::FieldDefinition.new('extent', is_vocabulary: 0, column_type: 4, default: 1, help_text:'', source_type: 'Collection'),\n ActiveDynamic::FieldDefinition.new('language', is_vocabulary: 1, column_type: 1, default: 1, help_text:'', vocabulary: ['English', 'Urdu', 'Punjabi'].to_json, source_type: 'Collection' ),\n ActiveDynamic::FieldDefinition.new('conditions_governing_access', is_vocabulary: 0, column_type: 6, default: 1, help_text:'' , source_type: 'Collection'),\n ActiveDynamic::FieldDefinition.new('title', is_vocabulary: 0, column_type: 4, default: 1, help_text:'', source_type: 'CollectionResource' ),\n ]\n else\n []\n end\n end", "title": "" }, { "docid": "f90e60bb68acc546ef93c28a827b15a3", "score": "0.5798181", "text": "def dynamic_model_def_current?\n # Check all columns are set\n return unless (dynamic_model_columns.map(&:name) - self.class.core_field_names).length == field_types.length\n\n # Check columns have the correct type\n res = true\n field_types.each do |k, v|\n v = :integer if v == :references\n unless dynamic_model_columns.find { |c| c.name == k.to_s }.type == v\n res = false\n break\n end\n end\n\n return res unless res\n\n # Check downcase is configured to match the dynamic model\n dynamic_model.default_options.field_options.each do |k, v|\n k = k.to_s\n unless config_fields.key?(k) && !!config_fields[k].no_downcase == !!v[:no_downcase]\n res = false\n break\n end\n end\n\n return res unless res\n\n # Check comments are configured to match the dynamic model\n fcs = dynamic_model.table_comments || {}\n fcs = fcs[:original_fields] || {}\n config_fields.each do |k, v|\n k = k.to_sym\n text = v.comment\n curr_text = fcs[k]\n unless text == curr_text\n res = false\n break\n end\n end\n\n return res unless res\n\n # Check caption is configured to match the dynamic model\n dmc = dynamic_model.default_options.caption_before\n config_fields.each do |k, v|\n k = k.to_sym\n text = Formatter::Substitution.text_to_html(v.caption)\n curr_text = dmc[k] && dmc[k][:caption]\n unless text == curr_text\n res = false\n break\n end\n end\n\n return res unless res\n\n # Check label is configured to match the dynamic model\n dmc = dynamic_model.default_options.labels\n config_fields.each do |k, v|\n k = k.to_sym\n text = v.label\n curr_text = dmc[k]\n unless text == curr_text\n res = false\n break\n end\n end\n\n res\n end", "title": "" }, { "docid": "e60f0c36abb84d89e3f318a73c3d56bc", "score": "0.5788203", "text": "def add_options_variants\n \n # TODO smart column ordering to ensure always valid by time we get to associations\n begin\n save_if_new\n rescue => e\n raise ProductLoadError.new(\"Cannot add OptionTypes/Variants - Save failed on parent Product\")\n end\n # example : mime_type:jpeg;print_type:black_white|mime_type:jpeg|mime_type:png, PDF;print_type:colour\n\n variants = get_each_assoc\n\n logger.info \"add_options_variants #{variants.inspect}\"\n \n # example line becomes : \n # 1) mime_type:jpeg|print_type:black_white \n # 2) mime_type:jpeg \n # 3) mime_type:png, PDF|print_type:colour\n\n variants.each do |per_variant|\n\n option_types = per_variant.split(Delimiters::multi_facet_delim) # => [mime_type:jpeg, print_type:black_white]\n\n logger.info \"add_options_variants #{option_types.inspect}\"\n puts \"add_options_variants #{option_types.inspect}\"\n \n optiontype_vlist_map = {}\n\n option_types.each do |ostr|\n\n oname, value_str = ostr.split(Delimiters::name_value_delim)\n\n option_type = @@option_type_klass.where(:name => oname).first\n\n unless option_type\n option_type = @@option_type_klass.create( :name => oname, :presentation => oname.humanize)\n # TODO - dynamic creation should be an option\n\n unless option_type\n puts \"WARNING: OptionType #{oname} NOT found and could not create - Not set Product\"\n next\n end\n logger.info \"Created missing OptionType #{option_type.inspect}\"\n puts \"Created missing OptionType #{option_type.inspect}\"\n end\n\n # OptionTypes must be specified first on Product to enable Variants to be created\n # TODO - is include? very inefficient ??\n @load_object.option_types << option_type unless @load_object.option_types.include?(option_type)\n\n # Can be simply list of OptionTypes, some or all without values\n next unless(value_str)\n\n optiontype_vlist_map[option_type] = []\n \n # Now get the value(s) for the option e.g red,blue,green for OptType 'colour'\n optiontype_vlist_map[option_type] = value_str.split(',')\n end\n\n next if(optiontype_vlist_map.empty?) # only option types specified - no values\n\n # Now create set of Variants, some of which maybe composites\n # Find the longest set of OVs to use as base for combining with the rest\n sorted_map = optiontype_vlist_map.sort_by { |k,v| v.size }.reverse\n\n # [ [mime, ['pdf', 'jpeg', 'gif']], [print_type, ['black_white']] ]\n\n lead_option_type, lead_ovalues = sorted_map.shift\n \n # TODO .. benchmarking to find most efficient way to create these but ensure Product.variants list\n # populated .. currently need to call reload to ensure this (seems reqd for Spree 1/Rails 3, wasn't required b4\n lead_ovalues.each do |ovname|\n\n ov_list = []\n\n ovname.strip!\n\n ov = @@option_value_klass.where(name: ovname, option_type_id: lead_option_type.id, presentation: ovname.humanize).first_or_create\n\n ov_list << ov if ov\n\n # Process rest of array of types => values\n sorted_map.each do |ot, ovlist|\n ovlist.each do |for_composite|\n\n for_composite.strip!\n\n \t\tov = @@option_value_klass.where(name: for_composite, option_type_id: ot.id, presentation: for_composite.humanize).first_or_create\n\n ov_list << ov if(ov)\n end\n end\n \n unless(ov_list.empty?)\n\n logger.info(\"Creating Variant from OptionValue(s) #{ov_list.collect(&:name).inspect}\")\n puts \"Creating Variant from OptionValue(s) #{ov_list.collect(&:name).inspect}\"\n\n i = @load_object.variants.size + 1\n\n # This one line seems to works for 1.1.0 - 3.2 but not 1.0.0 - 3.1 ??\n\t\t\t\t\t\t\tif(SpreeHelper::version.to_f >= 1.1)\n \tputs \"DEBUG INFO: Spree helper version is >= 1.1 so running 1st variant create line\" if(verbose)\n\t\t\t\t\t\t\t variant = @load_object.variants.create( :sku => \"#{@load_object.sku}_#{i}\", :price => @load_object.price, :weight => @load_object.weight, :height => @load_object.height, :width => @load_object.width, :depth => @load_object.depth)\n\t\t\t\t\t\t\telse\n \tputs \"DEBUG INFO: Spree helper version is < 1.1 so running 2nd variant create line\" if(verbose)\n\t\t\t\t\t\t\t variant = @@variant_klass.create( :product => @load_object, :sku => \"#{@load_object.sku}_#{i}\", :price => @load_object.price)\n\t\t\t\t\t\t\tend\n\n \tputs \"DEBUG INFO: Variant #{variant} created\" if(verbose)\n variant.option_values << ov_list if(variant)\n end\n end\n\n @load_object.reload unless @load_object.new_record?\n puts \"DEBUG Load Object now has Variants : #{@load_object.variants.inspect}\" if(verbose)\n end\n\n end", "title": "" }, { "docid": "1f0621cedddc2d0a0a2852f8d4b74cea", "score": "0.57713056", "text": "def set_models\n PizzaType.create(name: \"Hawaiana\")\n Cheese.create(name:\"Muzarela\")\n Sauce.create(name: \"BBQ\")\n Crust.create(name: \"Thin\")\n Size.create(name: \"Small\", slices: 4)\n end", "title": "" }, { "docid": "ec0aeecc2d78e00da63edfbcd85a06e4", "score": "0.5763683", "text": "def apply_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end", "title": "" }, { "docid": "c296cc82441043034d0bcc5d17a20894", "score": "0.57300615", "text": "def table name, options={}\n @tables ||= []\n tabledef = Richfield::Compatibility.create_table_definition(ActiveRecord::Base.connection, name, options)\n yield(tabledef) if block_given?\n\n # Convert the AR::CA::ColumnDefinitions to actual AR::CA::Column objects to match real life\n columns = tabledef.columns.map do |column|\n sql = Richfield::Compatibility.column_to_sql(ActiveRecord::Base.connection, column)\n ActiveRecord::ConnectionAdapters::Column.new(column.name, column.default, sql, column.null)\n end\n\n result = Richfield::TableDefinition.new(name.to_s, options, columns)\n @tables << result\n result\nend", "title": "" }, { "docid": "5de95b2aefebdfd6d52b83c2bdcf47bd", "score": "0.5718265", "text": "def create(options = {})\n generate_columns(options)\n @klass.create(@last_options)\n end", "title": "" }, { "docid": "4a6ea2c733cf17a86a7d89fc6837911a", "score": "0.56972903", "text": "def _configure_sti\n return if sti_children.nil?\n column = model.inheritance_column\n if sti_create_links\n columns[column].form_ui ||= :hidden\n else\n columns[column].form_ui ||= :select\n columns[column].options ||= {}\n columns[column].options[:options] = sti_children.collect do |model_name|\n [model_name.to_s.camelize.constantize.model_name.human, model_name.to_s.camelize]\n end\n end\n end", "title": "" }, { "docid": "18d5348cd35e03dca15484aec9c500fa", "score": "0.5696866", "text": "def add_options_variants\n\n # TODO smart column ordering to ensure always valid by time we get to associations\n begin\n save_if_new\n rescue => e\n logger.error(\"Cannot add OptionTypes/Variants - Save Failed : #{e.inspect}\")\n raise ProductLoadError.new(\"Cannot add OptionTypes/Variants - Save failed on parent Product\")\n end\n # example : mime_type:jpeg;print_type:black_white|mime_type:jpeg|mime_type:png, PDF;print_type:colour\n\n variants = get_each_assoc\n\n logger.info \"Adding Options Variants #{variants.inspect}\"\n\n # example line becomes :\n # 1) mime_type:jpeg|print_type:black_white\n # 2) mime_type:jpeg\n # 3) mime_type:png, PDF|print_type:colour\n\n variants.each do |per_variant|\n\n option_types = per_variant.split(Delimiters::multi_facet_delim).map(&:strip) # => [mime_type:jpeg, print_type:black_white]\n\n logger.info \"Checking Option Types #{option_types.inspect}\"\n\n optiontype_vlist_map = {}\n\n option_types.each do |ostr|\n\n oname, value_str = ostr.split(Delimiters::name_value_delim).map(&:strip)\n\n option_type = @@option_type_klass.where(:name => oname).first\n\n unless option_type\n option_type = @@option_type_klass.create(:name => oname, :presentation => oname.humanize)\n # TODO - dynamic creation should be an option\n\n unless option_type\n logger.warm(\"WARNING: OptionType #{oname} NOT found and could not create - Not set Product\")\n next\n end\n logger.info \"Created missing OptionType #{option_type.inspect}\"\n end\n\n # OptionTypes must be specified first on Product to enable Variants to be created\n load_object.option_types << option_type unless load_object.option_types.include?(option_type)\n\n # Can be simply list of OptionTypes, some or all without values\n next unless(value_str)\n\n optiontype_vlist_map[option_type] ||= []\n\n # Now get the value(s) for the option e.g red,blue,green for OptType 'colour'\n optiontype_vlist_map[option_type] += value_str.split(',').map(&:strip).flatten\n\n logger.debug(\"Parsed OptionValues #{optiontype_vlist_map[option_type]} for Option_Type #{option_type.name}\")\n end\n\n next if(optiontype_vlist_map.empty?) # only option types specified - no values\n\n # Now create set of Variants, some of which maybe composites\n # Find the longest set of OptionValues to use as base for combining with the rest\n sorted_map = optiontype_vlist_map.sort_by { |ot, ov| ov.size }.reverse\n\n logger.debug(\"Processing Options into Variants #{sorted_map.inspect}\")\n\n # {mime => ['pdf', 'jpeg', 'gif'], print_type => ['black_white']}\n\n lead_option_type, lead_ovalues = sorted_map.shift\n\n # TODO .. benchmarking to find most efficient way to create these but ensure Product.variants list\n # populated .. currently need to call reload to ensure this (seems reqd for Spree 1/Rails 3, wasn't required b4\n lead_ovalues.each do |ovname|\n\n ov_list = []\n\n ovname.strip!\n\n #TODO - not sure why I create the OptionValues here, rather than above with the OptionTypes\n ov = @@option_value_klass.where(:name => ovname, :option_type_id => lead_option_type.id).first_or_create(:presentation => ovname.humanize)\n ov_list << ov if ov\n\n # Process rest of array of types => values\n sorted_map.each do |ot, ovlist|\n ovlist.each do |ov_for_composite|\n\n ov_for_composite.strip!\n\n # Prior Rails 4 - ov = @@option_value_klass.find_or_create_by_name_and_option_type_id(for_composite, ot.id, :presentation => for_composite.humanize)\n ov = @@option_value_klass.where(:name => ov_for_composite, :option_type_id => ot.id).first_or_create(:presentation => ov_for_composite.humanize)\n\n ov_list << ov if(ov)\n end\n end\n\n unless(ov_list.empty?)\n\n logger.info(\"Creating Variant from OptionValue(s) #{ov_list.collect(&:name).inspect}\")\n\n i = @load_object.variants.size + 1\n\n variant = @load_object.variants.create( :sku => \"#{load_object.sku}_#{i}\", :price => load_object.price, :weight => load_object.weight, :height => load_object.height, :width => load_object.width, :depth => load_object.depth, :tax_category_id => load_object.tax_category_id)\n\n variant.option_values << ov_list if(variant)\n end\n end\n\n @load_object.reload unless @load_object.new_record?\n #puts \"DEBUG Load Object now has Variants : #{@load_object.variants.inspect}\" if(verbose)\n end\n\n end", "title": "" }, { "docid": "7c51deffb653bf37d7a02f5d7edee9bf", "score": "0.56953186", "text": "def dynamic_column(name, type, options={})\n add_dynamic_column ConnectionAdapters::Column.new(name.to_s, type, options)\n end", "title": "" }, { "docid": "6a58e96a73034a0c4c5139210177fc91", "score": "0.5687695", "text": "def apply_opinio_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end", "title": "" }, { "docid": "89d9b72281809e63d39ba1fc5a10f85d", "score": "0.5678163", "text": "def create type\n sql = \"\"\n @db.connect do \n sql = SqlGenerator.for_files(@table_files,@source.file_length) if type == :files\n if type == :records\n sql = SqlGenerator.for_records(@table_records,@source.records_fields) \n puts sql\n @db.query(sql)\n sql = SqlGenerator.for_records_union(@table_records_union,@source.records_fields, union: TableUtil::search_tables(@table_records))\n puts sql \n @db.query(sql)\n end\n Logger.<<(__FILE__,\"INFO\",\"Setup #{type} tables for #{@source.name}\")\n end\n end", "title": "" }, { "docid": "ded2ebf9025fc5e5bf41af1f2f1661df", "score": "0.56135064", "text": "def create_table_as(name, sql, options)\n sql = _no_auto_parameterize(sql)\n super\n end", "title": "" }, { "docid": "d59d7071109ab593d8bda05cef418de5", "score": "0.5612818", "text": "def initialize_field_types\r\n if self.metadata_field_name\r\n @metadata_field_type = load_or_create_field_type(self.metadata_table_name, self.metadata_field_name)\r\n initialize_metadata_property_grid\r\n end\r\n end", "title": "" }, { "docid": "a40117070b3ce618259215515f113d95", "score": "0.55802", "text": "def set_models\n Cheese.create(name:\"Muzarela\")\n Sauce.create(name: \"BBQ\")\n Crust.create(name: \"Thin\")\n Size.create(name: \"Small\", slices: 4)\n PizzaType.create(name: \"Hawaiana\")\n end", "title": "" }, { "docid": "c1e01df446aca89536766dc4ab2d0c35", "score": "0.55720776", "text": "def model_fields\n ActiveSupport::OrderedHash.new.tap do |hash|\n columns.map { |u| hash[u.name.to_sym] = u.type.to_sym }\n end\n end", "title": "" }, { "docid": "c1e01df446aca89536766dc4ab2d0c35", "score": "0.55720776", "text": "def model_fields\n ActiveSupport::OrderedHash.new.tap do |hash|\n columns.map { |u| hash[u.name.to_sym] = u.type.to_sym }\n end\n end", "title": "" }, { "docid": "c41c59ecbe6b2571da5c0dd92cff5c0e", "score": "0.5561401", "text": "def setup_dynamic_model\n raise FphsException, 'Not ready to set up dynamic model / database table' unless ready_to_setup_dynamic_model?\n\n dynamic_storage.create_dynamic_model\n record_job_request 'create_dynamic_model', result: { dynamic_model: dynamic_storage.dynamic_model.id }\n dynamic_storage.add_user_access_control\n end", "title": "" }, { "docid": "aa46e063581d51eb344d42ad6f5ec710", "score": "0.55476516", "text": "def check_options_against_database\n # extract the keys from the options hash as strings\n option_keys = @options.stringify_keys.keys\n # fetch the names of the Class's database table columns\n klass_columns = klass_name_constant.columns.collect { |c| c.name }\n # @should create new will be true if there are any option keys that are not in db table\n @should_create_new = !!option_keys.detect { |opt| !klass_columns.include?(opt) }\n end", "title": "" }, { "docid": "00129ec3f8808d18100ac28277e4965e", "score": "0.5543085", "text": "def migrate!\n ActiveRecord::Base.connection.create_table :test_models do |t|\n t.jsonb :title\n t.string :description\n end\nend", "title": "" }, { "docid": "811364768844c8b404738cd9cacc55c8", "score": "0.5539942", "text": "def create_model\n return if options[:existing_model]\n args = [name]\n args << \"platforms_#{concern_type}_id:integer\"\n\n # Recreate arguments\n attributes.each do |a|\n args << \"#{a.name}:#{a.type}#{a.has_index? ? \":index\" : \"\" }\"\n end\n\n # Recreate options\n options.each do |k, v|\n unless k == \"existing_model\"\n args << \"--#{k}=#{v}\"\n end\n end\n\n # Use the standard model generator\n generate \"model\", args.join(\" \")\n end", "title": "" }, { "docid": "9dadedc9f47fabf9801615f4a6e57caa", "score": "0.5538586", "text": "def sql_type_metadata; end", "title": "" }, { "docid": "c3b536fd26da512cbc9f5856830911ca", "score": "0.552883", "text": "def before_create\n if from_common_data?\n self.extra_options = extra_options.merge(common_data: true)\n end\n self.extra_options = extra_options.merge(column_sanitization_version: CartoDB::Importer2::Column::CURRENT_COLUMN_SANITIZATION_VERSION)\n end", "title": "" }, { "docid": "5261466e9a2e2c8493c68aacb8116a9c", "score": "0.55262935", "text": "def add_deployment_option_types\n [\n {'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 1},\n {'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'displayOrder' => 1}\n ]\n end", "title": "" }, { "docid": "654d07ac03a73ee20ba8f8cd3d0df4e8", "score": "0.55205464", "text": "def create_default_column\n # lead\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 1, name: \"ユニークキー\", key_name: \"unique_key\", data_type: :unique_key)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 2, name: \"商談名\", key_name: \"name\", data_type: :name)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 3, name: \"パートナー名\", key_name: \"partner\", data_type: :company)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 4, name: \"営業担当\", key_name: \"staff\", data_type: :staff)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 5, name: \"商品\", key_name: \"product\", data_type: :product)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 6, name: \"商談フェイズ\", key_name: \"phase\", data_type: :lead_phase)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 7, name: \"作成日\", key_name: \"created_at\", data_type: :created_at)\n table_columns.create!(default_column: true, table_type: \"lead\", index_page_position: 8, name: \"最終更新日\", key_name: \"updated_at\", data_type: :updated_at)\n\n # product\n table_columns.create!(default_column: true, table_type: \"product\", index_page_position: 1, name: \"ユニークキー\", key_name: \"unique_key\", data_type: :unique_key)\n table_columns.create!(default_column: true, table_type: \"product\", index_page_position: 2, name: \"商品名\", key_name: \"name\", data_type: :name)\n table_columns.create!(default_column: true, table_type: \"product\", index_page_position: 3, name: \"価格\", key_name: \"price\", data_type: :price)\n table_columns.create!(default_column: true, table_type: \"product\", index_page_position: 4, name: \"作成日\", key_name: \"created_at\", data_type: :created_at)\n table_columns.create!(default_column: true, table_type: \"product\", index_page_position: 5, name: \"最終更新日\", key_name: \"updated_at\", data_type: :updated_at)\n\n # company\n table_columns.create!(default_column: true, table_type: \"company\", index_page_position: 1, name: \"パートナー名\", key_name: \"name\", data_type: :name)\n table_columns.create!(default_column: true, table_type: \"company\", index_page_position: 2, name: \"作成日\", key_name: \"created_at\", data_type: :created_at)\n table_columns.create!(default_column: true, table_type: \"company\", index_page_position: 3, name: \"最終更新日\", key_name: \"updated_at\", data_type: :updated_at)\n\n # staff\n table_columns.create!(default_column: true, table_type: \"staff\", index_page_position: 1, name: \"担当者名\", key_name: \"name\", data_type: :name)\n table_columns.create!(default_column: true, table_type: \"staff\", index_page_position: 2, name: \"企業名\", key_name: \"partner\", data_type: :company)\n table_columns.create!(default_column: true, table_type: \"staff\", index_page_position: 3, name: \"作成日\", key_name: \"created_at\", data_type: :created_at)\n table_columns.create!(default_column: true, table_type: \"staff\", index_page_position: 4, name: \"最終更新日\", key_name: \"updated_at\", data_type: :updated_at)\n\n # contract\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 1, name: \"ユニークキー\", key_name: \"unique_key\", data_type: :unique_key)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 2, name: \"契約名\", key_name: \"name\", data_type: :name)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 3, name: \"パートナー名\", key_name: \"partner\", data_type: :company)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 4, name: \"商品\", key_name: \"product\", data_type: :product)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 5, name: \"価格\", key_name: \"price\", data_type: :price)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 6, name: \"作成日\", key_name: \"created_at\", data_type: :created_at)\n table_columns.create!(default_column: true, table_type: \"contract\", index_page_position: 7, name: \"最終更新日\", key_name: \"updated_at\", data_type: :updated_at)\n table_columns.create!(default_column: false, table_type: \"contract\", index_page_position: 8, name: \"契約開始日\", key_name: \"contracted_at\", data_type: :datetime)\n table_columns.create!(default_column: false, table_type: \"contract\", index_page_position: 9, name: \"契約終了日\", key_name: \"contract_end_at\",\ndata_type: :datetime)\n end", "title": "" }, { "docid": "d32177ee7016ce4f221cebc540abe739", "score": "0.55160046", "text": "def create_metafields_schema\n path = File.join(target_path, 'config', 'metafields_schema.yml')\n\n template 'schema.yml.tt', path\n end", "title": "" }, { "docid": "3a411bfed1572ece086e249ffc4d1ee1", "score": "0.5505655", "text": "def _generate_table_prep\n # Make sure the db_class has the custom_attribute definitions defined for\n # the report being built.\n load_custom_attributes\n\n # Default time zone in profile to report time zone\n time_profile.tz ||= tz if time_profile\n self.ext_options = {:tz => tz, :time_profile => time_profile}\n\n # TODO: these columns need to be converted to real SQL columns\n # only_cols = cols\n\n self.extras ||= {}\n end", "title": "" }, { "docid": "5d4edbd5710194bd387cd2a9b02e98b4", "score": "0.5499395", "text": "def declare_polymorphic_type_field(foreign_type, column_options)\n declare_field(foreign_type, :string, column_options.merge(limit: 255))\n # FIXME: Before hobo_fields was extracted, this used to now do:\n # never_show(type_col)\n # That needs doing somewhere\n end", "title": "" }, { "docid": "bf2c7b29e60b69835069fcf72b072352", "score": "0.54980206", "text": "def create_table_as(name, sql, options)\n super\n from(name).insert(sql.is_a?(Dataset) ? sql : dataset.with_sql(sql))\n end", "title": "" }, { "docid": "ce0765df01ba5ff962475a1ae3e82254", "score": "0.5497043", "text": "def create_tables(create_table_options = {})\n super(create_table_options)\n @stack.atoms.create_table(create_table_options)\n end", "title": "" }, { "docid": "f1c85844a61694b067f0f3cc28ac42af", "score": "0.5496407", "text": "def update_field(model_class, table_name, db_field, column_name, klasses, opts)\n sequel_class, sequel_opts = Helper.column_type_and_options_for_sequel(klasses, opts)\n\n # Check if column exists\n if !db_field\n\n log(\"Add field #{column_name} to #{table_name}\")\n # Column does not exist, add it.\n # Make sure klass matches\n @db.add_column(table_name, column_name, sequel_class, sequel_opts)\n else\n db_class, db_opts = @table_reconcile.sequel_class_and_opts_from_db(db_field)\n\n if db_class != sequel_class || db_opts != sequel_opts\n\n # Data type has changed, migrate\n up_code = []\n down_code = []\n\n # First remove the default values\n db_default = db_opts.delete(:default)\n sequel_default = sequel_opts.delete(:default)\n\n if db_default != sequel_default\n up_code << \"if column_exists?(#{table_name.inspect}, #{column_name.inspect})\\n set_column_default #{table_name.inspect}, #{column_name.inspect}, #{sequel_default.inspect}\\nend\"\n down_code << \"set_column_default #{table_name.inspect}, #{column_name.inspect}, #{db_default.inspect}\"\n end\n\n if db_opts != sequel_opts\n # Fetch allow_null, keeping in mind it defaults to true\n db_null = db_opts.fetch(:allow_null, true)\n sequel_null = sequel_opts.fetch(:allow_null, true)\n\n if db_null != sequel_null\n # allow null changed\n if sequel_null\n up_code << \"if column_exists?(#{table_name.inspect}, #{column_name.inspect})\\n set_column_allow_null #{table_name.inspect}, #{column_name.inspect}\\nend\"\n down_code << \"set_column_not_null #{table_name.inspect}, #{column_name.inspect}\"\n else\n up_code << \"if column_exists?(#{table_name.inspect}, #{column_name.inspect})\\n set_column_not_null #{table_name.inspect}, #{column_name.inspect}\\nend\"\n down_code << \"set_column_allow_null #{table_name.inspect}, #{column_name.inspect}\"\n end\n\n db_opts.delete(:allow_null)\n sequel_opts.delete(:allow_null)\n end\n end\n\n\n if db_class != sequel_class || db_opts != sequel_opts\n up_code << \"if column_exists?(#{table_name.inspect}, #{column_name.inspect})\\n set_column_type #{table_name.inspect}, #{column_name.inspect}, #{sequel_class}, #{sequel_opts.inspect}\\nend\"\n down_code << \"set_column_type #{table_name.inspect}, #{column_name.inspect}, #{db_class}, #{db_opts.inspect}\"\n end\n\n\n if up_code.present?\n generate_and_run(\"column_change_#{table_name.to_s.gsub('/', '_')}_#{column_name}\", up_code.join(\"\\n\"), down_code.join(\"\\n\"))\n end\n\n # TODO: Improve message\n # raise \"Data type changed, can not migrate field #{name} from #{db_field.inspect} to #{klass.inspect}\"\n end\n end\n\n end", "title": "" }, { "docid": "38c55e590ace3609c74e846b3cff88dc", "score": "0.54901814", "text": "def create_table_fields\n if params[:type] == \"Job\"\n DropdownValue.create(:custom_id => params[:custom_id], :company_id => current_login.id, :drop_value => params[:drop_value], :customer_id => session[:customer_id], :jobsite_id => session[:jobsite_id], :job_id => session[:job_id])\n else\n if session[:jobsite_id].present? && session[:jobsite_id] != nil && session[:jobsite_id] != \"All\" && session[:jobsite_id] != \"None\"\n DropdownValue.create(:custom_id => params[:custom_id], :company_id => current_login.id, :drop_value => params[:drop_value], :customer_id => session[:customer_id], :jobsite_id => session[:jobsite_id])\n else\n DropdownValue.create(:custom_id => params[:custom_id], :company_id => current_login.id, :drop_value => params[:drop_value], :customer_id => session[:customer_id])\n end\n end\n \n @custom = Custom.find(params[:custom_id])\n end", "title": "" }, { "docid": "29c2ec87726dfb1918789b0ec9d0b7b7", "score": "0.5487468", "text": "def active_scaffold_add_existing_input(options)\n if controller.respond_to?(:record_select_config)\n remote_controller = active_scaffold_controller_for(record_select_config.model).controller_path\n record_select_options = {:controller => remote_controller, :params => {:parent_model => record_select_config.model}}\n record_select_options.merge!(active_scaffold_input_text_options)\n record_select_field(options[:name], @record, record_select_options)\n # record_select_field(\n # \"#{options[:name]}\",\n # active_scaffold_config.model.new,\n # {:controller => remote_controller, :params => options[:url_options].merge(:parent_model => record_select_config.model)}.merge(active_scaffold_input_text_options)) \n else\n # select_options = options_for_select(options_for_association(nested_association)) unless column.through_association?\n select_options ||= options_for_select(active_scaffold_config.model.find(:all).collect {|c| [h(c.to_label), c.id]})\n unless select_options.empty?\n select_tag 'associated_id', '<option value=\"\">' + as_(:_select_) + '</option>' + select_options\n end \n end\n end", "title": "" }, { "docid": "65b1dd4aab265ec2a9997bf6ed269d2f", "score": "0.545795", "text": "def generate_model\n say \"Generates app/models/#{singular_table_name}.rb\", :bold\n invoke :model\n inject_into_class \"app/models/#{singular_table_name}.rb\", singular_table_name.camelize do\n<<-ACTS\n\n acts_as_api\n api_accessible :basic do |t|\n #{attributes_names.map { |name| \"\\tt.add :#{name}\" }.join(\"\\n\")}\n t.add :created_at\n t.add :updated_at\n end\n\nACTS\n end\n end", "title": "" }, { "docid": "9068d1970e50da7826e5add16c09f23e", "score": "0.54566604", "text": "def create_attributes\n merged_config_data.each do |k, v|\n send(\"define_#{v[:type].downcase}\", k, v) if v[:type]\n end\n end", "title": "" }, { "docid": "d05604d0a14621c55293de4d0878b34e", "score": "0.5455626", "text": "def configure_models\n configure_generic if generic?\n configure_field if auto_config?(:fields)\n configure_relation if auto_config?(:relations)\n end", "title": "" }, { "docid": "eaffedaa726222e7e79312b0a27e295a", "score": "0.5451612", "text": "def db_create\n DB_TYPE\n end", "title": "" }, { "docid": "0a5a8d7cb8be0bfc92152eb46f0632ca", "score": "0.5442662", "text": "def _before_validation\n if new? && model.cti_key && !model.cti_model_map\n set_column_value(\"#{model.cti_key}=\", model.name.to_s)\n end\n super\n end", "title": "" }, { "docid": "d3b7b996e6946219afa88e06b56d4d38", "score": "0.5438753", "text": "def migrate\n attrs = @db_setup_attributes || {}\n Ecore::db.create_table table_name do\n String :id, :size => 8, :primary_key => true\n attrs.each_pair do |name, arr|\n column name, :text, arr[1] if arr[0] == :text\n String name, arr[1] if arr[0] == :string || arr[0] == String\n Fixnum name, arr[1] if arr[0] == :integer || arr[0] == Fixnum\n DateTime name, arr[1] if arr[0] == :datetime || arr[0] == DateTime\n Date name, arr[1] if arr[0] == :date || arr[0] == Date\n Time name, arr[1] if arr[0] == :time || arr[0] == Time\n Float name, arr[1] if arr[0] == :float || arr[0] == Float\n TrueClass name, arr[1] if arr[0] == :boolean || arr[0] == TrueClass || arr[0] == FalseClass\n TrueClass name, arr[1] if arr[0] == :bool\n end\n end unless Ecore::db.table_exists?(table_name)\n end", "title": "" }, { "docid": "cff20aa878b681da788271eac0c68bc7", "score": "0.5434176", "text": "def generate_models_from_tables\n LegacyData::TableClassNameMapper.naming_convention = options[:table_naming_convention]\n \n analyzed_tables = LegacyData::Schema.analyze(:table_name=>table_name, :skip_associated=>options[:skip_associated])\n\n unless analyzed_tables.blank?\n spec_dir_exists = File.exist? \"#{Rails.root}/spec\"\n\n LegacyData::TableClassNameMapper.let_user_validate_dictionary\n\n analyzed_tables.each do |analyzed_table|\n analyzed_table.class_name = LegacyData::TableClassNameMapper.class_name_for(analyzed_table[:table_name])\n\n # m.class_collisions :class_path, analyzed_table[:class_name]\n @definition = analyzed_table\n template 'model.rb', File.join('app/models', \"#{analyzed_table[:class_name].underscore}.rb\")\n\n add_factory_girl_factory analyzed_table if options[:with_factories] && spec_dir_exists\n end\n end\n end", "title": "" }, { "docid": "ec417ff3466452d40134e0371c304549", "score": "0.5418841", "text": "def extract_table_options!(options)\n super.merge(options.extract!(:inherits, :schema))\n end", "title": "" }, { "docid": "7bfa09fb9b5a9ee1f436abca1bc12753", "score": "0.54116905", "text": "def create!\n gen_id!\n Persistence::Setup.db.insert(column_family, @properties['id'], @properties)\n if @model == \"blog\"\n new_blog = { @properties['created_at'].to_uuidtime => @properties['id'] }\n Persistence::Setup.db.insert(:BlogsforUser, @properties['user_id'], new_blog)\n elsif @model == \"post\"\n new_post = { @properties['created_at'].to_uuidtime => @properties['id'] }\n Persistence::Setup.db.insert(:PostsforBlog, @properties['blog_id'], new_post)\n end\n :ok\n end", "title": "" }, { "docid": "2db42ff41545244440d2c108bf48227e", "score": "0.5409116", "text": "def create_table_as(name, sql, options)\n super\n from(name).insert(sql.is_a?(Dataset) ? sql : dataset.with_sql(sql))\n end", "title": "" }, { "docid": "421cf98242f2f9941fdc3386fe281d4e", "score": "0.54083556", "text": "def prepare_column_options(column)\n spec = super\n\n if subtype = schema_subtype(column)\n spec[:subtype] = subtype\n end\n\n spec\n end", "title": "" }, { "docid": "421cf98242f2f9941fdc3386fe281d4e", "score": "0.54083556", "text": "def prepare_column_options(column)\n spec = super\n\n if subtype = schema_subtype(column)\n spec[:subtype] = subtype\n end\n\n spec\n end", "title": "" }, { "docid": "3dc8d64d5435804861a8023efdfcbbfe", "score": "0.54038566", "text": "def load_or_create_field_type(table_name, field_name)\r\n field_type = MetadataFieldType.new()\r\n field_type.type_name = table_name + '.' + field_name\r\n field_type.display_name = field_name\r\n field_type.hidden = true\r\n field_type.read_only = true\r\n field_type.computation='foobar'\r\n field_type.validation='fizbin'\r\n\r\n field_type\r\n end", "title": "" }, { "docid": "720331884da8915971a221f916862fa8", "score": "0.539529", "text": "def mysql_type=(val)\n self['mysql_type'] = val\n end", "title": "" }, { "docid": "a515307ca40cc96978ceb989b17b280c", "score": "0.5388416", "text": "def prepare_column_specs\n column_specs.select do |col|\n col[:action] == 'new_field'\n end.map do |col|\n field_guid = Guid.new.to_s\n col[:field] = field_guid\n TableFields::Local.new col[:name], field_guid, ''\n end\n end", "title": "" }, { "docid": "d6678ab9056eab0d7e3b352539080e73", "score": "0.5386942", "text": "def generate(template, model, columns)\n\n # Application Name\n appname = Dir.pwd.split('/').last\n template.gsub!('[[APPNAME]]', appname.downcase) \n \n # Model Name\n template.gsub!('[[ModelNameLowercase]]', model.downcase)\n template.gsub!('[[ModelNameCapitalized]]', model.capitalize)\n\n # Model Definition\n getter_and_setter_definition = \"\"\n columns.each do |column|\n getter_and_setter_definition += \"public String get#{column.capitalize}();\\n \"\n getter_and_setter_definition += \"public void set#{column.capitalize}(String #{column});\\n \"\n end\n template.gsub!('[[GetterAndSetterDefinition]]', getter_and_setter_definition)\n\n\n # Model Access\n json_output_for_columns = \"\"\n columns.each do |column|\n json_output_for_columns += \"json.put(\\\"#{column}\\\", #{model.downcase}.get#{column.capitalize}());\\n \"\n end\n template.gsub!('[[JSONOutputForColumns]]', json_output_for_columns)\n\n setters_from_params = \"\"\n columns.each do |column|\n setters_from_params += \"#{model.downcase}.set#{column.capitalize}(params.get(\\\"#{column}\\\").toString());\\n \"\n end\n template.gsub!('[[SetterFromParamsImplementation]]', setters_from_params)\n\n # New Template\n fields_for_new_model = \"\"\n columns.each do |column|\n fields_for_new_model += \"<label for=\\\"#{column}\\\">#{column.capitalize}: </label><input name=\\\"#{column}\\\" class=\\\"text\\\" type=\\\"text\\\" /><br />\\n \"\n end\n template.gsub!('[[InputFieldsForNewModel]]', fields_for_new_model)\n\n\n # Edit Template\n fields_for_edit_model = \"\"\n columns.each do |column|\n fields_for_edit_model += \"<label for=\\\"#{column}\\\">#{column.capitalize}: </label><input name=\\\"#{column}\\\" class=\\\"text\\\" type=\\\"text\\\" value=\\\"<%= #{model.downcase}.get#{column.capitalize}() %>\\\" /><br />\\n \"\n end\n template.gsub!('[[InputFieldsForEditModel]]', fields_for_edit_model)\n\n # Index Template\n index_table_headings = \"\"\n columns.each do |column|\n index_table_headings += \"<th>#{column.capitalize}</th>\\n \"\n end\n template.gsub!('[[TableHeadingsForIndexColumnNames]]', index_table_headings)\n\n index_td_content = \"\"\n columns.each do |column|\n index_td_content += \"<td><%= #{model.downcase}.get#{column.capitalize}() %></td>\\n \"\n end\n template.gsub!('[[TDsForIndexColumns]]', index_td_content)\n\n # Show Template\n show_columns = \"\"\n columns.each do |column|\n show_columns += \"<p><strong>#{column.capitalize}:</strong> <%= #{model.downcase}.get#{column.capitalize}() %></p>\\n \"\n end\n template.gsub!('[[ShowFieldsForColumns]]', show_columns)\n\n # SQL\n column_names = \"\"\n columns.each { |column| column_names += \"`#{column}` varchar(255) DEFAULT NULL,\\n\" }\n template.gsub!('[[ColumnLinesForSQL]]', column_names) \n template.gsub!('[[PWD]]', Dir.pwd.split('/').last)\n\n return template\n end", "title": "" }, { "docid": "68e0e715118d0456bfaa43005015dbc4", "score": "0.53852063", "text": "def set_kind\n return unless new_record?\n self.kind = Kind.where(name: 'Dynamic').first\n end", "title": "" }, { "docid": "9e9979d165a2b8645b1540b1e1b28b5a", "score": "0.53730196", "text": "def options_for(table)\r\n result = execute(\"show table status like '#{table}'\")\r\n engine = result.fetch_row[1]\r\n if engine !~ /inno/i #inno is default so do nothing for it in order not to clutter the migration\r\n \"ENGINE=#{engine}\" \r\n else\r\n nil\r\n end\r\n end", "title": "" }, { "docid": "760f41aea7f48bca1cd3a734406db91d", "score": "0.537208", "text": "def finalize\n if @options[:table]\n [:Column, @options[:table], @options[:name]]\n else\n [:Column, @options[:name]]\n end\n end", "title": "" }, { "docid": "95d5d52f0193687391b65e7eff5ffea0", "score": "0.5366091", "text": "def create_table; end", "title": "" }, { "docid": "f1cdd2cd38fa09ec370469c49a9fcbfb", "score": "0.53660744", "text": "def create\n @option = Option.new(params[:option])\n\n value = {'entry_types' => params[:entry_types], 'fields' => []}\n if params[:field].present?\n params[:field].each do |k, v|\n value['fields'] << v if v['name'].present?\n end\n end \n @option.value = YAML.dump(value)\n\n respond_to do |format|\n if @option.save\n format.html { redirect_to edit_admin_option_path(@option), notice: 'Option was successfully updated.' }\n format.json { render json: @option, status: :created, location: @option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d894d5663014e44505479b92d862093", "score": "0.5361133", "text": "def populate_column(options = { well: nil, sample: nil, column_options: nil })\n populate = options[:column_options][:populate]\n return '' unless populate[:for].include?(options[:row_type])\n\n obj = populate[:with] == :row_type ? options[options[:row_type]] : options[populate[:with]]\n instance_value(obj, options[:column_options])\n end", "title": "" }, { "docid": "9c08851a1ae5a006fad05e96c6fa152a", "score": "0.53509164", "text": "def generate_type_of_record\n self.type_of_record = mets_object.type_of_record\n end", "title": "" }, { "docid": "ebe3da67eda678a231e724b7e4bfc267", "score": "0.53494644", "text": "def options\n {\n keywords: ['Boolean', \"Quote all keywords, not just reserved words\"],\n restrict: ['String', \"Restrict generation to tables in the specified group (e.g. bdv, rdv)\"],\n joiner: ['String', \"Use 'str' instead of the default joiner between words in table and column names\"],\n unicode: ['Boolean', \"Use Unicode for all text fields by default\"],\n tables: [%w{cap title camel snake shout}, \"Case to use for table names\"],\n columns: [%w{cap title camel snake shout}, \"Case to use for table names\"],\n surrogates: [%w{counter guid hash}, \"Method to use for assigning surrogate keys\"],\n fks: [%w{no yes delay}, \"Emit foreign keys, delay them to the end, or omit them\"],\n # Legacy: datavault: ['String', \"Generate 'raw' or 'business' data vault tables\"],\n }\n end", "title": "" }, { "docid": "077d4fdd49bd51489d0e5e8ef9f7f1bc", "score": "0.5347689", "text": "def _before_validation\n if new? && (set = self[model.sti_key])\n exp = model.sti_key_chooser.call(self)\n if set != exp\n set_table = model.sti_class_from_key(set).cti_table_name\n exp_table = model.sti_class_from_key(exp).cti_table_name\n set_column_value(\"#{model.sti_key}=\", exp) if set_table != exp_table\n end\n end\n super\n end", "title": "" }, { "docid": "5ae48e203206de7657bca3300fed79bb", "score": "0.53466564", "text": "def catalog_item_type_column_definitions()\n {\n \"ID\" => 'id',\n \"Name\" => 'name',\n \"Description\" => 'description',\n # \"Type\" => lambda {|it| format_catalog_type(it) },\n # \"Blueprint\" => lambda {|it| it['blueprint'] ? it['blueprint']['name'] : nil },\n # \"Enabled\" => lambda {|it| format_boolean(it['enabled']) },\n \"Featured\" => lambda {|it| format_boolean(it['featured']) },\n \"Allow Quantity\" => lambda {|it| format_boolean(it['allowQuantity']) },\n #\"Config\" => lambda {|it| it['config'] },\n # \"Created\" => lambda {|it| format_local_dt(it['dateCreated']) },\n # \"Updated\" => lambda {|it| format_local_dt(it['lastUpdated']) },\n }\n end", "title": "" }, { "docid": "1efced78d51f5db2268e6005c6ef23b2", "score": "0.53444564", "text": "def setup_model # rubocop:disable Metrics/MethodLength\n generate_model \"book\"\n generate_migration \"create_books\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :books do\n primary_key :id\n column :title, String\n end\n end\nend\n EOF\n\n migrate\n end", "title": "" }, { "docid": "01d046ee2b5e278b0d48d5b3a4f50cd6", "score": "0.5343425", "text": "def apply_schema(name, type, options={})\n raise NotImplementedError\n end", "title": "" }, { "docid": "5dcd8249a2d21d3400b9f428b97f551e", "score": "0.53422946", "text": "def column_options_for(type, request, column)\n framework_opts = case framework_opts = framework.column_options\n when Proc, Method\n framework_opts.call(model, column, type, request) || {}\n else\n extract_column_options(framework_opts, column, type, request)\n end\n\n model_opts = case model_opts = column_options\n when Proc, Method\n model_opts.call(column, type, request) || {}\n else\n extract_column_options(model_opts, column, type, request)\n end\n\n opts = framework_opts.merge(model_opts).dup\n\n if association?(column) && associated_model = associated_model_class(column)\n if associated_model.autocomplete_options_for(:association, request) && !opts[:as] && association_type(column) == :one\n opts[:type] = 'text'\n opts[:class] = 'autoforme_autocomplete'\n opts[:attr] = {'data-column'=>column, 'data-type'=>type}\n opts[:name] = form_param_name(column)\n else\n unless opts[:name_method]\n opts[:name_method] = lambda{|obj| associated_model.object_display_name(:association, request, obj)}\n end\n\n case type\n when :edit, :new, :search_form\n unless opts[:options] || opts[:dataset]\n opts[:dataset] = lambda{|ds| associated_model.apply_dataset_options(:association, request, ds)}\n end\n end\n end\n end\n\n case type\n when :show, :search_form\n opts[:required] = false unless opts.has_key?(:required)\n if type == :search_form && opts[:as] == :textarea\n opts.delete(:as)\n end\n end\n\n opts\n end", "title": "" }, { "docid": "a0993f5119a7c94f2b47b673a07cdeda", "score": "0.53416747", "text": "def command\n command = @connection.create_command(to_s)\n command.set_types(column_types)\n command\n end", "title": "" }, { "docid": "177628eb58ae4bf0be63a213eff00df2", "score": "0.53415614", "text": "def table; @options[:table]; end", "title": "" }, { "docid": "12999e1df25aa503e22a50a0f579cecb", "score": "0.5335852", "text": "def create_model\n @model_generator.create_dynamic_model\n\n @dynamic_model = @model_generator.dynamic_model\n raise FphsException, 'Failed to generate the dynamic model table' unless @dynamic_model\n\n redirect_to edit_imports_model_generator_path(@model_generator, from_upload: 'generated_model')\n end", "title": "" }, { "docid": "9d5c7e46159379bb83961cbb3b40494e", "score": "0.53333515", "text": "def valid_options\n [ :autosave, :foreign_key, :index, :polymorphic ]\n end", "title": "" }, { "docid": "9b5fd62471b8efb3159368da1e437aad", "score": "0.53327626", "text": "def rebuild_model\n ActiveRecord::Base.connection.create_table :dummies, :force => true do |table|\n table.datetime :date\n table.string :date_string\n table.integer :date_specificity\n table.datetime :another_date\n table.string :another_date_string\n table.integer :another_date_specificity\n end\n rebuild_class\nend", "title": "" }, { "docid": "ea661478e6389834c5bd862b37f63068", "score": "0.53232694", "text": "def model_config_key\n model_type\n end", "title": "" }, { "docid": "a0c5a1a60809a4bf27fbe297cdbf1dcf", "score": "0.5320001", "text": "def database_type; end", "title": "" }, { "docid": "5ec6915649d69d3f6150d0c053187b43", "score": "0.5319535", "text": "def create_table_specific_fields?(db_rel)\n cols = db_rel[:columns]\n return nil if cols.nil?\n cols.each{ |col, col_info|\n if fk_rel = col_info[:foreign_key_rel_type]\n other_col_info = col_info.reject { |k, _v| k == :foreign_key_rel_type }\n fail Error.new(\"#{fk_rel} is in foreign key DSL and does not exist\") if DB_REL_DEF[fk_rel].nil?\n @db.add_foreign_key? db_rel, col, DB_REL_DEF[fk_rel], other_col_info\n else\n other_col_info = col_info.reject { |k, _v| k == :type }\n\n type = col_info[:type] == :json ? :text : col_info[:type]\n # explicitly setting size to nil to handle dbrebuild which removes size restriction\n if !other_col_info.key?(:size) and [:varchar].include?(type)\n other_col_info = other_col_info.merge(size: nil)\n end\n\n @db.add_column? db_rel, col, type, other_col_info\n end\n }\n nil\n end", "title": "" }, { "docid": "14fb042b09699b4e7208ef08e2e6e73b", "score": "0.53159744", "text": "def generate_model\n invoke 'active_record:model', [name], migration: false unless model_exists? && behavior == :invoke\n end", "title": "" }, { "docid": "14fb042b09699b4e7208ef08e2e6e73b", "score": "0.53159744", "text": "def generate_model\n invoke 'active_record:model', [name], migration: false unless model_exists? && behavior == :invoke\n end", "title": "" }, { "docid": "057817a6ea8c7d9635d228af00a84aa7", "score": "0.5314986", "text": "def generate_model_class\n name.chomp('Table').singularize.constantize\n end", "title": "" }, { "docid": "073af107af04a5cf2fe2c33f5a302f59", "score": "0.5311512", "text": "def create_migration\n return unless options[:existing_model]\n migration_name = table_name.classify.pluralize\n args = \"AddPlatformsNetworkIdTo#{migration_name} platforms_#{concern_type}_id:integer\"\n generate \"migration\", args\n end", "title": "" }, { "docid": "308a81ad5088fb4279e672216ccc9d8a", "score": "0.53050816", "text": "def create_table(table_name, options = {})\n super\n table_comment(table_name, options[:comment]) unless options[:comment].blank?\n end", "title": "" }, { "docid": "9667c81c551dd94b6d16e6a3f3ae1547", "score": "0.53031355", "text": "def mysql_type_name=(val)\n self['mysql_type_name'] = val\n end", "title": "" }, { "docid": "88f645dc45a7ae2144dbf8016a1d3c55", "score": "0.530111", "text": "def set_meta_data(options)\n options.each do |option|\n gmt = self.mg_goal_meta_types.find_by_var(option[0].to_s)\n\n #Create cmt if it doesn't current exist (unless nil)\n if gmt.nil? && !option[1].nil? && ( option[1].is_a?(Integer) || option[1].is_a?(String) )\n #infer type\n meta_type = \"gi_meta\" if option[1].is_a?(Integer)\n meta_type = \"gs_meta\" if option[1].is_a?(String)\n gmt = mg_goal.mg_goal_meta_types.create!(:name => option[0].to_s, :var => option[0].to_s, :meta_type => meta_type)\n end\n \n if !gmt.nil? #only if we can do it\n gmt.meta.create!(:mg_record_id => self.id, :data => option[1]) if !option[1].nil?\n end\n end\n end", "title": "" }, { "docid": "fcf677fab85c672be16e9a937688c17a", "score": "0.5296443", "text": "def setup_option_types_and_values\n if ::Spree::OptionType.count.zero?\n option_type_color = create(:option_type_color)\n option_type_size = create(:option_type_size)\n option_type_material = create(:option_type_material)\n %w|white black grey red|.each{|_color| create(\"option_value_#{_color}\".to_sym, option_type: option_type_color) }\n %w|xs s m l xl|.each{|_size| create(\"option_value_#{_size}\".to_sym, option_type: option_type_size) }\n %w|cotton silk metal aluminum|.each{|_m| create(\"option_value_#{_m}\".to_sym, option_type: option_type_material) }\n end\n end", "title": "" }, { "docid": "5afbeedff6c141646fbd137d7771fe37", "score": "0.5269528", "text": "def handle_option_type_config\n etp = params[:extra_type]\n etp = params[:extra_log_type] if etp.blank?\n etp = object_instance.extra_log_type if etp.blank?\n\n etp = if etp.blank?\n object_instance ? :primary : :blank_log\n else\n etp.to_s.underscore.to_sym\n end\n\n set_item\n\n unless etp.present? && @implementation_class && @implementation_class.definition.option_configs_names&.include?(etp)\n return\n end\n\n @option_type_name = etp\n # Get the options that were current when the form was originally created, or the current\n # options if this is a new instance\n @option_type_config = if object_instance.persisted?\n object_instance.option_type_config\n else\n @implementation_class.definition.option_type_config_for(etp)\n end\n @option_type_attr_name = :extra_log_type\n object_instance.extra_log_type = @option_type_name unless object_instance.persisted?\n end", "title": "" }, { "docid": "46f67996830227fec2967c7d9f6e227f", "score": "0.526841", "text": "def init\n if(@new_record)\n self.type_id = Datagrouptype::DEFAULT\n end\n end", "title": "" }, { "docid": "69f97e31c382cf0ab657064c0dcbc6c8", "score": "0.52647436", "text": "def apply_default_column_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end", "title": "" }, { "docid": "710f6d584fc0c3109bb24a022d80cc1d", "score": "0.5263253", "text": "def create_first_option_and_variant\n options.create! name: 'Type', default_value: 'Default'\n variants.create! option_value_1: 'Default', price: 100\n end", "title": "" }, { "docid": "6352afee8a3fbcca8e2b7ad70a62b1ca", "score": "0.5262946", "text": "def table_name_options(config = T.unsafe(nil)); end", "title": "" }, { "docid": "74003c66f434ce3b4cd00ee8ab40ed3f", "score": "0.52612525", "text": "def build_attributes(model)\n model.columns.map do |i|\n type = conversions[i.type.to_s]\n if (enum = model.defined_enums[i.name])\n type = enum.keys.map { |k| \"'#{k}'\" }.join(' | ')\n end\n\n {\n name: i.name,\n ts_type: i.null ? \"#{type} | null\" : type\n }\n end\n end", "title": "" }, { "docid": "50111d37e869ada96fb4da81b7ee0715", "score": "0.52605486", "text": "def set_defaults(object_class)\n self.table_name ||= object_class.name.pluralize\n end", "title": "" }, { "docid": "37aa4c39a4fe83cd92505c386645ab28", "score": "0.5256274", "text": "def create_database_schema!\n create_request_table_and_class\n create_warning_table_and_class\n \n file_format.line_definitions.each do |name, definition|\n create_database_table(definition)\n create_activerecord_class(definition)\n end\n end", "title": "" }, { "docid": "e705be8b58cc427985cbbdb684b47520", "score": "0.52540296", "text": "def supports_virtual_columns?; end", "title": "" }, { "docid": "543e86522028dd5cec25604812c6d5d7", "score": "0.5246578", "text": "def generate_migration\n @description = options.description?\n migration_template 'rails31_migration.rb.erb', \"db/migrate/create_enum_#{table_name}.rb\" if options.migration?\n end", "title": "" }, { "docid": "12f6025544b9f75a6764f246a83d24cd", "score": "0.5245574", "text": "def dynamic_model_data_dictionary_config\n dynamic_model.data_dictionary || {}\n end", "title": "" } ]
833da3e333d996c621dd8c2c22a0a000
Get all the public assets and their server locations
[ { "docid": "c4beb213bf57566508b30de613eec53f", "score": "0.7407176", "text": "def map_assets\n ret = {}\n Dir.glob(\"output/public/*\").each do |asset_dir|\n dir_name = File.basename asset_dir\n ret[dir_name] = {}\n Dir.glob(\"#{asset_dir}/*\").each do |filepath|\n filename = File.basename filepath\n ret[dir_name][filename] = \"http://localhost:#{@port}/#{dir_name}/#{filename}\"\n end\n end\n @public_assets = ret\n end", "title": "" } ]
[ { "docid": "c109309c71be9283cb535a048431543e", "score": "0.686753", "text": "def assets\n environments.collect {|e| e.assets }\n end", "title": "" }, { "docid": "bf9c777545d301703375556ec5effe61", "score": "0.6833751", "text": "def assets\n []\n end", "title": "" }, { "docid": "dff92909e7efb8d4f58e12bdf13a071c", "score": "0.677896", "text": "def assets\n Chute::GCAsset.perform(self.class.get(\"/chutes/#{id}/assets\"))\n end", "title": "" }, { "docid": "e5acff09f4f75af38ae1b278850956e0", "score": "0.6759839", "text": "def asset_paths; end", "title": "" }, { "docid": "b16a56e9ccbd76ccdb126b5cc3fbab1b", "score": "0.6643073", "text": "def static_files\n @static_files\n end", "title": "" }, { "docid": "db8dcbd81dbdc02ce1b0c6a41aae6729", "score": "0.66302603", "text": "def paths\n @paths ||= Config::AssetsPaths.new(@root)\n end", "title": "" }, { "docid": "66db41ddd4b750f599f0d23e3e24c1cc", "score": "0.6624484", "text": "def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end", "title": "" }, { "docid": "7496e8438eb5583b42bcef48145d8965", "score": "0.661718", "text": "def assets\n self.class.assets\n end", "title": "" }, { "docid": "a526afbb0dff8ab71fda64aef2677696", "score": "0.6591445", "text": "def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end", "title": "" }, { "docid": "75ba6a07a7df2fba3334e5adbff917e6", "score": "0.6591006", "text": "def get_assets\n {\n :'images' => get_images,\n :'stylesheets' => get_stylesheets,\n :'scripts' => get_scripts\n }\n end", "title": "" }, { "docid": "6f349bcaa4e092d492690f926d388ec5", "score": "0.6588631", "text": "def assets\n @assets\n end", "title": "" }, { "docid": "9e086c93439d2aa3258e005de8c44f55", "score": "0.65810853", "text": "def getSites()\r\n\tws = []\r\n\t#gets all the html files located in the 'public/ws' folder\r\n\tDir['./public/ws/*/*.html'].each {|x|\r\n\t\tws.push(x.gsub('./public/', ''))\r\n\t}\r\n\treturn ws\r\nend", "title": "" }, { "docid": "dd20206a8a185105bb1e3fd6f2059eec", "score": "0.6570356", "text": "def assets\n @assets ||= []\n end", "title": "" }, { "docid": "330cea9f3d4eea667c9bae093f62208c", "score": "0.65406775", "text": "def serve_public_assets\n set :root, File.expand_path(File.join(File.dirname(settings.app_file), '..'))\n set :static_cache_control, [ :public, :max_age => 31557600 ]\n set :public_folder, 'public'\n end", "title": "" }, { "docid": "b64ea04b22c0033303a7e7261dc19caf", "score": "0.653568", "text": "def assets\n # This singleton guard removes ordering coupling between assets() & static()\n @doc ||= compile\n\n # matches url(<path>) and returns the path as a capture group\n urlsrc = /url\\([\\\"\\']?(.*?)(?:[#\\?].*)?[\\\"\\']?\\)/\n\n # get all image and url() sources\n files = @doc.search('img').map {|img| img[:src] }\n @doc.search('*').each do |node|\n next unless node[:style]\n next unless matches = node[:style].match(urlsrc)\n files << matches[1]\n end\n\n # add in images from css files too\n css_files.each do |css_path|\n data = File.read(File.join(Showoff::Config.root, css_path))\n\n # @todo: This isn't perfect. It will match commented out styles. But its\n # worst case behavior is displaying a warning message, so that's ok for now.\n data.scan(urlsrc).flatten.each do |path|\n # resolve relative paths in the stylesheet\n path = File.join(File.dirname(css_path), path) unless path.start_with? '/'\n files << path\n end\n end\n\n # also all user-defined styles and javascript files\n files.concat css_files\n files.concat js_files\n files.uniq\n end", "title": "" }, { "docid": "989081b542d6571d93c5ee269057c532", "score": "0.64862514", "text": "def index\n @assets = @app.assets\n end", "title": "" }, { "docid": "b36669ed7c2278a0558368d1af611cb5", "score": "0.64726615", "text": "def static_files\n source = File.dirname(ENGINE.assets_path)\n asset_files.map do |file|\n dir = File.dirname(file)\n file_name = File.basename(file)\n Jekyll::StaticFile.new @site, source, dir, file_name\n end\n end", "title": "" }, { "docid": "4491462fe5d21f84596eb6928766cc4b", "score": "0.6426811", "text": "def get_public\n inner_public = if @app && @app.respond_to?(:settings)\n @app.settings.public_folder\n else\n nil\n end\n choices = [@public_dir, inner_public, settings.public_dir]\n choices.compact.shift\n end", "title": "" }, { "docid": "98b304c339568beb13ed467f76bbf724", "score": "0.6410392", "text": "def collect\n @assets.map! do |path|\n begin\n file = File.open(File.join(@site.source, path))\n rescue Exception => e\n puts \"Asset Pipeline: Failed to open asset file.\"\n raise e\n end\n file\n end\n end", "title": "" }, { "docid": "cc29ec0c43169cd75bad32cb1aafce30", "score": "0.6394303", "text": "def public\n response = self.class.get(\"/public.json\")\n response['items'].map {|item| ChunkyBaconfile::FileInfo.new(item)}\n end", "title": "" }, { "docid": "9506ffc114b76251bf2ab5a123ad5ffe", "score": "0.6376047", "text": "def assets(query = {})\n self.class.get(\"/assets.json\", :query => query)\n end", "title": "" }, { "docid": "993c606e8b4c02a52b9055d1280b5e6e", "score": "0.6372327", "text": "def all_assets_path\r\n Dir.glob( File.join(self.base_root, \"*\") ).map do |theme_name|\r\n assets_path( File.basename(theme_name) )\r\n end.flatten\r\n end", "title": "" }, { "docid": "952113e5fc4459154b4dcfe68fe4d0e6", "score": "0.63685477", "text": "def files\n require 'puppet-herald'\n @files = nil if PuppetHerald.in_dev?\n if @files.nil?\n public_dir = PuppetHerald.relative_dir(@base)\n all = Dir.chdir(public_dir) { Dir.glob('**/*.js') }\n all = all.reverse.reject { |file| file.match(/_test\\.js$/) }\n @files = all.reject { |file| file.match(/bower_components/) }\n end\n @files\n end", "title": "" }, { "docid": "f6afaa36a01308fe4d3a13ba38c3f013", "score": "0.63428473", "text": "def static_files\n @static_files ||= []\n end", "title": "" }, { "docid": "e7cb8b333d77a9dd19cb4dc80db82645", "score": "0.63335073", "text": "def find_static_assets\n\t\tpaths = self.options.static_path || []\n\t\tself.log.debug \"Finding asset paths. Static paths: %p\" % [ paths ]\n\n\t\t# Add each subdirectory of the template dir\n\t\tself.log.debug \" adding directories under %s\" % [ self.template_dir ]\n\t\tpaths << self.template_dir\n\t\tself.log.debug \" paths are now: %p\" % [ paths ]\n\n\t\treturn paths.flatten.compact.uniq\n\tend", "title": "" }, { "docid": "8208921bf3385997309319c92319e687", "score": "0.63324773", "text": "def asset_roots\n unless @asset_roots\n @asset_roots = Processor.expand_paths($LOAD_PATH, @options[:gem_asset_roots])\n @asset_roots << Processor.realpath(@options[:cache_root])\n end\n \n @asset_roots\n end", "title": "" }, { "docid": "4fc6c353130bb4cd6362ee25195684b3", "score": "0.6330758", "text": "def tag_public_assets\n data = @asset_path.read\n data = data.gsub(/url\\(([^\\)]+)\\)/) do\n if $1.include?('data:') || $1.include?('#') || $1.include?('?') || $1.include?('::')\n 'url(%s)' % $1\n else\n path = $1.gsub(/^['\"]|['\"]$/, '')\n path = path[0,1] == '/' ? Pathname.new('./public%s' % path) : Pathname.new('./public/assets').join(path)\n\n if path.exist?\n 'url(\"%s?%s\")' % [path.to_s.sub('./public', ''), Digest::SHA1.hexdigest(path.read)[0, 6]]\n else\n LuxAssets::Cli.warn 'Resource \"%s\" referenced in \"%s/%s\" but not found' % [path, @ext, @name]\n 'url(\"%s\")' % path\n end\n end\n end\n\n @asset_path.write data\n end", "title": "" }, { "docid": "bb3081bafce6c6f2fa5cca4a19075006", "score": "0.6327029", "text": "def local_files\n @local_files ||= CloudfileAsset::Local.public_files.collect{|filename| CloudfileAsset::Local.make_relative(filename)}\n end", "title": "" }, { "docid": "b6ee3dc51f4fc17067954c9cc3c2ac12", "score": "0.6303282", "text": "def default_public_directory\r\n %w(assets public).select { |dir| File.directory?(File.join(root, dir)) }.first || \"assets\"\r\n end", "title": "" }, { "docid": "e5d99555a0f484922759c9f453cbc2c6", "score": "0.63022095", "text": "def local_files\n remote_files.map {|x| Config::SRC_DIR+'/'+ File.basename(x) }\n end", "title": "" }, { "docid": "bb05e2b7d43eab756f48e30430f9d51d", "score": "0.627102", "text": "def dirs_at_root\n static_files.map do |file|\n File.dirname(file.path.sub(\"#{site.source}/\", \"\")).split(\"/\")[0]\n end.uniq\n end", "title": "" }, { "docid": "bc23fa07b355dec60b91481a2ccddbe9", "score": "0.62684536", "text": "def assets\n return @assets if @assets\n @assets = AssetManager.new.assets(asset_options)\n end", "title": "" }, { "docid": "f26d3dbdf527f53685a89f0a4d91bdf0", "score": "0.6267624", "text": "def default_public_directory\n Engines.select_existing_paths(%w(assets public).map { |p| File.join(directory, p) }).first\n end", "title": "" }, { "docid": "93329a2c9d6a74f753f143f5cfabc0ae", "score": "0.62653434", "text": "def find_asset_files\n @css_files = Dir[File.join(@source_templates_dir, 'OEBPS', '*.css')].\n map { |f| File.basename(f) }\n @image_files = Dir[File.join(@source_templates_dir, 'OEBPS', 'images', '*')].\n map { |f| File.basename(f) }\n @font_files = Dir[File.join(@source_templates_dir, 'OEBPS', 'fonts', '*')].\n map { |f| File.basename(f) }\n end", "title": "" }, { "docid": "1408d12420014de49d5e664bf66cb746", "score": "0.6257427", "text": "def assets\n return @assets if @assets\n\n if free_to_read?(self)\n # check if solr response already included assets\n if (asset_response = fetch('assets', nil))\n @assets = Blacklight::Solr::Response.new({ response: asset_response }, {}, blacklight_config: Blacklight::Configuration.new).docs\n else\n item_pid = fetch('fedora3_pid_ssi', nil)\n\n @assets = AcademicCommons.search { |p| p.assets_for(item_pid) }.docs\n end\n else\n @assets = []\n end\n rescue StandardError => e\n Rails.logger.error e.message\n return []\n end", "title": "" }, { "docid": "9cc606ca9038e5504099497a04c8506a", "score": "0.6257276", "text": "def assets\n raise NotImplementedError\n end", "title": "" }, { "docid": "9a719176f7d9b89f218889b3fc91c578", "score": "0.6238339", "text": "def generate_from_public(root_dir = '')\n\t\tlist = []\n\t\tfiles = Dir.new(\"#{RAILS_ROOT}/public#{root_dir}\").entries\n\t\tfiles.each do |filename|\n\t\t\t# Ignore certain folders and files.\n\t\t\tunless ((filename == '.') or (filename == '..') or (filename.slice(-1, 1) == '~'))\n\t\t\t\t# For directories, drill down.\n\t\t\t\tif (File.directory?(\"#{RAILS_ROOT}/public/#{filename}\"))\n\t\t\t\t\tfolder = ''\n\t\t\t\t\tif (root_dir == '')\n\t\t\t\t\t\t# From the root /public folder, only drill down on certain folders.\n\t\t\t\t\t\tfolder = case filename.downcase\n\t\t\t\t\t\t\twhen '.svn', 'javascripts', 'images', 'sitemap', 'stylesheets'\n\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\telse filename\n\t\t\t\t\t\tend\n\t\t\t\t\telsif (filename != '.svn')\n\t\t\t\t\t\tfolder = filename\n\t\t\t\t\tend\n\t\t\t\t\tunless (folder == ''): list.concat(generate_from_public(root_dir + '/' + folder)) end\n\t\t\t\telsif (root_dir != '')\n\t\t\t\t\turl_filename = ''\n\t\t\t\t\tunless /^index(\\.html|\\.htm)?$/i.match(filename): url_filename = '/' + filename end\n\t\t\t\t\tlist << { :url => root_dir + url_filename, :lastmod => File.mtime(\"#{RAILS_ROOT}/public/#{root_dir}/#{filename}\") }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tlist\n\tend", "title": "" }, { "docid": "dc96312e869fa11af7a782fed97d8fe9", "score": "0.6238024", "text": "def files\n Jammit::Lite.assets(@filetype)[@name]\n end", "title": "" }, { "docid": "3f89febbccade2a180d4edb6ada70c94", "score": "0.62203526", "text": "def public_asset_directory\r\n \"#{File.basename(Engines.public_directory)}/#{name}\"\r\n end", "title": "" }, { "docid": "2e977164dc4393beb3b07a36f204f553", "score": "0.6220249", "text": "def find_assets(drop, page = 1)\n token = get_default_token(drop)\n uri = URI::HTTP.build({:path => asset_path(drop), :query => get_request_tokens(token) + \"&page=#{page}\"})\n req = Net::HTTP::Get.new(uri.request_uri, DEFAULT_HEADER)\n assets = nil\n complete_request(req) { |body| assets = Mapper.map_assets(drop, body) }\n assets\n end", "title": "" }, { "docid": "a3e1af55123a754d745ea60e0bc669d0", "score": "0.62188905", "text": "def assets(page = 1)\n Dropio::Client.instance.find_assets(self, page)\n end", "title": "" }, { "docid": "609d175074b6de8e8d8d117603722ed0", "score": "0.6212895", "text": "def public_asset_directory\n \"#{File.basename(Engines.public_directory)}/#{name}\"\n end", "title": "" }, { "docid": "90b09e251f56f20fe3bf58254e5600e4", "score": "0.6204843", "text": "def asset_files\n asset_files = []\n Find.find(ENGINE.assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(ENGINE.stylesheets_sass_path)\n asset_files << path.sub(ENGINE.assets_path, 'assets')\n end\n asset_files\n end", "title": "" }, { "docid": "89cc68cc85126b8a2c3c8ddffb231e3f", "score": "0.6199104", "text": "def cdn_assets_host\n Settings.cloud_files.containers.assets.host\n end", "title": "" }, { "docid": "1535ee475ff0226dbfdf1b73da247f50", "score": "0.61578685", "text": "def assets\n @assets ||= begin\n base = extract_from_assets document\n\n document.xpath(\"//head/comment()\").each do |node|\n text = node.text\n next if text.match(/<script/).nil?\n\n text.gsub! /\\[if [A-Za-z0-9 ]+\\]>[^<]+/, \"\"\n text.gsub! /<!\\[endif\\]/, \"\"\n mini_doc = Nokogiri::HTML.parse text\n base += extract_from_assets mini_doc\n end\n\n document.xpath(\"//style[@type='text/css']\").each do |node|\n append_from_css node.text, base\n end\n\n document.xpath(\"//*[@style]\").each do |node|\n append_from_css node[\"style\"], base\n end\n \n base\n end\n end", "title": "" }, { "docid": "311ed0ead3542d5fa3c789e342d1b9a9", "score": "0.6153996", "text": "def get_public_images_url\n return @client.raw(\"get\", \"/content/public-images-url\")\n end", "title": "" }, { "docid": "20651d6755ba9e85a1b3c04b1b0c5280", "score": "0.61469936", "text": "def get_public_folders(options = nil)\n @client.raw('get', '/config/public-folders', options)\n end", "title": "" }, { "docid": "28e877667d713117ee8066a7e04499d8", "score": "0.61424315", "text": "def extra_assets\n assets = asset_config[\"assets\"] ||= []\n each_logical_path(*assets).map do |v|\n find_asset v\n end\n end", "title": "" }, { "docid": "0e93994f80abe790852910258b9f61e0", "score": "0.61404264", "text": "def extra_assets\n each_logical_path(*asset_config.fetch(\"assets\", [])).map do |v|\n find_asset v\n end\n end", "title": "" }, { "docid": "c0e58535a7f792ded5dc41c9f8ed5551", "score": "0.6126067", "text": "def server_root\r\n File.expand_path(\"#{rails_root}/public/\")\r\n end", "title": "" }, { "docid": "1b077f7467b38e20bc2f6d5ce0830c93", "score": "0.61171186", "text": "def get_public_images_url\n @client.raw('get', '/content/public-images-url')\n end", "title": "" }, { "docid": "87db59110a30fdfad696a94bf29f84df", "score": "0.611294", "text": "def get_asset_public_route\n @client.raw('get', '/content/assets/publicRoute')\n end", "title": "" }, { "docid": "5844071d8eb08ecb16fcb763536ecc8a", "score": "0.6110597", "text": "def index\n # Dir.chdir(\"#{RAILS_ROOT}/public/upload\")\n # @files = Dir.glob(\"*\") || Array.new\n \n s3_connect\n @files = []\n AWS::S3::Bucket.find('uhf.jasperdesign.com').each {|b| @files << b.key }\n \n \n # @assets = assets.find(:all)\n\n # respond_to do |format|\n # format.html # index.rhtml\n # end\n end", "title": "" }, { "docid": "1200840bc6e73a3c8677a5a62bc10caf", "score": "0.6105569", "text": "def asset_root\n env_var_or_dev_fallback(\"GOVUK_ASSET_ROOT\") { find(\"static\") }\n end", "title": "" }, { "docid": "9a999d82e50815230d6a8cced67b13d1", "score": "0.60940105", "text": "def index\n @path = params[:path]\n start_path = (@path and @path.length > 0) ? \"#{BASE_PATH}/#{@path}\" : BASE_PATH\n start_path = BASE_PATH if start_path == \"#{BASE_PATH}/..\"\n start_path = BASE_PATH if start_path == \"#{BASE_PATH}/.\"\n @assets = Dir.entries(start_path).sort.collect { |path|\n # file absolute path\n absolute_path = \"#{start_path}/#{path}\"\n \n # file relative path\n relative_path = absolute_path[BASE_PATH.length+1, absolute_path.length]\n \n # file parent directory path\n if relative_path.index('/..')\n parent_path = relative_path[0,relative_path.length-3]\n parent_path = parent_path.split('/')\n parent_path.delete(parent_path.last)\n parent_path = parent_path.join('/')\n relative_path = parent_path\n elsif relative_path.index('/.')\n parent_path = relative_path[0,relative_path.length-2]\n relative_path = parent_path\n else\n parent_path = relative_path\n end\n \n Asset.new(:filename => File.basename(absolute_path), \n :path => relative_path,\n :full_path => absolute_path, \n :parent_path => parent_path,\n :content_type => MIME.check(absolute_path).to_s,\n :created_at => File.atime(absolute_path))\n }\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "2b1df84f7c61f37253bcc0ba66413049", "score": "0.6093363", "text": "def get_image_assets\n\t\treturn [] unless File.exists? self.assets_folder_name\n\t\timages = Dir.entries( self.assets_folder_name )\\\n\t\t\t.select { |x| ( x =~ @@IMAGE_MATCH) != nil }\\\n\t\t\t.select { |x| ( x =~ @@DISPLAY_ICON_IMAGE_MATCH ) == nil }\n\t\timages\n\tend", "title": "" }, { "docid": "ff4a590d0297549aa6458303785b184a", "score": "0.6086976", "text": "def collect_and_cache_assets\n # Assets are only contained in objects\n lp 'Collecting assets..'\n asset_list = []\n asset_store = AssetStore.new\n\n if asset_store.valid_manifest? @checksum\n lp 'Assets are still valid (checksum match).'\n asset_store.compact!\n return true\n end\n\n @document.body.levels.each do |level|\n level.screens.each do |screen|\n screen.objects.each do |object|\n\n if(object.type != :text)\n asset_path = object.content\n\n # relative paths are specified from inside the SMIL directory\n if asset_path.start_with? '../'\n asset_path = File.absolute_path(File.join(@path, 'SMIL', asset_path))\n end\n\n if File.exists? asset_path\n asset_list << asset_path\n else\n @load_errors << \"Missing asset '#{object.content}' for '#{object.path}'\"\n end\n end\n end\n end\n end\n\n if @load_errors.empty?\n asset_list.each do |asset|\n lp \"Caching '#{asset}'..\", force_color: :yellow if app.development?\n\n unless asset_store.cache_resource(asset)\n @load_errors << \"Failed to cache asset '#{asset}'\"\n end\n end\n asset_store.register_manifest(@manifest, @checksum)\n asset_store.compact!\n lp \"Cached #{asset_list.count} assets.\"\n end\n end", "title": "" }, { "docid": "fb6e3d01bdfb2908ea013993c5054dc4", "score": "0.60864884", "text": "def assets; end", "title": "" }, { "docid": "fb6e3d01bdfb2908ea013993c5054dc4", "score": "0.60864884", "text": "def assets; end", "title": "" }, { "docid": "0617ee16f2a257090b72795522965d94", "score": "0.6078864", "text": "def assets\n @assets ||= Hash.new { |h,k| h[k] = channel.server.bucket.objects.build object_key(k) } # /win-dev/1.1/appcast.xml\n end", "title": "" }, { "docid": "f078569ec8e1a714514774b6f855edaf", "score": "0.6076859", "text": "def get_assets(type)\n\n # Parse the ASSETSPATH file for generating the list of EPUB\n # included images, or media assets.\n assets_xml = File.new(ASSETSPATH)\n #parsed_assets = AssetListener.new\n #Document.parse_stream(assets_xml, parsed_assets)\n parsed_assets = parsed_assets(ASSETSPATH)\n\n case type\n when \"images\"\n\n # Use the generated list to copy images\n # to the images directory.\n image_list = parsed_assets.get_image_list\n return image_list\n when \"media\"\n\n # Use the generated list to copy assets\n # to the media directory.\n media_asset_list = parsed_assets.get_media_list\n return media_asset_list\n end\n end", "title": "" }, { "docid": "eb7fda6c5c1bc60266b7ea40b8623686", "score": "0.60688615", "text": "def assets_path\n @assets_path ||= root_path.join(\"assets\")\n end", "title": "" }, { "docid": "58826a14408d200d12abdf7f8a2d7d50", "score": "0.6055302", "text": "def asset_urls\n [\n link_tag_urls,\n img_tag_urls,\n embed_tag_urls,\n object_tag_urls,\n video_tag_urls,\n track_tag_urls,\n audio_tag_urls,\n source_tag_urls,\n script_tag_urls\n ].flatten\n end", "title": "" }, { "docid": "136d47a91848acef897b7226eb2f4f8f", "score": "0.60552025", "text": "def list_assets\n client.make_request('/list-assets', 'post', params: {})\n end", "title": "" }, { "docid": "ce229b16bd36a251bdf1e0f64b570c18", "score": "0.60542303", "text": "def dist_urls\n get_urls( dist_url, dist_mirrors, dist_reference, dist_type, 'dist' )\n end", "title": "" }, { "docid": "fb922543f20c73f0d7481928c226786b", "score": "0.60469216", "text": "def find(sources, options)\n paths = normalise_sources(sources, options)\n if options[:development]\n assets = paths.flat_map { |path| a = environment[path, bundle: true].to_a ; a.empty? ? [path] : a }\n else\n assets = paths.map { |path| environment[path] || path }\n end\n assets.map { |asset| to_url(asset, options[:development]) }\n end", "title": "" }, { "docid": "fb922543f20c73f0d7481928c226786b", "score": "0.60469216", "text": "def find(sources, options)\n paths = normalise_sources(sources, options)\n if options[:development]\n assets = paths.flat_map { |path| a = environment[path, bundle: true].to_a ; a.empty? ? [path] : a }\n else\n assets = paths.map { |path| environment[path] || path }\n end\n assets.map { |asset| to_url(asset, options[:development]) }\n end", "title": "" }, { "docid": "90218722bdca8c85ec760bebe3d8866c", "score": "0.6039154", "text": "def assets_path\n root.join(\"assets\")\n end", "title": "" }, { "docid": "b05d32525b54f957942f2da0b481feb4", "score": "0.6030401", "text": "def children\n @children ||= assets.map do |asset|\n if %r{^#{ bucket }\\/([^\\/]+)} === asset.key\n path = \"#{ resource.public_path }/#{ $1 }\"\n Shopidav::Resource.new(path, path, resource.request, resource.response, resource.options)\n end\n end.compact.uniq_by { |asset| asset.path }\n end", "title": "" }, { "docid": "48d1236a08179321364ea0029ec634c6", "score": "0.6029047", "text": "def assets\n process_page unless @processed\n @assets\n end", "title": "" }, { "docid": "f45dfb37879ee6a9e8e58d6b825ee08b", "score": "0.60273504", "text": "def collins_asset\n @host.collins_asset\n end", "title": "" }, { "docid": "27b2ac24bf83e7faee6f89064979d1e4", "score": "0.6012564", "text": "def get_additional_scripts\n ctrl_script_url = \"page/\" + params[:controller] + \"/overall.js\"\n page_script_url = \"page/\" + params[:controller] + \"/\" + params[:action] + \".js\"\n\n res = Array.new\n\n if check_asset_existency ctrl_script_url\n res << \"/assets/#{ctrl_script_url}\"\n end\n\n if check_asset_existency page_script_url\n res << \"/assets/#{page_script_url}\"\n end\n \n return res\n end", "title": "" }, { "docid": "7505976d8fc438d04f9c668092676bd4", "score": "0.60080755", "text": "def root; File.join(Padrino.root,\"public/\"); end", "title": "" }, { "docid": "7505976d8fc438d04f9c668092676bd4", "score": "0.60080755", "text": "def root; File.join(Padrino.root,\"public/\"); end", "title": "" }, { "docid": "7ca32929d417bfe1d45fca069b4165c2", "score": "0.6006616", "text": "def assets\n @assets ||= Sprockets::Environment.new(root.to_s) do |env|\n env.version = ::Rails.env\n\n path = \"#{config.root}/tmp/cache/assets/#{::Rails.env}\"\n env.cache = Sprockets::Cache::FileStore.new(path)\n\n env.context_class.class_eval do\n include ::Sprockets::Rails::Helper\n end\n end\n end", "title": "" }, { "docid": "8fc98a06535e7a6cf93620d050064a60", "score": "0.6002765", "text": "def assets\n @assets ||= Assets.new\n end", "title": "" }, { "docid": "e56fb8400388d9594c92a1d4ba8baf23", "score": "0.59985703", "text": "def index\n\n \t@output = Array.new\n Dir.foreach('app/assets/images/') do |item|\n\t\t next if item == '.' or item == '..' or item.downcase == '.ds_store'\n\t\t \[email protected](item)\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "cfe54ae95e1272fb739bfca83773ce5f", "score": "0.5991413", "text": "def assets\n @assets ||= begin\n hash = Hash.new\n search_paths = []\n search_paths << File.join(@book.builtin_template_path, 'assets', '**', '*')\n search_paths << File.join(@book.path, 'assets', '**', '*')\n search_paths.each do |search_path|\n Dir[search_path].inject(hash) do |hash, path|\n if File.file?(path)\n content = File.open(path, 'rb', &:read)\n case path.split('.').last\n when 'scss'\n path.gsub!(/.scss\\z/, '.css')\n content = Sass::Engine.new(content, :syntax => :scss).render\n end\n hash[path.gsub(/\\A.*\\/assets\\//, '')] = content\n end\n hash\n end\n end\n hash\n end\n end", "title": "" }, { "docid": "85ca2d2d3120334e8ee4fc790e1420e0", "score": "0.5986956", "text": "def assets(page = 1)\n Resource.client.assets(self, page)\n end", "title": "" }, { "docid": "91c37d01c48d829d1a6b318ffa8b10ec", "score": "0.5977083", "text": "def asset_host; end", "title": "" }, { "docid": "af9228bb7a19fda361f8232186cb34ce", "score": "0.5974384", "text": "def copy_public_assets\n generate \"atrium:assets\"\n end", "title": "" }, { "docid": "24b133700d0dc59e8a0edf8e22dcfc1f", "score": "0.59713954", "text": "def items\n assets\n end", "title": "" }, { "docid": "f57088ed62c8f683f7ef99f0788b0342", "score": "0.597105", "text": "def images\n @images ||= parsed_images.map{ |i| URL.absolutify(i, base_url) }\n end", "title": "" }, { "docid": "ebe356edaffa4855baed65a8151a30f7", "score": "0.5968115", "text": "def assets\n @assets ||= begin\n Sprockets::Environment.new.tap do |environment|\n environment.append_path 'assets/images'\n environment.append_path 'assets/javascripts'\n environment.append_path 'assets/stylesheets'\n environment.context_class.class_eval { include AssetExtensions }\n end\n end\n end", "title": "" }, { "docid": "0c055d044118a09cc3c49bf4daf5ef56", "score": "0.59624237", "text": "def shared_files\n if current_user.shared_files\n @assets = list_shared_assets\n end\n end", "title": "" }, { "docid": "37356406b4e253bef2a0aa332901bf46", "score": "0.59586865", "text": "def public_directory\n File.expand_path(\"#{__FILE__}/../../public\")\n end", "title": "" }, { "docid": "4cbadc2c573462746767dad2b3ac02d9", "score": "0.59565645", "text": "def content_urls\n return [] unless @resource.file_view\n\n @resource.data_files.present_files.map { |f| Rails.application.routes.url_helpers.download_stream_url(f.id) }\n end", "title": "" }, { "docid": "c38f12c621dc3d738690692dc62a5a5f", "score": "0.59527946", "text": "def path_in_public\n (sitemaps_path + filename).to_s\n end", "title": "" }, { "docid": "c38f12c621dc3d738690692dc62a5a5f", "score": "0.59527946", "text": "def path_in_public\n (sitemaps_path + filename).to_s\n end", "title": "" }, { "docid": "270d8d9c552724ea10de3affab440d4d", "score": "0.5950332", "text": "def file_list\n files = Dir.glob( File.join( Rails.root , 'public', 'storage', self.site, self.name, '*' ) )\n files.delete_if {|f| File.directory?(f) }\n return files \n end", "title": "" }, { "docid": "2bd175628de799a208f6b64a436bc958", "score": "0.594352", "text": "def public_root\n \"#{Rails.root}/public#{@@public_url}\"\n end", "title": "" }, { "docid": "17bed8f8adba60bcdabfd2c8f0273258", "score": "0.5940798", "text": "def directory\n (public_path + sitemaps_path).to_s\n end", "title": "" }, { "docid": "556dccf2d97d2d478cf83297fd157209", "score": "0.5940319", "text": "def public_path\n path :public\n end", "title": "" }, { "docid": "890f8edc7d3d7ca634a943e1b6f466b3", "score": "0.5933453", "text": "def public_root\n [ @public_root,\n root/@public_root\n ].find{|path| File.directory?(path) } || @public_root\n end", "title": "" }, { "docid": "dfcd32c32b47e60dd3b16f8bf922f002", "score": "0.593142", "text": "def gitlab_webpack_asset_paths(source, extension: nil)\n return \"\" unless source.present?\n\n paths = Webpack::Rails::Manifest.asset_paths(source)\n if extension\n paths.select! { |p| p.ends_with? \".#{extension}\" }\n end\n\n force_host = webpack_public_host\n if force_host\n paths.map! { |p| \"#{force_host}#{p}\" }\n end\n\n paths\n end", "title": "" }, { "docid": "4b3a379d9daa537e7c98bf1b6bb1deb9", "score": "0.59223515", "text": "def asset_host # TODO: testme\n @asset_host ||= get('/asset_host').body\n end", "title": "" }, { "docid": "d13b945d5495a1f787ee04c7b70d0101", "score": "0.59207284", "text": "def files\n manifest.inject([]) do |memo, item|\n memo << full_path(item.first)\n end\n end", "title": "" }, { "docid": "2ed2e0b3d694c387f712091cd4625e9a", "score": "0.5920149", "text": "def assets(query = {})\n normalize_select!(query)\n Request.new(self, environment_url('/assets'), query).get\n end", "title": "" }, { "docid": "6d3732fbf7fd035802be769fc846f5e3", "score": "0.5917893", "text": "def urls\n @urls\n end", "title": "" }, { "docid": "5649085f5e5826493e1c8f6338816ab0", "score": "0.5915255", "text": "def files_available\n absolute_paths.map { |path| files_at(path) }.flatten\n end", "title": "" } ]
1ead71c531114e2deed322c4f6671db9
rubocop:enable all rubocop:disable AbcSize, MethodLength
[ { "docid": "95859b3674b8e0f6789f766f098d5387", "score": "0.0", "text": "def decompress_v2_len str\n length = 0\n offset = 0\n while offset < str.length\n substr = str[offset, str.length]\n match_data = substr.match(/\\((\\d+)x(\\d+)\\)/)\n if match_data.nil?\n length += str.length - offset\n offset = str.length\n else\n seg_len = match_data[1].to_i\n seg_cnt = match_data[2].to_i\n seg = str[offset + match_data.begin(0) + match_data[0].length, seg_len]\n length += match_data.begin(0) + decompress_v2_len(seg) * seg_cnt\n offset += match_data.begin(0) + match_data[0].length + seg_len\n end\n end\n length\n end", "title": "" } ]
[ { "docid": "978457f08b58776f5cfb90fcb9e1ebc7", "score": "0.63943464", "text": "def method_size_cutoff=(_arg0); end", "title": "" }, { "docid": "978457f08b58776f5cfb90fcb9e1ebc7", "score": "0.63943464", "text": "def method_size_cutoff=(_arg0); end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6229051", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6229051", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6229051", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6229051", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6229051", "text": "def implementation; end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.6189264", "text": "def desired; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6167825", "text": "def method; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.61376226", "text": "def methods; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6075962", "text": "def bodystmt; end", "title": "" }, { "docid": "58e2e07d11b107b6864a328f2187e248", "score": "0.6070581", "text": "def apop?; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.606902", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.606902", "text": "def used; end", "title": "" }, { "docid": "b22ea521ce6dc3254e1f74daf0331724", "score": "0.59838575", "text": "def method\n end", "title": "" }, { "docid": "31e801a93dc2fdf9be17a4b890837c5a", "score": "0.59546226", "text": "def public_method; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.59101564", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.59101564", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.59101564", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.59101564", "text": "def preparable; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.58818865", "text": "def internal; end", "title": "" }, { "docid": "e59b20560675ef59f6304c17ab4b893f", "score": "0.58818257", "text": "def default_tire_size\n raise NotImplementedError, \n \"This #{self.class.to_s} can not respond_to :: #{__method__.to_s}\"\n end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.5879352", "text": "def operations; end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.5879352", "text": "def operations; end", "title": "" }, { "docid": "c3285b979f713395f60cf13edce8a310", "score": "0.587545", "text": "def methodmissing; end", "title": "" }, { "docid": "b7cfdec5315b5d3c26b002081b1dbae3", "score": "0.58666307", "text": "def coming_soon; end", "title": "" }, { "docid": "78715c96fa1cf2097657613c494e2cc6", "score": "0.5863091", "text": "def internal_methods; end", "title": "" }, { "docid": "9a2e0893f9b358f9c0c64a17fcd66291", "score": "0.58455783", "text": "def non_ar_method; end", "title": "" }, { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.58198947", "text": "def override; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.58054346", "text": "def in_use; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.58054346", "text": "def in_use; end", "title": "" }, { "docid": "72cf1cb20d4bc11010b9431be33fbc9a", "score": "0.5786109", "text": "def proto; end", "title": "" }, { "docid": "edd5d23e0d7042e5e542e9b04934c6b0", "score": "0.576759", "text": "def ignoring_method_signature_failure!; end", "title": "" }, { "docid": "f8877e8a5e4afd637fc06584527bff92", "score": "0.5762036", "text": "def api\n raise NotImplementedError\n end", "title": "" }, { "docid": "954c5828178f6e4a659c40ef92736547", "score": "0.57604516", "text": "def helpful!\n\n\t\tend", "title": "" }, { "docid": "28e230f1bd5c2e2975b6248748fd9c33", "score": "0.5731777", "text": "def regular_method() end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5729147", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5729147", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5729147", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5729147", "text": "def operation; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.5723736", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.5723736", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.5723736", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.5723736", "text": "def extra; end", "title": "" }, { "docid": "b7567a2a68cade31f2360723a4c42dc7", "score": "0.568631", "text": "def used_by; end", "title": "" }, { "docid": "3adfffebcdd8244fe58cf26a3ebc3aaa", "score": "0.56716937", "text": "def java_method; end", "title": "" }, { "docid": "0770258543f6923d2e5195988948373d", "score": "0.56468606", "text": "def not_documented_1\n end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.5644411", "text": "def method_name; end", "title": "" } ]
d5b66d96c6e8bc61479e51ccf002a3bc
For the split subject facet Split with em dash along v,x,y,z
[ { "docid": "adb6e72553fb785d938a6d7be6601fa1", "score": "0.0", "text": "def process_subject_topic_facet(fields)\n lambda do |record, accumulator|\n return unless record.is_a? MARC::Record\n\n subjects = []\n Traject::MarcExtractor.cached(fields).collect_matching_lines(record) do |field, spec, extractor|\n subjects << extract_subjects(field, spec, extractor)\n end\n\n accumulator.replace(subjects.flatten.compact.uniq)\n end\n end", "title": "" } ]
[ { "docid": "8af3ca181b7563ab3f526efc5be7c3d5", "score": "0.60210836", "text": "def x_split; end", "title": "" }, { "docid": "7d2eaf7563567815c571325c568f47df", "score": "0.5649269", "text": "def subject_xfacet_to_facet(value)\n value.gsub('--', ' ').gsub(/\\s{2,}/, ' ')\n end", "title": "" }, { "docid": "725333084ed185807471be169aa15519", "score": "0.54448426", "text": "def facet\n super\n end", "title": "" }, { "docid": "2d24a7d748284a1ea56769656201c820", "score": "0.54329115", "text": "def y_split; end", "title": "" }, { "docid": "aca2a4c989c0e6171043adc6286fb3d8", "score": "0.53325325", "text": "def split(group)\n end", "title": "" }, { "docid": "faa62838841f69e0a0f02bcbc1fc413a", "score": "0.5330879", "text": "def splitView splitView, constrainMaxCoordinate:proposed_max, ofSubviewAt:divider_index\n\t\t300.0\n\tend", "title": "" }, { "docid": "311179792c626df3c799976835800531", "score": "0.5320899", "text": "def split(t)\n raise NotImplementedError, \"Implementors of SegmentLike must implement #split\"\n end", "title": "" }, { "docid": "330b962fb12d9d28967cd5da71f173be", "score": "0.52473", "text": "def mark_with_split_points \n @value.gsub!(@pattern, SPLIT_INDICATOR+'\\1'+MATCH_INDICATOR)\n end", "title": "" }, { "docid": "cd59f7159ba528076586d2734f63b2fb", "score": "0.5217909", "text": "def split_vertically!(y)\n raise \"Not Implemented\"\n end", "title": "" }, { "docid": "cd59f7159ba528076586d2734f63b2fb", "score": "0.5217909", "text": "def split_vertically!(y)\n raise \"Not Implemented\"\n end", "title": "" }, { "docid": "4a5e739ec07e779f2a7001b8b7e9e42a", "score": "0.5216409", "text": "def split(instance)\n end", "title": "" }, { "docid": "ac3ba34d30c4531f62b1dca3fe0498a7", "score": "0.5184463", "text": "def printSegmentedComponentsWithMeshNoExplode(e)\r\n\tcomponents = getComponents(e)\r\n\tf = File.new('C:/3DWarehouse/Matlab/compsWithMeshNoExplode.txt', 'w')\r\n\tfor i in 0..components.length-1\r\n\t\tf.puts \"New Instance\"\r\n\t\tif containsFaces(components[i].definition.entities)\r\n\t\t\tf.puts \"Transformation\"\r\n\t\t\tfor j in 0..15\r\n\t\t\t\tf.puts \"#{components[i].transformation.to_a[j]}\"\r\n\t\t\tend\r\n\t\t\tfor j in 0..components[i].definition.entities.length-1\r\n\t\t\t\tif components[i].definition.entities[j].typename == \"Face\"\r\n\t\t\t\t\tpoints = components[i].definition.entities[j].mesh.points\r\n\t\t\t\t\tpolygons = components[i].definition.entities[j].mesh.polygons\r\n\t\t\t\t\tfor k in 0..points.length-1\r\n\t\t\t\t\t\tf.puts \"#{points[k].x.to_f}\\n#{points[k].y.to_f}\\n#{points[k].z.to_f}\\n\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\t\tfor k in 0..polygons.length-1\r\n\t\t\t\t\t\tf.puts \"#{polygons[k][0]}\\n#{polygons[k][1]}\\n#{polygons[k][2]}\\n\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\tif containInstances(components[i].definition.entities)\r\n\t\t\tsubComponents = getComponents(components[i].definition.entities)\r\n\t\t\tfor j in 0..subComponents.length-1\r\n\t\t\t\tf.puts \"Transformation\"\r\n\t\t\t\tfor k in 0..15\r\n\t\t\t\t\tf.puts \"#{(components[i].transformation.* subComponents[j].transformation).to_a[k]}\"\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tfor k in 0..subComponents[j].definition.entities.length-1\r\n\t\t\t\t\tif subComponents[j].definition.entities[k].typename == \"Face\"\r\n\t\t\t\t\t\tpoints = subComponents[j].definition.entities[k].mesh.points\r\n\t\t\t\t\t\tpolygons = subComponents[j].definition.entities[k].mesh.polygons\r\n\t\t\t\t\t\tfor l in 0..points.length-1\r\n\t\t\t\t\t\t\tf.puts \"#{points[l].x.to_f}\\n#{points[l].y.to_f}\\n#{points[l].z.to_f}\\n\"\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\t\t\tfor l in 0..polygons.length-1\r\n\t\t\t\t\t\t\tf.puts \"#{polygons[l][0]}\\n#{polygons[l][1]}\\n#{polygons[l][2]}\\n\"\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\t\r\n\t\t\tsubGroups = getGroups(components[i].definition.entities)\r\n\t\t\tputs \"#{components[i].name}#{subGroups.length}\"\r\n\t\t\tfor j in 0..subGroups.length-1\r\n\t\t\t\tf.puts \"Transformation\"\r\n\t\t\t\tfor k in 0..15\r\n\t\t\t\t\tf.puts \"#{(components[i].transformation.* subGroups[j].transformation).to_a[k]}\"\r\n\t\t\t\tend\r\n\t\t\t\tfor k in 0..subGroups[j].entities.length-1\r\n\t\t\t\t\tif subGroups[j].entities[k].typename == \"Face\"\r\n\t\t\t\t\t\tpoints = subGroups[j].entities[k].mesh.points\r\n\t\t\t\t\t\tpolygons = subGroups[j].entities[k].mesh.polygons\r\n\t\t\t\t\t\tfor l in 0..points.length-1\r\n\t\t\t\t\t\t\tf.puts \"#{points[l].x.to_f}\\n#{points[l].y.to_f}\\n#{points[l].z.to_f}\\n\"\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\t\t\tfor l in 0..polygons.length-1\r\n\t\t\t\t\t\t\tf.puts \"#{polygons[l][0]}\\n#{polygons[l][1]}\\n#{polygons[l][2]}\\n\"\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tf.close\r\nend", "title": "" }, { "docid": "b253cd24256853089ade78bf92ce8c60", "score": "0.5179523", "text": "def split\n end", "title": "" }, { "docid": "ab9f01be34a73223edd1d7b82a3bf3c9", "score": "0.51643103", "text": "def compose! facet\n raise \"not implemented\"\n end", "title": "" }, { "docid": "45b663b717798731e089fb188d631501", "score": "0.5118418", "text": "def set_splitterpos_onsize(ww, hh )\r\n #@log.debug \"Set splitter position to #{ww}, #{hh}\"\r\n splitpos_y = @splitter.getSplit(0)\r\n ratio_y = hh - hh/3 + 3\r\n if splitpos_y > hh - 5\r\n posy = ratio_y \r\n @splitter.setSplit(0, posy)\r\n elsif splitpos_y < ratio_y\r\n @splitter.setSplit(0, ratio_y)\r\n end\r\n \r\n end", "title": "" }, { "docid": "556bb57c1cb686d26403353f75a5fe15", "score": "0.5109092", "text": "def split; end", "title": "" }, { "docid": "ab228ac5fd0bec66d23ef71622941c38", "score": "0.5081807", "text": "def psplit(cycv)\n\t\tself.class.psplit(cycv)\n\tend", "title": "" }, { "docid": "a6ad4f65aa996e260381de32b5ed0a30", "score": "0.5057705", "text": "def split(name); end", "title": "" }, { "docid": "53f6412c04b21a4192279d3f02478a99", "score": "0.5040958", "text": "def leg(e)\n group = e.add_group\n entities = group.entities\n t_c = newTranslation 0, 0, @C\n t_b = newTranslation @B, 0, 0\n t_l_extra_neg = newTranslation 0, -@l_extra, 0\n\n # L segment's plane\n l_lower = [\n Geom::Point3d.new([0, 0, 0]),\n Geom::Point3d.new([@B, 0, 0]),\n Geom::Point3d.new([@B, @L, 0]),\n Geom::Point3d.new([0, @L, 0]),\n ]\n # The upper plane is @l_extra shorter\n l_upper = [\n t_c * l_lower[0],\n t_c * l_lower[1],\n t_l_extra_neg * t_c * l_lower[2],\n t_l_extra_neg * t_c * l_lower[3],\n ]\n\n l_left_panel = [\n l_lower[0], \n l_upper[0],\n l_upper[3],\n l_lower[3],\n ]\n l_right_panel = l_left_panel.map {|v| t_b * v}\n\n l_end_panel = [\n l_lower[0], \n l_right_panel[0],\n l_right_panel[1],\n l_upper[0],\n ]\n\n l1_lower = [\n Geom::Point3d.new([ 0, @d2 - @l1, @a1 + @p]),\n Geom::Point3d.new([@B, @d2 - @l1, @a1 + @p]),\n Geom::Point3d.new([@B, @d2, @a1 + @p]),\n Geom::Point3d.new([ 0, @d2, @a1 + @p]),\n ]\n # The upper plane is @l_extra longer\n l1_upper = [\n t_l_extra_neg * t_c * l1_lower[0],\n t_l_extra_neg * t_c * l1_lower[1],\n t_c * l1_lower[2],\n t_c * l1_lower[3],\n ]\n\n l1_left = [\n l1_lower[0], \n l1_upper[0],\n l1_upper[3],\n l1_lower[3],\n ]\n l1_right = l1_left.map {|v| t_b * v}\n\n l2_lower = [\n l_lower[3],\n l1_lower[0],\n l1_lower[1],\n l_lower[2],\n ]\n\n l2_upper = [\n l_upper[3],\n l1_upper[0],\n l1_upper[1],\n l_upper[2],\n ]\n\n l2_left = [\n l_lower[3],\n l_upper[3],\n l1_upper[0],\n l1_lower[0],\n ]\n l2_right = l2_left.map {|v| t_b * v}\n\n quad(entities, l_lower, @legColor)\n quad(entities, l_upper, @legColor)\n\n quad(entities, l_left_panel, @legColor)\n quad(entities, l_right_panel, @legColor)\n\n quad(entities, l_end_panel, @legColor)\n\n quad(entities, l1_lower, @legColor)\n quad(entities, l1_upper, @legColor)\n quad(entities, l1_left, @legColor)\n quad(entities, l1_right, @legColor)\n\n quad(entities, l2_lower, @legColor)\n quad(entities, l2_upper, @legColor)\n quad(entities, l2_left, @legColor)\n quad(entities, l2_right, @legColor)\n\n group\n end", "title": "" }, { "docid": "a2411d062d9d46b0fe9bf9def99c1648", "score": "0.503798", "text": "def split_sentence(p_text)\nend", "title": "" }, { "docid": "698e5e0b481fb5311dcfc4ea0244c0e3", "score": "0.50305444", "text": "def plot_stem; end", "title": "" }, { "docid": "072524c7b2e2b60b79ac704b54f453f8", "score": "0.5010852", "text": "def split_subjects(str)\n str.split('|||')\n end", "title": "" }, { "docid": "d361418038c601817c7e7edf5463df46", "score": "0.49905822", "text": "def split\n tags.map do |tagname, datatype, value|\n h = RGFA::Line::Header.new([], validate: @validate)\n h.set_datatype(tagname, datatype)\n h.set(tagname, value)\n h\n end\n end", "title": "" }, { "docid": "0b362841565a216e748aca59b3ba11db", "score": "0.49367943", "text": "def facet_fields_form_value=(val)\n\t\tvals = val.split(/[\\s,]+/)\n\t\tself.field_name = vals[0]\n\t\tself.pivot = vals.length > 1 ? vals[1..-1] : nil\n\tend", "title": "" }, { "docid": "7c61fb0e3cdf28f15244c0c3fdf61c8e", "score": "0.4926403", "text": "def split_multiples\n k = 0\n for i in 1..self.data_dim do\n if !self.two_multiple(i.to_i)\n self.hword[i] = self.word[k]\n self.calc_group[i.to_s] = i\n k += 1\n else\n self.two_multiples << i\n end\n end\n end", "title": "" }, { "docid": "2ad38e12562f95c2cab069633feaecb6", "score": "0.48983765", "text": "def split(entity, origin, normal, recursive = true, &entity_validation)\n AMS.validate_type(entity, Sketchup::Group, Sketchup::ComponentInstance)\n AMS.validate_type(origin, Geom::Point3d)\n AMS.validate_type(normal, Geom::Vector3d)\n plane_tra = Geom::Transformation.new(origin, normal)\n cgroup = self.copy(entity, recursive, &entity_validation)\n groups = []\n if self.get_faces(cgroup, true).empty?\n cgroup.erase!\n return groups\n end\n groupa, groupb = self.split_at_plane(cgroup, plane_tra, recursive, nil, nil, &entity_validation)\n cgroup.erase!\n if self.get_faces(groupa, true).empty?; groupa.erase! else groups << groupa; end\n if self.get_faces(groupb, true).empty?; groupb.erase! else groups << groupb; end\n groups\n end", "title": "" }, { "docid": "11a0a56c8026b7fd2fa6e12695ac116a", "score": "0.48971415", "text": "def PartName=(v)", "title": "" }, { "docid": "c1f48f2e21e7b5225252222e68d705c8", "score": "0.489567", "text": "def text_splitter\n @string_array = @arr.split(\"\\n----\\n\").to_a\n end", "title": "" }, { "docid": "0d8f457e3cd0dfda4b1c846763ac3579", "score": "0.48909914", "text": "def stemplot1!(plt, \n scale: 10,\n divider: \"|\",\n padchar: \" \",\n trim: false,\n **_kw\n )\n\n stem_labels = plt.stems(all: !trim)\n label_len = stem_labels.map(&:length).max\n column_len = label_len + 1\n \n stem_labels.each do |stem|\n leaves = plt.leaves(stem).sort\n stemlbl = stem.rjust(label_len, padchar).ljust(column_len, padchar)\n puts stemlbl + divider + padchar + leaves.join\n end\n plt.print_key(scale, divider)\n end", "title": "" }, { "docid": "cc2cc02096900b0b35a4b9cfaa6409ec", "score": "0.48872313", "text": "def test_split_block\n v = Vericator.new()\n block = \"1|1|Testing>ad&*@|test\"\n\tsplit = v.split_block(block)\n\n assert_equal split.length, 4\n assert_equal split[0], \"1\"\n assert_equal split[3], \"test\"\n end", "title": "" }, { "docid": "d4d919c7958fe49d8131e9fa68e467d6", "score": "0.48345858", "text": "def split and_advance:\n # No need to split at the beginning or end of the text\n return if subsq_text.empty? || prior_text.empty?\n # Split the text element at the local marker\n text_element.next = subsq_text\n text_element.content = prior_text\n @elmt_bounds.split_elmt_at @elmt_bounds_index, text_element, text_element.next\n @elmt_bounds_index += 1 if and_advance\n assign_to_nth_elmt @elmt_bounds_index\n valid?\n yield(1) if block_given? # Report back an adjustment in @elmt_bounds\n end", "title": "" }, { "docid": "207592f913942bb26c728ad25e23b2b6", "score": "0.48292065", "text": "def multi_facet_delim\n @multi_facet_delim ||= ';'\n end", "title": "" }, { "docid": "0bd82204ea66b3422ea45af02ac7517c", "score": "0.48112187", "text": "def process_subject_facet record\n subjects = []\n Traject::MarcExtractor.cached('600|*0|abcdfklmnopqrtvxyz:610|*0|abfklmnoprstvxyz:611|*0|abcdefgklnpqstvxyz:630|*0|adfgklmnoprstvxyz:650|*0|abcvxyz:651|*0|avxyz').collect_matching_lines(record) do |field, spec, extractor|\n subject = extractor.collect_subfields(field, spec).first\n unless subject.nil?\n field.subfields.each do |s_field|\n if (s_field.code == 'v' || s_field.code == 'x' || s_field.code == 'y' || s_field.code == 'z')\n subject = subject.gsub(\" #{s_field.value}\", \"#{SEPARATOR}#{s_field.value}\")\n end\n end\n subjects << Traject::Macros::Marc21.trim_punctuation(subject)\n end\n end\n subjects\nend", "title": "" }, { "docid": "53ee6f2e511029abb9e93e14bd43427f", "score": "0.48077384", "text": "def split\n#pp @split_p\n all, @level, @proc, d = @data.match(@split_p ).to_a\n#puts @data\n\tif @level and @level = Levels[@level.downcase]\n\t @data = d\n\tend\n#STDERR.puts @data unless @level\n#STDERR.puts Levels_ar[@level]\n\n#\t@orec = \"#{@time} #{@h}: #{Levels_ar[@level]} '#{@data}'\"\n end", "title": "" }, { "docid": "46c9cd077c40aabbddce8cf9889fbcaf", "score": "0.47923347", "text": "def MLHS(parts, comma); end", "title": "" }, { "docid": "7c8ed3de45e24a3e1b8262481752bee0", "score": "0.47894707", "text": "def split(splitters)\n\n split = Java::CernColtListTdouble::DoubleArrayList.new(splitters.to_java(Java::double))\n res = DoubleDescriptive.split(sorted_data, split)\n lists = res.to_a\n bins = Array.new\n\n lists.each do |list|\n list.trimToSize()\n bins << list.elements().to_a\n end\n \n bins\n\n end", "title": "" }, { "docid": "927289f20327c308dce8980055f930d6", "score": "0.47767076", "text": "def split(args); end", "title": "" }, { "docid": "9bad1d16cb1b67387c597a018a844790", "score": "0.47744954", "text": "def part_vehicle_fitments(part)\n capture do\n if part.fitments.count > 1\n concat \"Multiple Vehicles\"\n elsif part.fitments.count === 1\n vehicle = part.oem_vehicles.first\n concat vehicle.year.to_s + \" \" + vehicle.brand.name + \" \" + vehicle.model.name + \" \"\n else\n nil\n end\n concat \"&nbsp;- \".html_safe + part.product.brand.name + \" \"\n concat part.product.name + \" \"\n end\n end", "title": "" }, { "docid": "1e084af47a13124fdf33cf9193a38f17", "score": "0.47617304", "text": "def splits\n split_names.map do |split_name|\n split(split_name)\n end\n end", "title": "" }, { "docid": "f03a8fe1934648e0c09902252571cdf9", "score": "0.47354788", "text": "def split_options\n options[:split]\n end", "title": "" }, { "docid": "b5ad59c1d475a273fc1e6120726b9a33", "score": "0.47353578", "text": "def split\n [@sign, @coeff, @exp]\n end", "title": "" }, { "docid": "74177751d9f565e2762014d2263f3f1c", "score": "0.47343972", "text": "def get_ead_subject_facets terms = Array.new\n self.subject.each do |term|\n splits = term.split(/--/)\n terms << splits\n end\n return terms.flatten.compact.uniq.sort\n end", "title": "" }, { "docid": "78c28e1fed6e825648c2530880f8824a", "score": "0.47199443", "text": "def part_name=(v); end", "title": "" }, { "docid": "af808597ca460f7e2f7a6c2f2dceb088", "score": "0.46978718", "text": "def split\n raise ValidationError.new unless valid?\n Phony.split(normalize)\n end", "title": "" }, { "docid": "657fa882d59dd65af84fd4c4bb069e71", "score": "0.46667174", "text": "def vertical_separator x, y, y2\n [x, y, x, y2, 150, 150, 150]\n end", "title": "" }, { "docid": "d0f4e602f3133c30f2f782fcf18719b0", "score": "0.46663204", "text": "def split_vertex!( s )\n adjacency_list = @graph_impl.adjacency_list s\n\n adjacency_list.each do |v, e|\n delete_edge! e\n end\n delete_vertex! s\n\n add_vertex \"#{s}-1\"\n add_vertex \"#{s}-2\"\n adjacency_list.each do |v, e|\n add_edge \"#{e}-1\", \"#{s}-1\", v\n add_edge \"#{e}-2\", \"#{s}-2\", v\n end\n\n self\n end", "title": "" }, { "docid": "6d100f91aa5dce190c3f45a254103f66", "score": "0.46535867", "text": "def printSegmentedComponentsWithMesh(e)\r\n\tf = File.new('C:/3DWarehouse/Matlab/compsWithMesh.txt', 'w')\r\n\tcomponents = getComponents(e)\r\n\tfor i in 19..19#components.length-1\r\n\t\t#puts \"#{components[i].name} #{i}\"\r\n\t\texplodeAllComponents(components[i].definition.entities)\r\n\t\tfor j in 0..components[i].definition.entities.length-1\r\n\t\t\tif components[i].definition.entities[j].typename == \"Face\"\r\n\t\t\t\tpoints = components[i].definition.entities[j].mesh.points\r\n\t\t\t\tpolygons = components[i].definition.entities[j].mesh.polygons\r\n\t\t\t\tfor k in 0..points.length-1\r\n\t\t\t\t\tf.puts \"#{points[k].x.to_f}\\n#{points[k].y.to_f}\\n#{points[k].z.to_f}\\n\"\r\n\t\t\t\tend\r\n\t\t\t\tf.puts \"a\\n\"\r\n\t\t\t\tfor k in 0..polygons.length-1\r\n\t\t\t\t\tf.puts \"#{polygons[k][0]}\\n#{polygons[k][1]}\\n#{polygons[k][2]}\\n\"\r\n\t\t\t\tend\r\n\t\t\t\tf.puts \"a\\n\"\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tf.close\r\nend", "title": "" }, { "docid": "8c2ca40acbd86e2f0dc2bc725271039c", "score": "0.46498838", "text": "def separate_line(v1)\n puts v1.split\n puts \"_______________\"\nend", "title": "" }, { "docid": "7bfd532fecf990d8c65a6b8bbead2075", "score": "0.46458173", "text": "def split_across_pattern\n @split_text = @value.split(SPLIT_INDICATOR)\n @split_text.reject!(&:empty?) # empty string?\n make_sure_all_elements_have_match_indicator\n end", "title": "" }, { "docid": "91b777831fa47f4721118339484c3645", "score": "0.46408916", "text": "def part_name; end", "title": "" }, { "docid": "7156ef0b8ca861e92c11511d504d4f65", "score": "0.4634137", "text": "def vertical_separator(options = {})\n separator = options.delete(:seperator) || \"&nbsp;|&nbsp;\"\n content_tag :span, separator, {:class => \"separator\"}.merge(options)\n end", "title": "" }, { "docid": "ff36fb7a0ecc7c5819755b70ebece701", "score": "0.46263868", "text": "def split\n self.transaction do\n split_facets = facets.reject do |facet|\n self.uuid == uuid_from_facet_key(facet.key).to_s\n end.each do |f|\n f.reload\n f.concept = Miletus::Merge::Concept.new\n f.save!\n end\n # We need to reindex this concept to process the loss of facets\n reload_facets_and_reindex\n end\n end", "title": "" }, { "docid": "a524157527a615753d934944fc82c1a9", "score": "0.46219692", "text": "def render_split_feature(feature, opt={})\n small_image_panel = content_tag :div,\n class: \"hide-for-medium-up show-for-small small-12 columns\" do\n translate_image_tag(feature, :image, size: :large)\n end\n image_panel = content_tag :div, raw('&nbsp;'),\n class: \"medium-7 hide-for-small columns image-container\",\n style: \"background-image: url(#{feature.image.url});\",\n data: { 'equalizer-watch': \"feature_#{feature.to_param}\" }\n text_panel = content_tag :div, render_feature_text(feature, opt),\n class: \"medium-5 small-12 columns\",\n data: { 'equalizer-watch': \"feature_#{feature.to_param}\" }\n content_tag :div, class: \"row collapse split-feature\", data: { equalizer: \"feature_#{feature.to_param}\" } do\n if feature.content_position.to_s == \"right\"\n small_image_panel + image_panel + text_panel\n else\n small_image_panel + text_panel + image_panel\n end\n end\n end", "title": "" }, { "docid": "302484b21c97303e662163e7ff332c8e", "score": "0.4617222", "text": "def gridlines=(v); end", "title": "" }, { "docid": "adaa5d5ab3a627b10c1d61bdc91758e2", "score": "0.4608516", "text": "def subplot; end", "title": "" }, { "docid": "63e8ba016b5b6ada10be1b3b2593796f", "score": "0.45887235", "text": "def initialize split:, ignore: nil\n @split = Array split\n \n \n end", "title": "" }, { "docid": "9f39ef051f1be1079ce2606d415b1f6a", "score": "0.45867813", "text": "def Button_SetSplitInfo(hwnd, pInfo) send_button_control_message(hwnd, :SETSPLITINFO, lparam: pInfo) end", "title": "" }, { "docid": "a04c93f7a7c802412ca664ed4aaeb24d", "score": "0.4575486", "text": "def split_point(text)\n end_char = 155\n while text.sms_length > 154\n end_char -= 1\n text = text.split_at(end_char).first\n # puts \"split_point #{end_char}\"\n end\n end_char\n end", "title": "" }, { "docid": "0307d8e8396754f282c0fafce1c219d5", "score": "0.457325", "text": "def explode\n end", "title": "" }, { "docid": "0307d8e8396754f282c0fafce1c219d5", "score": "0.457325", "text": "def explode\n end", "title": "" }, { "docid": "5ec060edb50734f3fe951ccb653b9c7c", "score": "0.45727673", "text": "def splitting_params\n params[:splitting]\n end", "title": "" }, { "docid": "e7e28e24c61134355a062307e0dc2aef", "score": "0.4570624", "text": "def split_complementary(spread=60)\n c = self.class.name.downcase\n hsv = self.to_hsv\n v = [HSV.new(((hsv.h + 540 - spread / 2) % 360),hsv.s,hsv.v).send(\"to_\" + c), \n HSV.new(((hsv.h + 540 + spread / 2) % 360),hsv.s,hsv.v).send(\"to_\" + c)]\n if block_given? then\n v.each do |color| yield color end\n end\n v \n end", "title": "" }, { "docid": "eabcc5fd6f83a88d2b7300383ac4fbe5", "score": "0.4567255", "text": "def part_d\n end", "title": "" }, { "docid": "fcf5de7cabd4bc06c72ba366ecad6ba2", "score": "0.45656753", "text": "def split!\n # Wait until the last second to parse the cue file, in case the user\n # changes it before we split.\n parse_cue_file\n\n format = @options.format or \"@p - @t\"\n\n unless @options.no_numbers or @options.format \n song_count_length = (@cuesheet.songs.length + 1).to_s.length\n number_format = \"@N#{song_count_length > 1 ? song_count_length : ''}\"\n format = \"#{number_format} #{format}\"\n end\n\n # Got to esape the spaces for the shell\n format = Shellwords.escape format\n\n command = ['mp3splt',\n \"-d #{escaped_output_folder}\",\n \"-o #{format}\",\n \"-c #{escaped_cue_file}\"]\n command.push '-Q' if @options.quiet\n command.push escaped_mp3_file\n\n system command.join(' ')\n end", "title": "" }, { "docid": "c985709147443588acb989e17d05564e", "score": "0.45653805", "text": "def split_mode\n end", "title": "" }, { "docid": "7ef81d6e5c4d8b9565992423fd3f2bdf", "score": "0.4556522", "text": "def dividing_line\n tmp = max_columns(fit).map{ |m| \"%#{m}s\" }.join(\" | \")\n tmp = \"| #{tmp} |\"\n lin = (tmp % (['-'] * column_size)).gsub(/[^\\|]/, '-').gsub('|', '+')\n lin\n end", "title": "" }, { "docid": "25add569eb7eae63163f72bcf71b7fb1", "score": "0.45564705", "text": "def delimiters; end", "title": "" }, { "docid": "25add569eb7eae63163f72bcf71b7fb1", "score": "0.45564705", "text": "def delimiters; end", "title": "" }, { "docid": "9f592971bad30424d771b749112caea8", "score": "0.4541419", "text": "def sentence_split(sentence)\n \tarr = []\n \tsentence.each do |item|\n arr << item.split(\" \")\n \tend\n \t@items = arr\n end", "title": "" }, { "docid": "959cb023a45b4109241ab6246fa71c2f", "score": "0.45355552", "text": "def splitView(aSplitView, constrainMaxCoordinate:proposedMax, ofSubviewAt:dividerIndex)\n dividerIndex == 0 ? 350 : proposedMax\n end", "title": "" }, { "docid": "b89fb555659f1c88b6aa4f3d496da244", "score": "0.4535539", "text": "def split\n @text = text.split\n end", "title": "" }, { "docid": "13be665bf3e55e6d862f361adb49d816", "score": "0.45353216", "text": "def segments\n string.split(%r{(?:[\\.\\?,:;!]|[[:space:]][/-])[[:space:]]})\n end", "title": "" }, { "docid": "8cb1a6f122940ff44c3412d32c017491", "score": "0.4527675", "text": "def test_splitter_normal\n assert_equal ['LET', 'A', '5'], @process.line_splitter('let a 5')\n end", "title": "" }, { "docid": "d9f652a01ea434f6831107663e6987a9", "score": "0.4515124", "text": "def process_subject_topic_facet record\n subjects = []\n Traject::MarcExtractor.cached('600|*0|abcdfklmnopqrtxz:610|*0|abfklmnoprstxz:611|*0|abcdefgklnpqstxz:630|*0|adfgklmnoprstxz:650|*0|abcxz:651|*0|axz').collect_matching_lines(record) do |field, spec, extractor|\n subject = extractor.collect_subfields(field, spec).first\n unless subject.nil?\n field.subfields.each do |s_field|\n if (s_field.code == 'x' || s_field.code == 'z')\n subject = subject.gsub(\" #{s_field.value}\", \"#{SEPARATOR}#{s_field.value}\")\n end\n end\n subject = subject.split(SEPARATOR)\n subjects << subject.map { |s| Traject::Macros::Marc21.trim_punctuation(s) }\n end\n end\n subjects.flatten\nend", "title": "" }, { "docid": "68eb4fdf018e822b96869829765ff4ff", "score": "0.45043284", "text": "def printSegmentedComponents(e)\r\n\tcomponents = []\r\n\tfor i in 0..e.length-1\r\n\t if e[i].typename == \"ComponentInstance\"\r\n\t\t#puts \"#{i}\"\r\n\t\tcomponents.push(e[i])\r\n\t end\r\n\tend\r\n\r\n\tfor j in 0..components.length-1\r\n\t comp = components[j];\r\n\r\n\t ents = comp.definition.entities\r\n\t edges = []\r\n\r\n\t for i in 0..ents.length-1\r\n\t\tif ents[i].typename == \"Edge\"\r\n\t\t edges.push(ents[i])\r\n\t\tend\r\n\t end\r\n\t if edges.length==1\r\n\t\tnext\r\n\t end\r\n\t points = []\r\n\t for i in 0..edges.length-1\r\n\t\tif !points.include?(edges[i].vertices[0].position)\r\n\t\t points.push(edges[i].vertices[0].position)\r\n\t\tend\r\n\t\tif !points.include?(edges[i].vertices[1].position)\r\n\t\t points.push(edges[i].vertices[1].position)\r\n\t\tend\r\n\t end\r\n\r\n\t if points.length==0\r\n\t\tnext\r\n\t end\r\n\r\n\t #puts \"2 #{points}\"\r\n\t # min and max x\r\n\t xmin = 10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].x.to_f < xmin\r\n\t\t xmin = points[i].x.to_f\r\n\t\tend\r\n\t end\r\n\t xmax = -10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].x.to_f > xmax\r\n\t\t xmax = points[i].x.to_f\r\n\t\tend\r\n\t end\r\n\t # min and max y\r\n\t ymin = 10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].y.to_f < ymin\r\n\t\t ymin = points[i].y.to_f\r\n\t\tend\r\n\t end\r\n\t ymax = -10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].y.to_f > ymax\r\n\t\t ymax = points[i].y.to_f\r\n\t\tend\r\n\t end\r\n\t # min and max z\r\n\t zmin = 10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].z.to_f < zmin\r\n\t\t zmin = points[i].z.to_f\r\n\t\tend\r\n\t end\r\n\t zmax = -10000\r\n\t for i in 0..points.length-1\r\n\t\tif points[i].z.to_f > zmax\r\n\t\t zmax = points[i].z.to_f\r\n\t\tend\r\n\t end\r\n\r\n\t #puts \"#{points}\"\r\n\t #puts \"#{j}: #{comp.name}\"\r\n\r\n\t File.open('C:/3DWarehouse/Matlab/done.txt','a') do |f|\r\n\t\tf.puts \"#{xmin}\\n #{xmax}\"\r\n\t\tf.puts \"#{ymin}\\n #{ymax}\"\r\n\t\tf.puts \"#{zmin}\\n #{zmax}\"\r\n\t\tfor i in 0..15\r\n\t\t f.puts \"#{comp.transformation.to_a[i]}\"\r\n\t\tend\r\n\t\t#puts \"#{comp.transformation.origin}, #{comp.transformation.xaxis},#{comp.transformation.yaxis},#{comp.transformation.zaxis}\"\r\n\t\tf.close\r\n\t end\r\n\tend\r\nend", "title": "" }, { "docid": "e9a982cd07cd06b0a7ca21754da89b13", "score": "0.4501437", "text": "def split_mos_models(model)\n\tmodels = []\n\tif model.match(/E12K\\-15K/)\n\t\tmodel = \"E25K - E15K\"\n\tend\n\tif model.match(/\\-X/)\n\t\tmodel = model.gsub(/\\-X/,\" - X\")\n\tend\n\tif model.match(/\\-N/)\n\t\tmodel = model.gsub(/\\-N/,\" - N\")\n\tend\n\tif model.match(/\\-W/)\n\t\tmodel = model.gsub(/\\-W/,\" - W\")\n\tend\n\tif model.match(/ \\- /)\n\t\tif model.match(/ \\- /)\n\t\t\tmodels = model.split(/ \\- /)\n\t\tend\n\telse\n\t\tmodels[0] = model\n\tend\n\treturn models\nend", "title": "" }, { "docid": "a6e1bbb30f8d69eaf9b2046bf04d0472", "score": "0.4496877", "text": "def split(id)\n c = self.center\n b = Box.new(Array.new(@d), Array.new(@d))\n for di in 0..(@d-1) do\n mask = id & (1 << di)\n b.upper[di] = (mask == 0) ? c[di] : @upper[di]\n b.lower[di] = (mask == 0) ? @lower[di] : c[di]\n end\n b\n end", "title": "" }, { "docid": "4661b4b2c94b0343b9bffc4a7d1ff105", "score": "0.44939885", "text": "def subdivide\n smallerFaces = Array.new\n @faces.each{|t| smallerFaces.concat t.subdivide}\n @faces = smallerFaces\n end", "title": "" }, { "docid": "4884928b93988bf47b120d407d5056ad", "score": "0.4490938", "text": "def segment( subdivs, transformation = nil )\r\n fail_if_invalid()\r\n points = TT::Geom3d::Bezier.points( self.positions, subdivs )\r\n if transformation\r\n points.map! { |point| point.transform!( transformation ) }\r\n end\r\n points\r\n end", "title": "" }, { "docid": "875acefa56d6e8844a68dc3324dc922f", "score": "0.44846097", "text": "def subdivide\n face = Face.new\n face.vertices = [next_position, tail, _next.next_position]\n \n self.part2 = Edge.new next_position, tail, face, \"part2\"\n _next.part1 = Edge.new tail, _next.next_position, face, \"part1\"\n face.odd_edge = Edge.new _next.next_position, next_position, face, \"odd_edge\"\n \n face.edges = [self.part2, _next.part1, face.odd_edge]\n \n self.part2._next = _next.part1\n _next.part1._next = face.odd_edge\n face.odd_edge._next = self.part2\n \n face\n end", "title": "" }, { "docid": "d8ab370ec93282e9af18cc86faefa507", "score": "0.44833395", "text": "def grouping=(v); end", "title": "" }, { "docid": "d8ab370ec93282e9af18cc86faefa507", "score": "0.44833395", "text": "def grouping=(v); end", "title": "" }, { "docid": "175eeb2bd9cb28d580e1f10f53e6d4b3", "score": "0.44799402", "text": "def split\n @player.split(self)\n end", "title": "" }, { "docid": "a1595ea11cb9a1d26c917b6f8b59f008", "score": "0.44766635", "text": "def compile_div(arr)\n @skim.divisions[arr[0]] = Transcript::Division.new(\"\")\n name = arr.shift\n @skim.divisions[name].name = name\n assign(@skim.divisions[name], [:color=, :hover=], arr) \n end", "title": "" }, { "docid": "01a3068cac8d0653d46cd6e696d1ffc2", "score": "0.4471872", "text": "def vml_shape; end", "title": "" }, { "docid": "32f7422bcfd0b024461e2ea0ad8760e1", "score": "0.44704974", "text": "def split\n\t\t\tlang = [@language]\n\t\t\tklass = self.class\n\t\t\tary = to_a(true)\n\t\t\t(0...(ary.size)).zip(ary).map { |i,e|\n\t\t\t\tinit = Array.new(ary.size, 0)+lang\n\t\t\t\tinit[i] = e\n\t\t\t\tklass.new(*init)\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "f35fafb5b4da25daf994324bd4f38055", "score": "0.44704953", "text": "def extract_parts; end", "title": "" }, { "docid": "13f7b0d3600e07b900cdefd76c8c0799", "score": "0.44636747", "text": "def parts; part; end", "title": "" }, { "docid": "bf4675524b888f3ccba4717e4534c4de", "score": "0.44519547", "text": "def vertical; end", "title": "" }, { "docid": "5422c10cf19ae3d68b10a9d696618972", "score": "0.4447161", "text": "def split(x)\n _convert(x).split\n end", "title": "" }, { "docid": "c772a287370c027201f59107766d979c", "score": "0.44388065", "text": "def facet_param_formatted facet_field \n m = /\\{.*\\}(\\S+)$/.match(facet_field)\n if m\n\t\t m[1] \n else\n facet_field\n end\n\t end", "title": "" }, { "docid": "1cc7f65f71be97391460d210a12f5b42", "score": "0.44362673", "text": "def printSegmentedComponentsWithFaces(e)\r\n\t# first get all components\r\n\tcomponents = []\r\n\tfor i in 0..e.length-1\r\n\t\tif e[i].typename == \"ComponentInstance\"\r\n\t\t\tcomponents.push(e[i])\r\n\t\tend\r\n\tend\r\n\t\r\n\tf = File.new('C:/3DWarehouse/Matlab/compsWithFaces.txt', 'w')\r\n\tfor j in 1..components.length-1 # iterate over all components\r\n\t\tcomp = components[j];\r\n\t\tents = comp.definition.entities\r\n\t\t# find all edges\r\n\t\tedges = []\r\n\t\tfor k in 0..ents.length-1\r\n\t\t\tedges.push(ents[k]) if (ents[k].typename == \"Edge\" && !edges.include?(ents[k]))\r\n\t\tend\r\n\t\tputs \"#{edges.length})\"\r\n\t\tnext if edges.length > 200\r\n\t\tfor i in 0..edges.length-1\r\n\t\t\tonePointX = edges[i].vertices[0].position.x.to_f\r\n\t\t\tonePointY = edges[i].vertices[0].position.y.to_f\r\n\t\t\tonePointZ = edges[i].vertices[0].position.z.to_f\r\n\t\t\totherPointX = edges[i].vertices[1].position.x.to_f\r\n\t\t\totherPointY = edges[i].vertices[1].position.y.to_f\r\n\t\t\totherPointZ = edges[i].vertices[1].position.z.to_f\r\n\t\t\tf.puts \"#{onePointX}\\n #{onePointY}\"\r\n\t\t\tf.puts \"#{onePointZ}\\n #{otherPointX}\"\r\n\t\t\tf.puts \"#{otherPointY}\\n #{otherPointZ}\"\r\n\t\t\tf.puts \"0\"\r\n\t\t\tfor i in 0..15\r\n\t\t\t\tf.puts \"#{comp.transformation.to_a[i]}\"\r\n\t\t\tend\r\n\t\t\tf.puts \"0\"\r\n\t\tend\r\n\tend\r\n\tf.close\r\nend", "title": "" }, { "docid": "e551c8ab54875bad8eb9025d089be491", "score": "0.4434731", "text": "def splitView(aSplitView, constrainMinCoordinate:proposedMin, ofSubviewAt:dividerIndex)\n dividerIndex == 0 ? 150 : proposedMin\n end", "title": "" }, { "docid": "fc31debc09e582b1cef68fb2ca4dc242", "score": "0.44198564", "text": "def subpiece (t1, t2)\n tan1, tan2 = self.subtangents( t1, t2 )\n return BezierSpline.new( :vector, self.point( t1 ), tan1, self.point( t2 ), tan2 )\n end", "title": "" }, { "docid": "bbf33feaeefc1d23cfc1d8cdbda3cb8a", "score": "0.44133323", "text": "def split_let string\n\t\tresult = split(string , '<=')\n\t\tif(result)\n\t\t\t#print(result.first)\n\t\t\t#print(\" LOWER equal THAN \")\n\t\t\t#puts(result.last)\n\t\t\tfirst = stripSpaces(result.first)\n\t\t\tlast = stripSpacesr(result.last)\n\t\t\t\n\t\t\t#DESCOMENTAR \n\t\t\t#last = LeftInfinite.new(last.to_i , true)\n\t\t\treturn Values.new(first , last) #cambair este last por la creacion de la isntacion de la clase pertinente\n\t\telse\n\t\t\treturn nil\n\t\tend\t\t\t\t\n\tend", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" }, { "docid": "3fff7ea9b6967fb0af70c64a4d13faae", "score": "0.44066277", "text": "def parts; end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "5f1839500ad47c13c1908b00979c839f", "score": "0.0", "text": "def attachment_params\n params.require(:attachment).permit(:image, :attachable_id, :attachable_type, :remove_image, :crop_x, :crop_y, :crop_w, :crop_h)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6887521", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.67666084", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.671326", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6705381", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.66164786", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.66156906", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.65888846", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6575757", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6572969", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572365", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.65321475", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.65129966", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.65128386", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.64990044", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.6491305", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6489574", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6476191", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.645836", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.64389294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6431918", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.642512", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.63736504", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6336598", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6319846", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.63113743", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.6290657", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.62724084", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6266407", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.6265082", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6262119", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6258491", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6243215", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62372005", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.6226018", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.62250364", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.62147176", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.62035644", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.61931455", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.618889", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6180647", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.6180104", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175616", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.61731255", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.61730814", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.6172509", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.6172386", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6163843", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.6146083", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.6145458", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.61444825", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.61364955", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.61280644", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6113519", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6112032", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6106793", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61061025", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6105072", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6092409", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.60909486", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.60895824", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6083517", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.6081807", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6079226", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077248", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.60767365", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.60746986", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.60703695", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6070048", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.6069783", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.6063365", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.6047726", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.60399187", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.6033119", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6029004", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.6025425", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" } ]
4a778d83c7f915f63d80fdba5362dc8c
Polls a port on a specified ip address until it is found to be open or max tries is reached
[ { "docid": "57ddef5f006a6835e2d19310f84dc993", "score": "0.8151685", "text": "def poll_port(ip, port, port_type, timer, max_tries = 10)\n\t\twhile(open_port?(ip, port) != true) do\n\t\t\tputs \"#{port_type} port not online yet..\"\n\t\t\tif max_tries == 0\n\t\t\t\tputs \"Max port checks attempts reached\"\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tmax_tries -= 1\n\t\t\tend\n\t\t\tputs \"Checking again to see if #{port_type} port is up\"\n\t\t\tsleep(timer)\n\t\tend\n\t\tputs \"#{port_type} port online\\n\"\n\tend", "title": "" } ]
[ { "docid": "f3ca714bc0a3ce4b1d96d63e9272df35", "score": "0.7475638", "text": "def wait_for_port(port, opts={})\n ip = opts.delete(:public_ip) || public_ip\n retry_times = opts.delete(:retry_times) || 10\n pause_time = opts.delete(:pause_time) || 1\n \n retry_times.times do |i| \n if is_port_open?(ip, port, opts)\n return true\n else\n sleep pause_time\n end\n end\n false\n end", "title": "" }, { "docid": "66b479d608660b95922a350ca2094210", "score": "0.7322921", "text": "def port_open?(ip, port, timeout)\n\n\tstart_time = Time.now\n\tcurrent_time = start_time\n \twhile (current_time - start_time) <= timeout\n\t\tbegin\n \t\t TCPSocket.new(ip, port)\n \t\t return true\n \t rescue Errno::ECONNREFUSED\n \t\t\tsleep 0.1\n \t\tend\n \t\tcurrent_time = Time.now\n \tend\n\n \treturn false\n\n end", "title": "" }, { "docid": "ba188d34dd72e00811441573bed6131a", "score": "0.7254195", "text": "def wait_for_port(port, attempts = 15)\n @logger.debug(\" Waiting for port #{port} ... \", false)\n start = Time.now\n done = repeat_fibonacci_style_for(attempts) { port_open?(port) }\n if done\n @logger.debug(format('connected in %0.2f seconds', (Time.now - start)))\n else\n @logger.debug('timeout')\n end\n done\n end", "title": "" }, { "docid": "273f2da02c8da2ee950d2d8bfa2d8a1f", "score": "0.70340455", "text": "def port_open_within?( host, port = 8140, seconds = 120 )\n repeat_for( seconds ) do\n host.port_open?( port )\n end\n end", "title": "" }, { "docid": "395f8c20a94892950d95520e20a2fad0", "score": "0.7015521", "text": "def wait_port(port, timeout=5)\n deadline = Time.now + timeout\n begin # Wait for the port to be connectible\n TCPSocket.open(\"\", $port).close\n rescue Errno::ECONNREFUSED\n if Time.now > deadline then\n raise TestError, \"timed out waiting for port #{port}\"\n end\n sleep(0.1)\n retry\n end\nend", "title": "" }, { "docid": "aa0d01c1d9c126f3c76ff09f5a0eb228", "score": "0.693495", "text": "def wait_for_port_or_fail(host, port)\n result = false\n 3.times do\n # ensure we wait a minimum between retries\n start_time = Time.now\n result = check_port_for_http_response(host, port)\n check_time = Time.now - start_time\n break if result\n\n if check_time < 10\n sleep 10 - check_time\n end\n end\n return if result\n fail 'Timeout waiting for port to be open.'\n end", "title": "" }, { "docid": "501202fc1206bbf6ff4989cc01f47b6c", "score": "0.6811099", "text": "def wait_for_port(port, timeout = default_timeout)\n instance_ip = ip\n log_debug \"[ #{@node}/#{@environment} ] - Wait for #{instance_ip}:#{port} to be opened (timeout #{timeout})...\"\n port_listening = false\n remaining_timeout = timeout\n until port_listening\n start_time = Time.now\n port_listening =\n begin\n Socket.tcp(instance_ip, port, connect_timeout: remaining_timeout) { true }\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT\n log_warn \"[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{$ERROR_INFO}\"\n false\n end\n sleep 1 unless port_listening\n remaining_timeout -= Time.now - start_time\n break if remaining_timeout <= 0\n end\n log_debug \"[ #{@node}/#{@environment} ] - #{instance_ip}:#{port} is#{port_listening ? '' : ' not'} opened.\"\n port_listening\n end", "title": "" }, { "docid": "02098f8546d3123e2c9da54b10d55b7f", "score": "0.6777667", "text": "def ScanningPort(host, ports)\n# puts \"Scanning... #{host}\"\n ports.each do |port|\n# puts \"Scanning Port #{port}\"\n begin\n socket = TCPSocket.open(host, port)\n Timeout::timeout(1)\n rescue\n puts \"Scan Error: #{$!}\"\n end\n if (socket)\n socket.close\n puts \"'Port: #{port} / Open\"\n return port\n\t\t else\n\t\t puts \"This host don't have any POP3 guess open port\"\n \t return\n end\n end\n end", "title": "" }, { "docid": "fac1be9d69c66e6f1822292435703fae", "score": "0.6771328", "text": "def port_available?(port, ip = \"127.0.0.1\", seconds = 1)\n Timeout::timeout(seconds) do\n begin\n TCPSocket.new(ip, port).close\n false\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n true\n end\n end\n rescue Timeout::Error\n false\n end", "title": "" }, { "docid": "4da87c8e73bd7941921c27c68e6c2d5e", "score": "0.6753149", "text": "def port_open?(ip, port, seconds = 1)\n Timeout.timeout(seconds) do\n ip ||= Socket.ip_address_list.detect(&:ipv4_private?).ip_address\n TCPSocket.new(ip, port).close\n true\n end\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Timeout::Error\n false\n end", "title": "" }, { "docid": "4022d98e637b0cffa738a8fd01bd79ec", "score": "0.6618172", "text": "def find_available_port(starting, range)\n test_port = starting - 1\n port_available = false\n until port_available || test_port == (starting + range)\n test_port += 1\n port_available = true unless is_port_open? test_port\n end\n return false unless port_available\n test_port\nend", "title": "" }, { "docid": "1dd12b3395a06b17381c6a035f7cd7d6", "score": "0.65816236", "text": "def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend", "title": "" }, { "docid": "98ac5ab4b59e271ec516c3b11ecaaf0a", "score": "0.6524382", "text": "def port_open?(ip, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(ip, port)\n s.close\n return false\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return true\n end\n end\n rescue Timeout::Error\n end\n\n return true\n end", "title": "" }, { "docid": "4568f86d55788f1b51a13006ff62a6a5", "score": "0.6523211", "text": "def port_open?(ip, port)\n begin\n Timeout.timeout(10) do\n begin\n s = TCPSocket.new(ip, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n return false\n end\n end", "title": "" }, { "docid": "30462485c5e7ebe1cf1820b670345073", "score": "0.64715594", "text": "def is_port_open?(ip, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(ip, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n end\n\n return false\n end", "title": "" }, { "docid": "e3680a17d3209158209df079bb28a9fa", "score": "0.6462212", "text": "def connect_to(host, port, attempts = 30)\n while attempts > 0 do\n begin\n return Net::Telnet::new('Host' => host, 'Port' => port)\n rescue => e\n attempts -= 1\n sleep rand(2...5.0)\n end\n end\nend", "title": "" }, { "docid": "b2affbbe3987cb948579c2537eee44ed", "score": "0.6460128", "text": "def is_port_open?(ip, port, opts={})\n timeout = opts[:timeout] || 1\n begin\n Timeout::timeout(timeout) do\n begin\n s = TCPSocket.new(ip, port)\n s.close\n ddputs(\"Connected to #{ip}:#{port} - Port is open and good to go\")\n return true\n puts ','\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n ddputs(\"Port #{port} on #{ip} is not accessible (yet)\")\n return false\n end\n end\n rescue Timeout::Error\n end\n ddputs(\"Port #{port} on #{ip} is not accessible\")\n return false\n end", "title": "" }, { "docid": "3a86a2cd76a592208b887b460929fc35", "score": "0.64437586", "text": "def is_port_open?(ip, port)\n\t begin\n\t\tTimeout::timeout(1) do\n begin\n s = TCPSocket.new(ip, port)\n\t\t s.close\n return true\n\t\trescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n\t\t return false\n end\n\t end\n\t rescue Timeout::Error\n\t end\n\t return false\n end", "title": "" }, { "docid": "f70410d1defd1350ea9ba7b5c65495fb", "score": "0.6357478", "text": "def port_open?(host, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(host, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n end\n return false\nend", "title": "" }, { "docid": "f5c8b603e59f3969b6350dac50fe40bf", "score": "0.6349391", "text": "def start!\n ports = ports_to_try\n Log.debug \"Trying ports #{ports.inspect}...\"\n until port || !(try_port = ports.shift)\n begin\n Log.debug \"Trying to listen on port #{try_port}...\"\n @socket.bind('0.0.0.0', try_port)\n Log.info \"Successfully listening on port #{try_port}...\"\n rescue Errno::EADDRINUSE, Errno::EINVAL\n Log.warn \"Port #{try_port} occupied, trying another...\"\n end\n end\n Log.error \"Could not find any port to listen on...\" unless port\n end", "title": "" }, { "docid": "62ae66e3396499bcf7f987e753777396", "score": "0.63456", "text": "def portainer?(ip, segundos=1) \n Timeout::timeout(segundos) do \n begin\n TCPSocket.new(ip, \"#{$port}\").close # Check Portainer port.\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError\n false # If Exception, do not count this host.\n end\n end\n rescue Timeout::Error # If Timeout, do not count this host.\n false\nend", "title": "" }, { "docid": "7a812858ddbeaa2c8c3f3b7ff8c99f04", "score": "0.6333392", "text": "def find_open_ip(port)\n allocated_ips = get_allocated_private_ips\n logger.debug(\"IPs already allocated for #{port} in gear #{@user.uuid}: #{allocated_ips}\")\n\n open_ip = nil\n\n for host_ip in 1..127\n candidate_ip = UnixUser.get_ip_addr(@user.uid.to_i, host_ip)\n\n # Skip the IP if it's already assigned to an endpoint\n next if allocated_ips.include?(candidate_ip)\n\n # Check to ensure the IP/port is not currently bound to another process\n if address_bound?(candidate_ip, port)\n logger.debug(\"Candidate address #{candidate_ip}:#{port} is unallocated by the gear\n but is already bound to another process and will be skipped\")\n next\n end\n\n open_ip = candidate_ip\n break\n end\n\n open_ip\n end", "title": "" }, { "docid": "cda153c60d210b390e8dd82a65b567cc", "score": "0.6327962", "text": "def open_port?(ip, port)\n\t\tbegin\n\t\t\tTimeout::timeout(1) do\n\t\t\t\tbegin\n\t\t\t\t\tsocket = TCPSocket.new(ip, port)\n\t\t\t\t\tsocket.close\n\t\t\t\t\treturn true\n\t\t\t\trescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\trescue Timeout::Error\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "a0fef9aa2ca48d58ce0594efd23a6694", "score": "0.63183105", "text": "def is_port_open?(port)\n begin\n ::Timeout.timeout(5) do\n begin\n s = TCPSocket.new('localhost', port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL\n return false\n end\n end\n rescue ::Timeout::Error\n return false\n end\n\n false\nend", "title": "" }, { "docid": "9820a03c7f7b405ef94f89fe613b1b5e", "score": "0.631635", "text": "def confirm_listening_on_port(port, timeout=10)\n checker_th = Thread.new { ssh_cmd \"while [[ `netstat -ln | grep :#{port} | wc -l` -lt 1 ]] ; do sleep 1; done\" }\n raise \"Nothing is listening on #{@ip}:#{port} after #{timeout} seconds\" unless checker_th.join(timeout)\n true\n end", "title": "" }, { "docid": "8c966e9e47f3eca6b164b965a4d9eb9e", "score": "0.6271969", "text": "def wait_for_port!(port, timeout = default_timeout)\n raise \"[ #{@node}/#{@environment} ] - Instance fails to have port #{port} opened with timeout #{timeout}.\" unless wait_for_port(port, timeout)\n end", "title": "" }, { "docid": "421ff5195fd5296dc24011b758dc1e51", "score": "0.62197554", "text": "def is_port_open?(ip, port)\n begin\n # Timeout is important\n Timeout::timeout(1) do\n begin\n # Create the socket and close it\n s = TCPSocket.new(ip, port)\n s.close\n return true\n # If it fails the port is closed\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n end\n end\n rescue Timeout::Error\n end\n\n # Sorry port is closed\n return false\n end", "title": "" }, { "docid": "273588208877a95ef8cc2ff2c9ee6451", "score": "0.6154693", "text": "def port_bound?(host, port)\n Timeout.timeout(1) do\n s = TCPSocket.new(host, port)\n s.close rescue nil\n return true\n end\nrescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, \\\n Errno::ENETUNREACH, Errno::EACCES, Errno::ENOTCONN, \\\n Errno::EADDRNOTAVAIL\n return false\nend", "title": "" }, { "docid": "10ab261a0b12ae755e9e305d07207e02", "score": "0.6136691", "text": "def port_open?\n begin\n Timeout.timeout(1) do\n begin\n s = TCPSocket.new(@host, @port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n return false\n end\n\n false\n end", "title": "" }, { "docid": "12f8b7adc26db318895d61b1a4b59610", "score": "0.6116815", "text": "def is_port_open?(tested_port)\n self.class.reachable?(host, tested_port)\n end", "title": "" }, { "docid": "0d919022f11b9019cd5edb1a51e8daa5", "score": "0.60995513", "text": "def guess_free_port(min_port,max_port)\n ui.info \"Received port hint - #{min_port}\"\n\n guessed_port=nil\n\n for port in (min_port..max_port)\n unless is_tcp_port_open?(get_local_ip, port)\n guessed_port=port\n break\n end\n end\n\n if guessed_port.nil?\n ui.error \"No free port available: tried #{min_port}..#{max_port}\"\n raise Veewee::Error, \"No free port available: tried #{min_port}..#{max_port}\"\n else\n ui.info \"Found port #{guessed_port} available\"\n end\n\n return guessed_port\n end", "title": "" }, { "docid": "078b769a53e35838d812b30ed9d7fbb2", "score": "0.60750645", "text": "def findPort()\n # this is REALLY ugly\n port = @config['startPort']\n while true\n good = true\n #self.class.each { |v|\n # if (v.port == port)\n # good = false\n # break\n # end\n #}\n # Retrieve the list of all Daemons running\n if (@@inst[self.class] != nil)\n @@inst[self.class].each_value { |value|\n # For each Daemon, check its used port compared to our candidate one\n if (value.port == port)\n good = false\n break\n end\n }\n end\n if (good)\n begin\n info \"Checking port TCP:#{port}...\"\n serv = TCPServer.new(port)\n rescue\n good = false\n info \"Port TCP:#{port} is in use!\"\n else\n serv.close\n info \"Port TCP:#{port} is free!\"\n begin\n info \"Checking port UDP:#{port}...\"\n serv = UDPSocket.new\n\t serv.bind(nil,port)\n rescue\n good = false\n info \"Port UDP:#{port} is in use!\"\n else\n serv.close\n info \"Port UDP:#{port} is free!\"\n\t end\n end\n end\n return port if (good)\n # The candidate port is already used, increase it and loop again...\n port += 1\n end\n end", "title": "" }, { "docid": "10d25daba00b82f2c4400c83be686043", "score": "0.6027231", "text": "def find_open_ip(port)\n allocated_ips = get_allocated_private_ips\n\n open_ip = nil\n\n for host_ip in 1..127\n candidate_ip = UnixUser.get_ip_addr(@user.uid.to_i, host_ip)\n\n # Skip the IP if it's already assigned to an endpoint\n next if allocated_ips.include?(candidate_ip)\n\n # Check to ensure the IP/port is not currently bound to another process\n next if address_bound?(candidate_ip, port)\n \n open_ip = candidate_ip\n break\n end\n\n return open_ip\n end", "title": "" }, { "docid": "8e61aa45a0b826d7d3be12880b4a58ea", "score": "0.6026582", "text": "def get_available_port(host)\n (7000..7100).each do |port|\n status = `nmap -Pn -p #{port} #{host} | grep #{port} | awk '{print $2}'`.chomp(\"\\n\")\n return port if status.eql? 'closed'\n end\n nil\n end", "title": "" }, { "docid": "f18a9e952ceca5d2e04b3d2f407bb5db", "score": "0.59942496", "text": "def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\nrescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\nend", "title": "" }, { "docid": "36131ebd325a05295b63656c130e0906", "score": "0.5922789", "text": "def find_lowest_free_port(starting_port)\n possibly_free_port = starting_port\n loop {\n actually_available = Djinn.log_run(\"lsof -i:#{possibly_free_port}\")\n if actually_available.empty?\n Djinn.log_debug(\"Port #{possibly_free_port} is available for use.\")\n return possibly_free_port\n else\n Djinn.log_warn(\"Port #{possibly_free_port} is in use, so skipping it.\")\n possibly_free_port += 1\n end\n }\n end", "title": "" }, { "docid": "8df0e78bb1503fc3e1126ce52aeb4492", "score": "0.5917099", "text": "def port_available? port\n server = TCPServer.open port\n server.close\n true\n rescue Errno::EADDRINUSE\n false\n end", "title": "" }, { "docid": "166cb7f7d377d6b200eaf0bc6da00645", "score": "0.5885775", "text": "def is_port_in_use?(port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new('127.0.0.1', port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n rescue\n return false\n end\n end\n rescue Timeout::Error\n end\n\n return false\n end", "title": "" }, { "docid": "04f363e8eeffa074b02655bc415326c3", "score": "0.58828694", "text": "def port_open?(node)\n Timeout::timeout(node.timeout) do\n begin\n TCPSocket.new(node.host, node.port).close\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n false\n end\n end\n rescue Timeout::Error, SocketError\n false\n end", "title": "" }, { "docid": "c9ec5590263418a1ae583f82a4f89fef", "score": "0.5881611", "text": "def scan_host(ip)\n if spoofed?\n datastore['ScannerRecvWindow'] = 0\n scanner_spoof_send(@probe, ip, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS'])\n else\n scanner_send(@probe, ip, datastore['RPORT'])\n end\n end", "title": "" }, { "docid": "124307773ede65a80ec67ebca1e395cd", "score": "0.5866526", "text": "def port_lock\n Thread.new do\n begin\n server = TCPServer.new('127.0.0.1', 17553)\n server.accept\n rescue\n raise(\"Someone's already bound to our port. We're outta here.\")\n end\n end\n sleep(1) # Give it a second to attempt the accept\nend", "title": "" }, { "docid": "3451b7d6c2e913c787b08ad0336814c8", "score": "0.5821948", "text": "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "title": "" }, { "docid": "215f23ac0b8b047173b46a754f46d205", "score": "0.57932985", "text": "def test_port(port)\n !EventMachine::Synchrony::TCPSocket.new('127.0.0.1', port).nil?\nrescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n false\nend", "title": "" }, { "docid": "e866c147a572582b0eb0b2a8761e7756", "score": "0.5790695", "text": "def address_bound?(ip, port)\n _, _, rc = Utils.oo_spawn(\"/usr/sbin/lsof -i @#{ip}:#{port}\")\n rc == 0\n end", "title": "" }, { "docid": "bed33ea91c4c3b6b0575c637eeda262f", "score": "0.5767286", "text": "def ping target, attempts = 5\n try = 0\n while try < attempts\n result = exec(Beaker::Command.new(\"ping -c 1 #{target}\"), :accept_all_exit_codes => true)\n return true if result.exit_code == 0\n\n try += 1\n end\n result.exit_code == 0\n end", "title": "" }, { "docid": "a08d32b6a129c27165d8bba065ead7ac", "score": "0.57533693", "text": "def determine_public_port(local_port)\n port = 0\n count = 0\n max_attempts = 30\n\n # Give up after 30 seconds\n while port == 0 && count < max_attempts do\n hostname = ENV['HOSTNAME']\n command = \"curl --silent -XGET --unix-socket /var/run/docker.sock http://localhost/containers/#{hostname}/json\"\n result = Maze::Runner.run_command(command)\n if result[1] == 0\n begin\n json_string = result[0][0].strip\n json_result = JSON.parse(json_string)\n port = json_result['NetworkSettings']['Ports'][\"#{local_port}/tcp\"][0]['HostPort']\n rescue StandardError\n $logger.error \"Unable to parse public port from: #{json_string}\"\n return 0\n end\n end\n\n count += 1\n sleep 1 if port == 0 && count < max_attempts\n end\n $logger.error \"Failed to determine public port within #{max_attempts} attempts\" if port == 0 && count == max_attempts\n\n port\n end", "title": "" }, { "docid": "1dac83c0515c593842d0ba21d6055fb3", "score": "0.57331836", "text": "def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end", "title": "" }, { "docid": "9d1a122ab1b5f670639f20c30bd6f64b", "score": "0.5716002", "text": "def find_available_port\n server = TCPServer.new(FIND_AVAILABLE_PORT)\n server.addr[1]\n ensure\n server.close if server\n end", "title": "" }, { "docid": "595692fbe0e614b5381e3815e17546b2", "score": "0.5663709", "text": "def appium_port_available?(port)\n `netstat -vanp tcp | awk '{ print $4 }' | grep \"\\.#{port}$\"`.empty?\n end", "title": "" }, { "docid": "98d93d990147e3448c74b04277198af9", "score": "0.5653999", "text": "def tcp_test_port(host, port)\n tcp_socket = TCPSocket.new(host, port)\n readable = IO.select([tcp_socket], nil, nil, 5)\n if readable\n log.debug(\"Accepting connections on #{host} port #{port}, banner: #{tcp_socket.gets}\")\n true\n else\n false\n end\n rescue SocketError,\n IOError,\n Errno::ETIMEDOUT,\n Errno::EPERM,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::EHOSTUNREACH,\n Errno::ENETUNREACH\n sleep 2\n false\n ensure\n tcp_socket && tcp_socket.close\n end", "title": "" }, { "docid": "baa6b6217a2fff95e4c1664549a1914a", "score": "0.5644257", "text": "def find_available_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n server.addr[1]\n ensure\n server.close if server\n end", "title": "" }, { "docid": "9fe90a7ab094eeb91c1bba820154da5d", "score": "0.5635343", "text": "def ping\n tries = 3\n begin\n # @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end", "title": "" }, { "docid": "0812c6c93a150be4d55d0c04097a0281", "score": "0.5622256", "text": "def online?\n sock = UDPSocket.new()\n online = false\n begin\n sock.connect('193.0.14.129', 25) # that address is k.root-servers.net\n online = true\n sock.close\n rescue Exception => exception\n puts \"\n------------------------------------------------------------\nCannot bind to socket:\n #{exception}\n\nThis is an indication you have network problems.\nNo online tests will be run!!\n------------------------------------------------------------\n\"\n end\n online\nend", "title": "" }, { "docid": "96adf04c190133aa76257fd51b514916", "score": "0.56186336", "text": "def wait_for_server_start\n require 'socket'\n require 'net/http'\n tries = 1\n max_tries = 30\n successes = 0\n max_successes = 2\n wait = 5\n print \"Waiting for the server to start (max tries: #{max_tries} with a #{wait} second pause between tries): \"\n begin\n while tries <= max_tries\n tries += 1\n begin\n Net::HTTP.start(\"localhost\", \"3010\") do |http|\n response = http.get('/')\n if response.code == \"200\"\n print \"O\"\n successes += 1\n return true if successes >= max_successes\n else\n print \"o\"\n end\n end\n rescue SystemCallError => e\n successes = 0\n if tries == max_tries\n print \"!\"\n raise\n end\n print \".\"\n end\n $stdout.flush\n sleep(wait)\n end\n ensure\n puts # Ensure a newline gets added\n $stdout.flush\n end\n return false\nend", "title": "" }, { "docid": "c939ca359983b4805bb1fabeafbe8cad", "score": "0.5612632", "text": "def address_bound?(ip, port)\n out, err, rc = shellCmd(\"/usr/sbin/lsof -i @#{ip}:#{port}\")\n return rc != 0\n end", "title": "" }, { "docid": "36aa5d4f6bcfb1dd002af765348b4a19", "score": "0.5602565", "text": "def test_connection(ip,port)\n\t\tbegin\n\t\t\tsock = Rex::Socket::Tcp.create(\n\t\t\t\t'PeerHost' => ip,\n\t\t\t\t'PeerPort' => port,\n\t\t\t\t'Timeout' => 1\n\t\t\t\t)\n\t\trescue Rex::ConnectionError\n\t\t\treturn :down\n\t\tend\n\t\tsock.close\n\t\treturn :up\n\tend", "title": "" }, { "docid": "d404a8f16b99f53a38240c0caa2c8f7b", "score": "0.55955935", "text": "def wait_for_TIME_WAIT_to_clear(threshold=20)\n while true\n count = `netstat -a inet -n|grep TIME_WAIT|wc -l`.to_i\n return if count < threshold\n puts \"TIME_WAIT count: #{count}\"\n sleep 1\n end\nend", "title": "" }, { "docid": "1dcf72e110d7b1ef28ca8e20c0a40618", "score": "0.55852085", "text": "def serverup?(ip, port)\n http = Net::HTTP.start(ip, port, {open_timeout:3, read_timeout:3})\n response = http.send_request('GET', '/')\n JSON.parse(response.body)\nrescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n nil\nend", "title": "" }, { "docid": "aac1d97c0474f2b6a989e4f1903f77f3", "score": "0.55785704", "text": "def ScanningHostPort(hosts, ports)\n\thosts.each do |host|\n#\t puts \"Scanning... #{host}\"\n ports.each do |port|\n#\t puts \"Scanning Port #{port}\"\n begin\n socket = TCPSocket.open(host, port)\n Timeout::timeout(1)\n rescue\n\t\t puts \"Scan Error: #{$!}\"\n \t end\n\t\tif (socket)\n\t\t socket.close\n\t\t puts \"'Port: #{port} / Open\"\n\t\t return host,port\n\t\tend\n\t end\n end\n\tputs \"The scan don't guess any hosts with open ports\"\n\treturn\n end", "title": "" }, { "docid": "1b24852f12602e628c8e7a9bf1e56cbe", "score": "0.55768275", "text": "def wait_until_ready!\n Timeout.timeout(timeout) do\n begin\n Chef::Log.debug \"trying to open #{endpoint}\"\n open(endpoint)\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n OpenURI::HTTPError => e\n # If authentication has been enabled, the server will return an HTTP\n # 403. This is \"OK\", since it means that the server is actually\n # ready to accept requests.\n return if e.message =~ /^403/\n Chef::Log.debug(\"Redmine is not accepting requests - #{e.message}\")\n sleep(0.5)\n retry\n end\n end\n rescue Timeout::Error\n raise RedmineNotReady.new(endpoint, timeout)\n end", "title": "" }, { "docid": "cd5a5d8689020653acb201cab1ec7d93", "score": "0.5557432", "text": "def find_open_telnets\n puts \"[#{'*'.blue}] Scanning #{@cidr.blue.bold}\"\n Open3.popen3(\"nmap -v -p23 #{@cidr} -oG - | grep \\\"Ports: 23\\\"\") do |stdin, stdout, stderr, wth|\n stdout.sync = true\n stdout.each_line do |line|\n data = line.match(/^Host: (\\d+\\.\\d+\\.\\d+\\.\\d+).*Ports: (\\d+)\\/(\\w+).*/)\n puts \"[#{'+'.blue}] #{data[1].ljust(13)} #{data[3].ljust(13)}\"\n if data[3] == 'open'\n @hosts << data[1]\n end\n end\n end\n end", "title": "" }, { "docid": "b234bdfee90b7552e41d76a6ad611660", "score": "0.554798", "text": "def poll(max: 0.1)\n if connected?\n if client.read_and_process_pending(max: max)\n STATE_PENDING_DATA\n else\n STATE_CONNECTED\n end\n elsif !closed?\n poll_connection_attempt\n STATE_DISCONNECTED\n end\n rescue Interrupt\n close\n raise\n rescue ComError\n Log.info \"link closed, trying to reconnect\"\n unreachable!\n unless closed?\n attempt_connection\n end\n false\n rescue Exception => e\n Log.warn \"error while polling connection, trying to reconnect\"\n Roby.log_exception_with_backtrace(e, Log, :warn)\n unreachable!\n unless closed?\n attempt_connection\n end\n false\n end", "title": "" }, { "docid": "ad95573c442eb3c6e7fe5ba7eab030ab", "score": "0.55191255", "text": "def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "f8b7778e61c9dd2aab1b13a39ccb25cc", "score": "0.55023694", "text": "def direct_connection(ip)\n task_name = \"_direct_connection_#{ip}_#{rand(1000)}\"\n task task_name, :hosts => ip do\n yield\n end\n\n begin\n send task_name\n rescue ConnectionError, IOError => e\n sleep 2\n logger.info \"Failed to connect to #{ip}, retrying\"\n teardown_connections_to(sessions.keys) if e.message =~ /closed stream/\n retry\n end\n end", "title": "" }, { "docid": "733d603866367c0e6aa5abf232caeb26", "score": "0.5501818", "text": "def port_open?(server, port)\n http = Net::HTTP.start(server, port, open_timeout: 5, read_timeout: 5)\n response = http.head('/')\n response.code == '200'\n rescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n false\n end", "title": "" }, { "docid": "d5b8f78e8948b3f5eb5f81839f25293f", "score": "0.5491984", "text": "def port_open?(addr, port)\n begin\n s = TCPServer.new(addr, port)\n s.close\n true\n rescue \n false\n end\n end", "title": "" }, { "docid": "24fb9161de3d472a85eea1741bec5df1", "score": "0.54748976", "text": "def find_open_port\n server = TCPServer.new('127.0.0.1', 0)\n port = server.addr[1]\n server.close\n port\n end", "title": "" }, { "docid": "cfcb6e87f0797f80c70fde1ac7cc662d", "score": "0.5458811", "text": "def run_internal\n monitors = @monitors\n selector = @selector\n\n while true\n begin\n ready = selector.select @sleep_for\n rescue IOError => e\n Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue\n if monitors.any? { |mon| mon.value.closed? }\n STDERR.puts \"Error in select: #{e.message} (#{e.class})\"\n STDERR.puts e.backtrace\n\n monitors.reject! do |mon|\n if mon.value.closed?\n selector.deregister mon.value\n true\n end\n end\n\n retry\n else\n raise\n end\n end\n\n if ready\n ready.each do |mon|\n if mon.value == @ready\n @mutex.synchronize do\n case @ready.read(1)\n when \"*\"\n @input.each do |c|\n mon = nil\n begin\n begin\n mon = selector.register(c, :r)\n rescue ArgumentError\n # There is a bug where we seem to be registering an already registered\n # client. This code deals with this situation but I wish we didn't have to.\n monitors.delete_if { |submon| submon.value.to_io == c.to_io }\n selector.deregister(c)\n mon = selector.register(c, :r)\n end\n rescue IOError\n # Means that the io is closed, so we should ignore this request\n # entirely\n else\n mon.value = c\n @timeouts << mon if c.timeout_at\n monitors << mon\n end\n end\n @input.clear\n\n @timeouts.sort! { |a,b| a.value.timeout_at <=> b.value.timeout_at }\n calculate_sleep\n when \"c\"\n monitors.reject! do |submon|\n if submon.value == @ready\n false\n else\n submon.value.close\n begin\n selector.deregister submon.value\n rescue IOError\n # nio4r on jruby seems to throw an IOError here if the IO is closed, so\n # we need to swallow it.\n end\n true\n end\n end\n when \"!\"\n return\n end\n end\n else\n c = mon.value\n\n # We have to be sure to remove it from the timeout\n # list or we'll accidentally close the socket when\n # it's in use!\n if c.timeout_at\n @mutex.synchronize do\n @timeouts.delete mon\n end\n end\n\n begin\n if c.try_to_finish\n @app_pool << c\n clear_monitor mon\n end\n\n # Don't report these to the lowlevel_error handler, otherwise\n # will be flooding them with errors when persistent connections\n # are closed.\n rescue ConnectionError\n c.write_error(500)\n c.close\n\n clear_monitor mon\n\n # SSL handshake failure\n rescue MiniSSL::SSLError => e\n @server.lowlevel_error(e, c.env)\n\n ssl_socket = c.io\n begin\n addr = ssl_socket.peeraddr.last\n # EINVAL can happen when browser closes socket w/security exception\n rescue IOError, Errno::EINVAL\n addr = \"<unknown>\"\n end\n\n cert = ssl_socket.peercert\n\n c.close\n clear_monitor mon\n\n @events.ssl_error @server, addr, cert, e\n\n # The client doesn't know HTTP well\n rescue HttpParserError => e\n @server.lowlevel_error(e, c.env)\n\n c.write_error(400)\n c.close\n\n clear_monitor mon\n\n @events.parse_error @server, c.env, e\n rescue StandardError => e\n @server.lowlevel_error(e, c.env)\n\n c.write_error(500)\n c.close\n\n clear_monitor mon\n end\n end\n end\n end\n\n unless @timeouts.empty?\n @mutex.synchronize do\n now = Time.now\n\n while @timeouts.first.value.timeout_at < now\n mon = @timeouts.shift\n c = mon.value\n c.write_error(408) if c.in_data_phase\n c.close\n\n clear_monitor mon\n\n break if @timeouts.empty?\n end\n\n calculate_sleep\n end\n end\n end\n end", "title": "" }, { "docid": "1bf7d914921cde01ffb79530005491e3", "score": "0.5455489", "text": "def wait_connect(trycnt=10)\n trycnt.times do\n case sts = status\n when 0x00; return\n when 0x23; raise \"SSID not configured\"\n when 0x24; raise \"Encryption key invalid\"\n when 0x27; raise \"SSID was found, but join failed\"\n # else; Object.puts \"status = 0x#{sts.to_s(16)}\"\n end\n end\n raise \"Cannot connect to target\"\n end", "title": "" }, { "docid": "4be9e3950f9e9d76391c480721ea98e1", "score": "0.54476", "text": "def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\n rescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\n end", "title": "" }, { "docid": "42609465ba6bc062fa341744e9e9e7ff", "score": "0.542125", "text": "def wait_for_online\n Puppet.debug \"Waiting #{RETRY_COUNT * RETRY_STEP} seconds for Pacemaker to become online\"\n retry_block_until_true do\n is_online?\n end\n Puppet.debug 'Pacemaker is online'\n end", "title": "" }, { "docid": "375649ab41e9143ebb6841f0c1bcbca6", "score": "0.5401854", "text": "def visit_port?(port)\n @port_rules.accept?(port)\n end", "title": "" }, { "docid": "be5bb649c093a8cbd51344945031301f", "score": "0.5399812", "text": "def open_ports\n @scanned_ports ||= host_stats[:open_ports].to_i\n end", "title": "" }, { "docid": "7fb23de4ecf08b46acf51a5a28a7056f", "score": "0.53854156", "text": "def initiate_connection\n Retriable.retriable on: [Errno::ECONNREFUSED, Errno::EHOSTUNREACH] do\n TCPSocket.new(ip, port).close\n end\n end", "title": "" }, { "docid": "0319dd7fc1e945cca68f686d4ba00b32", "score": "0.5381222", "text": "def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end", "title": "" }, { "docid": "41aa8742dfc099ad188506bf4b9644bd", "score": "0.5373287", "text": "def wait_and_open\n info \"Attempting to connect to the web site...\"\n Http.head \"http://127.0.0.1:3000/\"\n rescue Errno::ECONNREFUSED\n sleep(0.5)\n retry if (self.try += 1) < max\n info \"Server not found, sorry.\"\n raise\n else\n Launchy.open(\"http://127.0.0.1:3000/\")\n end", "title": "" }, { "docid": "abba7cb610a843bd921a892adc753738", "score": "0.53695947", "text": "def startup_wait!\n begin\n Timeout::timeout(startup_wait) do\n sleep 1 until (Felixwrapper.is_port_in_use? self.port and Felixwrapper.is_responding? self.port)\n end \n rescue Timeout::Error\n logger.warn \"Waited #{startup_wait} seconds for felix to start, but it is not yet listening on port #{self.port}. Continuing anyway.\"\n end\n end", "title": "" }, { "docid": "4db6ab3955423b951ddc6a0222f14abc", "score": "0.53632194", "text": "def get_avail_port(host)\n host ||= (Socket::gethostbyname('')||['localhost'])[0]\n\n infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC,\n Socket::SOCK_STREAM, 0, \n Socket::AI_PASSIVE)\n fam = infos.inject({}) { |h, arr| h[arr[0]]= arr[2]; h }\n sock_host = fam['AF_INET'] || fam['AF_INET6']\n\n sock = sock_host ? TCPServer.open(sock_host, 0) : TCPServer.open(0)\n port = sock.addr[1]\n sock.close\n\n port\n end", "title": "" }, { "docid": "3e3e300b2dcfdeb5b3c210fe9474ccf0", "score": "0.53586334", "text": "def ssh_ip\n 5.times do\n ip = read_guest_ip_dhcp\n return ip unless ip.empty?\n\n ip = read_guest_ip_prlctl\n return ip unless ip.empty?\n\n sleep 2\n end\n\n # We didn't manage to determine IP - return nil and\n # expect SSH client to do a retry\n return nil\n end", "title": "" }, { "docid": "55bd06039c68e9fece171311aebc4891", "score": "0.5355538", "text": "def pids_on_ports(first=3000, count=4)\n last = first + count - 1\n `lsof -Fp -i tcp:#{first}-#{last}`.split(\"\\n\").map { |el| el[1,el.length].to_i }\nend", "title": "" }, { "docid": "ec564cfbf2d0a04714952871859bb396", "score": "0.53348213", "text": "def available_port\n server = TCPServer.new('0.0.0.0', 0)\n server.addr[1].tap do\n server.close\n end\n end", "title": "" }, { "docid": "a8586c35e55683ca901d4feafd86ee05", "score": "0.5321138", "text": "def wait_for_supporting_service_to_start(environment, service_name, service_port, service_url)\n\n puts \"Waiting for service '#{service_name}' to start...\"\n\n host = determine_docker_host_for_container_ports\n port = get_host_mapped_port_for_container(environment, service_name, service_port)\n\n target_url = \"http://#{host}:#{port}/#{service_url}\"\n puts \"Testing access to service '#{service_name}' via URL '#{target_url}'...\"\n\n up = false\n until up do\n begin\n\n # Firstly, sleep so we don't bombard the service with requests and then check the container is still running\n sleep 2\n get_host_mapped_port_for_container(environment, service_name, service_port)\n\n # Then try accessing the service on the target_url. Anything other than a non-400 status code means its not up\n response = Net::HTTP.get_response(URI(target_url))\n response_code = response.code.to_i\n up = response_code < 400\n rescue\n up = false\n end\n end\n\n puts \"Service '#{service_name}' is up on '#{target_url}'\"\n\n [host, port]\nend", "title": "" }, { "docid": "870451e68683ab49de3cd89831e4a576", "score": "0.5296452", "text": "def check\n tcp_socket_request\n mark_message \"Ping check to #{host}:#{port} successful\"\n rescue => e\n mark_message \"Error: '#{e}'\"\n mark_failure\n end", "title": "" }, { "docid": "c8dd754d13928463199f7718cc06ee94", "score": "0.5295665", "text": "def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end", "title": "" }, { "docid": "354598c82fed47fc2a0c7580191db937", "score": "0.5277496", "text": "def negotiate!(socket, timeout); end", "title": "" }, { "docid": "b0ef61394302161f1ae9163959316818", "score": "0.5272157", "text": "def search_peers_by_port (port)\r\n $peers.length.times do |i|\r\n return $peers[i] if ($peers[i].port == port.to_i)\r\n end\r\n return -1\r\nend", "title": "" }, { "docid": "1b5968d73a69140fae30628733cef478", "score": "0.526741", "text": "def wait_until(timeout = 30, retry_interval = 0.1, &block)\n start = Time.now\n while (result = !block.call)\n break if (Time.now - start).to_i >= timeout\n sleep(retry_interval)\n end\n !result\nend", "title": "" }, { "docid": "50ecac375290156796ae6111681521dd", "score": "0.52645016", "text": "def ping()\n\n ip = Resolv.getaddress(@host)\n puts ('ip: ' + ip.inspect).debug if @debug\n valid = pingecho(ip)\n puts ('valid: ' + valid.inspect).debug if @debug \n \n @results[:ping] = if valid then\n a = [valid]\n 4.times {sleep 0.01; a << pingecho(ip)}\n (a.min * 1000).round(3)\n else\n nil\n end\n\n end", "title": "" }, { "docid": "49ce87b826a3437a9d610c4d6e96bb9c", "score": "0.5259742", "text": "def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\nend", "title": "" }, { "docid": "c5a168fc18bc32a7489fd9e0a6a17eac", "score": "0.52435976", "text": "def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend", "title": "" }, { "docid": "61bf1c9bc0130eda62c4fb4e2b7ac031", "score": "0.5239601", "text": "def scan_range(ip_range)\n active_ips = ip_range.select { |ip| Net::Ping::External.new(ip).ping? }\nend", "title": "" }, { "docid": "345b44de166d5db99c9d1f9728bd65f7", "score": "0.5235471", "text": "def wait_for_ipv4(timeout, vm)\n sleep_time = 5\n print 'Waiting for ipv4 address.'\n tries = 0\n start_search_ip = true\n max_tries = timeout > sleep_time ? timeout / sleep_time : 1\n while start_search_ip && (tries += 1) <= max_tries\n print '.'\n sleep sleep_time\n vm_ip = vm.guest.ipAddress if vm_guest_ip?(vm)\n start_search_ip = false if @vm_helper.open_port?(vm_ip, @vm_helper.port, 1)\n end\n raise 'Timed out waiting for ipv4 address!' if tries > max_tries\n puts 'Found ipv4 address!'\n true\n end", "title": "" }, { "docid": "b3a2ea49ca1272ac0151619dfc75d3cd", "score": "0.52110493", "text": "def poll_max_retries\n 3\n end", "title": "" }, { "docid": "9105e869ddc3f8f042888f9885924d43", "score": "0.5207734", "text": "def alive?\n Utils::NetworkUtils.port_open?(@host, @port)\n end", "title": "" }, { "docid": "4beb39e22c1da83b53a270adcf85e4ee", "score": "0.52065355", "text": "def ping_nodes\n\t\twhile true\n\t\t\tsleep(rand(60))\n\t\t\tn = rand(@neighbour_nodes.count)\n\t\t\tnode = @neighbour_nodes[n]\n\t\t\ts = UDPSocket.new\n\t\t\tbegin\n\t\t\t\tTimeout::timeout(10){ \n\t\t\t\t\tputs \"Pinging #{node}\"\n\t\t\t\t\tsend_message [\"PING\", @info], 0, node.host, node.port\n\t\t\t\t\t@waiting = true\n\t\t\t\t\twhile waiting?\n\t\t\t\t\t\tsleep(0.2)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue Timeout::Error => ex\n\t\t\t\tif waiting?\n\t\t\t\t\tputs \"Conenction to #{node} timed out, sending DROP_NODE to all remaining nodes\"\n\t\t\t\t\t@neighbour_nodes - [node]\n\t\t\t\t\t@neighbour_nodes.each do |n|\n\t\t\t\t\t\tsend_message [\"DROP_NODE\", node], 0, n.host, n.port\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Socket::Error => ex\n\t\t\t\tputs \"Connection to #{node} failed, trying again in 60 seconds\"\n\t\t\trescue => ex\n\t\t\t\tputs ex.message\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "79e5411edd5882696a7fdef30e566253", "score": "0.5206208", "text": "def wait\n config.ui.logger.debug { \"Waiting for socket to become available; timeout after #{config.wait} seconds.\" }\n Timeout.timeout(config.wait) do\n until ready?\n config.ui.logger.debug { \"Sleeping 1 second.\" }\n sleep(1)\n end\n end\n true\n rescue Timeout::Error => e\n config.ui.logger.warn { \"socket(#{config.host}:#{config.port}) timeout!\" }\n false\n end", "title": "" }, { "docid": "43f18ef4e373f2eb8ce2569df8f94619", "score": "0.5200287", "text": "def test_idle_timeout_server_no_open\n s = TCPServer.new(0)\n cont = Container.new(__method__)\n cont.connect(\":#{s.addr[1]}\", {:idle_timeout => 0.1, :handler => ExceptionMessagingHandler.new })\n ex = assert_raises(Qpid::Proton::Condition) { cont.run }\n assert_match(/resource-limit-exceeded/, ex.to_s)\n ensure\n s.close if s\n end", "title": "" }, { "docid": "f5013c6af50e1846bb1374b515f47025", "score": "0.5189069", "text": "def sleep_until_puppetserver_started(host, port = nil)\n port = options[:puppetserver_port] if port.nil?\n curl_with_retries('start puppetserver (ssl)',\n host, \"https://#{host.node_name}:#{port}\", [35, 60])\n end", "title": "" }, { "docid": "649998eaaa86d418d294bfc00c57da91", "score": "0.5181552", "text": "def test_port_exists\n port = 20000\n client = ChainReactor::ClientConnection.new(mock_socket(\"\",port),get_logger)\n assert_equal port, client.port\n end", "title": "" }, { "docid": "66ba91cf080226256be4cd97314e8be1", "score": "0.5176672", "text": "def scanner_pass?(input, delay)\n scanner = PacketScanner.new(input, delay)\n scanner.length.times do |i|\n return false if scanner.caught?(i)\n end\n true\nend", "title": "" } ]
4f72e5619aa2d42158336a6da06e396b
Select the method to parse out links
[ { "docid": "2b0cdc81159541bbb3594fc779653eaa", "score": "0.60742414", "text": "def get_links(text)\n if ($options.use == :uri)\n get_links_with_uri(text)\n elsif ($options.use == :hpricot)\n get_links_with_hpricot(text)\n elsif ($options.use == :nokogiri)\n get_links_with_nokogiri(text)\n else\n LOG.error(\" => Unknown parser #{$options.use} requested!\");\n end\n end", "title": "" } ]
[ { "docid": "d7d67ba0228c2889c01acb4e7d5dacec", "score": "0.76905304", "text": "def links_parser; end", "title": "" }, { "docid": "5a2485def94b46cb90fcd8668985c2dd", "score": "0.68952626", "text": "def links_parser=(_arg0); end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6888538", "text": "def links; end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.6705181", "text": "def hyperlinks; end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.6705181", "text": "def hyperlinks; end", "title": "" }, { "docid": "623fe703fb09b8058bf2eef1732ab64b", "score": "0.6654336", "text": "def hyperlink; end", "title": "" }, { "docid": "192f2803d8f68ca13b9b6114bc569131", "score": "0.6586116", "text": "def link\n end", "title": "" }, { "docid": "e15f194083b1c1d0e7fe449e40322886", "score": "0.64873046", "text": "def link_pattern\n end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.64175224", "text": "def link?; end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.64175224", "text": "def link?; end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.64175224", "text": "def link?; end", "title": "" }, { "docid": "3e6a102b1a3550d5f44ae38a296641ec", "score": "0.638943", "text": "def href; end", "title": "" }, { "docid": "3e6a102b1a3550d5f44ae38a296641ec", "score": "0.638943", "text": "def href; end", "title": "" }, { "docid": "fea33128071275c665aa911203c16f99", "score": "0.63813025", "text": "def link() url; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.63668454", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.63668454", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.63668454", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.63668454", "text": "def link_support; end", "title": "" }, { "docid": "8c32cbb52b3d00caa2c425a9b77fb959", "score": "0.63156915", "text": "def method_missing(*args, &block)\n @next_link.send(*args, &block)\n end", "title": "" }, { "docid": "ff8c4b97b3205ffe7a0f930d7ffa7ba2", "score": "0.6298955", "text": "def each_link\n return enum_for(__method__) if !block_given?\n @links.each_value { |l| yield(l) }\n end", "title": "" }, { "docid": "746815dc155edc99650ceb1b571705be", "score": "0.62945867", "text": "def links=(_arg0); end", "title": "" }, { "docid": "746815dc155edc99650ceb1b571705be", "score": "0.62945867", "text": "def links=(_arg0); end", "title": "" }, { "docid": "7819be1a61c043c66caafbb1f53d644e", "score": "0.62711567", "text": "def handle_links anElement\r\n self.apply anElement\r\n end", "title": "" }, { "docid": "e17f7ea4490dbeea006c1b68d44639a5", "score": "0.62627006", "text": "def command_links(m)\n m.user.send \"Go to #{shared[:Sinatra_Url]}\" + \"/links to see the link suggestions.\"\n end", "title": "" }, { "docid": "3872d21ab89831742b73575fa53375a0", "score": "0.62551457", "text": "def link(path, &block) end", "title": "" }, { "docid": "3872d21ab89831742b73575fa53375a0", "score": "0.62551457", "text": "def link(path, &block) end", "title": "" }, { "docid": "ab4b8d7221ae4b35ff4941a80b9979a7", "score": "0.62350476", "text": "def extract_links(page)\n page.links(@source[:archive_patterns])\n end", "title": "" }, { "docid": "c91f38eec5b2155b8bffbcf337a3366e", "score": "0.6216562", "text": "def linkParse( sent )\n\t\treturn Linguistics::EN::linkParser.parse( sent.to_s )\n\tend", "title": "" }, { "docid": "e189b84a8b0084c999660eae8f7e765d", "score": "0.6212177", "text": "def link_to_method(method_text, url = nil, classname = nil)\n method_text =~ /\\A(.+) \\((.+)\\)\\Z/\n method_name, module_name = $1, $2\n link_to %Q(<span class=\"method_name\">#{h method_name}</span> <span class=\"module_name\">(#{h module_name})</span>), url, classname\n end", "title": "" }, { "docid": "e189b84a8b0084c999660eae8f7e765d", "score": "0.6212177", "text": "def link_to_method(method_text, url = nil, classname = nil)\n method_text =~ /\\A(.+) \\((.+)\\)\\Z/\n method_name, module_name = $1, $2\n link_to %Q(<span class=\"method_name\">#{h method_name}</span> <span class=\"module_name\">(#{h module_name})</span>), url, classname\n end", "title": "" }, { "docid": "60ccd9b2ac6b6313fece747defe4f4c6", "score": "0.62002057", "text": "def method_missing(method, *args, &block)\n if args.any? && args.first.is_a?(Hash)\n _links.send(method, [], &block)._expand(*args)\n elsif !Array.method_defined?(method)\n %i[_attributes _embedded _links].each do |target|\n target = send(target)\n return target.send(method, *args, &block) if target.respond_to?(method.to_s)\n end\n super\n end\n end", "title": "" }, { "docid": "2bc951a4407bbe008284fe3c4578da29", "score": "0.6188603", "text": "def method\n link_schema['method'].downcase.to_sym\n end", "title": "" }, { "docid": "f26da5285bd74220f98ab862b02c554c", "score": "0.61851794", "text": "def method_missing(meth, *attrs, &block)\n @link.send(meth, *attrs, &block)\n end", "title": "" }, { "docid": "cb99bcadc7fa7fc53f2a35c487ed9b9c", "score": "0.61824954", "text": "def link_to_method(entry, url = nil, classname = nil)\n method_name = entry.pretty_name rescue entry.name\n module_name = entry.parent_name rescue entry.name\n link_to %Q(<li><strong>#{h method_name}</strong><small>#{h module_name}</small></li>), url, classname\n end", "title": "" }, { "docid": "a16a547516f61e4f143ee9608441cdfe", "score": "0.6171393", "text": "def link_matcher(page:)\n exchange_on_hooks(type: :scan_rules) do\n page.all('a').map { |a| a['href'] }\n end\n end", "title": "" }, { "docid": "36a88946decb996613651d918459de57", "score": "0.6160347", "text": "def links\n process_page unless @processed\n @links\n end", "title": "" }, { "docid": "f2e9cf48c0a38257ddd7f5e9987a41e4", "score": "0.61576563", "text": "def link_to_identifier; end", "title": "" }, { "docid": "6e8c846cac51cdb5e8b59d550fbcd899", "score": "0.6153345", "text": "def links_feed\n end", "title": "" }, { "docid": "7de33e00c5cdb1a42e8c000545aaaa7a", "score": "0.6136829", "text": "def method_missing(meth, *args)\n if @bibitem.respond_to?(meth)\n @bibitem.send meth, *args\n elsif URL_TYPES.include? meth\n link = @bibitem.link.detect do |l|\n l.type == meth.to_s || (meth == :uri && l.type.nil?)\n end\n link&.content&.to_s\n elsif URL_TYPES.include? meth.match(/^\\w+(?==)/).to_s.to_sym\n /^(?<type>\\w+)/ =~ meth\n link = @bibitem.link.detect do |l|\n l.type == type || (type == \"uri\" && l.type.nil?)\n end\n if link\n link.content = args[0]\n else\n @bibitem.link << RelatonBib::TypedUri.new(type: type, content: args[0])\n end\n else\n super\n end\n end", "title": "" }, { "docid": "e79f2e25f76aa41ea889ec2abdb7b496", "score": "0.61248386", "text": "def get\n to_link.get\n end", "title": "" }, { "docid": "f722451248d56728d37f3eb2af45bd1d", "score": "0.6123633", "text": "def get_links()\n\t\t\tget_document(@tag_type[0])\n\t\tend", "title": "" }, { "docid": "597c67ccf2b78a4d58a6bc927455508a", "score": "0.6120921", "text": "def parse_special_links(text=\"\")\n text.gsub! @links do\n model,link = $1,$2\n mod = model.camelize \n\n if @models.keys.include? mod\n con = model.tableize\n ins = mod.constantize.find_by_id link\n url = @url_helpers.url_for(controller: con, action: :show, id: link, only_path: true)\n if(ins.nil?)\n tag = \"invalid reference(#{$2})\"\n else\n tag = ins.send @models[mod]\n end\n \"[#{tag}](#{url})\"\n else\n \"invalid tag (#{mod} => #{@models.keys.to_sentence})\"\n end\n end\n return text\n end", "title": "" }, { "docid": "80aa3b41822380df9969a7b16e34da8e", "score": "0.6086288", "text": "def link_to_method(m, specp = false)\n label = specp ? m.label : m.short_label\n a_href(@urlmapper.method_url(methodid2specstring(m.id)), label)\n end", "title": "" }, { "docid": "a132ef1a1fdfb6d44bba1b9f75da2483", "score": "0.60791117", "text": "def each_link\n return enum_for(__method__) if !block_given?\n xml.elements.each('link') do |element|\n yield(Link.new(element, self))\n end\n end", "title": "" }, { "docid": "4d1ee627b16b1bad499d48e7a3cbb8fb", "score": "0.6072996", "text": "def href()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "4d1ee627b16b1bad499d48e7a3cbb8fb", "score": "0.6072996", "text": "def href()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "31be62b383b56014db16948f297501bb", "score": "0.60643506", "text": "def visit_links\n @link_rules.accept\n end", "title": "" }, { "docid": "e33c6658f34d5f7c956e4a68526b80ef", "score": "0.6023595", "text": "def collection_links(parser_links, options={})\n links = Array.new\n parser_links = [parser_links].flatten.uniq\n parser_links.each do |link|\n data = {}\n data[:href] = link.attributes[\"href\"].nil? ? \" \" : link.attributes[\"href\"].value.strip\n data[:text] = link.text.nil? ? \" \" : link.text.strip\n links << data\n end\n collection_attr(links, options)\n end", "title": "" }, { "docid": "cb9133c241f229e749e5bdf6a5e1876e", "score": "0.6023569", "text": "def link_to_method(entry, url = nil, classname = nil)\n method_name = begin\n entry.pretty_name\n rescue StandardError\n entry.name\n end\n module_name = begin\n entry.parent_name\n rescue StandardError\n entry.name\n end\n link_to %(<span class=\"method_name\">#{h method_name}</span> <span class=\"module_name\">(#{h module_name})</span>), url, classname\n end", "title": "" }, { "docid": "666004de9ca086e09dd95ca190657ba6", "score": "0.5996339", "text": "def links\n each_link.to_a\n end", "title": "" }, { "docid": "d7e36662197888bce42956a8b7d7b065", "score": "0.5985455", "text": "def getlinks\n @shortlinks = [\"in\", \"br\"] #, \"up\"]\n @shortlinks_special = [\"in\", \"br\", \"up\"]\n @links = [\"index\", \"browse\", \"update\"]\n @link_names = [\"Description\", \"Browse Database\", \"Update Database\"]\n @link_text = [\"Description\", \"Browse the database\", \"Update the database\"]\n end", "title": "" }, { "docid": "67395ddfe366f3ee03c491cec3dfdee1", "score": "0.5982866", "text": "def method_link(m, count, force_filename = false)\n name = count ? \"[#{count}]\" : m.short_filename\n class_name = class_for_filename(m.filename)\n url = url_for_filename(m.filename, m.line, force_filename)\n %{<a href=\"#{url}\" title=\"#{html_safe(m.signature)}\"#{\" class=\\\"#{class_name}\\\"\" if class_name}>#{name}</a>}\n end", "title": "" }, { "docid": "6d29aff2e22ccd1d512704734a37f26d", "score": "0.59372514", "text": "def href=(_arg0); end", "title": "" }, { "docid": "294145c75588ac44ac0325ecd7ed04b4", "score": "0.5921939", "text": "def getLink( how, what )\n links = document.all.tags(\"A\")\n \n # Guard ensures watir won't crash if somehow the list of links is nil\n if (links == nil)\n raise UnknownObjectException, \"Unknown Object in getLink: attempted to click a link when no links present\"\n end\n \n link = nil\n case how\n when :index\n begin\n link = links[ (what-1).to_s ]\n rescue\n link=nil\n end\n \n when :url\n links.each do |thisLink|\n if what.matches(thisLink.href) \n link = thisLink if link == nil\n end\n end\n \n when :text\n links.each do |thisLink|\n if what.matches(thisLink.innerText.strip) \n link = thisLink if link == nil\n end\n end\n \n when :id\n links.each do |thisLink|\n if what.matches(thisLink.invoke(\"id\"))\n link = thisLink if link == nil\n end\n end\n when :name\n links.each do |thisLink|\n if what.matches(thisLink.invoke(\"name\"))\n link = thisLink if link == nil\n end\n end\n\n when :title\n links.each do |thisLink|\n if what.matches(thisLink.invoke(\"title\"))\n link = thisLink if link == nil\n end\n end\n \n when :beforeText\n links.each do |thisLink|\n if what.matches(thisLink.getAdjacentText(\"afterEnd\").strip)\n link = thisLink if link == nil\n end\n end\n\n when :afterText\n links.each do |thisLink|\n if what.matches(thisLink.getAdjacentText(\"beforeBegin\").strip)\n link = thisLink if link == nil\n end\n end\n else\n raise MissingWayOfFindingObjectException, \"#{how.inspect} is an unknown way of finding a link ( #{what} )\"\n end\n \n # if no link found, link will be a nil. This is OK. Actions taken on links (e.g. \"click\") should rescue \n # the nil-related exceptions and provide useful information to the user.\n return link\n \n end", "title": "" }, { "docid": "1a9d821e9d21528f0267fdef3574c032", "score": "0.5897404", "text": "def url\n link\n end", "title": "" }, { "docid": "5afc4895ea0ccb4d484bd2403e35978b", "score": "0.5891327", "text": "def process\n url = message[LINK_RE, 1]\n log \"> #{url}\"\n case url\n when %r(twitter\\.com.+/status(es)?/.+)i\n tweet_content = extract_tweet_content(url)\n unless tweet_content.blank?\n paste Text::Format.new(:text => tweet_content, :first_indent => 0).paragraphs\n end\n when %r(github\\.com.+/tree/master)i\n github_description = extract_github_description(url)\n unless github_description.blank?\n paste Text::Format.new(:text => github_description, :first_indent => 0).paragraphs\n end\n else\n page_title = extract_page_title(url)\n unless page_title.blank?\n speak \"Last link: #{page_title}\"\n end\n end\n end", "title": "" }, { "docid": "8f356dba7338603b2a3902365fd9f8f0", "score": "0.5887336", "text": "def internal_links\n respond_with @page.internal_links\n end", "title": "" }, { "docid": "e6fd32dde0d3dcff2745ceac58d16ab1", "score": "0.5880483", "text": "def link_by_href(link_href)\n return @browser.link(:href, link_href)\nend", "title": "" }, { "docid": "3d5af0982faee575da2198ea7e0e29c2", "score": "0.5879605", "text": "def find_link(element)\n case element.how\n when :index\n%|var element = document.getElementsByTagName('A')[#{element.what-1}];|\n else\n%|var element = undefined;\nfor (var i = 0; i < document.links.length; i++) {\n if (document.links[i].#{handle_match(element)}) {\n element = document.links[i];\n break;\n }\n}|\n end\n end", "title": "" }, { "docid": "785753e1d300d3f429d8cad759830662", "score": "0.58775073", "text": "def process_link(link_pk)\n link = db[:MicroServiceChainLinks][:pk => link_pk]\n raise \"Lookup failed: #{link_pk}\" unless link\n\n task = db[:TasksConfigs][:pk => link.fetch(:currentTask)]\n\n microservice_group = link.fetch(:microserviceGroup)\n default_next = link.fetch(:defaultNextChainLink)\n\n next_by_exit_code = db[:MicroServiceChainLinksExitCodes].filter(:microServiceChainLink => link_pk).map {|row|\n [row[:exitCode], row[:nextMicroServiceChainLink]]\n }.to_h\n\n task_description = task[:description].to_s\n\n method = find_method(link_pk)\n\n return method if method\n\n method = create_method!(microservice_group, task_description, link_pk, @task_types.fetch(task[:taskType]))\n\n if @task_types.fetch(task[:taskType]) == 'get user choice to proceed with'\n next_possible_chains = db[:MicroServiceChainChoice].filter(:choiceAvailableAtLink => link_pk)\n\n next_possible_chains.each do |chain|\n chain_description = db[:MicroServiceChains][:pk => chain[:chainAvailable]][:description].to_s\n next_method = follow_chain(chain[:chainAvailable])\n\n method.add_block(\"if get_user_input() == \\\"#{chain_description}\\\"\") do |m|\n m.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n end\n end\n\n elsif ['one instance', 'for each file'].include?(@task_types.fetch(task[:taskType]))\n executable = db[:StandardTasksConfigs][:pk => task[:taskTypePKReference]]\n next_by_exit_code.each do |exit_code, next_link_pk|\n method.add_block(\"if run_client_script(\\\"#{strescape(executable[:execute].to_s)}, #{strescape(executable[:arguments].to_s)}\\\") == #{exit_code}\") do |m|\n if next_link_pk\n next_method = process_link(next_link_pk)\n m.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n else\n m.prn(\"# end of the line\")\n end\n end\n end\n\n if default_next\n default_method = process_link(default_next)\n method.prn(\"return #{default_method.name}() # #{default_method.link_pk}\")\n end\n\n elsif @task_types.fetch(task[:taskType]) == 'linkTaskManagerSetUnitVariable'\n unit_variable = db[:TasksConfigsSetUnitVariable][:pk => task[:taskTypePKReference]]\n\n $unit_variables[@directory_type][unit_variable[:variable].to_s] ||= Set.new\n $unit_variables[@directory_type][unit_variable[:variable].to_s] << unit_variable[:microServiceChainLink]\n\n method.prn(\"# set variable '#{unit_variable[:variable].to_s}' for type '#{@directory_type}' to transition to '#{unit_variable[:microServiceChainLink]}'\")\n\n if next_by_exit_code[0]\n raise unless (next_by_exit_code.length == 1)\n next_method = process_link(next_by_exit_code[0])\n method.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n else\n method.prn(\"# missing next step\")\n end\n\n elsif @task_types.fetch(task[:taskType]) == 'linkTaskManagerUnitVariableLinkPull'\n unit_variable = db[:TasksConfigsUnitVariableLinkPull][:pk => task[:taskTypePKReference]]\n\n if $unit_variables[@directory_type][unit_variable[:variable].to_s] && !$unit_variables[@directory_type][unit_variable[:variable].to_s].empty?\n $unit_variables[@directory_type][unit_variable[:variable].to_s].each do |target_link|\n method.add_block(\"if read_variable(\\\"#{unit_variable[:variable].to_s}\\\", \\\"#{@directory_type}\\\") == \\\"#{target_link}\\\"\") do |m|\n next_method = process_link(target_link)\n m.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n end\n end\n else\n method.prn(\"# No variable match for '#{unit_variable[:variable].to_s}'. Going to default\")\n next_method = process_link(unit_variable[:defaultMicroServiceChainLink])\n method.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n end\n\n elsif ['get replacement dic from user choice'].include?(@task_types.fetch(task[:taskType]))\n db[:MicroServiceChoiceReplacementDic].filter(:choiceAvailableAtLink => link_pk).each_with_index do |vars, idx|\n next_link_pk = next_by_exit_code[0]\n method.add_block(\"if get_user_selection() == \\\"#{strescape(vars[:description].to_s)}\\\"\") do |m|\n if next_link_pk\n next_method = process_link(next_link_pk)\n m.prn(\"# set vars #{vars[:replacementDic]}\")\n m.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n else\n m.prn(\"# end of the line\")\n end\n end\n end\n\n if default_next\n default_method = process_link(default_next)\n method.prn(\"return #{default_method.name}() # #{default_method.link_pk}\")\n else\n method.prn(\"# end of the line\")\n end\n\n elsif ['Get microservice generated list in stdOut', 'Get user choice from microservice generated list'].include?(@task_types.fetch(task[:taskType]))\n if next_by_exit_code[0]\n raise unless (next_by_exit_code.length == 1)\n next_method = process_link(next_by_exit_code[0])\n method.prn(\"return #{next_method.name}() # #{next_method.link_pk}\")\n elsif default_next\n default_method = process_link(default_next)\n method.prn(\"return #{default_method.name}() # #{default_method.link_pk}\")\n else\n method.prn(\"# end of the line\")\n end\n else\n raise \"UNKNOWN TASK TYPE: #{@task_types.fetch(task[:taskType])} for #{task[:description].to_s} and link #{link.inspect}\"\n end\n\n method\n end", "title": "" }, { "docid": "8436929f412d57346345188f2c423890", "score": "0.58739066", "text": "def navigate\n\t\t\tFeed.parse_url(self[1],browser)\n\t\t\tend", "title": "" }, { "docid": "3dd49887637dd23b2647e769c9ddc4e1", "score": "0.58720255", "text": "def prepare_links!\n links_def = self.class.find_links_definition or return\n links_def.rel2block.each do |link|\n links << links_def.sought_type.from_attributes({ # create Hyperlink representer.\n \"rel\" => link[:rel],\n \"href\" => run_link_block(link[:block])})\n end\n end", "title": "" }, { "docid": "3be286054db67c8d1dc461b66d711d08", "score": "0.5868113", "text": "def get_links(content) \n #pull any a tags and save to results array\n results = Array.new\n # in certain situations, there is no links method\n # not sure why, looks like the it happens when the document is not html/xml\n if content.respond_to?('links')\n content.links.each do |link|\n href = link.href\n # concerned about links for deletion rather than buttons\n #this is not a very good solution\n if href and ( link.text.downcase != \"delete\" or link.text.downcase != \"destroy\")\n # if link starts with / we are fine\n if href.length >= 1 and href[1..1] == \"/\"\n results.push(href)\n # if link starts with ./, remove the dot\n elsif href.length >= 2 and href[1..2] == \"./\"\n result.push(href[2..-1])\n # if link starts with the url, remove it \n elsif href.match(self.url)\n href.gsub!(self.url, '')\n results.push(href) \n end\n # otherwise, don't use the link\n end\n end\n end\n #return the url results array\n return results\n end", "title": "" }, { "docid": "b1b01977cd4df11527a33a1885759895", "score": "0.58346844", "text": "def links\r\n @calc_links ||= calc_links\r\n end", "title": "" }, { "docid": "f71ba2b8610ca7fe6ab0c9927a08a370", "score": "0.58324826", "text": "def pc_downloads_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(\"omtr-link11\"), __method__)\n end", "title": "" }, { "docid": "c95be82568c330c1d16056ffcc8247d1", "score": "0.582749", "text": "def link(name, *arguments)\n type = :link\n selector = discover_selector(arguments)\n\n define_object_readers(type, name, selector)\n define_clicker name, selector\n define_method(\"#{name}_text\") { @browser.find(selector).text }\n end", "title": "" }, { "docid": "efa0396933ce81d120c5ea76b662d450", "score": "0.5817667", "text": "def link(name, locator)\r\n define_method(\"#{name}_text\") do\r\n adapter.link(locator).value\r\n end\r\n define_method(\"click_#{name}\") do\r\n adapter.link(locator).click\r\n end\r\n define_method(\"#{name}_view\") do\r\n adapter.link(locator).view\r\n end\r\n end", "title": "" }, { "docid": "a03aa472ad2126355c744eaa619f6360", "score": "0.5812935", "text": "def links\n _fast_links\n rescue NameError\n method = \"def _fast_links\\n\"\n\n method << \" h = {}\\n\"\n\n _links.each do |rel|\n if respond_to?(\"_generate_#{rel}_link\")\n method << \" h[:\\\"#{rel}\\\"] = _generate_#{rel}_link\\n\"\n end\n end\n method << \" h\\nend\"\n\n self.class.class_eval method\n _fast_links\n end", "title": "" }, { "docid": "d6eebda312567edcc24ed321ba8e806d", "score": "0.58099705", "text": "def each_url\n return enum_for(__method__) unless block_given?\n\n each_link do |link|\n if (url = to_absolute(link))\n yield url\n end\n end\n end", "title": "" }, { "docid": "e839d8fbbb6f22f20fee77765b6ade41", "score": "0.5802858", "text": "def parsePage ()\n\tbookClasses = [\"anandha-vikatan\", \"junior-vikatan\", \"aval-vikatan\", \"chutti-vikatan\", \"sakthi-vikatan\", \"nanayam-vikatan\", \"motor-vikatan\", \"pasumai-vikatan\"];\t\t\n\n\t$logger.info(\"Parsing main page to get links to books\")\n\t$mechanizer.get('http://www.vikatan.com/') do |page|\n\t\tbookClasses.each do |currentBookClass|\n\n\t\t\tcurrentAnchorElement = page.link_with(:class => currentBookClass);\n\n\t\t\tcreateCurrentBook(currentBookClass, currentAnchorElement.href);\n\t\tend\n\tend\nend", "title": "" }, { "docid": "e839d8fbbb6f22f20fee77765b6ade41", "score": "0.5802858", "text": "def parsePage ()\n\tbookClasses = [\"anandha-vikatan\", \"junior-vikatan\", \"aval-vikatan\", \"chutti-vikatan\", \"sakthi-vikatan\", \"nanayam-vikatan\", \"motor-vikatan\", \"pasumai-vikatan\"];\t\t\n\n\t$logger.info(\"Parsing main page to get links to books\")\n\t$mechanizer.get('http://www.vikatan.com/') do |page|\n\t\tbookClasses.each do |currentBookClass|\n\n\t\t\tcurrentAnchorElement = page.link_with(:class => currentBookClass);\n\n\t\t\tcreateCurrentBook(currentBookClass, currentAnchorElement.href);\n\t\tend\n\tend\nend", "title": "" }, { "docid": "a9d57dfafb5d29c36b38358c56f0b518", "score": "0.5788769", "text": "def validate_page_link_set\n # do each |link|\n # link.text\n # link.location\nend", "title": "" }, { "docid": "7fc94cc4be8ed9b5454df8fd948e605d", "score": "0.5787968", "text": "def scrape link_or_links, what = nil\n unless what.is_a?(String) || what.is_a?(Symbol)\n what, imm = nil, what\n end\n [link_or_links].flatten.compact.collect { |link|\n link = registrar.absolutize link # A Mechanize object for a link\n Scraper.assert link, what, recur\n }\n end", "title": "" }, { "docid": "12a8f1e162610e497e952e9c1e1b6e01", "score": "0.57822084", "text": "def each_link_with_name\n return enum_for(__method__) if !block_given?\n @links.each { |name, link| yield(link, name) }\n end", "title": "" }, { "docid": "e7418453739ea93aedbff8c3622c005a", "score": "0.577999", "text": "def anchor_url_select_spec(*args)\n url_select_spec(\"a\", \"href\", *args)\n end", "title": "" }, { "docid": "dd69889a565191a7b13255866ebacec7", "score": "0.57764673", "text": "def each_link(&block)\n return enum_for(__method__) unless block_given?\n\n each_redirect(&block) if is_redirect?\n\n if (html? && doc)\n doc.search('//a[@href[string()]]').each do |a|\n yield a.get_attribute('href')\n end\n\n doc.search('//frame[@src[string()]]').each do |iframe|\n yield iframe.get_attribute('src')\n end\n\n doc.search('//iframe[@src[string()]]').each do |iframe|\n yield iframe.get_attribute('src')\n end\n\n doc.search('//link[@href[string()]]').each do |link|\n yield link.get_attribute('href')\n end\n\n doc.search('//script[@src[string()]]').each do |script|\n yield script.get_attribute('src')\n end\n end\n end", "title": "" }, { "docid": "f4d208c0acb705397530baa93a002cc4", "score": "0.57666403", "text": "def link_name\n self.send(:link_name_method)\n end", "title": "" }, { "docid": "f4d208c0acb705397530baa93a002cc4", "score": "0.57666403", "text": "def link_name\n self.send(:link_name_method)\n end", "title": "" }, { "docid": "b365ddb2f26141df72b831e115b0750a", "score": "0.575273", "text": "def href\n raise NotImplementedError\n end", "title": "" }, { "docid": "65ba3ec933c428507c1c98c10aff821e", "score": "0.5743621", "text": "def document_link; end", "title": "" }, { "docid": "f09ca4d6a9215c022cd6468dc2056bad", "score": "0.5738589", "text": "def visit_method; end", "title": "" }, { "docid": "f09ca4d6a9215c022cd6468dc2056bad", "score": "0.5738589", "text": "def visit_method; end", "title": "" }, { "docid": "041e78c87f24677ac973a859bdd2db95", "score": "0.5738223", "text": "def find_link_page\n @browser.find_elements(:tag_name, \"a\").each do |link|\n\t #puts link.attribute(\"href\")\n\t @links_path.push(link.attribute(\"href\"))\n end \n end", "title": "" }, { "docid": "594f406cad087b1bb05db84187f1f216", "score": "0.57345325", "text": "def link\n link_name || class_name\n end", "title": "" }, { "docid": "d4476c3a46ce116fdc849e731bdd73e2", "score": "0.5734395", "text": "def links\n nil\n end", "title": "" }, { "docid": "1940792fae466fd7159791f1dc931e73", "score": "0.5733657", "text": "def get_response\n to_link.get_response\n end", "title": "" }, { "docid": "00df4bb10e394f540a86f621cc9fb845", "score": "0.5731425", "text": "def define_methods\n methods = []\n pretty_name = @relationship[:target][:name]\n methods << define_method(@link_field)\n methods << define_alias(pretty_name, @link_field) if pretty_name != @link_field\n methods\n end", "title": "" }, { "docid": "0ec72b8ca418639b0124f11326732cbb", "score": "0.5725095", "text": "def link_by_text(link_text)\n return @browser.link(:text, link_text)\nend", "title": "" }, { "docid": "16ccbf95e58de5be3fd8cb86a2484507", "score": "0.57232594", "text": "def url_proc; end", "title": "" }, { "docid": "26a4867c30665d8f6861a7e627c46b48", "score": "0.5722229", "text": "def links; @links; end", "title": "" }, { "docid": "1d48a80b13877832cf5671ed7ab74d90", "score": "0.5719272", "text": "def connected_nodes_with_method(node_to, amethod)\r\n (@link_list.collect do |link|\r\n link if (link.to == node_to) && (link.from.respond_to?(amethod)) \r\n end).compact\r\n end", "title": "" }, { "docid": "4f549887a3eb07c0c7766a7b43dec364", "score": "0.5703693", "text": "def parse_links(content)\n\t\treturn content.gsub(/\\[\\[(.+?)\\]\\]/m) do\n\t\t\tname = $1\n\t\t\tpermalink = name.downcase.gsub(' ', '_')\n\t\t\tdisplay_name = name.split('/').last\n \n\t\t\tif @wiki.page(permalink)\n\t\t\t\t\"<a class=\\\"internal\\\" href=\\\"/#{permalink}\\\">\" + display_name + '</a>'\n\t\t\telse \n\t\t\t\t\"<a class=\\\"internal new\\\" href=\\\"/#{permalink}\\\">\" + display_name + '</a>'\n\t\t\tend\n\t\tend.to_s\n\tend", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.57011324", "text": "def create_links\n end", "title": "" } ]
e1eab3224802a1dbca4ace5ec89188dc
def self.has_residency(arg_client_id) where("client_id = ? and residency is not null", arg_client_id).count > 0 end
[ { "docid": "dece2ee755f42a0ceb1e42cd87ca8fd2", "score": "0.0", "text": "def valid_alien_DOE?\n if alien_DOE.present?\n if alien_DOE.to_date < Date.civil(1900,1,1)\n errors.add(:alien_DOE, \"must be after 1900.\")\n return false\n else\n return true\n end\n else\n return true\n end\n end", "title": "" } ]
[ { "docid": "777fe90c589a2ac3b0fbae3e3ba14c4a", "score": "0.625542", "text": "def tiene_nota_redaccion?\n NotaEnEvaluacion.where(:usuario_ci => usuario_ci, :idioma_id => idioma_id, \n :tipo_categoria_id => tipo_categoria_id, \n :tipo_nivel_id => tipo_nivel_id,\n :periodo_id => periodo_id, \n :seccion_numero => seccion_numero,\n :tipo_evaluacion_id => REDACCION).limit(1).count > 0\n end", "title": "" }, { "docid": "c533a1196fc2331c3ee240db28f3b4d5", "score": "0.6209109", "text": "def has_rink?\n (rink_id > 0)\n end", "title": "" }, { "docid": "6fe067e65f5f3361012a3a3a6771631d", "score": "0.61438364", "text": "def corriente\n self.payments.where(estatus:1).count == 0 \n end", "title": "" }, { "docid": "3853dafd382987c51d7c2da4bede2ed3", "score": "0.60038114", "text": "def tiene_nota_redaccion?\n notas_en_evaluaciones.where(tipo_evaluacion_id: REDACCION).count > 0\n end", "title": "" }, { "docid": "8b525d8dd2498ef5fa2af481dadf6ac5", "score": "0.58983684", "text": "def has_sales_return?\n self.delivery_entries.where{ (quantity_returned.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "8b525d8dd2498ef5fa2af481dadf6ac5", "score": "0.58983684", "text": "def has_sales_return?\n self.delivery_entries.where{ (quantity_returned.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "40455b18b3aa4d979ca7d108deb14042", "score": "0.57930607", "text": "def suitable_for_all?\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n end", "title": "" }, { "docid": "6dc2b5036cddfaae7a09e3fe525c54c3", "score": "0.578281", "text": "def only_incident_on_prisoner?\n prisoner\n .incidents\n .where.not(id: id)\n .size == 0\n end", "title": "" }, { "docid": "36626215b72abd6747c664ade4dbdc23", "score": "0.5750803", "text": "def has_subsequent_incident?\n prisoner\n .incidents\n .where('date_of_arrest > ?', date_of_arrest)\n .where.not(id: id)\n .size > 0\n end", "title": "" }, { "docid": "a56c0b42df2bff5958149ed4cd2876f9", "score": "0.5749681", "text": "def suitable_for_all?\r\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\r\n end", "title": "" }, { "docid": "8c89cf20c603dc48a32763e500bd1fa9", "score": "0.56153005", "text": "def patients_reinitiated_on_art_ever\n Observation.find(:all, :joins => [:encounter], :conditions => [\"concept_id = ? AND value_coded IN (?) AND encounter.voided = 0 \\\n AND DATE_FORMAT(obs_datetime, '%Y-%m-%d') <= ?\", ConceptName.find_by_name(\"EVER RECEIVED ART\").concept_id,\n ConceptName.find(:all, :conditions => [\"name = 'YES'\"]).collect{|c| c.concept_id},\n @end_date.to_date.strftime(\"%Y-%m-%d\")]).length rescue 0\n end", "title": "" }, { "docid": "fc1e21b73faeaa324e4caf03e947757c", "score": "0.5613958", "text": "def has_itineraries?\n self.itineraries.count > 0\n end", "title": "" }, { "docid": "4b5c98c25d2a2d924ad6dc000e35c9d5", "score": "0.56075835", "text": "def residence_addresses_count\n\t\taddresses.count(:conditions => { :address_type_id => AddressType['residence'].id })\n\tend", "title": "" }, { "docid": "b5646e2c5cb6cd982915c298e368e78c", "score": "0.5595042", "text": "def residents\n Resident.with(:consistency => :eventual).where(:deleted_at => nil)\n end", "title": "" }, { "docid": "5bf63721ab9757e6aa84f78f8f3820ef", "score": "0.5586541", "text": "def suitable_for?(discipline)\n name = name_discipline(discipline)\n count = self.disciplines.count(:conditions => ['name = ?', name])\n return count > 0\n end", "title": "" }, { "docid": "aae5f8585077c4f0e1846e032abc9ce8", "score": "0.55577755", "text": "def has_riders?\n !@riders[:count].zero?\n end", "title": "" }, { "docid": "b39252d9fc1a4e6052c497ed3613229d", "score": "0.5554136", "text": "def primary_search_ok?\n @result_id.to_i < 0\n end", "title": "" }, { "docid": "238f9ca811afe5dfab8206df17865e19", "score": "0.5544369", "text": "def suitable_for_any?\n \treturn self.disciplines.count > 0\n end", "title": "" }, { "docid": "ecec5168d1c45af71ca86ee2623c1509", "score": "0.5537571", "text": "def has_itens?\n #!self.cautelaitems.count.nil\n self.cautelaitems.any? #<-- verificar por que retorna falsa condição\n end", "title": "" }, { "docid": "f2ad6c71e2efd3acf594d91c90d70d86", "score": "0.55337876", "text": "def lawyer_client_documents(cid,eid)\n date = Time.zone.now.to_date\n matters = User.find(eid).my_all_matters.find(:all,:include=>[:client_document_homes],:conditions=>[\"matter_peoples.is_active = 't'\n AND (( matter_peoples.end_date >= '#{date}' AND matter_peoples.start_date <= '#{date}') or ( matter_peoples.start_date <= '#{date}' and matter_peoples.end_date is null)\n or ( matter_peoples.start_date is null and matter_peoples.end_date is null))\"])\n matters.collect(& :client_document_homes).flatten.uniq.compact.size\n end", "title": "" }, { "docid": "843869ce5487d044056660faa09e19cf", "score": "0.55227554", "text": "def income_and_budget_exists(property_id)\n income_budget = IncomeAndCashFlowDetail.find(:all,:conditions => [\"resource_id =? and resource_type=? \",property_id, @resource])\n !income_budget.empty? ? true : false\n end", "title": "" }, { "docid": "b9df77fc5d4fadd85f3ad8032bbc7a69", "score": "0.55213374", "text": "def is_real?\n self.class.count(:conditions=>['id = ?',self.id]) == 1\n end", "title": "" }, { "docid": "667678fd5cf89569e7f8df6d43c84ab8", "score": "0.551195", "text": "def validatePhone\n#get a community worker with a specific phone number send\n@communityworker = Villageworker.where(\"phonenumber =?\",@phone_number)\nif @communityworker.count == 0\nreturn false\nend \ntrue\nend", "title": "" }, { "docid": "c135e8dcae4444b92002468be3143e9c", "score": "0.55043375", "text": "def has_comps_to_use? \n self.coupon_referrals.count(:conditions => {:applied_on => nil}) > 0\n end", "title": "" }, { "docid": "44cf734f696e390a57f19e8b12ab8a32", "score": "0.5498564", "text": "def has_unconfirmed_production_history?\n self.subcription_production_histories.where(:is_confirmed => false ).count != 0 \n end", "title": "" }, { "docid": "94a377b16dc103d48c52a4d91a200a5d", "score": "0.54940295", "text": "def has_programs_associated?\n count = Program.count(:conditions => [\"tourist_sight_id = ?\", id])\n \n if count > 0\n return true\n end\n \n false\n end", "title": "" }, { "docid": "8c480ee6aa22bc9a8688504eecccfa0a", "score": "0.5455332", "text": "def active_clients \n Contact.count(:all, :conditions => [\"assigned_to_employee_user_id=? AND contact_stage_id=? AND status_type=?\",get_employee_user_id,current_company.contact_stages.array_hash_value('lvalue','Client','id'),current_company.prospect_status_types.find_by_lvalue(\"Active\").id])\n end", "title": "" }, { "docid": "a875330877c5aed89c7a25aa32b0b0a6", "score": "0.5451841", "text": "def commercial\n identities.any?(&:commercial)\n end", "title": "" }, { "docid": "a247742b729433ec5cea7378642d86b4", "score": "0.5449181", "text": "def has_delivery_lost?\n self.delivery_entries.where{ (quantity_lost.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "a247742b729433ec5cea7378642d86b4", "score": "0.5449181", "text": "def has_delivery_lost?\n self.delivery_entries.where{ (quantity_lost.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "bb0a3e1c354841e5aad4818af99f76ac", "score": "0.5442883", "text": "def resident_count\n clients.count\n end", "title": "" }, { "docid": "13384a967ebe76e2eb931f0e9bd6ce7e", "score": "0.5442185", "text": "def client_exist\n return if params[:client_id].blank?\n\n return if Client.exists?(id: params[:client_id])\n\n redirect_to clients_path, alert: \"Client \\##{params[:client_id]} does not exist.\"\n end", "title": "" }, { "docid": "54c19269c87c5f5e1fcd40753a0f47e9", "score": "0.5431164", "text": "def check_movie_availability?\n\n inventory = self.movie.inventory\n rentals = self.movie.rentals.where(:checked_out? => true)\n return rentals.length < inventory\n end", "title": "" }, { "docid": "1892398aabe6a718cefdbecd5155a9b0", "score": "0.5424897", "text": "def lease_exists(property_id)\n lease = PropertySuite.find(:first,:conditions => [\"real_estate_property_id=? \",property_id])\n occupancy = PropertyOccupancySummary.find(:first,:conditions => [\"real_estate_property_id=? \",property_id])\n (!lease.nil? && !occupancy.nil?) ? true : false\n end", "title": "" }, { "docid": "21e67a9490541607fa05d678f9a5dc7e", "score": "0.5417495", "text": "def suitable_for_any?\r\n \treturn self.disciplines.count > 0\r\n end", "title": "" }, { "docid": "5e684cfecc9b7741b2cff0a59eb8888c", "score": "0.54113525", "text": "def qualifications_valid?\n not self.qualifications.empty?\n end", "title": "" }, { "docid": "48c27e5fbce3184b348f49dc18e2b485", "score": "0.54030275", "text": "def is_for_rent\n if self.rents.size > 0\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "62f32ea409afb9f8af1911305c32acb4", "score": "0.54028195", "text": "def has_programs_associated?\n count = Program.count(:conditions => [\"shop_id = ?\", id])\n \n if count > 0\n return true\n end\n \n false\n end", "title": "" }, { "docid": "51e010aba81cde515f07a86b86f96b4d", "score": "0.5391353", "text": "def exists?\n if @relation_search.nil?\n count.exists?\n else\n add_filter(\"> 0\")\n end\n end", "title": "" }, { "docid": "51e010aba81cde515f07a86b86f96b4d", "score": "0.5391353", "text": "def exists?\n if @relation_search.nil?\n count.exists?\n else\n add_filter(\"> 0\")\n end\n end", "title": "" }, { "docid": "a29c998648fa9637402cbcac2c6198f4", "score": "0.5364245", "text": "def has_reservations?\n self.reservations.length > 0\n end", "title": "" }, { "docid": "e5f05ff767ff0eda3f799d07729f1a97", "score": "0.5360802", "text": "def total_exclusivity?\n self.exclusivity_id == Exclusivity.total_id\n end", "title": "" }, { "docid": "70298b4f38eda1c039850f070cf2e04d", "score": "0.53421247", "text": "def hasReceipts\n self.receipts.all.any?\n end", "title": "" }, { "docid": "e88f4e578391e2a328ed0f55eff71d97", "score": "0.5340859", "text": "def primary?\n @client.lawsuits.each do |lawsuit|\n next unless lawsuit.primary_client_id == @client.id\n return true\n end\n false\n end", "title": "" }, { "docid": "606812f94258418278af6551362f7c41", "score": "0.53331184", "text": "def positive_not_art\n ActiveRecord::Base.connection.select_one(\n <<~SQL\n SELECT COUNT(DISTINCT(obs.person_id)) AS total FROM obs LEFT OUTER JOIN concept_name ON concept_name.concept_id = obs.concept_id WHERE obs.person_id IN (SELECT patient_id FROM patient_program where program_id = 21) AND obs.concept_id = 9656 and value_coded = 703 AND obs.person_id IN (select person_id from obs where concept_id = 7010 and value_coded = 1066 and voided = 0) AND obs.voided = 0 AND (obs.obs_datetime) BETWEEN '#{start_date}' AND '#{end_date}';\n SQL\n )['total']\n end", "title": "" }, { "docid": "4e379d28276a90ada900d13b147cd230", "score": "0.5319905", "text": "def validate_state_residence\n\t\t@family_struct.members.each do |client_id|\n\t\t\tunless Client.is_a_state_resident(client_id)\n\t\t\t\t@family_struct.ineligible_codes[client_id] << 6088\n\t\t\tend\n\t\t\t# insert_application_eligibility_result(@family_struct.application_id, client.client_id, 6088, result) # State Residence\n\t\tend\n\tend", "title": "" }, { "docid": "79b46ea11cc62962db53193dc8412ae6", "score": "0.5299473", "text": "def model_restricted?(reserver_id)\n return false if reserver_id.nil?\n reserver = User.find(reserver_id)\n !(requirements - reserver.requirements).empty?\n end", "title": "" }, { "docid": "79b46ea11cc62962db53193dc8412ae6", "score": "0.5299473", "text": "def model_restricted?(reserver_id)\n return false if reserver_id.nil?\n reserver = User.find(reserver_id)\n !(requirements - reserver.requirements).empty?\n end", "title": "" }, { "docid": "d4848555c13c6609969e6f0c99c5e1c8", "score": "0.5298415", "text": "def has_variants_with_fault_override?\n value = Variant.count( :conditions => [\"product_id=? AND deleted_at IS NULL AND is_master = 0\", id] );\n value > 0\n end", "title": "" }, { "docid": "0e9ae3d403bd153683ce5fb3e529a6da", "score": "0.5298262", "text": "def has_previous_incident?\n prisoner\n .incidents\n .where('date_of_arrest < ?', date_of_arrest)\n .where.not(id: id)\n .size > 0\n end", "title": "" }, { "docid": "63f850c9f4eb57b1e8bd607b8164adb7", "score": "0.52954954", "text": "def is_qualified?\n 3 <= @non_primary_participant_occurrence_count &&\n 3 <= @three_or_more_pilot_occurrence_count\nend", "title": "" }, { "docid": "553ffd5a6c4f34fa19ee30b1dae34305", "score": "0.52948743", "text": "def physics_no_chemistry\n # In which years was the Physics prize awarded, but no Chemistry prize?\n execute(<<-SQL)\n SELECT\n COUNT(winner)\n FROM\n nobels\n JOIN\n nobels AS nobels_alias\n WHERE\n nobels.subject = 'Physics' AND nobels_alias.subject != 'Chemsitry'\n SQL\nend", "title": "" }, { "docid": "81691e0697db8198611a08b79c049de8", "score": "0.52817583", "text": "def has_employer_sponsored_coverage?\n benefits.where(insurance_kind: 'employer_sponsored_insurance').present?\n end", "title": "" }, { "docid": "c7b125d4398e891880bba16ed358635f", "score": "0.5279734", "text": "def fact_or_risk_associated?\n (self.matter_risks.count + self.matter_facts.count) > 0\n end", "title": "" }, { "docid": "104ae29e9b3f12e8c288ec3777fbcdc5", "score": "0.52752954", "text": "def fuel_exists(fuelid)\n fuel = Fuel.first(id: fuelid)\n return (not fuel.nil?)\nend", "title": "" }, { "docid": "89d0944d76c57518bc18c0ec62cc3df5", "score": "0.52660906", "text": "def polyphonique?\n @instruments.count > 1\n end", "title": "" }, { "docid": "37634a2aa70a92a3e83b3494864f59cd", "score": "0.52658725", "text": "def has_vaad?\n vaad_cnt = Tenant.count(:conditions=>[\"building_id=? AND (role='TR_VAAD' OR role='TR_BUDGET')\", id]);\n return (vaad_cnt!=0);\n end", "title": "" }, { "docid": "a55ecded962061aeda9051033c411cb1", "score": "0.525875", "text": "def num_proxy_user_reviews\r\n reviews.count :conditions => \"`partner_pub_date` IS NOT NULL\"\r\n end", "title": "" }, { "docid": "ca6ed734cb8e4e2faee05a364caffe43", "score": "0.52478755", "text": "def valida_viajes_completos(cliente)\n if cliente.reservacions.find_all_by_estadotipo_id(3).count==0 \n return false\n end\n end", "title": "" }, { "docid": "e0de0f49a1fb2a27afca6a0140610789", "score": "0.5235306", "text": "def success_refers_count\n self.refers.count { |refer| refer.orders.count > 0 }\nend", "title": "" }, { "docid": "353967536b516a226c0a6891ed821e6c", "score": "0.523469", "text": "def va_patient?\n mhv_correlation_id.present?\n end", "title": "" }, { "docid": "3ce87031db3dc8cf6647fbc4a4369538", "score": "0.52225935", "text": "def check_patient_in_use?\n result = ActiveRecord::Base.connection.select_one <<~SQL\n SELECT count(*) AS count\n FROM information_schema.tables\n WHERE table_schema = \"#{@database}\"\n AND table_name = 'ART_patient_in_use'\n SQL\n !result['count'].zero?\n end", "title": "" }, { "docid": "c15e444d6eb7d3789e76ee1a03690415", "score": "0.5192798", "text": "def test(voc) \n\t\tb = false \n\t\tresult = Voc.find(:first, \n :conditions=>\"german='#{voc.german}' and wylie='#{voc.wylie}' and grm='#{voc.grm}'\") \n\t\tif result == nil \n\t\t\tb = true \n\t\tend\n\t\treturn b\n\tend", "title": "" }, { "docid": "8202a8e86991dcf95c8a02bcb34d8305", "score": "0.51919276", "text": "def count?\n query.count?\n end", "title": "" }, { "docid": "a7a681792a5bc5a11073e03f54b6e1cd", "score": "0.5188577", "text": "def contains_response_and_soln?() false ; end", "title": "" }, { "docid": "065d94c5f9b40c0ebfa26249cd628bbf", "score": "0.5188489", "text": "def liked_by?(romance_id)\n likes.where(romance_id: romance_id).exists?\n end", "title": "" }, { "docid": "bc265da7468c7fa2a929658745ab0e67", "score": "0.51851153", "text": "def available?\n count = park_spacerentals.where(\"end_rent > '#{Date.today}'\").count\n if count > 0 \n false\n else \n true\n end\n end", "title": "" }, { "docid": "efefe6a1503d1f95aaa6e54b258dfa0a", "score": "0.51793027", "text": "def secondary_search_ok?\n @result_id.to_i > 0\n end", "title": "" }, { "docid": "298fa3b782bd09eeeb4c49234ee9729d", "score": "0.51776415", "text": "def has_inventory?\n inventory_count > 1\n end", "title": "" }, { "docid": "c662498d1dfe65ad67fbc9df60cf6d97", "score": "0.5177189", "text": "def has_reviews?\n self.contractor_reviews.size > 0\n end", "title": "" }, { "docid": "b0f38b44f4ffc34222084c6d0c7da2ad", "score": "0.51757014", "text": "def insufficient_query?\n return false unless (@primo_id.nil? or @primo_id.empty?)\n return false unless (@issn.nil? or @issn.empty?) and (@isbn.nil? or @isbn.empty?)\n return false unless (@title.nil? or @title.empty?) or (@author.nil? or @author.empty?) or (@genre.nil? or @genre.empty?)\n return true\n end", "title": "" }, { "docid": "d8e09f0ade62454005f503c6fb0e7f35", "score": "0.51617503", "text": "def find_availabe_rooms\n @all_rooms.find_all { |room| room.count_customers == 0}\n end", "title": "" }, { "docid": "0fe248bb9d7475632aaddbf37defce67", "score": "0.51600385", "text": "def count_disqualifications\r\n @mirs.each.count{ |mir| mir.is_disqualified }\r\n end", "title": "" }, { "docid": "974172c14f85bfda991bf072b7ea53b1", "score": "0.5157049", "text": "def can_be_hired_for_solr\n #logger.debug \"DEBUG: WORK can_be_hired_for_solr\"\n result = \"no\"\n sql_template = sql_for_availability('available_for_hire')\n sql = sql_template.result(binding)\n \n n_available = ActiveRecord::Base.connection.execute(sql)[0]['count'].to_i\n result = \"yes\" if n_available > 0\n result\n end", "title": "" }, { "docid": "4d174baea0f7fddd41e5f73c0affbce8", "score": "0.5156019", "text": "def external?\n # if the customer is Non-UVA (academic_status.id = 1)\n if self.academic_status_id == 1 \n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "9364bab0ab232083f7b0782a99b784c7", "score": "0.5154897", "text": "def approvable?\n fund_grant.fund_items.where( 'fund_items.id NOT IN ' +\n '(SELECT fund_item_id FROM fund_editions)' ).empty? && fund_editions.nonzero?\n end", "title": "" }, { "docid": "e821af6115a80f7e989ea5e6f9d6af2f", "score": "0.5154134", "text": "def enrolled_in? contract\n\t Enrollment.count(:conditions => [\"contract_id = ? AND participant_id = ? AND completion_status <> ?\", contract.id, self.id, Enrollment::COMPLETION_CANCELED]) > 0\n\tend", "title": "" }, { "docid": "fe6c9de6d6f40a91c1896bbf5ec48a3b", "score": "0.5146468", "text": "def exist?\n dbtable_frigos.count(where: {id: owner_id}) > 0\n end", "title": "" }, { "docid": "a954b0190cfa3d2bbf1718fae440306e", "score": "0.5144135", "text": "def va_patient?\n va_treatment_facility_ids.length.positive?\n end", "title": "" }, { "docid": "e060da0d2fa4a03aeb0e9401a561d8c3", "score": "0.5140314", "text": "def shared?\n Role.filter({residential_contact_id: id, mailing_contact_id: id}.sql_or).select(:person_id).distinct.count > 1\n end", "title": "" }, { "docid": "105d0ca3744cd37cef2114fe14dfc87d", "score": "0.5139332", "text": "def promotion_credit_exists?(adjustable)\n self.adjustments.where(:adjustable_id => adjustable.id).exists?\n end", "title": "" }, { "docid": "ba63e60dc6246b963b7b267de2eacb0d", "score": "0.51360685", "text": "def check_holdings_memberitem (db)\n conn = db.get_conn();\n q = \"SELECT COUNT(*) AS rc FROM #{DB_SCH}.#{DB_TAB}\";\n ret = false;\n conn.query(q) do |res|\n puts res;\n puts \"There are #{res[:rc]} rows in #{DB_TAB}\";\n if res[:rc].to_i == 0 then\n ret = true;\n end\n end\n conn.close();\n return ret;\nend", "title": "" }, { "docid": "1679b633fcfac6d8fdc1c89ec9284843", "score": "0.5132792", "text": "def exists_returns_integer; end", "title": "" }, { "docid": "60f2ddbe637bdf31d9291548b8ef7b1b", "score": "0.5131445", "text": "def client_count\n self.rentals.map{ | rental | rental.client }.uniq.size\n end", "title": "" }, { "docid": "2c2c7b61c3e8c41ba7b2a3e4f0fc98bc", "score": "0.5116961", "text": "def no_trips_for_this_car?\n Trip.where(car_id: self.id).empty?\n end", "title": "" }, { "docid": "4222914174eb9b9cf6705fe4dd400c9c", "score": "0.51109445", "text": "def hasNonSuspiciousMonthlySalesAmount(vendor_user)\n timeNow = Time.now \n curentMonthlySales = Interaction.where(\n :interactions =>{\n :user_id => vendor_user.id , \n :created_at => timeNow.beginning_of_month..timeNow.end_of_month\n },\n :apps => {\n :type => 'TrocaAkiValidation'})\n .includes(:app).count \n\n #puts \"Current #{curentMonthlySales}\"\n curentMonthlySales < MAX_MONTHLY_SALES_AMOUNT\n end", "title": "" }, { "docid": "99a8416824f6c221c312886b9a06983d", "score": "0.5107889", "text": "def rooms_set?\n venue.present? && venue.rooms.count > 0\n end", "title": "" }, { "docid": "f0333f2ac00e77e6e4ab4e3507881611", "score": "0.5104627", "text": "def paid?\n self.charges.where(status: Charge.statuses[:succeeded]).count >= 1\n end", "title": "" }, { "docid": "8ffe2ea520ca0ca82251c0bf037d5435", "score": "0.5096065", "text": "def alumni?\n courses.count > 0\n end", "title": "" }, { "docid": "12ac0833a8d47bb8c7ef2664d45cc2f2", "score": "0.5095921", "text": "def client_ellegible_for_free_ticket?(client)\n ticket_count = tickets.where(client: client).count\n TicketPriceCalculator.free_ticket_elllegible? ticket_count\n end", "title": "" }, { "docid": "7e38082e9c8f5a83227d6b0b4fc5a6bb", "score": "0.50936013", "text": "def creatinine_ever\n @orders = Order.find_by_sql(\"SELECT DISTINCT person_id, value_numeric FROM obs \\\n LEFT OUTER JOIN patient ON patient.patient_id = obs.person_id \\\n WHERE concept_id IN (SELECT concept_id FROM concept_name \\\n WHERE name = 'CREATININE') AND COALESCE(value_numeric, 0) >= 1.2 AND \\\n DATE_FORMAT(patient.date_created, '%Y-%m-%d') <= '\" + @end_date + \"' \\\n AND patient.voided = 0\").length\n end", "title": "" }, { "docid": "3150166782f4bbfc69540180b6a92574", "score": "0.5093076", "text": "def any_residential_attributes?\n @_any_residential ||= @@residential_attributes.map { |method|\n self.send(method)\n }.any?\n end", "title": "" }, { "docid": "a9caf01703dbf52c0a14e4ce22b524dc", "score": "0.50903034", "text": "def rented_by?(user)\n ownrent = Purchase.joins(:movie_id)\n user = ownrent.user_id\n ownrent.own_or_rent\n end", "title": "" }, { "docid": "f780c1b44889259b0675fc0c15354646", "score": "0.5090221", "text": "def univ_doesnt_countable?() order.university && in_field? && ignore_for_univ_limits == false end", "title": "" }, { "docid": "fc33de83a857a5517203d7d4800cf4b2", "score": "0.50858897", "text": "def rest(correct_num)\n Card.where(correct_count: correct_num).count\nend", "title": "" }, { "docid": "6bc3a80358a183671324c46096921014", "score": "0.5085761", "text": "def exists?(id_or_conditions = :none); false; end", "title": "" }, { "docid": "4471e53f89d522a3c9b24656802a10d3", "score": "0.50855935", "text": "def resident_count\n clients.size\n end", "title": "" }, { "docid": "285c673007c12fea12f3f6c9207a72cf", "score": "0.50799793", "text": "def invalidPatientId\n@patients =Patient.where(\"patient_number =?\",@commands[1])\n\tif @patients.size == 0\n\t\treturn true\t\n\tend \nreturn false\nend", "title": "" }, { "docid": "fc018b1164d2f73fcf2cacfac85c557d", "score": "0.507092", "text": "def prevalence_in_patients # instance method returns number of unique users who have at least 1 obsession w/ theme content\n User.obsessing_about(self).count\n end", "title": "" }, { "docid": "1edb1cf22e8860b66a636a338fac9859", "score": "0.50665975", "text": "def by_industry_exclusivity?\n self.exclusivity_id == Exclusivity.by_industry_id\n end", "title": "" }, { "docid": "68782a5687fc7c0c2c2c1a1f2f802114", "score": "0.50637805", "text": "def hasPatients?\r\n return @numberOfPatients > 0\r\n end", "title": "" } ]
73e4dfb7cfc749baefd5967b35efbc4b
this will send one email with all payments to each payee, from a particular user
[ { "docid": "81f9e4f6800ae3b129049786a69f3930", "score": "0.76282007", "text": "def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end", "title": "" } ]
[ { "docid": "500a5d89e03db93db31fa2d33c7dba3d", "score": "0.7408952", "text": "def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end", "title": "" }, { "docid": "a1b64bd2a3be13323c5339d32f6f5a67", "score": "0.6934367", "text": "def paid_email(payment)\n @payment = payment\n\n mail(:to => User.find(@payment.user_id).email, :subject => \"You've been paid back!\", :cc => @payment.email)\n end", "title": "" }, { "docid": "7b659aa2a1989417c8f28f6895d27262", "score": "0.69240355", "text": "def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end", "title": "" }, { "docid": "c4283bcacfe6d357867496f9946e696c", "score": "0.6908509", "text": "def reminder_email(payment)\n @payment = payment\n @url = generate_url(User.find_by_email(@payment.email))\n #loaner_email = User.find(@payment.user_id).email\n\n mail(:to => @payment.email, :subject => \"Reminder that you owe some money\")\n end", "title": "" }, { "docid": "c93d9ab05a6b4d35df8007ebb41e3d6f", "score": "0.68933463", "text": "def deliver\n User.all.each do |user|\n UserMailer.send_message(user,self).deliver\n end\n end", "title": "" }, { "docid": "3714abcbbe250cbe614b38ee3ba105af", "score": "0.68712485", "text": "def funded_email_to_pledges\n Pledge.where(\"gift_id\" => self.id).each do |pledge|\n user = User.find_by_id(pledge.user_id)\n Pony.mail(:to => user.email, :from => '[email protected]', :subject => 'gift got bought!', :body => 'yay. you did it! now you owe money.')\n end\n end", "title": "" }, { "docid": "4667c1fc40a0505fd81340508bbbb43a", "score": "0.68169266", "text": "def donate_email(user, payment_option)\n \t@user = user\n \t@payment_option = payment_option\n mail( :to => user.email,\n :subject => \"Your contribution to Coderise\" )\n end", "title": "" }, { "docid": "30a63b364598fbfc03694f74ae0f7340", "score": "0.68119025", "text": "def send_email(payment, bill)\n Admin.all.each do |admin|\n Pony.mail :to => admin.email,\n :from => payment.contributor_email,\n :subject => I18n.t(:upload_receipt_subject),\n :html_body => erb(:\"/mails/payment_confirmation\",\n :locals => {:receipt => payment, :bill => bill },\n :layout => false),\n :via => :smtp\n\n end\nend", "title": "" }, { "docid": "344aaf75298884835ef14d8895689809", "score": "0.67897236", "text": "def new_invoice(user_id, payment_id)\n @user = User.find_by_id(user_id)\n @payment = Payment.find_by_id(payment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Invoice!\"\n end", "title": "" }, { "docid": "2814bcf62cf68cc39543007023545fb5", "score": "0.67840624", "text": "def repayment_notification(user)\n @user = user\n\n mail to: user.email, subject: \"Scholarship Confirmation\"\n end", "title": "" }, { "docid": "962ad3aca5da84b3be35cb50fc687d23", "score": "0.6766185", "text": "def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end", "title": "" }, { "docid": "743fd3c0bd133ca7ec1df3edf42cba03", "score": "0.67613465", "text": "def send_invoice\n if payment_at_changed? && payment_at.present?\n payable.try(:payment_completed!, self)\n if payable_type == 'UserGroup'\n UserMailer.payment_completed(user, self).deliver\n end\n end\n end", "title": "" }, { "docid": "34f8ae12de8bb98656e116934bd4e2c9", "score": "0.663279", "text": "def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <[email protected]>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to '[email protected]'\n html_part do\n content_type 'text/html; charset=UTF-8'\n body \"<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p>\n <p style= text-align: justify>\n <b>confirmation code:</b> #{payment.code}<br>\n <b>good for:</b> #{payment.offer.name}<br>\n <b>only at:</b> #{payment.offer.venue.name}<br>\n <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br>\n <b>expiring:</b> #{30.days.from_now.to_date}</p><br>\n <b>3 steps to redeem:</b>\n <p>\n <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br>\n <b>2)</b> Order regular food or drink for each person in party.<br>\n <b>3)</b> Mark Voucher used by following this link! <a href=\\\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\\\">Mark Voucher Used</a></br>\n </p><br><br>\n Enjoy!<br><br>\n Contact support at <b>[email protected]</b> if you have any concerns or questions whatsoever.<br><br><br>\n <h3><u>FOR SERVERS:</u></h3>\n <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \\\"Buy One, Feed One\\\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>\"\n end\n end\n end", "title": "" }, { "docid": "14cf0b4e240359fda1d4819b4b235a12", "score": "0.6632488", "text": "def send_user\n UserProfileCertificationMailer.send_user\n end", "title": "" }, { "docid": "21d48543ecb31bce92221acc5f5d1e46", "score": "0.6617005", "text": "def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <[email protected]>\",\n\t return_path: \"[email protected]\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end", "title": "" }, { "docid": "0635b83f0625e4ec234f12ec134a5190", "score": "0.66085994", "text": "def fund_reminder(user_id)\n @user = User.find_by_id(user_id)\n mail :to => recipient(@user.email), :subject => t('user_mailer.fund_reminder.subject')\n end", "title": "" }, { "docid": "e3a48f06e2c0db65630a241052835ab2", "score": "0.6598391", "text": "def congratulation_email(user)\n @user = user\n mail to: @user.email, subject: \"[IDEANOTE] 환영합니다.\"\n end", "title": "" }, { "docid": "bec6eb459b2c64e17aaf2025ecd7592b", "score": "0.6587695", "text": "def mail\n @transaction = Transaction.find(params[:id])\n \n @transaction.steps.each do |step|\n StepMailer.deliver_uome_email(step) if step.to.email.present?\n end\n render :json => []\n end", "title": "" }, { "docid": "1489357fdc6883b76cef44cfea409245", "score": "0.6570423", "text": "def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end", "title": "" }, { "docid": "03b244124fa3a59e3919f4fd1367f38f", "score": "0.65539056", "text": "def purchase_more_tokens(opportunity_id, user_id)\n @opportunity = Opportunity.find(opportunity_id)\n @user = User.find(user_id)\n @requester = User.find(@opportunity.user_id)\n mail(to: [@user.email, @requester.email] , subject: 'Request to purchase MOBEEAS Tokens')\n\n end", "title": "" }, { "docid": "cc6f6827552fe334dfed2f6c84165e59", "score": "0.65477747", "text": "def send_thx_email\n @user = User.where(:uid => self.uid).first\n if [email protected]? && [email protected]?\n Services::Mandrill.mail(@user.email, 'PicsforPets_2013_Reportback', 'How to get puppies adopted')\n end\n end", "title": "" }, { "docid": "ab96f61564f9d638c27893c2a771438f", "score": "0.6493989", "text": "def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end", "title": "" }, { "docid": "96d1de4f31be16f957a4868edaa2bd19", "score": "0.6474826", "text": "def send_new_purchase_email(user)\n @user = user\n mail( :to => @user.email,\n :subject => 'Thank you for your purchase!')\n end", "title": "" }, { "docid": "732e09f2799c802aeefc86519a1bee99", "score": "0.6444957", "text": "def payees\n [\n {:email => user.email, :amount => pay_shares[:seller]},\n {:email => cause.user.email, :amount => pay_shares[:cause]}\n ]\n end", "title": "" }, { "docid": "8004887e97bdb79cdabdcd24b3dc4c45", "score": "0.6412207", "text": "def send_pledge_reminder!\n UserMailer.payment_reminder_pledge(user, self).deliver\n end", "title": "" }, { "docid": "2d8fbf02ce894c9c7c4c4ebdb2c05218", "score": "0.64092827", "text": "def send_farewell_email(user)\n @user = user\n mail( :to => @user.email ,\n :subject => '[Todo Manager] See you again!')\n end", "title": "" }, { "docid": "ac16206536982d6fc8b8e5c9d41acb27", "score": "0.638501", "text": "def welcome_email(payment)\n @payment = payment\n @url = generate_url(User.find_by_email(@payment.email))\n loaner_email = User.find(@payment.user_id).email\n\n mail(:to => @payment.email, :subject => \"Yo, you owe some money!\", :cc => loaner_email)\n end", "title": "" }, { "docid": "b847de0a31b7cc44f3bd87b6eab8d441", "score": "0.6380373", "text": "def send_self_eval_invitations\n users = User.all.select{|u| \n u.has_current_registration && \n u.current_registration.participant && \n !u.faculty && \n !u.test && \n !u.current_registration.has_complete_eval\n }\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_invitation(u)\n puts(\"Succeed on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end", "title": "" }, { "docid": "4491d962fc469f553a7c5647544e0720", "score": "0.6357051", "text": "def send_signup_email(user)\n @user = user\n @appointment = Appointment.where(id: @user.appointment_id).first\n mail(\n :to => @user.email,\n :bcc => \"[email protected]\",\n :subject => \"Ace CPR SD Sign-Up Confirmation ##{@user.id}\"\n )\n end", "title": "" }, { "docid": "ca34a67d913a21c7e0724637a8f22ae0", "score": "0.6351409", "text": "def payment_notification(options={})\n options = options.symbolize_keys\n receivers = fetch_payment_receivers(options)\n @amount = ((options[:amount].to_f)/100)\n @conn_count = options[:connection_count]\n @last4 = options[:last4]\n mail(:to => receivers, :subject => \"Payment Successful!\")\n end", "title": "" }, { "docid": "0a60072d799b40bc35ae9ef577072310", "score": "0.63505733", "text": "def profile_completion_reminder(user_id)\n @user = User.find(user_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Profile Completion Reminder\"\n end", "title": "" }, { "docid": "5415bd622203babd97a6884c51be41cf", "score": "0.63419884", "text": "def profile_completion_thankyou(user_id)\n @user = User.find(user_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Profile Completed!\"\n end", "title": "" }, { "docid": "9046420db37afc987fd0d0e1b3f43f2f", "score": "0.6331862", "text": "def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end", "title": "" }, { "docid": "69d7d8263c8c0a9e34571d8417543a3a", "score": "0.6329712", "text": "def send_cart_mail(user)\n \n mail to: user.email, subject: \"Cart\", from:'[email protected]'\n end", "title": "" }, { "docid": "a5aed13adfe47b79bf8122695ea50a2c", "score": "0.6329526", "text": "def send_emails\n self.attendees.distinct.each do |attendee|\n UpdatesMailer.updates_mail(attendee, self).deliver_now\n end\n end", "title": "" }, { "docid": "6e85ab642ec5905b2edead85b296fcde", "score": "0.6316187", "text": "def send_invoice_to_user(participation_request)\n @user = participation_request.user\n @structure = participation_request.structure\n @invoice = participation_request.invoice\n @participation_request = participation_request.decorate\n\n mail to: @user.email,\n subject: \"Votre facture du cours du #{ @participation_request.day_and_hour } avec #{ @structure.name }\"\n end", "title": "" }, { "docid": "dd3f18da601f5fe45402b8390e940b51", "score": "0.6310952", "text": "def updated(user)\n @user = user\n @email = @user.email\n\n mail to: @email,\n subject: \"Subscription Payment Received\"\n end", "title": "" }, { "docid": "109e252ea232a655e4b08bc962c581a9", "score": "0.63012224", "text": "def send_email_to_user(user)\n if user.email && user.unsubscribed == false\n Email.create(:user_id => user.id, :message_id => self.id).deliver\n end\n end", "title": "" }, { "docid": "0fd2b6c9639925dd051762b97d122225", "score": "0.62956345", "text": "def send_orders_email\n UserMailer.orders(self).deliver_now\n end", "title": "" }, { "docid": "9794a900daa06ebc7b6883d9169c4b5e", "score": "0.62939674", "text": "def send_deal_email(entity_user, deal)\n return unless params[:send_deal_invitation_email].present?\n DealMailer.deal_invitation_email(entity_user, deal, params[:custom_message]).deliver_later\n end", "title": "" }, { "docid": "b69643c3cac25c38a1d604849a660ff2", "score": "0.6293087", "text": "def email\n # redirect to the first page of the website\n redirect_to login_path\n\n # Get all users who subscribe\n users = User.where(subscribe: true)\n\n # Get mandril object\n mandrill = Mandrill::API.new 'SyKEz-QytC97dIODlvKQoQ'\n\n # Send a digest to each user\n users.each do |user|\n # Set the elementary content string\n content = \"Here is the list of interesting articles for you\\n\\n\"\n\n # Get all the interesting articles and order by date_time\n articles = Article.tagged_with(user.interest_list, any: true).order(date_time: :desc)\n\n # Get at most 10 new interesting articles\n num = 0\n articles.each do |article|\n # If 10 interesting articles are already extracted, break the loop\n break if num >= MAX_NUM_ARTICLES\n\n # If this article has not been sent to this user, include this to digest\n unless user.articles.include?(article)\n user.articles << article\n # Update content string\n content += make_paragraph(article.title, article.link)\n num += 1\n end\n end\n\n # If there is no interesting article\n if num == 0\n content = \"There is no any new interesting articles for you this time.\\n\"\n end\n\n # create a message to send\n message = {\n subject: 'Hello, ' + user.first_name + '. This is the digest you required',\n from_name: 'The Digest',\n text: content,\n to: [\n {\n email: user.email,\n name: user.first_name + ' ' + user.last_name\n }\n ],\n from_email: '[email protected]'\n }\n\n # send the email\n mandrill.messages.send message\n end\n end", "title": "" }, { "docid": "254ac0e86f6adf8110ffa476c10256c8", "score": "0.6292365", "text": "def perform(user_id)\n user = User.find(user_id)\n Usermailer.booksemail(user).deliver_now\n end", "title": "" }, { "docid": "6c3156e75b6c398a3f7c711516080826", "score": "0.62866646", "text": "def payment_upcoming\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "c1f7135c5992aaa7f4056b62150de460", "score": "0.62821454", "text": "def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend", "title": "" }, { "docid": "8a8eb10ad5a9a69f194c9915033d4e76", "score": "0.62820613", "text": "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"[email protected]\"] )\n \n end", "title": "" }, { "docid": "da12c320e049890a0b5f4e27932c9aa3", "score": "0.62714285", "text": "def order_receipt(user_name, user_email, order, total_amount)\n @user = user_name\n @order = order\n @total_amount = total_amount\n mail(to: user_email, subject: \"Thank you for your order ##{@order.id}\")\n end", "title": "" }, { "docid": "9fd30432fa518acc87978646bb70c4c2", "score": "0.6252928", "text": "def email_cory(user)\n @user_info = user_info\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "9b1c979e068417e59849800096b8c8b9", "score": "0.62462986", "text": "def unpaid_user_notification(user)\n mail(to: user.email, subject: I18n.t('user_mailer.unpaid_user_notification.subject'))\n end", "title": "" }, { "docid": "3bd2030412ccf1a75c279bc4bb91fc26", "score": "0.6243937", "text": "def perform(user_id)\n user = User.find(user_id)\n Notifier.email_meed_fair_new_users(user).deliver\n end", "title": "" }, { "docid": "74c50109c424da439ca5c693fd0d15b0", "score": "0.62221104", "text": "def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend", "title": "" }, { "docid": "0d927ecf001a632deb3e5dc2fff1125a", "score": "0.6212877", "text": "def send!(other_user, current_user, mex)\n mails.create!(receiver_id: other_user.id, sender_id:current_user.id, sender_name:current_user.name, message: mex)\n\n end", "title": "" }, { "docid": "0bb751423cad54b08a2e78b1e1eeda71", "score": "0.61989766", "text": "def reply_send(user, daily)\n\t\t@user = user\n\t\t@daily = daily\n\t\tmail({\n\t\t\t:to => @user.email,\n\t\t\t:subject => \"Responda a Daily - #{daily.data} - #{daily.team.nome}\"\n\t\t\t})\n\tend", "title": "" }, { "docid": "c618c6ca3f6804eaf30912c106b8d344", "score": "0.61988777", "text": "def invitation(users)\n # making sure we only send in bulks of 1000 emails by the Sendgrid Api limits\n users = users[0..998]\n sendgrid_recipients users.collect {|user| user.email}\n sendgrid_substitute \"|name|\", users.collect {|user| user.name}\n mail :to => \"[email protected]\", :subject => \"Invitation to a demo app\"\n end", "title": "" }, { "docid": "dd4d7518a9f73d4a619b3b16ddc2a0aa", "score": "0.6194956", "text": "def send_mail(changed_watched_paths, hash, paths_by_users)\n \n # send one email for email address\n paths_by_users.keys.each do |user_email|\n subject=nil\n body=String.new @body_prefix\n \n # merge in the changed paths this user is interested in\n paths_by_users[user_email].each do |watched_path|\n \n if changed_watched_paths[watched_path]\n \n body << \"\\n\" << changed_watched_paths[watched_path].join(\"\\n\")\n # take any to generate the branch\n if !subject\n \n subject= String.new @subject_prefix\n subject << extract_branch(changed_watched_paths[watched_path])\n subject << \" by user \"\n subject << hash[:author]\n\t @logger.debug(\"Subject is=\"<< subject)\n end\n end \n end\n \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"revision: \" << hash[:rev]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n \n yield(user_email, subject, body)\n \n end\n end", "title": "" }, { "docid": "edb7d29493fe51962a509c12230df6ed", "score": "0.61851746", "text": "def sendout\n # do tricky HL7 and PIT stuff with narrative\n for recipient in self.user.interested_parties\n if recipient.wedgetail != created_by # don't sent back to original sender\n # do tricky encryption and email stuff for recipient\n om = OutgoingMessage.new(:recipient_id=>recipient.wedgetail)\n self.outgoing_messages << om\n om.sendout recipient\n om.save!\n end\n end\n end", "title": "" }, { "docid": "306d89f93e32f257e8e293465ab7d000", "score": "0.6181522", "text": "def send_current_offers(user)\n @user = user\n @matches = User.offer_matches(@user)\n @offers = Offer.all\n .order(:date)\n .where('date >= ?', DateTime.now.to_date)\n .where('filled = ?', false)\n .joins(:center)\n .where(centers: {circonscription: @user.circonscription})\n .limit(5)\n\n if (@day_of_week == 1 || @day_of_week == 3)\n if (@matches.blank? && @offers.present?)\n mail( :to => @user.email,\n :subject => 'Certaines de nos offres pourraient vous intéresser' ) do |format|\n format.html(content_transfer_encoding: \"7bit\")\n end\n end\n end\n end", "title": "" }, { "docid": "0a67c3d2cf937982f1402eceba619d0c", "score": "0.6179841", "text": "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "title": "" }, { "docid": "785551337e7eaa0782e2c8228b1f1d73", "score": "0.61770636", "text": "def send_order_mail_user(user, order)\n @order = order\n @user = @order.listing.user\n mail( :to => @user.email, :subject => \"Your listing (#{@order.listing.title}) has been sold!\" )\n end", "title": "" }, { "docid": "080f424696270a6f04545ad264fc931c", "score": "0.6175364", "text": "def setup_email(user)\n recipients user.email\n from self.contact_email\n sent_on Time.now\n end", "title": "" }, { "docid": "52383e6239fb9038706a3a346c0600a0", "score": "0.6168696", "text": "def send_following_emails\n self.question.follow_questions.each do | follow |\n if follow.user_id != self.user_id && follow.user.email_follows?\n FollowQuestionMailer.new_answer(follow.user, self.question, self).deliver\n end\n end\n end", "title": "" }, { "docid": "f0fd9af9522591a3320befb0f734df5d", "score": "0.6168015", "text": "def send_notification\n # Getting users of current group\n @group = Group.find(params[:id])\n @users = @group.users\n\n # Subject for mail\n if action_name == \"create\"\n subject = \"New task creation\"\n else\n subject = \"Task update\"\n end\n\n # Sending mail to each user of the group\n @users.each do |user|\n TaskMailer.task_create_notification(subject, user, @group, @task).deliver_now\n end\n\n end", "title": "" }, { "docid": "7fc87ebdbacbef55f8a2aac569b6a43f", "score": "0.61515254", "text": "def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n users.each do |user|\n sent_to_users << user.email\n GenericMailer.delay.send_email(\n subject: params[:subject],\n body: params[:body],\n to: user.email,\n task: task\n )\n end\n trigger_email_sent_event(task)\n d = Time.now.getlocal\n initiator = current_user.email\n render json: {\n letter_template: {\n to: sent_to_users,\n from: initiator,\n date: d.strftime(\"%h %d, %Y %r\"),\n subject: params[:subject],\n body: params[:body]\n }\n }\n end", "title": "" }, { "docid": "d42d8c828096ce402b22dba7212b6b6f", "score": "0.61510354", "text": "def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end", "title": "" }, { "docid": "86536d337b12098043690aaee6df87c1", "score": "0.61458707", "text": "def final_price(order)\n @greeting = \"Hi\"\n @order = order;\n\n mail to: order.email\n end", "title": "" }, { "docid": "6abf7758aad45bfda7383830c70194de", "score": "0.6143658", "text": "def new_user_email(user)\n @user = user\n User.where(admin: true).each do |admin|\n mail(to: admin.email, subject: \"A new user #{@user.email} has been added.\")\n end\n end", "title": "" }, { "docid": "2a302ebe9eba4b359ffd1ee2140bea5c", "score": "0.6143414", "text": "def email_for_recipient(user)\n IntervalNotifier.daily_email(user, report) if report.top_public_recognitions.size > 0\n end", "title": "" }, { "docid": "58d06cdd65ce242e66ca344bd3521e02", "score": "0.6138123", "text": "def perform\n User.find_each do |user|\n transfers =\n user.received_transfers.newest_first.pending\n .where('created_at <= ?', Time.zone.now - 3.days)\n next if transfers.empty?\n TransferMailer.pending_transfers(transfers, user).deliver_now\n end\n end", "title": "" }, { "docid": "7d152ce27e2ea3722342431c946f70fe", "score": "0.61368793", "text": "def send_mail(user)\n @greeting = \"Hi #{user.name}\"\n\n mail to: user.email\n end", "title": "" }, { "docid": "0b792d8f0dbb8bef01c50c7d7e1bbc24", "score": "0.61258435", "text": "def paid(order)\n @order = order\n\n mail :to => order.billing_address.email\n end", "title": "" }, { "docid": "26bc2b3ae0e859f982ced2c38846f457", "score": "0.61248434", "text": "def send_order(order)\n # simpan parameter order ke dalam instance variable\n @order = order \n\n # karena instance dari order terelasi dengan user\n # note : order belongs_to user, and user has_many orders\n # maka simpan variabel user melalui order\n @user = order.user\n\n # setelah itu kirim email ke user\n mail to: @user.email, subject: 'Delivery System - Your Purchanse Order' do |format|\n format.html\n end\n end", "title": "" }, { "docid": "fee047f0ee6741a8ce5f5a0fbc8c86ee", "score": "0.6124655", "text": "def send_daily_report(user)\n Rails.logger.info \"Processing daily report for #{user.email}\"\n @user = user\n @entries = @user.partners_entries\n\n if @entries.count > 0\n mail( :to => @user.email,\n :subject => 'Your daily LoveBank report' )\n Rails.logger.debug \"Updating #{@user.email} Daily mailed report ID to #{@entries.last.id}\"\n @user.update(last_daily_report_id: @entries.last.id)\n else\n Rails.logger.debug \"No entries to include in Daily Report for #{@user.email}. Daily report not mailed\"\n end\n end", "title": "" }, { "docid": "cbe12143f813d1b993aa38b1f211548a", "score": "0.6121501", "text": "def send_emails\n mail = build_mail\n get_recipients do |recipient|\n unless EmailResponse.exists?(email: recipient.email) # bounces & complaints\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end\n end\n end", "title": "" }, { "docid": "9b0af2169834291b211e8511b09877c8", "score": "0.6119731", "text": "def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end", "title": "" }, { "docid": "02dff111d5aec21b1be1bd4563763be4", "score": "0.6116603", "text": "def paid_signup(user)\n DelayedKiss.alias(user.full_name, user.email)\n DelayedKiss.record(user.email, 'Sent Paid Signup Email')\n @user = user\n mail to: user.email, subject: \"You've Upgraded to our Business Pro plan!\"\n end", "title": "" }, { "docid": "7f4969e8b888c2c5ab46812370165658", "score": "0.61164886", "text": "def mail(subject, recipient, message)\n user = User.discover(id, recipient).take\n UserMailer.student_email(user, subject, message).deliver\n end", "title": "" }, { "docid": "c20a009275b5a383dafe767d31d250ad", "score": "0.61163867", "text": "def send_notifications\n\t\t#puts \"------------- CAME TO SEND NOTIFICAITONS FOR RECEIPT ------------------\"\n\t\t## we will have to override the gather recipients.\n\t\t## how to get the patient ?\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\t#puts \"recipient is: #{recipient}\"\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => RECEIPT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => build_var_hash,\n\t\t\t\t\t:template_sender_id => RECEIPT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\t#puts \"the recipient has email id\"\n\t\t\t\t#puts recipient.email_ids.to_s\n\t\t\t\temail = OrderMailer.receipt(recipient,self,self.payable_to_organization.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend", "title": "" }, { "docid": "6407adf15816fb45608a430526c93c1b", "score": "0.6116263", "text": "def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end", "title": "" }, { "docid": "b4b3a8f92054ebbfa6252cb5c3b691e8", "score": "0.6115554", "text": "def run_schedule_works\n # TODO list\n puts \"send email\"\n user_list = User.includes(:goods_stores).where('goods_stores.goods_expire_date < ?', Time.now.strftime(\"%Y-%m-%d\")).references(:goods_stores)\n\n\n user_list.each{|user|\n if user.goods_stores.length == 0\n next\n end\n\n email_content = \"\"\n email_content += \"<h1>Alert! Some Item in Your Fridge were expired</h1>\"\n email_content += \"<p>Hello #{user.username}</p>\"\n email_content += \"<p>The following item in your fridge is expired</p>\"\n email_content += \"<ul>\"\n\n user.goods_stores.each{|goods|\n email_content += \"<li>food name: #{goods.goods_info.goods_name} food expire date: #{goods.goods_expire_date} fridge: #{goods.fridge.fridge_name}</li>\"\n }\n\n email_content += \"</ul>\"\n puts email_content\n\n from = Email.new(email: '[email protected]')\n to = Email.new(email: user.email)\n subject = \"Alert! Some Item in Your Fridge were expired\"\n content = Content.new(type: 'text/html', value: email_content)\n mail = Mail.new(from, subject, to, content)\n\n sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])\n response = sg.client.mail._('send').post(request_body: mail.to_json)\n puts response.status_code\n puts response.body\n puts response.headers\n }\n\n end", "title": "" }, { "docid": "204746758deb7ae6a483b55d1313d19a", "score": "0.61123043", "text": "def order_received(user)\n@user = user\nActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :subject => \"Adding new product\", :body => \"the product is added into the list\").deliver\nend", "title": "" }, { "docid": "6b2f9ebdfc4a6d84de2da38ccaa39061", "score": "0.6111738", "text": "def weekly_progress_report(user)\n @greeting = \"Hi\"\n \n user_email = @user.email\n\n mail to: user_email\n end", "title": "" }, { "docid": "791bf2943a19a857c14d3c202683517e", "score": "0.6103209", "text": "def send_email\r\n if User.exists? params[:id]\r\n @email_to_usr = User.find(params[:id])\r\n if params[:commit]\r\n if @sending_res = profile_mail_sending(params, @email_to_usr)\r\n return if @sending_res.kind_of? Hash\r\n redirecting(t(:email_redir), session[:last_page])\r\n else\r\n redirect_to_info_page t(:email_error)\r\n end\r\n return\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end", "title": "" }, { "docid": "bcb2a510f4be7ad40ae3a9a47108fe26", "score": "0.6102737", "text": "def send_to_admins\n @all_recipients = User.where(:receive_admin_email => true)\n raise NoRecipients if @all_recipients.blank?\n @all_recipients.group_by(&:language).each do |lang, users|\n @recipients = users\n mail_with_locale users, lang\n end\n end", "title": "" }, { "docid": "12a7654c71ae156835d7aac132eb5400", "score": "0.61017317", "text": "def alert_email(user)\n @user = user\n mail( :to => '[email protected]',\n :subject => 'You have a request from: '+ @user.email )\n end", "title": "" }, { "docid": "fd10b3340c88a4cad80702f5e3972d27", "score": "0.6100939", "text": "def alteration_email(user, trip)\n @trip=Trip.find_by(:id => trip)\n @user = User.find_by(:id => user)\n @fbo= Fbo.find_by(:id => @trip.fbo_id)\n @airport = Airport.find_by(:id => @fbo.airport_id)\n @url = 'http://chartair.us/trips'\n mail(to: @user.email, subject: 'Trip Alteration')\n end", "title": "" }, { "docid": "323072e459edeac7b9fad380f80e1bd0", "score": "0.6097608", "text": "def send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend", "title": "" }, { "docid": "7d83fc4986ff9b2deef27f7dde4837e5", "score": "0.60949254", "text": "def send_signup_email(user)\n\t\tuser = user\n subject = \"Thank you for sign up on miniflix.\"\n merge_vars = {\n \"USER_NAME\" => user.name\n }\n body = mandrill_template(\"Paid-user-signup-mail\", merge_vars)\n\n send_mail(user.email, subject, body)\n\tend", "title": "" }, { "docid": "852ad08559c85d9b519b26efc965df41", "score": "0.60895073", "text": "def customer_purchase_email(user)\n @user = user \n mail(to:ENV['MAILJET_SENDER'], subject: 'Une commande à préparer a été effectué !')\n end", "title": "" }, { "docid": "e559a0ddc05a6ee97b539df4dcd47f9a", "score": "0.6085836", "text": "def send_test_mail(current_value, user)\n @user = user\n @current_values = current_value\n\n mail to: '[email protected]', subject: 'Currency Exchange Rate'\n end", "title": "" }, { "docid": "a60c8d7d083972e9b3d41695846b323e", "score": "0.6085634", "text": "def invoice_mail(user,job)\n @user = user\n @job = job\n mail(to: @user.email, subject: 'Job Invoice')\n end", "title": "" }, { "docid": "d0945e471b1c70b9cbc7114b5263bf02", "score": "0.6084937", "text": "def new_game\n @greeting = \"Hi\"\n# @all_rsvps = Rsvp.where(\"event_id = ?\", event.id)\n #@all_rsvps.each do |rsvp|\n # @user = User.where(\"id = ?\", rsvp.user_id).first\n #mail(:to => @user.email, :from => \"[email protected]\", :subject => \"Event Change\")\n #end\n\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "c4e0deb49945df5eaa7cc6b970514545", "score": "0.6068769", "text": "def send_observer_mail(user)\n mail to: user.email, subject: \"Changes to Cart\", from:'[email protected]'\n end", "title": "" }, { "docid": "0bfef485a8fd9559ed8826101f4319e3", "score": "0.6044715", "text": "def send_reminder_email(user, expiringtasks)\n @user = user\n @expiringtasks = expiringtasks\n mail( :to => @user.email ,\n :subject => '[Todo Manager] Task Reminder')\n end", "title": "" }, { "docid": "9cb2b53568489f3c3ee343cfd7589994", "score": "0.60410386", "text": "def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end", "title": "" }, { "docid": "390300a04e84e592e0eb71e2fcf016cc", "score": "0.6040084", "text": "def participant_user(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: applicant_email,\n reply_to: schooladmins,\n subject: \"Thank you for your recent registration to \" + @school.name\n end", "title": "" }, { "docid": "ecc87d5b7ba3bd48a13861a721d3daa6", "score": "0.60329574", "text": "def send_result_mail\n employee = Employee.find_by(email: \"[email protected]\")\n value = employee.values.last\n EmployeeMailer.send_result_mail(employee, value)\n end", "title": "" }, { "docid": "963bd7a4dfbbd29102b61ce1ceee8116", "score": "0.6030438", "text": "def rental_confirmation(user)\n @user = user\n \n mail to: @user.email_address, subject: \"Rental confirmation\"\n end", "title": "" }, { "docid": "26662fceed9c7b6795d4cd303913f4a3", "score": "0.60265553", "text": "def referral_earnings(referrer, referral)\n @referrer = referrer\n @referral = referral\n\n set_attachments\n\n mail(to: referrer.email, subject: \"Notificaciones @ Social Target - Un referido ha generado un ingreso\")\n end", "title": "" }, { "docid": "39d419bd957c3372d8a698075affefde", "score": "0.601725", "text": "def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end", "title": "" }, { "docid": "244c490a32b653ad42e5ed71d785c940", "score": "0.6017195", "text": "def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end", "title": "" }, { "docid": "790ffc0ea0a484a713a5826e5560207d", "score": "0.60142297", "text": "def call(user, email, reward, shipping_address)\n @user = user\n @reward = reward\n # admin = \"[email protected]\"\n admin = \"[email protected]\"\n @shipping_address = shipping_address\n mail to: email, subject: 'Redemption details'\n end", "title": "" } ]
632b8d73125ab306e8a1c84b93add17e
GET /presentations/1 GET /presentations/1.json
[ { "docid": "a324ac8ff809a25182eecee524148702", "score": "0.0", "text": "def show\n render :layout => \"presentation\"\n end", "title": "" } ]
[ { "docid": "481972badb5741820fd4815f7fc22536", "score": "0.75861156", "text": "def show\n @presentation = current_church.presentations.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presentation }\n end\n end", "title": "" }, { "docid": "0564b452a6e2e16ba1bcb1964dcfbb1f", "score": "0.71725863", "text": "def index\n @presentations = Presentation.all\n end", "title": "" }, { "docid": "0564b452a6e2e16ba1bcb1964dcfbb1f", "score": "0.71725863", "text": "def index\n @presentations = Presentation.all\n end", "title": "" }, { "docid": "6b33c3578dbecb1034ef0d04c75e310f", "score": "0.7059558", "text": "def show\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presentation }\n end\n end", "title": "" }, { "docid": "a3d7893d81d0646bb15d02e617bef990", "score": "0.7031408", "text": "def show\n @present = Present.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @present }\n end\n end", "title": "" }, { "docid": "d27580455f4ee4f8fae315207edc7b15", "score": "0.6793392", "text": "def get_presentation\n if params[:presentation_id].present?\n @presentation = Presentation.find params[:presentation_id]\n end\n end", "title": "" }, { "docid": "4cae5a1fbbb3b6de5704bb0a467bb596", "score": "0.6762323", "text": "def index\n @presents = Present.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @presents }\n end\n end", "title": "" }, { "docid": "62c58977af6f00ba36c977d9ae5a36c0", "score": "0.6524001", "text": "def show\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end", "title": "" }, { "docid": "fb9033b2ff89d81e46f9c43de762b2a5", "score": "0.638431", "text": "def index\n @presentations = Presentation.in_conference(current_conference).\n paginate(:page => params[:page], :per_page => 30)\n end", "title": "" }, { "docid": "c1792c90c8119a585ced9fcd8f998915", "score": "0.63455737", "text": "def show\n \n authorize @presentation\n respond_to do |format|\n format.html\n format.json\n end\n end", "title": "" }, { "docid": "c9fe9f87e52f7beda1b163cf97d5d182", "score": "0.633131", "text": "def index\n @user = current_user\n @presentation = Presentation.find(params[:id])\n end", "title": "" }, { "docid": "17cb2cb1db0dea5c12a38f14e3e78750", "score": "0.6286547", "text": "def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end", "title": "" }, { "docid": "6fc0a9242e78b1fec4e45f90c2d3e675", "score": "0.62828374", "text": "def show\n @presence = Presence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presence }\n end\n end", "title": "" }, { "docid": "4311d6e12faa4ede5f0f26c63fda2f11", "score": "0.6242617", "text": "def new\n @present = Present.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @present }\n end\n\n end", "title": "" }, { "docid": "1d81880e67f115a8c6cdc465f17bc2eb", "score": "0.62202185", "text": "def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end", "title": "" }, { "docid": "b354e179ba97332ffdc8d7c4d35be81e", "score": "0.6207625", "text": "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "title": "" }, { "docid": "a3d9102695a3e0e17368f6c040e884d1", "score": "0.6206988", "text": "def show\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confession }\n end\n end", "title": "" }, { "docid": "e45d0e8cee0e44f685ea531e2f331a49", "score": "0.6205403", "text": "def index\n @presentationdetails = Presentationdetail.all\n end", "title": "" }, { "docid": "84b63a488fba5ce1eb3ddf4163c3613b", "score": "0.61993456", "text": "def show\n @presentation = Presentation.find_by_name(params[:prez_id])\n @pslide = Pslide.find(params[:id])\n @pcontent=Array.new\n @pbehavior=Pbehavior.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pslide }\n end\n end", "title": "" }, { "docid": "fd9735b2e3fe2cb3bbca53b645c43c13", "score": "0.61695105", "text": "def show\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end", "title": "" }, { "docid": "17be5b62121dff6a7c3699902de8ec0b", "score": "0.61575246", "text": "def show\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @presentation }\n end\n end", "title": "" }, { "docid": "9c2e391f2aab422bf7d998c44e97b25c", "score": "0.6141258", "text": "def show\n @punch = Punch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch }\n end\n end", "title": "" }, { "docid": "c1f002b668da1fdbc3e1d20fba2b428b", "score": "0.61412376", "text": "def destroy\n @presentation = current_church.presentations.find(params[:id])\n @presentation.destroy\n\n respond_to do |format|\n format.html { redirect_to presentations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "742b9351ee8ae8c54f1dd3fab11e72dc", "score": "0.6130618", "text": "def index\n @presentations = current_church.presentations.order('fecha desc').page params[:page]\n\n end", "title": "" }, { "docid": "57c3f16696c49004cb2e1d64a5f74dcc", "score": "0.611996", "text": "def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end", "title": "" }, { "docid": "d3716fbc9081ddb4fe1d7982ad0cabf6", "score": "0.61035424", "text": "def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end", "title": "" }, { "docid": "12ce59750f406225e4e1e736dbf2411f", "score": "0.6101287", "text": "def new\n @presentation = Presentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presentation }\n end\n end", "title": "" }, { "docid": "433515e8c4e2dd12c70d71012f81bc9a", "score": "0.6083147", "text": "def show\n @interview = Interview.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "title": "" }, { "docid": "89a852fce655b6244306478595d9daab", "score": "0.60827684", "text": "def index\n @q = current_lead \n @presentations = current_lead.presentations.order(\"created_at ASC\")\n # = current_user.presentations.ransack(params[:q])\n #@presentations = @q.result(:distinct => true).includes(:lead, :contributors, :insights).page(params[:page]).per(10)\n # this was mine but its not working, @presentations = current_user.presentations\n render(\"presentations/index.html.erb\")\n end", "title": "" }, { "docid": "a791b6fb10fce8877390e58257720251", "score": "0.6069582", "text": "def show\n render json: @laboratory\n end", "title": "" }, { "docid": "ec559048817be2429f26df47a66dcd77", "score": "0.60657364", "text": "def create\n @presentation = Presentation.new(params[:presentation])\n @session = @presentation.session\n\n if type_name = params[:presentation].delete(:type)\n @presentation.type = type_name.constantize.to_s #constantize will effectively sanitize the :type param\n end\n @presentation.starts_at = @session.starts_at\n if url = params[:data_transfer]['text/plain'] || params[:data_transfer]['text/html']\n @presentation.submission = if url =~ /submissions\\/(\\d+)/\n Submission.find($1)\n elsif url =~ /presentations\\/(\\d+)/\n Presentation.find($1).submission\n end\n end\n\n respond_to do |format|\n if @presentation.save\n flash[:notice] = \"Presentation was successfully created\"\n format.html { render :partial => 'list', :locals => {:presentations => @session.presentations}}\n # format.html { redirect_to @presentation, notice: 'Presentation was successfully created.' }\n # format.json { render json: @presentation, status: :created, location: @presentation }\n else\n flash[:error] = \"Presentation failed to create<br>#{@presentation.errors.full_messages}\"\n format.html { render :partial => 'list', :locals => {:presentations => @session.presentations}}\n # format.html { render action: \"new\" }\n # format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab5bcf6db915cc5379342ea388698718", "score": "0.60363495", "text": "def json_responses_for_presentation(p, exclude_paths)\n @counter ||= 0 # We want to restrict the number of presentations\n # downloaded per go.\n return nil if @counter > MAXIMUM_NUMBER_OF_PRESENTATIONS_PER_BATCH\n fragments = {}\n # We only batch load for the current locale.\n # We are seeing people with hundreds of likes, so this makes sense.\n #\n # Same as PresentationContrller#show\n @presentation = p\n @menu = @presentation.is_poster? ? :posters : :sessions\n restrict_disclosure(@presentation)\n\n path = presentation_path(@presentation, :locale => locale)\n unless exclude_paths.include?(path)\n fragments[path] = render_to_string(\"show#{\".s\" if smartphone?}\", :formats => [:html], :layout => false)\n end\n @counter += 1\n fragments\n end", "title": "" }, { "docid": "db8da6685192f978b633cb3b054b613b", "score": "0.60236204", "text": "def index\n @presentations = Presentation.all.where(:publish => true)\n end", "title": "" }, { "docid": "3a83877514afc953e8dd621dccc34753", "score": "0.60207987", "text": "def show\n @parasitic_interaction = ParasiticInteraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parasitic_interaction }\n end\n end", "title": "" }, { "docid": "cd3da4cd6fad62190bb7d69b6daf1db4", "score": "0.59991974", "text": "def show\n @mision_mision = MisionMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision_mision }\n end\n end", "title": "" }, { "docid": "3c26d94bf9a5b1c37103563011b62a98", "score": "0.59965956", "text": "def show\n @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end", "title": "" }, { "docid": "2c0828a897e387e448941bb631d43527", "score": "0.599526", "text": "def create\n @presentation = Presentation.new(presentation_params)\n\n respond_to do |format|\n if @presentation.save\n format.html { redirect_to @presentation, notice: 'Presentation was successfully created.' }\n format.json { render :index, status: :created, location: @presentation }\n else\n format.html { render :new }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4c0e8e5e60d3ba8d8e167873e23eba7", "score": "0.59946173", "text": "def create\n @presentation = current_church.presentations.build(params[:presentation])\n\n respond_to do |format|\n if @presentation.save\n format.html { redirect_to @presentation, notice: 'Presentation was successfully created.' }\n format.json { render json: @presentation, status: :created, location: @presentation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8acdee70d1cfc265914740652808bab0", "score": "0.5991904", "text": "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "title": "" }, { "docid": "ed0884d929f9ddb90d5cca299efd72e7", "score": "0.5979337", "text": "def show\n @publication = Publication.find(params[:id])\n @title = @publication.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end", "title": "" }, { "docid": "a07931492d3f56bdd8e63545a120166e", "score": "0.5967351", "text": "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "title": "" }, { "docid": "a07931492d3f56bdd8e63545a120166e", "score": "0.5967351", "text": "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "title": "" }, { "docid": "486819d887d9e058f527f1770f29f4fb", "score": "0.5960627", "text": "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end", "title": "" }, { "docid": "6784ba580311e47148cf29d581c722d0", "score": "0.5936213", "text": "def show\n @practitioner_type = PractitionerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "title": "" }, { "docid": "a73ec79dc01a99d71319904c0041008a", "score": "0.592526", "text": "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "title": "" }, { "docid": "1df4b1b89914d7900a7a2966d4b3288a", "score": "0.59226286", "text": "def update\n @presentation = current_church.presentations.find(params[:id])\n\n respond_to do |format|\n if @presentation.update_attributes(params[:presentation])\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd6a002c95c76217fe5df357d46b501d", "score": "0.5916339", "text": "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "title": "" }, { "docid": "bd6a002c95c76217fe5df357d46b501d", "score": "0.5916339", "text": "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "title": "" }, { "docid": "e9fd4a28ea30d09f216e50b8ed0367de", "score": "0.5911247", "text": "def create\n @employee = current_employee\n @presentation = @employee.presentations.build(presentation_params)\n\n respond_to do |format|\n if @presentation.save\n format.html { redirect_to @presentation, notice: 'Presentation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @presentation }\n else\n format.html { render action: 'new' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bea4b975e383f54c4d7f7324a38f51d0", "score": "0.5907586", "text": "def show\n @precinct = Precinct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @precinct }\n end\n end", "title": "" }, { "docid": "31f4586227e3b597a65184eacb72db21", "score": "0.5884203", "text": "def create\n @presentation = Presentation.new(params[:presentation])\n\n respond_to do |format|\n if @presentation.save\n format.html { redirect_to @presentation, notice: 'Presentation was successfully created.' }\n format.json { render json: @presentation, status: :created, location: @presentation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f26d041e21fd24e8285435ae6bb612e4", "score": "0.5878856", "text": "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "title": "" }, { "docid": "ea50ad8911d9ca4113506ded566c3c41", "score": "0.5873865", "text": "def show\n @exhibition = Exhibition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exhibition }\n end\n end", "title": "" }, { "docid": "6709bd6632119711b2c782df32396a38", "score": "0.5863704", "text": "def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end", "title": "" }, { "docid": "24dbbd0d5455a9ae088833f71c3b88db", "score": "0.58611846", "text": "def index\n if params[:user_id] and user_in_organizer_committee?\n @user = User.find(params[:user_id])\n else\n @user = current_user\n end\n @presentations = @user.presentations.includes(:tags, authors: :user, conference_session: [organizers: :user]).all\n end", "title": "" }, { "docid": "4c2d733b9d2f5c9a3d3716726bc55c4d", "score": "0.5856388", "text": "def set_presentacion\n @presentacion = Presentacion.find(params[:id])\n end", "title": "" }, { "docid": "7f3ea99d932f1fe5c3cb6ea811c1e6d5", "score": "0.5852125", "text": "def show\n @experience_sharing = ExperienceSharing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_sharing }\n end\n end", "title": "" }, { "docid": "12d473d3718d01b586874e8f699f346e", "score": "0.58310324", "text": "def show\n @followup_interview = FollowupInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup_interview }\n end\n end", "title": "" }, { "docid": "2239d26bd300129aad6b6e8e7bcb875e", "score": "0.58262193", "text": "def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end", "title": "" }, { "docid": "b6179f2fa838ba68d5cf0b9fe251fc2b", "score": "0.5820597", "text": "def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end", "title": "" }, { "docid": "53c232107d4e6552cd7a57843215f92f", "score": "0.58196795", "text": "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "title": "" }, { "docid": "53c232107d4e6552cd7a57843215f92f", "score": "0.58196795", "text": "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "title": "" }, { "docid": "04c26863bb7806ba42ca02fe11a5a36c", "score": "0.581922", "text": "def show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end", "title": "" }, { "docid": "315243ca8e66e33f87a1a4074c1abf01", "score": "0.58096963", "text": "def index\n @product_presentations = ProductPresentation.all\n @product_presentation = ProductPresentation.new\n end", "title": "" }, { "docid": "f86c3020a2c15d3bb5acb1e1b1277a8a", "score": "0.58089936", "text": "def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end", "title": "" }, { "docid": "99615caa1ca0dba664dd5b4e415a7940", "score": "0.57959396", "text": "def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end", "title": "" }, { "docid": "4db2e79a6814522c776b0960145009fe", "score": "0.5791108", "text": "def publications\n @publications = Publication.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "title": "" }, { "docid": "f79fa3b2dd1be32f97acdb4c53bff2f4", "score": "0.57888603", "text": "def show\n @user = User.find(@repa.user_id)\n @participations = Participation.where(repa_id: @repa.id)\n end", "title": "" }, { "docid": "7a5b115dee72aa4c06dd81c615645153", "score": "0.5788255", "text": "def create\n @presentation = Presentation.new(presentation_params)\n @presentation.user = current_user\n \n respond_to do |format|\n if @presentation.save\n format.html { redirect_to presentation_slides_path(@presentation), notice: 'Presentation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @presentation }\n else\n format.html { render action: 'new' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12d1d2426729840636ea7314abf5a92d", "score": "0.5780498", "text": "def show\n @programme = Programme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programme }\n end\n end", "title": "" }, { "docid": "96c727b812ca9b37a2433ae1de27ae53", "score": "0.57773566", "text": "def show\n respond_with @inproceedings\n end", "title": "" }, { "docid": "a82393e491db26146c1b3e9e7e77bab5", "score": "0.576656", "text": "def index\n @participates = Participate.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participates }\n end\n end", "title": "" }, { "docid": "6379638e957514df29efd4372e4a43b8", "score": "0.5760683", "text": "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "title": "" }, { "docid": "6a01f04784b595d2f7cd401c63bc245e", "score": "0.57594806", "text": "def show\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "title": "" }, { "docid": "57d7506de4b88790a815038b70e85f18", "score": "0.57513344", "text": "def show\n @participation = Participation.find(params[:id])\n end", "title": "" }, { "docid": "045e4c2ded081d32289f7812d7360a64", "score": "0.57491416", "text": "def show\n render json: @publication\n end", "title": "" }, { "docid": "9268a0496778d88babb1e4af44499d12", "score": "0.57407254", "text": "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "title": "" }, { "docid": "d794e32df52ebfb6d54f7e914ff11bad", "score": "0.5734529", "text": "def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end", "title": "" }, { "docid": "80eb38bce5a2c830088ea42e9db904fe", "score": "0.5733818", "text": "def show\n @portion = Portion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portion }\n end\n end", "title": "" }, { "docid": "89ae4fa14a239dc96f1795ffb7504ada", "score": "0.5733575", "text": "def show\n @participations = @challenge.participations \n @participation = @challenge.participations.new\n end", "title": "" }, { "docid": "0885c8357f0bcda525804504f7d6dc39", "score": "0.5729239", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participate }\n end\n end", "title": "" }, { "docid": "031f8d941aa6d5d0926827efae3d20c6", "score": "0.5728054", "text": "def show\n @research_appointment = ResearchAppointment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_appointment }\n end\n end", "title": "" }, { "docid": "b956bdec15f69738fda460eb0f4220d2", "score": "0.5720789", "text": "def show\n @prospective = Prospective.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @prospective }\n end\n end", "title": "" }, { "docid": "752fed593912fc1ab5c9a118cfe3ddea", "score": "0.57196", "text": "def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end", "title": "" }, { "docid": "01f6780765931d935ec264efb2039005", "score": "0.5714337", "text": "def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end", "title": "" }, { "docid": "4e52a61e61280ad10947a28967902c4a", "score": "0.5708797", "text": "def show\n render json: Festival.build_for(params[:id]).to_json\n end", "title": "" }, { "docid": "2f98c1fc09bbf3df2ba04252beaa132c", "score": "0.57076097", "text": "def show\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @theoretical_part }\r\n end\r\n end", "title": "" }, { "docid": "6327d71a69369127f5a9d1e1eec454d1", "score": "0.570666", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "title": "" }, { "docid": "20e1c24a761e8d7c7fc51883839c2993", "score": "0.57046294", "text": "def new\n @petition = Petition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @petition }\n end\n end", "title": "" }, { "docid": "bab1bd5a1796f04841696cf3d88dc905", "score": "0.5704144", "text": "def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end", "title": "" }, { "docid": "23776c5473590eec0a11dd2f2cd21f19", "score": "0.56931496", "text": "def show\n @publication = Publication.find(params[:id])\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "title": "" }, { "docid": "da63c65acaeb2e479bbf5ed0d3e3f60a", "score": "0.56915057", "text": "def set_presentation\n @presentation = Presentation.find(params[:presentation_id])\n end", "title": "" }, { "docid": "31111446cf679cca5761e25ca4b2951c", "score": "0.56901366", "text": "def set_presentation\n @presentation = Presentation.find(params[:id])\n end", "title": "" }, { "docid": "cb20c0a7d871e69f0ffb84457ee1b423", "score": "0.5688611", "text": "def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { render :index, status: :ok, location: @presentation }\n else\n format.html { render :edit }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd1c36d5adad1cd66c80253dedb6570e", "score": "0.5687658", "text": "def show\n @proposed_person = ProposedPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @proposed_person }\n end\n end", "title": "" }, { "docid": "866fb825bca58dcaf33a97d48adab451", "score": "0.56875986", "text": "def show\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repuestum }\n end\n end", "title": "" }, { "docid": "59673b78130a37710c31c39d40f87220", "score": "0.56869197", "text": "def show\n @persons_release = PersonsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persons_release }\n end\n end", "title": "" }, { "docid": "91b4f5a888a850d6d65ccc55b7889f26", "score": "0.5684784", "text": "def show\n @game_profession = GameProfession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_profession }\n end\n end", "title": "" }, { "docid": "507b561e1cb306db1c9e94eb4df5097d", "score": "0.56846637", "text": "def show\n @laboratory = Laboratory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laboratory }\n end\n end", "title": "" }, { "docid": "9e47632a48dcb3c7288642d205c4a67e", "score": "0.56840485", "text": "def create\n @present = Present.new(params[:present])\n\n flash[:notice] = 'Present was successfully created.' if @present.save\n respond_with @present, :location => admin_presents_path\n end", "title": "" }, { "docid": "3fb04ad30791bfde6bc7e7912fa77cd8", "score": "0.5679742", "text": "def presentation_params\n params.require(:presentation).permit(:name, :path, :authors, :location_id, :number, :page, :is_active)\n end", "title": "" } ]
82f01c3328a0fdf720c48f36593dff81
Register a validation rule for the given key.
[ { "docid": "b666f2b7a5fc4856d6b9460923095f10", "score": "0.6999911", "text": "def validate(key, &validator)\n vs = (validators[key] || [])\n vs << validator\n validators[key] = vs\n end", "title": "" } ]
[ { "docid": "cf856dd49ef26913fcca60bea8693cc0", "score": "0.73656493", "text": "def add_rule(key, rule)\n\n instance = rule.new\n\n #verify the rule instance inherits ValidationRule\n if instance == nil || !instance.is_a?(ValidationRule)\n raise ValidationProfiler::Exceptions::InvalidValidationRuleType.new(instance.class)\n end\n\n #verify the rule name has not already been registered\n if [email protected] { |r| r[:key] == key }.empty?\n raise ValidationProfiler::Exceptions::ValidationRuleAlreadyExists.new(key)\n end\n\n @rules.push({ key: key, instance: instance})\n\n end", "title": "" }, { "docid": "78a577eee0131be14a273efa33eae5a3", "score": "0.6937535", "text": "def rule(key, &action)\n @@rules << [key, action]\n end", "title": "" }, { "docid": "369eb256069f19f3b2dbffcb7629ffc3", "score": "0.68162477", "text": "def validate(key, validator=\"validate_#{key}\", &block)\n validators[key.to_s] = validator.to_sym\n \n if block_given?\n define_method(validator, &block)\n protected validator\n end\n end", "title": "" }, { "docid": "511361390cadb3d1cd3705bf209c584e", "score": "0.6536498", "text": "def validate_only(key)\n validation_name, attribute_name = key.split(\"/\")\n validation_name = validation_name.split(\"_\").collect{|word| word.capitalize}.join\n validation_key = \"#{self.class.name}/Validatable::Validates#{validation_name}/#{attribute_name}\"\n validation = self.class.all_validations.find { |validation| validation.key == validation_key }\n raise ArgumentError.new(\"validation with key #{validation_key} could not be found\") if validation.nil?\n errors.clear\n run_validation(validation)\n end", "title": "" }, { "docid": "4fa11bc0959200340910adcf322bd66e", "score": "0.6418175", "text": "def add_rule(key, length, prefixes)\n unless brands.has_key?(key)\n raise Error.new(\"brand #{key} is undefined, please use #add_brand method\")\n end\n length, prefixes = Array(length), Array(prefixes)\n brands[key][:rules] << {length: length, regexp: compile_regexp(prefixes), prefixes: prefixes}\n end", "title": "" }, { "docid": "b920234d950b1a631b331f75d9441c71", "score": "0.6136573", "text": "def validations_for(key)\n @validations[key] ||= []\n end", "title": "" }, { "docid": "05a368ef1db0ffa0f30b4525fa866471", "score": "0.61150646", "text": "def validator(key, &block)\n return if !block\n vals = (@validators[key.to_sym] ||= [])\n vals << block\n end", "title": "" }, { "docid": "39f1a64f97c13e6dc5f12bf80f4802cc", "score": "0.6102484", "text": "def param_validation(name, rule)\n Validate::Rules.validate_single_param_rule! rule\n (@param_validations ||= {})[name.to_sym] = rule\n end", "title": "" }, { "docid": "f0e1ff512607336e1eb9cc1522c1c652", "score": "0.6009362", "text": "def get_rule(key)\n\n results = @rules.select { |r| r[:key] == key }\n if !results.empty?\n results[0][:instance]\n else\n raise ValidationProfiler::Exceptions::ValidationRuleNotFound.new(key)\n end\n end", "title": "" }, { "docid": "e6435db36e2e6104ee982933ad7766bb", "score": "0.5993679", "text": "def validate_key\n call :validate_key, Response\n end", "title": "" }, { "docid": "c5267d0f7bd01a5322042dcc44e7c1f2", "score": "0.59297806", "text": "def add_single_rule(field, key_or_klass, params = nil)\n klass = if key_or_klass.respond_to?(:new)\n key_or_klass\n else\n get_rule_class_by_name(key_or_klass)\n end\n\n args = [params].compact\n rule = klass.new(*args)\n rule.obj = @obj if rule.respond_to?(:obj=)\n rules[field] << rule\n end", "title": "" }, { "docid": "89c90c144621dbbc2230405d39d2bc4c", "score": "0.5898968", "text": "def [](key)\n keysym = key.to_sym\n rule = @rules[keysym]\n return rule if rule\n # Return the rule if we have it, otherwise make a placeholder,\n # and store that place holder.\n rule = placeholder(\"#{keysym}\")\n @rules[keysym] = rule\n return @rules[keysym]\n end", "title": "" }, { "docid": "5f60f9104bfee1e41420b5906e259102", "score": "0.58857733", "text": "def insert(key, *rules)\n @rules[Table.normalize_key(key)] = [*@rules[Table.normalize_key(key)], *rules]\n end", "title": "" }, { "docid": "dac4788615c1a5516c30a92fe79b1b97", "score": "0.5843142", "text": "def add_rule(rule); end", "title": "" }, { "docid": "7647e8d36cb00d911af16b407b592421", "score": "0.58359057", "text": "def validate_key!\n end", "title": "" }, { "docid": "26c7b98239b31b1a1472b1534666171a", "score": "0.5834114", "text": "def set_validation_rule\n @validation_rule = ValidationRule.find(params[:id])\n end", "title": "" }, { "docid": "92a04942f0d082461f4ca7900a508d83", "score": "0.58098865", "text": "def rule(*keys, &block)\n ensure_valid_keys(*keys) if __schema__\n\n Rule.new(keys: keys, block: block).tap do |rule|\n rules << rule\n end\n end", "title": "" }, { "docid": "a06a4db294ea43eb4211e416a52866e5", "score": "0.57925236", "text": "def validate_value!(key, args)\n\t\t validation = self.class.validations[key]\n\t\t raise \"No validation was found for #{key}\" if !validation\n\t\t @errors << {:key => key} if !validation.call(args)\n\t\tend", "title": "" }, { "docid": "42996001d753b36bb0bf834cd69dbfa2", "score": "0.57844293", "text": "def [](key)\n keysym = key.to_sym\n rule = @rules[keysym]\n return rule if rule\n # Return the rule if we have it, otherwise make a placeholder,\n # and store that place holder.\n rule = placeholder(\"#{keysym}\")\n @rules[keysym] = rule\n return @rules[keysym]\n end", "title": "" }, { "docid": "cf0f8cf47d41d00f5dcf041fe10f3047", "score": "0.577648", "text": "def contraint_keyword(k)\n @key = k\n end", "title": "" }, { "docid": "3b1723eb2f42a5c157eaaa6bcb0070d2", "score": "0.57242453", "text": "def set(key, value)\n method_name = \"validate_#{key}\"\n send(method_name.to_sym, value) if respond_to?(method_name.to_sym)\n @data[key.to_s] = value\n end", "title": "" }, { "docid": "3b1723eb2f42a5c157eaaa6bcb0070d2", "score": "0.57242453", "text": "def set(key, value)\n method_name = \"validate_#{key}\"\n send(method_name.to_sym, value) if respond_to?(method_name.to_sym)\n @data[key.to_s] = value\n end", "title": "" }, { "docid": "c3b2a86bb62e62d547d75a29d28964a3", "score": "0.56903213", "text": "def has_rule?(key, rule)\n @rules[Table.normalize_key(key)].include?(rule)\n end", "title": "" }, { "docid": "1247693eba4494fbc0525202b66a13e7", "score": "0.56533915", "text": "def add_alias! key, to_key\n key = validate_new_key! key\n @values.delete key\n @defaults.delete key\n @validators[key] = to_key.to_sym\n self\n end", "title": "" }, { "docid": "99e1b4a2d552c8c906b1ab5829718cdd", "score": "0.56431866", "text": "def add_error(key, message)\n @errors[key] = message\n return self\n end", "title": "" }, { "docid": "f8d778b259a0abc08a7032b70c981493", "score": "0.5641443", "text": "def add_rule(param, *rules)\n check_rule_set(rules[0])\n @rules[param.to_s] = rules[0]\n end", "title": "" }, { "docid": "b9d50a4136d14f0731340ae28221da78", "score": "0.56391156", "text": "def addKeyChange(old, new)\n @keyChangeRules[old] = new\n end", "title": "" }, { "docid": "ad993989831a066ea2ae66bb89475f87", "score": "0.561531", "text": "def add_error(key, message)\n @errors[key] = message\n return self\n end", "title": "" }, { "docid": "321f996aa62bd4ded3af9b6898a3b21b", "score": "0.5611263", "text": "def rule name, &proc\n self.rules.push({ name: name, rule: proc })\n end", "title": "" }, { "docid": "cd29b78bbd824c6c0b68530d0db5b8a9", "score": "0.5601202", "text": "def validation_key(arg = nil)\n set_or_return(\n :validation_key,\n arg,\n :kind_of => [String, NilClass],\n )\n end", "title": "" }, { "docid": "672949a04de93fb4f2ebbe3ce66f31a6", "score": "0.5587065", "text": "def add_error(key, message)\n @errors[key] = message\n return self\n end", "title": "" }, { "docid": "885173ce620b73d89300c599379d4dec", "score": "0.55848265", "text": "def validate_rule(attribute, rule)\n if self.class.const_defined?(:Validator)\n validator = self.class.const_get(:Validator)\n end\n \n if validator.nil? || !validator.singleton_class.instance_methods(false).include?(attribute)\n validator = HungryForm::Validator\n end\n\n self.error = validator.send(attribute, self, rule) || ''\n end", "title": "" }, { "docid": "fcf2c56be8a6a1903344cb97babb3f86", "score": "0.55710226", "text": "def []=(key, value) \n keysym = key.to_sym\n oldrule = @rules[keysym]\n if oldrule \n if oldrule.respond_to?(:define_rule)\n # define rule \n oldrule.define_rule(value)\n end\n # and rename it anyway\n oldrule.name = keysym\n else \n setrule = self.to_rule(value, keysym)\n @rules[keysym] = setrule\n setrule.name = keysym\n end \n end", "title": "" }, { "docid": "0272bfff5a48ca5187b21924ec75c523", "score": "0.5562515", "text": "def []=(key, value) \n keysym = key.to_sym\n oldrule = @rules[keysym]\n if oldrule && oldrule.respond_to?(:define_rule)\n # define rule and rename it \n oldrule.define_rule(value)\n oldrule.name = keysym\n else \n setrule = self.to_rule(value, keysym)\n @rules[keysym] = setrule\n end\n end", "title": "" }, { "docid": "93b234c5a1043d0712f614350db7d87d", "score": "0.5508094", "text": "def add_rule(rule)\n @rules << rule\n end", "title": "" }, { "docid": "f5a754fd29902fa7686e8fdc2ca4d11f", "score": "0.54883206", "text": "def validator(key = nil, opts = {}, &block)\n key = default_validator_name if key.nil?\n unless block_given?\n validator_keys << convert_to_container_key(key)\n return\n end\n\n validators << Appfuel::Validation.build_validator(key, opts, &block)\n nil\n end", "title": "" }, { "docid": "5ee159ac1b50db0b71a8beab2c58bda7", "score": "0.5464081", "text": "def assert_valid(key, value)\n validators[key].each do |validator|\n validator.(key, value)\n end\n end", "title": "" }, { "docid": "620021de629e3dd99a962a6a791063a2", "score": "0.54513127", "text": "def validate(*keys, &validator)\n key = flatten_keys(keys)\n values = validators[key] || []\n values << validator\n validators[key] = values\n end", "title": "" }, { "docid": "3db5cb2464361dbe4aa0cdd4899a00a3", "score": "0.5447544", "text": "def add_key_constraint(key, constraint, sanity: false, **options)\n add_constraint(\n constraint,\n property: key,\n property_type: :key,\n sanity: sanity,\n **options\n )\n end", "title": "" }, { "docid": "35e7bb6ee45d32fd021a81fb2b8dff10", "score": "0.5441709", "text": "def auto_validations!\n AUTO_VALIDATIONS.each do |key, value|\n next unless options.has_key?(key)\n validation = value.call(name, options[key])\n next if validation.empty?\n klass.class_eval <<-EOS\n begin\n #{validation}\n rescue ArgumentError => e\n throw e unless e.message =~ /specify a unique key/\n end\n EOS\n end\n end", "title": "" }, { "docid": "ff7e8d82a947d0a3d30c19655fd9f01f", "score": "0.54292583", "text": "def contraint_keyword(keyword)\n @key = keyword\n end", "title": "" }, { "docid": "7d3ccdd1fad8628890f80c9a4a65c4e2", "score": "0.54085046", "text": "def add_rule rule\n self[rule.meaning.to_sym] = rule\n end", "title": "" }, { "docid": "9b5ef7d735d78c92c6763fd590d5f97e", "score": "0.53913534", "text": "def symbol_key\n self.rule_key.to_sym\n end", "title": "" }, { "docid": "026db536a863fa3051ff7dad866dcd51", "score": "0.53894687", "text": "def set(name, rule, **options)\n @rules[name] = rule\n end", "title": "" }, { "docid": "e884165f2bfac49cdf11011f9bdac9c2", "score": "0.53462577", "text": "def validate\n validates_exact_length 12, :keyId\n end", "title": "" }, { "docid": "428b9da845deac3fc658f8a2a092f1b0", "score": "0.53456223", "text": "def add_rule(name, rule)\n @repository[name] = rule\n end", "title": "" }, { "docid": "43d402d25a484e1dd3c81d6f0291d41c", "score": "0.53450733", "text": "def store(key, process, options)\n match_regex?(key, validator.datas[key], options[:regex]) if(options.has_key?(:regex))\n super(key, process, options)\n end", "title": "" }, { "docid": "7e057b90ce1240ee9bd82c92d0de693d", "score": "0.5336964", "text": "def add_parameterized_rules(field, rules)\n rules.each_pair do |key, params|\n add_single_rule(field, key, params)\n end\n end", "title": "" }, { "docid": "77eb717e23d2b5e189e831a44c0da985", "score": "0.53336215", "text": "def validate_key_uniqueness\n self.errors.add :key if Setting.find_by_context_and_key(self[:context], self[:key]).present?\n end", "title": "" }, { "docid": "bc2a8a033b8dae8a571f41a16a2d1951", "score": "0.53207517", "text": "def delay_validation(key, callback)\n -> do\n val = callback.()\n assert_valid(key, val)\n val\n end\n end", "title": "" }, { "docid": "1fbbd12d58db31422e39b3c723b2b189", "score": "0.53143734", "text": "def reg_key(key, &proc)\n @keys[key] = proc\n true\n end", "title": "" }, { "docid": "1fbbd12d58db31422e39b3c723b2b189", "score": "0.53143734", "text": "def reg_key(key, &proc)\n @keys[key] = proc\n true\n end", "title": "" }, { "docid": "6df55433a259cebdf7756db3cd66ebbe", "score": "0.5307933", "text": "def apply_regexp_constraint(key, constraint)\n ### New code to handle multiple elements (beware!)\n if Array(@form[key]).length > 1\n index = 0\n Array(@form[key]).each do |value|\n m = constraint.match(@form[key][index].to_s)\n if m\n if untaint?(key)\n @form[key][index] = m[0]\n @form[key][index].untaint\n end\n else\n @form[key].delete_at(index)\n @invalid_fields[key] ||= []\n unless @invalid_fields[key].include?(constraint.inspect)\n @invalid_fields[key].push(constraint.inspect)\n end\n nil\n end\n index += 1\n end\n ### End new code\n else\n m = constraint.match(@form[key].to_s)\n if m\n if untaint?(key)\n @form[key] = m[0]\n @form[key].untaint\n end\n else\n @form.delete(key)\n @invalid_fields[key] ||= []\n unless @invalid_fields[key].include?(constraint.inspect)\n @invalid_fields[key].push(constraint.inspect)\n end\n nil\n end\n end\n end", "title": "" }, { "docid": "42bc6d37d90f7024cedc6a8d5e724af4", "score": "0.5302789", "text": "def validations_for(key)\n setting_validations = {}\n Settler.load! if config.nil?\n (setting = config[key.to_s]) ? setting['validations'] || {} : {}\n end", "title": "" }, { "docid": "37227c1edde7294c9fedda4210bae923", "score": "0.5275982", "text": "def register(key, lifetime_scope = :instance_per_request, &block)\n end", "title": "" }, { "docid": "ae47d96c62f03d4e73b01fdb5340460d", "score": "0.52694213", "text": "def add_validation(*params, &block)\n validation = Validation.new(*params, &block)\n\n validation.attributes.each do |attribute|\n @validations[attribute] << validation if attribute.is_a? Symbol\n end\n end", "title": "" }, { "docid": "7db62f266cd2114b027c994ee63bac8d", "score": "0.52650833", "text": "def rule(method, matcher)\n @rules[method] = matcher\n end", "title": "" }, { "docid": "85dba463fa8a63f5dda2f15ce25e0bb8", "score": "0.5258445", "text": "def accept_rule(rule)\n end", "title": "" }, { "docid": "4c1aa6d06e86f68201878dcf701542e3", "score": "0.5258444", "text": "def validations_for key\n (errors.keys + warnings.keys + ok.keys).select do |x|\n x.to_s.starts_with? key\n end\n end", "title": "" }, { "docid": "5d21120483a403f703c07cd4e687cb7f", "score": "0.52480084", "text": "def add_rule(rule_id)\n @rule_ids << rule_id\n end", "title": "" }, { "docid": "5d21120483a403f703c07cd4e687cb7f", "score": "0.52480084", "text": "def add_rule(rule_id)\n @rule_ids << rule_id\n end", "title": "" }, { "docid": "dd849e3ed55848bd6146e22d81d6e892", "score": "0.52123505", "text": "def apply_hash_constraint(key, constraint)\n name = constraint[\"name\"]\n action = constraint[\"constraint\"]\n params = constraint[\"params\"]\n res = false\n skip_end = false\n\n # In order to call a builtin or proc, params and action must be present.\n if action and params\n arg = params.map {|m| @form[m]}\n if String === action\n res = self.send(\"match_#{action}\".intern, *arg)\n elsif Proc === action\n res = action.call(*arg)\n end\n end\n\n if Regexp === action\n ### New code to handle multiple elements (beware!)\n if Array(@form[key]).length > 1\n index = 0\n skip_end = true\n Array(@form[key]).each do |value|\n m = action.match(value)\n res = m[0] if m\n if res\n @form[key][index] = res if untaint?(key)\n else\n @form[key].delete_at(index)\n constraint = (name) ? name : constraint\n @invalid_fields[key] ||= []\n unless @invalid_fields[key].include?(constraint)\n @invalid_fields[key].push(constraint) \n end\n nil\n end\n index += 1\n end\n ### End new code\n else\n m = action.match(@form[key].to_s)\n res = m[0] if m\n end\n end\n\n if not skip_end\n if res\n @form[key] = res if untaint?(key)\n else\n @form.delete(key)\n constraint = (name) ? name : constraint\n @invalid_fields[key] ||= []\n unless @invalid_fields[key].include?(constraint)\n @invalid_fields[key].push(constraint) \n end\n nil\n end\n end\n end", "title": "" }, { "docid": "6184b9695d2f7e6587624a9e12970b20", "score": "0.5204562", "text": "def add_pattern(key, pattern)\n @patterns[key.to_sym] = pattern\n end", "title": "" }, { "docid": "d5e93f7d521716e12e78399cd3038e3f", "score": "0.52037776", "text": "def next_race_key_validation\n return true if self.key == 'next_race'\n self.errors.add(:key, \"must specify 'next_race' as API key\")\n false\n end", "title": "" }, { "docid": "e00627fbb0d71516cf3defc42e2784e3", "score": "0.5196864", "text": "def validate_hook(value, rule, path, errors)\n case rule.name\n when 'DiskURL'\n begin\n arr = URI.split(value)\n if arr[0] != \"disk\"\n msg = \"Should have protocol disk: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if arr[2] == \"\"\n msg = \"Should have host specified: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if arr[5] == \"\"\n msg = \"Should have path specified: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n rescue URI::InvalidURIError\n msg = \"Should be a valid URI: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n when 'FQDN'\n subregex = /[a-zA-Z0-9\\-]{1,63}/\n endregex = /[\\-]\\z/\n startregex = /\\A[\\-]/\n numberregex = /\\A\\d+\\z/\n\n if value.length > 254\n msg = \"Should be a shorter than 254 characters: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n\n arr = value.split(\".\")\n if arr.length < 2\n msg = \"Must contain 2 or more subdomains: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if arr.last.length < 2\n msg = \"Last subdomain must be more than 1 character: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n arr.each do |dn|\n if dn[subregex].nil?\n msg = \"Can only contain _-A-Za-z0-9: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if !dn[endregex].nil?\n msg = \"Last character can not be - or _: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if !dn[startregex].nil?\n msg = \"First character can not be - or _: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n if !dn[numberregex].nil?\n msg = \"Subdomain can not be only numbers: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n end\n when 'Email'\n regex = /\\A([\\w\\!\\#$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\`{\\|\\}\\~]+\\.)*[\\w\\!\\#$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\`{\\|\\}\\~]+@((((([a-z0-9]{1}[a-z0-9\\-]{0,62}[a-z0-9]{1})|[a-z])\\.)+[a-z]{2,6})|(\\d{1,3}\\.){3}\\d{1,3}(\\:\\d{1,5})?)\\z/\n if value[regex].nil?\n msg = \"Should be an Email Address: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n when 'DomainName'\n # http://tools.ietf.org/html/rfc1034#section-3.5\n label = /[a-z]([a-z0-9\\-]{0,61}[a-z0-9])?/i\n regex = /\\A#{label}(\\.#{label})*\\z/\n if value[regex].nil?\n msg = \"Should be a Domain Name: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n when 'IpAddress'\n regex = /\\A(?:25[0-5]|(?:2[0-4]|1\\d|[1-9])?\\d)(?:\\.(?:25[0-5]|(?:2[0-4]|1\\d|[1-9])?\\d)){3}\\z/\n if value[regex].nil?\n msg = \"Should be an IP Address: #{value}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n when 'IpAddressMap'\n regex = /\\A(?:25[0-5]|(?:2[0-4]|1\\d|[1-9])?\\d)(?:\\.(?:25[0-5]|(?:2[0-4]|1\\d|[1-9])?\\d)){3}\\z/\n value.each_key do |key|\n if key[regex].nil?\n msg = \"Should be an IP Address: #{key}\"\n errors << Kwalify::ValidationError.new(msg, path)\n end\n end\n end\n end", "title": "" }, { "docid": "58a742b29d92bf0a793d46315261f195", "score": "0.51923835", "text": "def add_rule(name, regex)\n @rules << Rule.new(name, regex)\n end", "title": "" }, { "docid": "03a4a4bc336a3c8454e8c9b9f9d4eced", "score": "0.5187702", "text": "def add_replacement(keyword, replacement)\n @rules[keyword] ||= Rule.new(keyword)\n @rules[keyword] << replacement\n end", "title": "" }, { "docid": "d73c93dd812a4257f4565840ea508622", "score": "0.51726747", "text": "def read_attribute_for_validation(key)\n send(key)\n end", "title": "" }, { "docid": "1ce17eabdfa0815f7ee43f49c6d1c70d", "score": "0.515746", "text": "def register(key, callable)\n actions[key] = callable\n end", "title": "" }, { "docid": "fa8d3d811848995a792b6ce9c7d0d378", "score": "0.51566637", "text": "def add_rule(rule = {})\n @lock.synchronize do\n # Temporarily disable warnings regarding IGNORECASE flag\n verbose = $VERBOSE\n $VERBOSE = nil\n pattern = Regexp.new(rule[:pattern], Regexp::IGNORECASE)\n $VERBOSE = verbose\n\n @database.find_or_create_by(\n :resource => rule[:resource].to_s,\n :pattern => pattern.source,\n :response => rule[:response]\n ).id\n end\n end", "title": "" }, { "docid": "2b0940f16c4932f518106e170f979046", "score": "0.5147786", "text": "def key_validator\n KeyValidator.new(key_map: key_map + parent_key_map)\n end", "title": "" }, { "docid": "505ae9d7abb4d21057ceee532aa52b59", "score": "0.5134076", "text": "def add_rule(brand, length, prefixes, skip_validation = false)\n prefixes = Array.wrap(prefixes)\n length = Array.wrap(length)\n rules[brand] = [] if rules[brand].blank?\n rules[brand] << {length: length, regexp: compile_regexp(prefixes), prefixes: prefixes, skip_validation: skip_validation}\n #create methods like visa? mastercard? etc\n class_eval <<-BOOLEAN_RULE, __FILE__, __LINE__\n def #{brand}?\n valid?(:#{brand})\n end\n BOOLEAN_RULE\n end", "title": "" }, { "docid": "38cdb87f046b43197944f02ad042d942", "score": "0.5118702", "text": "def validators\n @validators ||= Settler.validations_for(key)\n end", "title": "" }, { "docid": "7a91773c258ed53a3a9cd360214deb79", "score": "0.510882", "text": "def add_rule(var, statement)\n @rules[var] ||= []\n @rules[var].push(statement)\n end", "title": "" }, { "docid": "c2b93f727d897d580c24393ccc912e32", "score": "0.5106722", "text": "def check_key_valid; end", "title": "" }, { "docid": "eec6ddac57610f8f326fff072654ebdf", "score": "0.50986266", "text": "def rule name, regexp, data = {}, &block\n rules[name] = Rule.new regexp, data, block || after\n end", "title": "" }, { "docid": "042ee3b647a45d720957c1baa3fe0573", "score": "0.5092056", "text": "def validate!\n KEYS.has_key?(@key)\n end", "title": "" }, { "docid": "e9cd26a1f2a708fa2c14c14d3e69f532", "score": "0.50814396", "text": "def add_rule name\n @patterns << name\n end", "title": "" }, { "docid": "db57d42986af13e8069feac076f67288", "score": "0.5077512", "text": "def add_rule(rule)\n raise ArgumentError, \"Rule must be instance of 'Rule'\" unless rule.is_a?(Rule)\n @rules << rule\n end", "title": "" }, { "docid": "f174a71afa1ad579b40943438320aebf", "score": "0.50674653", "text": "def add_error(key, message)\n if errors.key?(key)\n errors[key] << message\n else\n errors[key] = [message]\n end\n end", "title": "" }, { "docid": "1c7b508de5bda9094b457bf887510967", "score": "0.50528777", "text": "def required_key(key, options={}, &block)\n options[:required] = true\n # Pass on processing to given_key with :required => true option\n given_key(key, options, &block)\n rescue Exception => e\n validation_error(\"#{e.message}\")\n end", "title": "" }, { "docid": "f8e8c77d074a85ea9f78f6f9fda317e5", "score": "0.5043997", "text": "def [] key\n case key\n when Entity\n @rules.find {|i| i.eql? key }\n when String\n @rules.find {|i| i.to_s == key }\n else raise ArgumentError\n end\n end", "title": "" }, { "docid": "35cd0a75214ebcd0836459f2c252c5d1", "score": "0.5037764", "text": "def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end", "title": "" }, { "docid": "35cd0a75214ebcd0836459f2c252c5d1", "score": "0.5037764", "text": "def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end", "title": "" }, { "docid": "9c9feadd0808f77f6ba976e7a3986be7", "score": "0.5030011", "text": "def define_validation_hook\n owner_class.set_callback(:validation, :around, self, prepend: true)\n end", "title": "" }, { "docid": "c4a48b68d1beae696c1811a4155ac1f7", "score": "0.5025968", "text": "def register_rule(name, options)\n self.holiday_rules = holiday_rules.merge(\n name.to_sym => IsBusinessDay::HolidayRule.new(name, options)\n )\n end", "title": "" }, { "docid": "ce5fdd38f412c7fe7d3f24c1bc4f2d00", "score": "0.5024247", "text": "def add_key(key)\n @mpw.add_key(key)\n @mpw.write_data\n\n puts I18n.t('form.add_key.valid').to_s.green\n rescue => e\n puts \"#{I18n.t('display.error')} #13: #{e}\".red\n end", "title": "" }, { "docid": "158dbd7d7886138a2621b3f3da59b7b5", "score": "0.50145185", "text": "def add key, val\n @style[key] = val\n self\n end", "title": "" }, { "docid": "4496ad13c8b2d5a8a310dec1afe386a8", "score": "0.5007877", "text": "def rule=(value)\n @rule = value\n end", "title": "" }, { "docid": "6f77f26661ee83cae0625103314831b7", "score": "0.49981123", "text": "def validate_phone_model_key()\n if ! PhoneModelKey.exists?( :id => self.phone_model_key_id )\n errors.add( :phone_model_key_id, \"is invalid.\")\n end\n end", "title": "" }, { "docid": "b1cc0354f80056a3f564f0784069d35a", "score": "0.49913365", "text": "def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end", "title": "" }, { "docid": "aea64a390d928ad960bc47afec888352", "score": "0.4983637", "text": "def validate_source_key(key)\n unless config[:valid_source_keys].include?(key)\n raise \"#{INVALID_SOURCE_MESSAGE} #{config[:valid_source_keys]}.\"\n end\n\n key\n end", "title": "" }, { "docid": "d1971913e552aaf4c2183850c7dfc8bd", "score": "0.49624154", "text": "def t_scoped(key, *args, **kwargs)\n I18n.t(\"course.assessment.question_bundle_assignments.validations#{key}\", *args, **kwargs)\n end", "title": "" }, { "docid": "a29a931182fbe9515dda38998fc1c812", "score": "0.49597836", "text": "def validation_error(message_key)\n violation = Aequitas::Violation\n .new(@invitation, I18n::t(message_key))\n @invitation.errors[:invited_id] << violation\n raise InvalidResource\n end", "title": "" }, { "docid": "f31aec730b5194cb17ac0ef3ec292d0b", "score": "0.495769", "text": "def define_validate(name)\n define_method :\"validate_#{name}!\" do |value|\n __send__(:\"validate_#{name}_type\", value)\n __send__(:\"validate_#{name}_one_of\", value)\n __send__(:\"validate_#{name}_assertion\", value)\n end\n private :\"validate_#{name}!\"\n end", "title": "" }, { "docid": "73ff17364957075d9d139c308c410b80", "score": "0.49451536", "text": "def apply_proc_constraint(key, constraint)\n if res = constraint.call(@form[key])\n if untaint?(key)\n @form[key] = res \n @form[key].untaint\n end\n else\n @form.delete(key)\n @invalid_fields[key] ||= []\n unless @invalid_fields[key].include?(constraint.inspect)\n @invalid_fields[key].push(constraint.inspect)\n end\n nil\n end\n end", "title": "" }, { "docid": "a6fd6d06b80285eaa5210719e7c11a4c", "score": "0.49428195", "text": "def read_attribute_for_validation(key)\n respond_to?(key) ? send(key) : self[key]\n end", "title": "" }, { "docid": "a6fd6d06b80285eaa5210719e7c11a4c", "score": "0.49428195", "text": "def read_attribute_for_validation(key)\n respond_to?(key) ? send(key) : self[key]\n end", "title": "" }, { "docid": "8da1c5b4a9a16d45a4d4899532315fa2", "score": "0.49320552", "text": "def validate!\n [:rr_name, :type, :ttl, :resource_records].each { |f| self.send(f) }\n end", "title": "" }, { "docid": "414c6122732d9052b517e52562c6c494", "score": "0.49282897", "text": "def add(key, error)\n self[key].push(error)\n self\n end", "title": "" } ]
56135cc615ecf86813aa3b30ab142ce5
Allows access to the process ids created by the runner.
[ { "docid": "0ff365de5d8fb82384279d9f6e67f5c6", "score": "0.7259227", "text": "def pids\n @pids ||= []\n end", "title": "" } ]
[ { "docid": "5625276bb4967d94f31ae72352bdf293", "score": "0.7377363", "text": "def pids\n list = []\n @processes.each do |p|\n list.push(p.pid)\n end\n list\n end", "title": "" }, { "docid": "8a255a1bd4640dc9f7e11243b979aa33", "score": "0.71878374", "text": "def biz_process_ids\n biz_processes.map { |bp| bp.id }\n end", "title": "" }, { "docid": "8a255a1bd4640dc9f7e11243b979aa33", "score": "0.71878374", "text": "def biz_process_ids\n biz_processes.map { |bp| bp.id }\n end", "title": "" }, { "docid": "09069576ccb65983129b98584ecba736", "score": "0.71692574", "text": "def process_id; end", "title": "" }, { "docid": "4b856b6a14ae0372fe50ce28d39c30fb", "score": "0.7133667", "text": "def pids\n @pids_lock.synchronize { @pids }\n end", "title": "" }, { "docid": "0e84aa4cea7cc9af7d0fa9654271c51f", "score": "0.7117409", "text": "def process_id\n return @process_id\n end", "title": "" }, { "docid": "0e84aa4cea7cc9af7d0fa9654271c51f", "score": "0.7117409", "text": "def process_id\n return @process_id\n end", "title": "" }, { "docid": "c291a5b3d58e454b7b20e3d07166e893", "score": "0.7011233", "text": "def child_pids\n reap_all\n pids = []\n @jobs.each {|job| pids.push(job.pid) if job.pid}\n pids\n end", "title": "" }, { "docid": "0f55f6537c6c53039b8b139118fdde94", "score": "0.7007364", "text": "def pids\n @mutex.synchronize { @pids.dup }\n end", "title": "" }, { "docid": "dabdd1093fff7f829047d5a5e13b49f8", "score": "0.69972116", "text": "def pids\n @pids ||= {}\n end", "title": "" }, { "docid": "d8b882c7969bb261c89aa96700225764", "score": "0.6967271", "text": "def pid\n @runner.pid\n end", "title": "" }, { "docid": "48e5030dc9480decfd59dfc2d3080432", "score": "0.68432826", "text": "def workers_pids\n pgrep_result = `pgrep -f '#{WORKER_CMDLINE_PATTERN}'`.split(\"\\n\")\n return unless $CHILD_STATUS.success?\n\n pgrep_result\n end", "title": "" }, { "docid": "cb7a61aee9fe3815100354ceeb893f8a", "score": "0.6818007", "text": "def pids\n cmd = [\"pgrep\", \"-x\", process_name]\n hash = run_shell_command(cmd)\n out = hash[:out]\n\n if out.nil? || out == \"\"\n []\n else\n out.split($-0).map do |pid|\n if pid.nil? || pid == \"\"\n nil\n else\n pid.to_i\n end\n end.compact\n end\n end", "title": "" }, { "docid": "b9a4cc2dd31b355b107cfeb3dc95d62e", "score": "0.68118775", "text": "def pid\n @process.pid\n end", "title": "" }, { "docid": "ee2d96c2611376b9cb437546244acc0d", "score": "0.6779983", "text": "def pid\n @process.pid\n end", "title": "" }, { "docid": "ee2d96c2611376b9cb437546244acc0d", "score": "0.6779983", "text": "def pid\n @process.pid\n end", "title": "" }, { "docid": "a00805d33afe4e449a3ebf8a2fd723b0", "score": "0.67730904", "text": "def process_id\n attributes.fetch(:processId)\n end", "title": "" }, { "docid": "72338a0e17fd9122acb09e53e78fa4a3", "score": "0.6739187", "text": "def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end", "title": "" }, { "docid": "34208b62ccdaf279424ea1f85316bf93", "score": "0.66897315", "text": "def pid\n Process.pid\n end", "title": "" }, { "docid": "21898ba3fd5d346416e2255a8bbc7392", "score": "0.6679164", "text": "def worker_pids\n @state.worker_pids ||= {}\n end", "title": "" }, { "docid": "4c53c0bb7245a958877bdf5ab622327e", "score": "0.6662895", "text": "def processes\n pids = []\n cgroup_paths.each do |subsys, path|\n begin\n pids << File.read(File.join(path, \"tasks\")).split.map { |pid| pid.to_i }\n rescue Errno::ENOENT\n end\n end\n pids.flatten.uniq\n end", "title": "" }, { "docid": "d8207094c82b5674a135d974ea601569", "score": "0.6651486", "text": "def linux_worker_pids\n get_worker_pids('ps -A -o pid,command')\n end", "title": "" }, { "docid": "66cb52cba32b43dbf76d9286e4a592a1", "score": "0.6635585", "text": "def nodes_pids\n # Try to fetch node info from running cluster\n nodes = JSON.parse(http_object.get('/_nodes/?process').body) rescue []\n # Fetch pids from returned data\n nodes.empty? ? nodes : nodes['nodes'].map { |_, info| info['process']['id'] }\n end", "title": "" }, { "docid": "3b8133eb257e028776569ed953857e9f", "score": "0.6634991", "text": "def pids\n workers.keys\n end", "title": "" }, { "docid": "1084806a86ba2c14dd1aab9b58b05b87", "score": "0.6619362", "text": "def pid\n Process.pid\n end", "title": "" }, { "docid": "ffab3d1029f7b2c1dfcbd0389f6e88ee", "score": "0.6616086", "text": "def windows_worker_pids\n lines = `tasklist /FI \"IMAGENAME eq ruby.exe\" /FO list`.encode(\"UTF-8\", Encoding.locale_charmap).split($/)\n\n lines.select! { |line| line =~ /^PID:/}\n lines.collect!{ |line| line.gsub(/PID:\\s+/, '') }\n end", "title": "" }, { "docid": "3758d31081944ccbf5b57e5566913a87", "score": "0.66090745", "text": "def process_id=(value)\n @process_id = value\n end", "title": "" }, { "docid": "3758d31081944ccbf5b57e5566913a87", "score": "0.66090745", "text": "def process_id=(value)\n @process_id = value\n end", "title": "" }, { "docid": "9269f45c7100d14f1016113e1e44081e", "score": "0.66002154", "text": "def windows_worker_pids\n tasklist_output = `tasklist /FI \"IMAGENAME eq ruby.exe\" /FO list`.encode(\"UTF-8\", Encoding.locale_charmap)\n tasklist_output.split($/).select { |line| line =~ /^PID:/ }.collect { |line| line.gsub(/PID:\\s+/, '') }\n end", "title": "" }, { "docid": "db80d8d0735b3bb2ba807bb11148b823", "score": "0.6597881", "text": "def get_pid\n @pid = `pidof #{process_name}`.delete(\"\\n\")\n end", "title": "" }, { "docid": "28902cd3d11853ab25703645bf5e8c4f", "score": "0.65911573", "text": "def __get_pids\n __get_pidfiles.map { |pidfile| File.read(pidfile).to_i }.uniq\n end", "title": "" }, { "docid": "865094be73d27d674acea25d6a512b75", "score": "0.65859646", "text": "def running_procs\n @processes.keys\n end", "title": "" }, { "docid": "5f9806e104fb668a401e1c5e5d3ce8f1", "score": "0.65840435", "text": "def get_pids\n pids_ports = []\n pids = `pgrep -f thin`.split\n pids.each do |t|\n #port = `lsof -p #{t} | grep LISTEN`.split[8]\n #port = port.split(\":\")[1]\n port = `ps -ef | grep #{t} | grep -v grep | grep thin | awk '{ print $10 }' | awk -F: '{ print $2 }' | tr --delete '()'`.chomp\n pids_ports << [t,port]\n end\n pids_ports\n end", "title": "" }, { "docid": "e5c9b431b374b2ca4b18f89af36a4574", "score": "0.65240324", "text": "def current_pid\n Process.pid\n end", "title": "" }, { "docid": "38152851d00fcc6e95cbbdb646568252", "score": "0.64821875", "text": "def child_pids(parent_pid)\n process_list = %x{ps -eo pid,ppid | grep #{parent_pid}}.split(\"\\n\")\n process_list.map(&:strip).find_all{|pr| pr.split.last == parent_pid.to_s }.map{|pr| pr.split.first.strip.to_i }\n end", "title": "" }, { "docid": "46df2f5b3283614987cb270549bab537", "score": "0.6455413", "text": "def child_pids\n return [] if is_child\n @child_pids ||= []\n tmp_ids = []\n for id in @child_pids\n next if id.to_i == Process.pid\n begin\n Process.kill(0, id)\n tmp_ids << id\n rescue Errno::ESRCH\n end\n end\n @child_pids = tmp_ids if @child_pids != tmp_ids\n @child_pids\n end", "title": "" }, { "docid": "ef703c5466a47e7408182c62e53e12c5", "score": "0.64069265", "text": "def spotify_helper_pids\n `pgrep \"Spotify Helper\"`.split.map(&:to_i)\nend", "title": "" }, { "docid": "7c9a4b63c05d281e71aad0be9323e0ef", "score": "0.6402378", "text": "def pid\n ['PID:', OSX::NSProcessInfo.processInfo.processIdentifier.to_s]\n end", "title": "" }, { "docid": "d4159bf41d66ad7df21cf85c6e39ff5f", "score": "0.6396118", "text": "def child_pids\n @child.keys\n end", "title": "" }, { "docid": "2c6be521a8291e838563838e9806f57b", "score": "0.6372407", "text": "def process_list()\n return @process_list\n end", "title": "" }, { "docid": "287bff1b5ac721b1757b74bea4780842", "score": "0.63648397", "text": "def this_process\n process = RLPS.processes.select { |p| p.pid == ::Process.pid }\n RLPS::Process.new name: process[0].name, pid: ::Process.pid\n end", "title": "" }, { "docid": "dbb97c6525106ba6d48a3dd4b79ca74b", "score": "0.6355884", "text": "def pid\n @pid ||= Process.pid\n end", "title": "" }, { "docid": "dbb97c6525106ba6d48a3dd4b79ca74b", "score": "0.6355884", "text": "def pid\n @pid ||= Process.pid\n end", "title": "" }, { "docid": "f68f901602316ed8c80c5630d6d0ea8e", "score": "0.63451475", "text": "def get_process_pids(image_name)\n pid_array = Array.new\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n pid_array << line.split(/ +/)[1]\n end\n end\n return pid_array\n end", "title": "" }, { "docid": "7e811b5363ccac81500382a780bda8e6", "score": "0.6342221", "text": "def list_processes\n @process.keys\n end", "title": "" }, { "docid": "a109e956a47c50f7910d16cd0c101f9e", "score": "0.63011694", "text": "def processes\n return @processes\n end", "title": "" }, { "docid": "9c73f442d6d6ffc455bf0ab8f4aaf9af", "score": "0.6293255", "text": "def child_pids(pid)\n\tkids = []\n\tDir.foreach('/proc') do |entry|\n\t\tnext unless entry =~ /^\\d+$/\n\t\tnext if parent_pid(entry) != pid\n\t\tkids << entry.to_i\n\tend\n\tkids\nend", "title": "" }, { "docid": "fa566c073c6ff6996c81d30170cc8526", "score": "0.62918586", "text": "def passenger_pids\n pids = %x(#{'rvmsudo ' if @rvmsudo}passenger-status).split(\"\\n\").map { |l| l[/PID: (\\d+)/, 1] }.compact.map(&:to_i)\n if $?.success?\n pids\n else\n warn \"passenger-status returned a #{$?.exitstatus} exit code. Please check if passenger-status is working properly.\"\n nil\n end\n end", "title": "" }, { "docid": "dd7f4999a6f362a302310f28ab56e5dc", "score": "0.6291612", "text": "def worker_pids\n Unicorn::HttpServer::WORKERS.keys\n end", "title": "" }, { "docid": "d85a695dab2bd30904830fdcdfcf0af5", "score": "0.62850285", "text": "def get_processes(setsid)\n proclist = Sys::ProcTable.ps\n result = []\n proclist.each do |proc|\n next if proc.pid == Process.pid\n if (Struct::ProcTableStruct.method_defined?(:session))\n result << proc if proc.session == setsid\n elsif (Struct::ProcTableStruct.method_defined?(:pgid))\n result << proc if proc.pgid == setsid\n end\n end\n result\nend", "title": "" }, { "docid": "21c0a324d92cabc8f1090ccb686e8cfe", "score": "0.62727606", "text": "def ps!\n retrieve_processes\n end", "title": "" }, { "docid": "21c0a324d92cabc8f1090ccb686e8cfe", "score": "0.62727606", "text": "def ps!\n retrieve_processes\n end", "title": "" }, { "docid": "21c0a324d92cabc8f1090ccb686e8cfe", "score": "0.62727606", "text": "def ps!\n retrieve_processes\n end", "title": "" }, { "docid": "44c25d6855bc90e4a673a1d6f69e5d22", "score": "0.62624663", "text": "def get_pids(name)\n pids = `ps awwx | grep #{name} | grep -v grep | awk '{print $1}'`\n result = []\n pids.split(\"\\n\").each do |pid|\n pid.gsub!(/\\s+/, \"\")\n result.push(pid.to_i)\n end\n return result\n end", "title": "" }, { "docid": "e3eda27d03c0a3210efac55ced17e3a2", "score": "0.6252574", "text": "def linux_worker_pids\n `ps -A -o pid,command | grep -E \"[r]esque:work|[r]esque:\\sStarting|[r]esque-[0-9]\" | grep -v \"resque-web\"`.split(\"\\n\").map do |line|\n line.split(' ')[0]\n end\n end", "title": "" }, { "docid": "1e12bea66593aa5f36115b9c7546c6dc", "score": "0.6248877", "text": "def processes\n @processes ||= ProcessSet.new self\n end", "title": "" }, { "docid": "bd4bfa36d170b24b78666c8da9c78c1a", "score": "0.62414765", "text": "def created_processable_ids_for_stage_position(current_position)\n all_statuses_grouped_by_stage_position[current_position]\n .to_a\n .select { |processable| processable[:status] == 'created' }\n .map { |processable| processable[:id] }\n end", "title": "" }, { "docid": "1c68093f8785506c8d8d3cf21952e5d5", "score": "0.62399924", "text": "def child_processes\n @child_processes ||= []\n end", "title": "" }, { "docid": "02bff3857b3a2851e8126d0f11c4cb0e", "score": "0.6231351", "text": "def proc_id\n running? ? @proc.id.to_i : nil\n end", "title": "" }, { "docid": "9cfcbc2966d17b8624bbd88bf1c27f5c", "score": "0.6228301", "text": "def ppid\n @proc.ppid\n end", "title": "" }, { "docid": "d591fe4cf32619b7d49b01f603d04a33", "score": "0.62202156", "text": "def pidlist\n processes = `ps -C mplayer -o pid,cmd | grep -v defunct`.split(\"\\n\")[1..-1]\n processes.map { |p| p.split[0].to_i }\nend", "title": "" }, { "docid": "c8a40dd30fa63cea6aee4e8eb579c43c", "score": "0.62192374", "text": "def pid\n @pid\n end", "title": "" }, { "docid": "c8a40dd30fa63cea6aee4e8eb579c43c", "score": "0.62192374", "text": "def pid\n @pid\n end", "title": "" }, { "docid": "c8a40dd30fa63cea6aee4e8eb579c43c", "score": "0.62192374", "text": "def pid\n @pid\n end", "title": "" }, { "docid": "c8a40dd30fa63cea6aee4e8eb579c43c", "score": "0.62192374", "text": "def pid\n @pid\n end", "title": "" }, { "docid": "c403495c4f121d23b78d5876c5948a1d", "score": "0.62147397", "text": "def orphaned_processes\n processes = RuoteGlobals.host.engine.processes\n job_registry = RuoteGlobals.job_registry\n rjids = []\n processes.map do |process|\n rjid = process.wfid\n job = job_registry.job_for_rjid(rjid)\n rjids << process unless job\n end\n rjids\n end", "title": "" }, { "docid": "1f705afe955dfd04c8dc19cafb075948", "score": "0.6188132", "text": "def id\n\t\t\traise RuntimeError.new(\"No processes in group, no group id available.\") if @running.size == 0\n\t\t\t\n\t\t\t-@pgid\n\t\tend", "title": "" }, { "docid": "4d546b8be1101af815f0666188edcc1a", "score": "0.61803687", "text": "def get_processes()\n active_build_users.map do |user|\n pids = `pgrep -u #{user.shellescape}`\n .strip.split(\"\\n\")\n .map(&:to_i)\n .sort\n path = get_out_path(user, pids.first)\n\n [\n user,\n [path, pids]\n ]\n end\nend", "title": "" }, { "docid": "dd917bdc38c94d2e08d72f55932ce597", "score": "0.6176183", "text": "def parent_process_id\n return @parent_process_id\n end", "title": "" }, { "docid": "0f2cb88e9b262fc043e18df29cc5ef47", "score": "0.6169415", "text": "def pid\n @pid.pid\n end", "title": "" }, { "docid": "7e213bf3235530562541ec66bde3c700", "score": "0.6167754", "text": "def process_ids\n\n @context.storage.expression_wfids({})\n end", "title": "" }, { "docid": "3130cbb55daea50e05a43fa9cceb54a1", "score": "0.6167068", "text": "def pid\n @pid\n end", "title": "" }, { "docid": "4ba8d9babe56f376127486e6a4001010", "score": "0.61548144", "text": "def pid\n @config_manager['task.pid']\n end", "title": "" }, { "docid": "f8942475f2cbe773e6ec5454e4c01b92", "score": "0.6152977", "text": "def report_pid\n @process[:report_pid]\n end", "title": "" }, { "docid": "572c179cb846009f4fac699963faf22e", "score": "0.6102422", "text": "def pid\n status.pid\n end", "title": "" }, { "docid": "8ec5becdfc34b73d0e3bacede8f1142f", "score": "0.6065701", "text": "def id\n @pid ||= Process.pid\n @id ||= SecureRandom.uuid\n\n # Check if runtime has changed, e.g. forked.\n if Process.pid != @pid\n @pid = Process.pid\n @id = SecureRandom.uuid\n end\n\n @id\n end", "title": "" }, { "docid": "e34b58f205dbdcd06989bc5b0aa64ab7", "score": "0.60642505", "text": "def host_id; process_client.host_id end", "title": "" }, { "docid": "e34b58f205dbdcd06989bc5b0aa64ab7", "score": "0.60642505", "text": "def host_id; process_client.host_id end", "title": "" }, { "docid": "24b56aa650f8e5bb89ce5311100d91d1", "score": "0.6058417", "text": "def solaris_worker_pids\n get_worker_pids('ps -A -o pid,args')\n end", "title": "" }, { "docid": "bc4a4f40c2e6826da562b58c52a43494", "score": "0.6056527", "text": "def detectpid\nprocs = []\npid = nil\nusername = \"\"\nexistingProcs = []\ncmd = \"notepad.exe\"\n proc = client.sys.process.execute(cmd, nil, {'Hidden' => true })\nprint_good(\"notepad is #{proc.pid}\")\npid = proc.pid\nreturn pid\n\nend", "title": "" }, { "docid": "8f4d59d8d4fc7f91de10078982b34cb8", "score": "0.6047762", "text": "def uids\n @proc.uids\n end", "title": "" }, { "docid": "23a0fbbeae2ce1869f17f9f845f471f0", "score": "0.60390776", "text": "def pid\n\t\t\t\tProcessFile.recall(@daemon)\n\t\t\tend", "title": "" }, { "docid": "3b1c97fc6d36c230b0427e8479d9abf2", "score": "0.60352665", "text": "def pid\n return @args[:pid]\n end", "title": "" }, { "docid": "cd734d3a5ca26310de2fe55a491eef29", "score": "0.6035036", "text": "def get_pid\n return Mat::get_pid(@pid_file)\n end", "title": "" }, { "docid": "9a2afe2322ae3d5239ccf398bbf7e462", "score": "0.60088885", "text": "def pids\n @ids.each do |id|\n pid_file = @checks[id][:pid_file]\n if File.exists?(pid_file) && File.readable?(pid_file)\n puts id + ' : ' + Cyberengine.green(pid_file)\n else\n puts id + ' : ' + Cyberengine.red(pid_file)\n end\n end\nend", "title": "" }, { "docid": "384499961bdbac04ed6248b103400e53", "score": "0.60080194", "text": "def get_pid(task_name)\n command = Command::GetPid.new(task_name)\n Client.run(command)\n end", "title": "" }, { "docid": "b72518ae53f60ed2ea29ce7e013d0fc2", "score": "0.59986645", "text": "def task_ids\n tasks.map(&:id)\n end", "title": "" }, { "docid": "10c05e4e96749510920bef8e3efbea42", "score": "0.59943104", "text": "def procs\n cg = \"#{CGROUP}/#{@app}/cgroup.procs\"\n tgids = ria cg\n d \"INFO (cgroups): Current cgroup.procs is #{tgids.inspect}.\"\n return tgids # pids : Array of all process id(s) in resource controller\n end", "title": "" }, { "docid": "6262b7ae60f1c7fa7ec3e91e6dfa8433", "score": "0.59885675", "text": "def current_application_pid\n pid = Process.pid\n pid = ppid(pid) while ppid(pid) != 1\n pid\n end", "title": "" }, { "docid": "7d1e497d102882757aa4aaf84b4c89b4", "score": "0.59849185", "text": "def processes=(value)\n @processes = value\n end", "title": "" }, { "docid": "68d5d59da983e165d03ab5979ea1467c", "score": "0.59763646", "text": "def process_id\n @json['schedule']['params']['PROCESS_ID']\n end", "title": "" }, { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.597024", "text": "def pid; end", "title": "" }, { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.597024", "text": "def pid; end", "title": "" }, { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.597024", "text": "def pid; end", "title": "" }, { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.597024", "text": "def pid; end", "title": "" }, { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.597024", "text": "def pid; end", "title": "" }, { "docid": "fd6f071de291e0eb2d694cad4a28f415", "score": "0.5948787", "text": "def server_pid\n\t\treturn @pid\n\tend", "title": "" }, { "docid": "fd6f071de291e0eb2d694cad4a28f415", "score": "0.5948787", "text": "def server_pid\n\t\treturn @pid\n\tend", "title": "" }, { "docid": "b041cbb1d46247b5a33d3313112b23cd", "score": "0.5942472", "text": "def get_running_port_with_pid_map(goliath_env)\n ps_result = capture(\"ps aux | grep '[r]uby yep_app.rb -e #{goliath_env}' | grep -v grep\") rescue ''\n ps_result.split(\"\\n\").inject({}) do |port_with_pid_map, str|\n array = str.split(' ')\n port_with_pid_map[array[15].to_i] = array[1].to_i\n port_with_pid_map\n end\n end", "title": "" }, { "docid": "57ea94a56fe434c31708a1f15d7a53be", "score": "0.5930051", "text": "def pid\n expr('getpid()')\n end", "title": "" } ]
e3a16e5759b257195afba45d918ba9e6
Merge application metadata into meeting instance and return.
[ { "docid": "5a575dd56c67bb2c40f09bfe5deb0347", "score": "0.81933564", "text": "def merge_application_meeting_metadata(meeting)\n meeting[:Meeting][:ApplicationMetadata] = application_meeting_metadata(meeting)\n meeting\n end", "title": "" } ]
[ { "docid": "f290c857813704c078facdd10b0fc7a6", "score": "0.7051463", "text": "def application_meeting_metadata(meeting)\n {}\n end", "title": "" }, { "docid": "a3028660e10d3d0e9027f638b04df566", "score": "0.7001923", "text": "def merge_application_attendee_metadata(attendee)\n attendee[:Attendee][:ApplicationMetadata] = application_attendee_metadata(attendee)\n attendee\n end", "title": "" }, { "docid": "6aae2329a8e1591a4d3bb23c0753cf6b", "score": "0.6769418", "text": "def get_meeting\n @meeting = ChimeSdk::MeetingCoordinator.get_meeting(meeting_id)\n @meeting = merge_application_meeting_metadata(@meeting)\n end", "title": "" }, { "docid": "ab5775150442d760de5635c8ad4e961f", "score": "0.6072647", "text": "def create_attendee_from_meeting\n create_attendee\n @meeting = @meeting.merge(@attendee)\n @meeting = merge_application_attendee_metadata(@meeting)\n @meeting = merge_application_attendee_metadata(@meeting)\n @attendee = merge_application_attendee_metadata(@attendee)\n end", "title": "" }, { "docid": "1b50aae4ce25fa5aa7ea4a0822131caa", "score": "0.6066686", "text": "def create_meeting\n @meeting = ChimeSdk::MeetingCoordinator.create_meeting(meeting_request_id, tags: meeting_tags)\n @meeting = merge_application_meeting_metadata(@meeting)\n end", "title": "" }, { "docid": "237452a1b6af1ee4a153b84aaa92cf6a", "score": "0.5750371", "text": "def app_metadata\n Hash[\"time\" => time_tag, \"cmdline\" => \"#{$0} #{ARGV.join(' ')}\",\n \"robot_name\" => robot_name, \"robot_type\" => robot_type,\n \"app_name\" => app_name, \"app_dir\" => app_dir].merge(app_extra_metadata)\n end", "title": "" }, { "docid": "680ca3f3d3f4b7ac398282534aa60659", "score": "0.5634018", "text": "def refresh\n check_read_only\n new_app = @marathon_instance.apps.get(id)\n @info = new_app.info\n refresh_attributes\n self\n end", "title": "" }, { "docid": "fd1493302d868c7ec305eadc0cbc5784", "score": "0.5621488", "text": "def parse_app(data)\n temp_app = ProcessApp.find_or_create_by_id(data['id'])\n temp_app.description=data['description']\n temp_app.guid=data['guid']\n temp_app.name=data['name']\n temp_app.short_name=data['short_name']\n temp_app\n end", "title": "" }, { "docid": "275a0b59cbea7ef394999bcbd8a00254", "score": "0.5579806", "text": "def merge_metadata_into(data)\n merge_metadata_from_model_into(data)\n merge_metadata_from_controller_into(data)\n end", "title": "" }, { "docid": "9808e8b7a52abec4f7f698f1ae299af2", "score": "0.55550796", "text": "def get_meeting\n if @meeting\n @meeting\n else\n @local_result ? @local_result.meeting : '?'\n end\n end", "title": "" }, { "docid": "18bb9451f5ffbef021e9c7228386df54", "score": "0.5500509", "text": "def merge_metadata(existing_metadata, section, new_metadata); end", "title": "" }, { "docid": "5524ab6e0ec0d97a9176bc165a3e303d", "score": "0.54551625", "text": "def fetch_meeting_info\n response = self.server.api.get_meeting_info(self.meetingid, self.moderator_password)\n\n @participant_count = response[:participantCount]\n @moderator_count = response[:moderatorCount]\n @running = response[:running]\n @has_been_forcibly_ended = response[:hasBeenForciblyEnded]\n @start_time = response[:startTime]\n @end_time = response[:endTime]\n @attendees = []\n response[:attendees].each do |att|\n attendee = OnlineMeetingAttendee.new\n attendee.from_hash(att)\n @attendees << attendee\n end\n\n response\n end", "title": "" }, { "docid": "10c7d55506b7d26008186730613471f5", "score": "0.54168975", "text": "def application_attendee_metadata(attendee)\n {}\n end", "title": "" }, { "docid": "10c7d55506b7d26008186730613471f5", "score": "0.54168975", "text": "def application_attendee_metadata(attendee)\n {}\n end", "title": "" }, { "docid": "01fe2f21f96b2687eb4d39a9d9fefa80", "score": "0.53898585", "text": "def merge_metadata_from_model_into(data)\n @record.paper_trail_options[:meta].each do |k, v|\n assert_metadatum_key_is_permitted(k)\n data[k] = model_metadatum(v, data[:event])\n end\n end", "title": "" }, { "docid": "7b6c2c0675cdcb8b6ea9ed3f8abb428c", "score": "0.5368945", "text": "def fetch_meeting_info\n require_server\n\n response = self.server.api.get_meeting_info(self.meetingid, self.moderator_password)\n\n @participant_count = response[:participantCount]\n @moderator_count = response[:moderatorCount]\n @running = response[:running]\n @has_been_forcibly_ended = response[:hasBeenForciblyEnded]\n @start_time = response[:startTime]\n @end_time = response[:endTime]\n @attendees = []\n response[:attendees].each do |att|\n attendee = BigbluebuttonAttendee.new\n attendee.from_hash(att)\n @attendees << attendee\n end\n\n response\n end", "title": "" }, { "docid": "8625f84e0cc83a030b2d5b13e80408b4", "score": "0.5343833", "text": "def copy_application\n return if application.is_draft?\n copied_application = duplicate\n copied_application.assign_attributes(hash_app_data)\n copied_application.save!\n initialize(copied_application)\n sync_family_members_with_applicants\n copied_application\n end", "title": "" }, { "docid": "cee80170aac443f64de8631cb7875a74", "score": "0.5296238", "text": "def meta(metadata)\n pending_metadata.merge! metadata\n end", "title": "" }, { "docid": "484d24f0ac6b6e2467ba589e0963cf73", "score": "0.5246151", "text": "def list_meetings\n @meetings = ChimeSdk::MeetingCoordinator.list_meetings(prefix_filter: meeting_request_id)\n @meetings = @meetings.map { |meeting| merge_application_meeting_metadata(meeting) }\n end", "title": "" }, { "docid": "38e1715b37e076edcade24b3d0252957", "score": "0.5195124", "text": "def get_attendee\n @attendee = ChimeSdk::MeetingCoordinator.get_attendee(meeting_id, attendee_id)\n @attendee = merge_application_attendee_metadata(@attendee)\n end", "title": "" }, { "docid": "fe2a71889a8251d3cd4f8d1102868d3e", "score": "0.51827925", "text": "def build(params = {})\n meeting = Ketchup::Meeting.new @api, params\n push meeting\n meeting\n end", "title": "" }, { "docid": "5977916eebb9a85c0571bd7e583fe4eb", "score": "0.51526165", "text": "def provide_metadata\n metadata = session[:metadata]\n @warnings ||= metadata.delete(:warnings) || []\n @errors ||= metadata.delete(:errors) || []\n if session[:workflow_id].present?\n @workflow = Workflow.find(session[:workflow_id])\n @workflow.assign_attributes(metadata)\n else\n @workflow ||= Workflow.new(metadata)\n end\n\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "7ed2ffafd64e87b2ed26cd518c4d4650", "score": "0.51047456", "text": "def merge_metadata_for_draft(data)\n # First, we merge the model-level metadata in `meta`.\n draftsman_options[:meta].each do |attribute, value|\n data[attribute] =\n if value.respond_to?(:call)\n value.call(self)\n elsif value.is_a?(Symbol) && respond_to?(value)\n # if it is an attribute that is changing, be sure to grab the current version\n if has_attribute?(value) && send(\"#{value}_changed?\".to_sym)\n send(\"#{value}_was\".to_sym)\n else\n send(value)\n end\n else\n value\n end\n end\n\n # Second, we merge any extra data from the controller (if available).\n data.merge(Draftsman.controller_info || {})\n end", "title": "" }, { "docid": "742ec57eb27080c8a29cea42aed6619e", "score": "0.5058577", "text": "def application_info\n {\n application_name: application_name,\n application_version: application_version\n }\n end", "title": "" }, { "docid": "50daa0cd14ece5442983f18dc6ad4498", "score": "0.5003574", "text": "def meeting_program\n MeetingProgram.where(\n meeting_event_id: meeting_event.id,\n category_type_id: category_type.id,\n gender_type_id: gender_type.id\n ).first\n end", "title": "" }, { "docid": "09c6854e280ebc6bc3cc33e7e2864ca5", "score": "0.49891105", "text": "def execute\n info = init_with_version!({})\n\n APPLICATION_META.each_with_object(info) do |meta_attr, memo|\n memo[meta_attr] = public_send(meta_attr)\n end\n end", "title": "" }, { "docid": "4738d060525604c4bfb1d9c8449fe218", "score": "0.49860007", "text": "def show\n @meeting = @meeting.decorate\n end", "title": "" }, { "docid": "c2c22851225d905cc8b3af5934e1d050", "score": "0.49787468", "text": "def with_metadata(metadata)\n @metadata = metadata\n\n self\n end", "title": "" }, { "docid": "8bde5841d84c3126de88dffd50cc7500", "score": "0.49755853", "text": "def create\n @instance = Instance.find(params[:meeting][:instance_id])\n @meeting = Meeting.new(meeting_params)\n @groups = @instance.available_groups\n if @meeting.save\n flash[:notice] = \"New meeting successfully added.\"\n @object = @meeting.instance\n end\n respond_with( @meeting, layout: !request.xhr? )\n end", "title": "" }, { "docid": "fc0545e479553ccd11b148c2c64c189b", "score": "0.497294", "text": "def set_meeting\n @meeting = Meeting.includes(:meeting_has_members).find(params[:id])\n end", "title": "" }, { "docid": "6b138240ed3e5c1a8cd63cb6f5f610fa", "score": "0.49631473", "text": "def build\n object_attributes.each_with_object({}) do |attribute, attributes|\n handler = determine_handler(attribute)\n attributes[attribute] = handler.extract(raw_meeting, attribute)\n end\n end", "title": "" }, { "docid": "11888042b4e06e6076ea24317e8d6db4", "score": "0.49619177", "text": "def create_meeting_with_attendee\n create_meeting\n create_attendee_from_meeting\n @meeting\n end", "title": "" }, { "docid": "f68f44a9b71871f40a3956ccfb34ac26", "score": "0.49377906", "text": "def application_for_offering\n return invitable if invitable.is_a?(ApplicationForOffering)\n return invitable.app if invitable.is_a?(ApplicationGroupMember)\n return nil if event.offering.nil?\n ApplicationForOffering.find_by_person_id_and_offering_id(person.id, event.offering.id)\n end", "title": "" }, { "docid": "87c51152ab0a4cea56f4b7af9dc7ae22", "score": "0.49343684", "text": "def find_or_create!()\n # Bail out if we have already found a result:\n if @result_meeting.instance_of?( Meeting )\n add_to_log( \"\\r\\nfind_or_create!() re-called. Returning previous meeting '#{ @result_meeting.code }'...\" )\n return @result_meeting\n end\n # Check source row integrity:\n valid_meeting_code = (\n @source_row.goggles_meeting_code.present? &&\n ( @source_row.goggles_meeting_code.to_s =~ /risultati|start/ui ).nil?\n )\n # Calendar place could be invalid for meetings like \"regpuglia\", season 162,\n # which occur in several different places. So, the following option is an \"OR\":\n valid_calendar_place = ( @source_row.calendar_place.present? && @source_row.calendar_place.length > 3 )\n\n unless valid_meeting_code ||\n ( @source_row.calendar_name.present? && valid_calendar_place )\n add_to_log( \"\\r\\nSkipping processing for incomplete calendar row '#{ @source_row.get_verbose_name }'.\" )\n return @result_meeting\n end\n # Prepare Meeting requires:\n code = @source_row.goggles_meeting_code\n season_id = @source_row.season_id\n user_id = @current_user.id\n header_year = @source_row.season.header_year\n header_date = FinCalendarMeetingBuilder.get_iso_date(\n @source_row.calendar_year,\n @source_row.calendar_month,\n @source_row.calendar_date\n )\n # Edition and description parsing:\n # [Steve, 20170803] Just as a remark, we'll get the \"stripped\" description from\n # the actual meeting name on the FIN calendar as a tool for seeking any existing\n # meeting with a similar name.\n # The actual creation or update process uses the full calendar name itself\n # for the meeting description.\n description, edition, edition_type_id = FinCalendarMeetingBuilder.parse_edition_and_type(\n @source_row.calendar_name\n )\n # Make an educated guess for timing_type_id:\n timing_type_id = if @source_row.season.season_type.code == \"MASFIN\"\n TimingType::AUTOMATIC_ID\n else\n TimingType::SEMIAUTO_ID\n end\n # [Steve, 20170705] \"Manual\" has never been actually used and is DEPRECATED:\n # TimingType::MANUAL_ID\n # --- Pre-check for already set links between calendar & meeting ---\n if @source_row.meeting\n add_to_log( \"\\r\\nMeeting already set on FIN Calendar row. Using it...\" )\n @result_meeting = @source_row.meeting\n end\n # --- SEARCH #1: SAME season, date and code ---\n unless @result_meeting.instance_of?( Meeting )\n add_to_log( \"\\r\\nSearching meeting within season #{ season_id }, header_date #{ header_date } & code '#{ code }'...\" )\n @result_meeting = Meeting.where(\n [\n \"(season_id = ?) AND (header_date = ?) AND (code = ?)\",\n season_id, header_date, code\n ]\n ).first\n end\n # --- SEARCH #2: SAME season and code (meeting possibly \"moved\") ---\n unless @result_meeting.instance_of?( Meeting )\n add_to_log( \"\\r\\nSearching meeting within season #{ season_id } & code '#{ code }'...\" )\n @result_meeting = Meeting.where(\n [ \"(season_id = ?) AND (code = ?)\", season_id, code ]\n ).first\n end\n # --- SEARCH #3: season, date and similar code token (from city) ---\n if @result_meeting.nil? && @source_row.calendar_place.present? &&\n @source_row.calendar_place.length > 3\n norm_city_token = '%' + NameNormalizer.get_normalized_name( @source_row.calendar_place ) + '%'\n add_to_log( \"Searching meeting within season #{ season_id }, header_date #{ header_date } & code token '#{ norm_city_token }' (from city)...\" )\n @result_meeting = Meeting.where(\n [\n \"(season_id = ?) AND (header_date = ?) AND (code LIKE ?)\",\n season_id, header_date, norm_city_token\n ]\n ).first\n end\n # --- SEARCH #4: season, date and similar code token (from title) ---\n if @result_meeting.nil? && @source_row.calendar_place.present? &&\n @source_row.calendar_place.length > 3\n norm_title = '%' + NameNormalizer.get_normalized_name( @source_row.calendar_name ) + '%'\n add_to_log( \"Searching meeting within season #{ season_id }, header_date #{ header_date } & code token '#{ norm_title }' (from title)...\" )\n @result_meeting = Meeting.where(\n [\n \"(season_id = ?) AND (header_date = ?) AND (code LIKE ?)\",\n season_id, header_date, norm_title\n ]\n ).first\n end\n # --- SEARCH #5: season, date and similar description token ---\n # [Steve, 20180106] Skip search #5 for Regional Meetings, that usually have too similar descriptions\n if @result_meeting.nil? && description.present? && ( description =~ /regional/ui ).nil?\n # Extract a searchable (normalized) token from the description of the Meeting:\n # (token must be a word and not too short and not a too-common word)\n description_token = NameNormalizer.get_normalized_string( description )\n .split(/\\s/).reject{ |token|\n !!(token =~ /\\d+|campionato|distanze|special|region|finali|master|nuoto/ui) || (token.length < 4)\n }.first.to_s\n if description_token.present?\n description_token = \"%#{ description_token }%\"\n add_to_log( \"Searching meeting within season #{ season_id }, header_date #{ header_date } & description token '#{ description_token }'...\" )\n @result_meeting = Meeting.where(\n [\n \"(season_id = ?) AND (header_date = ?) AND (description LIKE ?)\",\n season_id, header_date, description_token\n ]\n ).first\n else\n add_to_log( \"Unable to extract a suitable description token within the current rule set.\" )\n end\n end\n # Match found?\n if @result_meeting.instance_of?( Meeting )\n add_to_log( \"Meeting found! => #{ @result_meeting.inspect }\" )\n # --- UPDATE ---\n # Force update of the found instance with the correct values if there are\n # any differences (except user_id):\n if FinCalendarMeetingBuilder.has_different_values?( @result_meeting,\n code, header_date, header_year, @source_row.calendar_name,\n edition, edition_type_id, timing_type_id,\n ( @source_row.manifest_link.present? || @source_row.startlist_link.present? || @source_row.results_link.present? ),\n @source_row.name_import_text,\n @source_row.manifest_link\n )\n update_existing( code, header_date, header_year, season_id, edition, edition_type_id, timing_type_id )\n else\n if @result_meeting.do_not_update\n add_to_log( \"Possible difference in values, but do_not_update flag is ON. Skipping update...\" )\n end\n end\n # --- CREATION ---\n else\n create_new( code, header_date, header_year, season_id, edition, edition_type_id, timing_type_id )\n end\n\n @result_meeting\n end", "title": "" }, { "docid": "1496a9789c46774a296aba02e017150f", "score": "0.4914907", "text": "def application\n PermittedApplicationParams.new(self.params, self.user)\n end", "title": "" }, { "docid": "9bce8498db2cf1731081711c073cca1b", "score": "0.4904945", "text": "def set_meeting_event\n @meeting_event = MeetingEvent.find_by!(event_auth_token: params[:event_auth_token])\n end", "title": "" }, { "docid": "ba4a844fb593f46c50d48e619b1ba8e3", "score": "0.49034178", "text": "def set_application\n @application = @job.applications.find(params[:application_id])\n end", "title": "" }, { "docid": "76d0f73dfe248c54eaa5cf4e632ef702", "score": "0.4882822", "text": "def set_app_info\n @app_info = AppInfo.find(params[:id])\n end", "title": "" }, { "docid": "76d0f73dfe248c54eaa5cf4e632ef702", "score": "0.4882822", "text": "def set_app_info\n @app_info = AppInfo.find(params[:id])\n end", "title": "" }, { "docid": "51e203f8476e1591d37e6e76053bbd11", "score": "0.4881426", "text": "def meetings\n @meetings ||= Ketchup::MeetingArray.new api\n end", "title": "" }, { "docid": "b62cef83d31e2910d6b7e9f3dda0e2a3", "score": "0.4875101", "text": "def set_application\n @application = Oread::Application.find(params[:application_id])\n end", "title": "" }, { "docid": "e47522a152641ba7cd015cfb34ec75e4", "score": "0.48724002", "text": "def metadata\n return @metadata if instance_variable_defined?(:@metadata)\n\n @metadata = Metadata.from self\n end", "title": "" }, { "docid": "d425260b9482bbf2a2d39bd9091854b5", "score": "0.48706147", "text": "def welcome_screen_meeting_information\n return @welcome_screen_meeting_information\n end", "title": "" }, { "docid": "6df3cc31730243ef971defdb9b35023d", "score": "0.485438", "text": "def application(application_id)\n app = @tropo_client.get(\"applications/#{application_id.to_s}\")\n if app.instance_of? Array\n href = app[0].href\n app[0].merge!({ :application_id => get_element(href) })\n else\n href = app.href\n app.merge!({ :application_id => get_element(href) })\n end\n end", "title": "" }, { "docid": "e27ce1ba7a1b07a6b1d990b6b2c7af5c", "score": "0.4845814", "text": "def update_and_overwrite_from_meetup\n unless meetup_link.blank?\n Rails.logger.info Group.init_rmeetup\n Rails.logger.info method = Group.query_method(meetup_link)\n Rails.logger.info query = Group.clean_query(meetup_link)\n Rails.logger.info response = RMeetup::Client.fetch( :groups,{ method => query }).first\n overwrite_from_meetup_api_response(response) unless response.blank?\n fetch_events_from_meetup\n end\n rescue Exception => e\n Rails.logger.error e.message\n end", "title": "" }, { "docid": "813ae5db9f8d4f518f62987c24e563c9", "score": "0.48298126", "text": "def advertiser_app_info\n return advertiser_app_info if advertiser_app_info\n\n raise \"item_id isn't set yet. This is a bug in test_chamber\" unless item_id\n app_api_response = authenticated_request(:post, \"/api/client/apps/#{item_id}\", payload: payload)\n self.advertiser_app_info = JSON.parse(app_api_response[:body])[\"result\"].first[1]\n end", "title": "" }, { "docid": "23bb091e963fb5d59e9258b655f5b50f", "score": "0.48177844", "text": "def format_meeting(meeting)\n meeting[:meetingID] = meeting[:meetingID].to_s\n meeting[:moderatorPW] = meeting[:moderatorPW].to_s\n meeting[:attendeePW] = meeting[:attendeePW].to_s\n meeting[:hasBeenForciblyEnded] = meeting[:hasBeenForciblyEnded].downcase == \"true\"\n meeting[:running] = meeting[:running].downcase == \"true\"\n meeting\n end", "title": "" }, { "docid": "e8d60f2795767934ebf27ef2b1e50376", "score": "0.47991085", "text": "def find_application\n @application = Application.cached_app(params[:application_id])\n end", "title": "" }, { "docid": "a3eb885bf3ed4ded3feee91a3717a724", "score": "0.47942835", "text": "def initialize(application)\n @application = application\n @yamls = OpenStruct.new\n end", "title": "" }, { "docid": "373673989c9a281c0ef55f901be24bdb", "score": "0.47884533", "text": "def app_info\n @@_app_info ||= {\n instance_id: AwsMetadataService.instance_id,\n environment: Rails.env\n }\n end", "title": "" }, { "docid": "2c51c2fa2952321cabd17fafcbe7cfff", "score": "0.47883546", "text": "def combine\n questionnaire_manager_data =\n appointments_with_questionnaires.each_with_object([]) do |base_structure, accumulator|\n groups = get_groups(base_structure)\n\n set_responses_for_base_structure(groups)\n accumulator << base_structure\n end\n\n { data: questionnaire_manager_data }\n end", "title": "" }, { "docid": "5c3bd58b172f6a41cd23380f94cc1473", "score": "0.477881", "text": "def set_application\n @application = @owner.applications.find_by!(name: params[:app_name])\n end", "title": "" }, { "docid": "17e4056f0690298a59126511793108aa", "score": "0.47765896", "text": "def appendToMetadata(additionalMetadata)\n @additionalMetadata.merge!(additionalMetadata)\n end", "title": "" }, { "docid": "31f37895e347d591f99b28c7f2462d44", "score": "0.47708255", "text": "def create\n unless options[:app]\n options[:app] = Meme.generate\n end\n orig_create\n end", "title": "" }, { "docid": "5612d4e18a03b8a356d20f40655f5ad3", "score": "0.47695568", "text": "def add_metadata(new_metadata)\n event_metadata.merge!(new_metadata)\n end", "title": "" }, { "docid": "b269c6be682816fc53fb6e1d9f9b410e", "score": "0.47681946", "text": "def prefilled_data\n data = {}\n return data if @application.blank?\n\n # Grab the non-nil attributes from the application that we want to return.\n # Some attributes, like `annotation`, are private, and shouldn't be returned.\n application_data =\n @application.attributes.slice(\n 'program',\n 'department',\n 'yip',\n 'previous_department_ta',\n 'previous_university_ta',\n 'previous_experience_summary',\n 'gpa',\n 'comments'\n ).compact\n data.merge! application_data\n\n # Custom question answers are stored as a JSON blob in the database. We unpack them if there are any\n if @application.custom_question_answers\n data.merge! @application.custom_question_answers.except('utorid')\n end\n\n # Position-preferences must be reconstructed from the database. Surveyjs expects\n # an object { [course_code]: preference_level }\n position_preferences = {}\n position_preferences_subs.each do |preference|\n position_preferences[preference['position_code']] =\n preference['preference_level']\n end\n data[:position_preferences] = position_preferences\n\n data.symbolize_keys!\n end", "title": "" }, { "docid": "f6fe82aeee3c581d2ea0dcfc80bc262c", "score": "0.47617805", "text": "def application_details\n response = client.as(client.app_secret).execute(\n method: :get,\n path: \"/a/#{app_id}\",\n auth_method: HttpClient::AuthMethod::BASIC\n )\n ApplicationDetail.new(**response)\n end", "title": "" }, { "docid": "542191667affbe6d96173789aaab771e", "score": "0.4760863", "text": "def meetings\n @meetings ||= @api.get(\"/projects/#{shortcode_url}/meetings.json\").\n collect { |hash|\n Ketchup::Meeting.new @api, hash\n }\n end", "title": "" }, { "docid": "f569065b1c97408eff1325d142a8760c", "score": "0.47527018", "text": "def save_icx_application(application)\n check_podio\n sync_icx_country(application)\n sync_home_lc(application)\n\n # rubocop:disable Metrics/LineLength\n params = {\n title: application.exchange_participant.fullname,\n 'epid': application.expa_ep_id.to_s,\n status: icx_status_to_podio(application.status),\n email: [\n {\n 'type': 'home',\n value: application.exchange_participant.email\n }\n ],\n #'data-de-nascimento': parse_date(application.exchange_participant.birthdate),\n 'data-do-applied': parse_date(application.applied_at),\n 'data-do-accepted': application.accepted_at ? parse_date(application.accepted_at) : nil,\n 'data-do-approved': parse_date(application.approved_at),\n 'opportunity-name': application.opportunity_name,\n 'opportunity-start-date': parse_date(application.opportunity_start_date),\n 'expa-opportunity-id': application.tnid.to_s,\n 'host-lc': application&.host_lc&.podio_id,\n 'home-lc': application&.home_lc&.podio_id,\n 'home-mc': application&.home_mc&.podio_id,\n 'background-academico-do-ep': application&.exchange_participant&.academic_backgrounds,\n 'background-da-vaga': application&.academic_backgrounds,\n \"celular\": [\n {\n 'type': 'mobile',\n value: application.exchange_participant.cellphone ? application.exchange_participant.cellphone[0...50] : nil #maximum of 50 characters (podio limit)\n }\n ],\n 'sdg-de-interesse': application.sdg_goal_index,\n 'expa-application-id': application.expa_id.to_s\n }\n\n params['aplicante-qualificado'] = map_aplicante_qualificado(application) if application.home_mc&.name\n\n params['data-do-break-approval'] = application.break_approved_at ? parse_date(application.break_approved_at) : nil\n\n params['quero-ser-contactado-por-telefone'] = application&.exchange_participant&.cellphone_contactable ? 1 : 2 #1 = Yes, 2 = No\n\n params['da-onde-veio-este-ep'] = application.from_impact ? 2 : 1 #1 = YOP, 2 = Impact Brazil\n\n params['opportunity-date-opened'] = parse_date(application.opportunity_date) unless application.product.to_sym == :gv\n\n params['projeto'] = BrazilIcxProject.call(application.opportunity_name) if application.product == 'gv'\n\n\n # rubocop:enable Metrics/LineLength\n\n params = cut_icx_params_by_program(params, application)\n\n Raven.extra_context podio_params: params.to_json\n if application.podio_id.nil?\n app_id = PODIO_APPLICATION[application.product.to_sym]\n podio_item = Podio::Item.create(app_id, fields: params)\n application.update_attributes(\n podio_last_sync: Time.now,\n podio_id: podio_item.item_id\n )\n else\n Podio::Item.update(application.podio_id, fields: params)\n application.update_attributes(\n podio_last_sync: Time.now\n )\n end\n\n begin\n update_icx_application_prep(application) if prep_valid_status_inclusion?(application)\n rescue => exception\n Raven.capture_message \"[ICX I#{application.product_upcase} Prep]Error when updating prep data\",\n extra: {\n application: application.to_json,\n exception: exception\n }\n application.update_attribute(:prep_podio_sync_error, true)\n end\n end", "title": "" }, { "docid": "6407fd0e1bd520f02cd9b772ed7f9f7d", "score": "0.47526443", "text": "def application\n application = TeamApplication.first\n NotificationMailer.application(application)\n end", "title": "" }, { "docid": "4c9a16c2365dd255c53ef13bf6d02950", "score": "0.47524786", "text": "def metadata\n request_metadata.merge(response_metadata)\n end", "title": "" }, { "docid": "30d7305d825a35b8b9c8cd7469a6a94f", "score": "0.47516578", "text": "def app_info\n { name: configuration[:application_name], version: configuration[:application_version] }\n end", "title": "" }, { "docid": "47b974fc383ce216eeba477dc9d37ff1", "score": "0.47506154", "text": "def merge_metadata_from_controller_into(data)\n metadata = PaperTrail.request.controller_info || {}\n metadata.keys.each { |k| assert_metadatum_key_is_permitted(k) }\n data.merge(metadata)\n end", "title": "" }, { "docid": "cc373c811babe34566ce1693af023401", "score": "0.47489792", "text": "def application\n return @application\n end", "title": "" }, { "docid": "de6300168dde1f5c8f10a940e11fee7c", "score": "0.47488084", "text": "def and_metadata(additional_metadata)\n return self if additional_metadata.empty?\n\n builder = self.class.builder.new\n build_duplicate builder, @metadata.merge(additional_metadata)\n builder.build\n end", "title": "" }, { "docid": "0fe1a372c1a9f141b9833545df37c275", "score": "0.47465283", "text": "def touch_meeting(meeting)\n meeting.updated_at = Time.now\n meeting.save!\n end", "title": "" }, { "docid": "b5e3655b2d91f98cbe2d7c55494f9bbc", "score": "0.47429693", "text": "def application_profile\n Yoti::ApplicationProfile.new(@extended_application_profile)\n end", "title": "" }, { "docid": "ecba4fbdda48f3abbcb7c826c6dac9bf", "score": "0.47411096", "text": "def find(appid)\n response = @api.request(:get, \"apps/#{appid}\")\n h = doc_to_hash(response, \"//data\")[\"data\"]\n add_meta(response, h)\n end", "title": "" }, { "docid": "e918b77a5b27400aacc8afa53155c049", "score": "0.47394696", "text": "def app_info\n { name: configuration[:application_name], version: configuration[:application_version] }\n end", "title": "" }, { "docid": "6e6f7f9b2fa13cef5ea3bfa1cf989d5a", "score": "0.4735767", "text": "def create_or_retrieve_application_from_session\r\n if session[:app] == nil\r\n session[:app] = AccountApplication.new\r\n end\r\n \r\n @app = session[:app]\r\n @primary = @app.applicants.primary\r\n @joint = @app.applicants.joint\r\n end", "title": "" }, { "docid": "0212be61879c5a3b81904b90e62f9955", "score": "0.47325832", "text": "def set_application\n @application = App.find(params[:id])\n end", "title": "" }, { "docid": "76dd3905ff7dbed5eeab2bcc1c7a6ca7", "score": "0.47324118", "text": "def upcoming\n @upcoming ||= @api.get('/meetings/upcoming.json').collect { |hash|\n Ketchup::Meeting.new(@api, hash)\n }\n end", "title": "" }, { "docid": "49db25d87a1279073c94e223711aa9ed", "score": "0.47272018", "text": "def prepare_appdata\n @appdata = Rails.cache.fetch(\"appdata\", :expires_in => 12.hours) do\n Appdata.get \"factory\"\n end\n end", "title": "" }, { "docid": "6982997ab88814172d89fa443a441e3b", "score": "0.47258663", "text": "def meta_data\n @email.meta version\n end", "title": "" }, { "docid": "ca48d76c3c77ad307ea7a5567a225b92", "score": "0.47242114", "text": "def show\n get_meeting\n if params[:create_attendee_from_meeting].to_s.to_boolean(false) || ChimeSdk.config.create_attendee_from_meeting\n create_attendee_from_meeting\n end\n respond_to do |format|\n format.html\n format.json { render json: @meeting }\n end\n end", "title": "" }, { "docid": "fc66f6c4f2bb467ff9ad3493f7403231", "score": "0.4715803", "text": "def initialize( metadata=DEFAULTMETADATA )\n\t\t@metadata = metadata\n\t\t@apps = {}\n\tend", "title": "" }, { "docid": "545b90ae581e9835ec0b01789b7061ac", "score": "0.47130504", "text": "def metadata\n @em_metadata ||= self.class.metadata.dup rescue {}\n end", "title": "" }, { "docid": "b0f8df97fa504846cdb49b7281eeda45", "score": "0.46911874", "text": "def set_meeting\n @meeting = Meeting.find(params[:id])\n end", "title": "" }, { "docid": "280a41c161c95dcef1d608f8bc936898", "score": "0.46879825", "text": "def load_app_details\n @info = Wackamole::MoledInfo.collect_dashboard_info( @updated_on.clone.utc )\n end", "title": "" }, { "docid": "cc79bd27cf494250190f145b06fb31ab", "score": "0.46873978", "text": "def appointment_registry\n {\n patient: user.icn,\n date: appointment_dates,\n location: clinic_id,\n _count: resource_count,\n page: resource_page\n }\n end", "title": "" }, { "docid": "01293a4d62e336fca1e9fad86aee5adf", "score": "0.4683649", "text": "def create\n @meeting = Meeting.create(meeting_params)\n respond_modal_with @meeting\n end", "title": "" }, { "docid": "01293a4d62e336fca1e9fad86aee5adf", "score": "0.4683649", "text": "def create\n @meeting = Meeting.create(meeting_params)\n respond_modal_with @meeting\n end", "title": "" }, { "docid": "69289b24b41b71505f1299a954f0a3de", "score": "0.4682182", "text": "def metadata\n data[\"site_metadata\"] ||= HashWithDotAccess::Hash.new\n end", "title": "" }, { "docid": "9594db30817bef0ffb469cd47d26e566", "score": "0.46791217", "text": "def set_meeting\n\t\t@meeting = Meeting.find(params[:id])\n\tend", "title": "" }, { "docid": "ed466637fe10ee0d5061c5c37b2664b1", "score": "0.46779957", "text": "def metadata\n @metadata || {}\n end", "title": "" }, { "docid": "ed466637fe10ee0d5061c5c37b2664b1", "score": "0.46779957", "text": "def metadata\n @metadata || {}\n end", "title": "" }, { "docid": "ba47f22ddffd7afac13a2946a32424ec", "score": "0.46773747", "text": "def set_application\n\t\t@application = TaApplication.find(params[:id])\n\tend", "title": "" }, { "docid": "a6c6098fc4b81e3531357901e6fe1537", "score": "0.46741754", "text": "def set_application\n @application = Request.find(params[:id])\n end", "title": "" }, { "docid": "40283876a27d5fa360d2fd1886085565", "score": "0.46681857", "text": "def write_metadata\n metadatum.update!(\n authors: gemspec&.authors,\n files: gemspec&.files&.to_json,\n summary: gemspec&.summary,\n description: gemspec&.description,\n email: gemspec&.email,\n homepage: gemspec&.homepage,\n licenses: gemspec&.licenses&.to_json,\n metadata: gemspec&.metadata&.to_json,\n author: gemspec&.author,\n bindir: gemspec&.bindir,\n executables: gemspec&.executables&.to_json,\n extensions: gemspec&.extensions&.to_json,\n extra_rdoc_files: gemspec&.extra_rdoc_files&.to_json,\n platform: gemspec&.platform,\n post_install_message: gemspec&.post_install_message,\n rdoc_options: gemspec&.rdoc_options&.to_json,\n require_paths: gemspec&.require_paths&.to_json,\n required_ruby_version: gemspec&.required_ruby_version&.to_s,\n required_rubygems_version: gemspec&.required_rubygems_version&.to_s,\n requirements: gemspec&.requirements&.to_json,\n rubygems_version: gemspec&.rubygems_version\n )\n end", "title": "" }, { "docid": "864eacb5ea30df0e2082a8355eda5d53", "score": "0.46641177", "text": "def metadata\n OpenStruct.new metadata_config\n end", "title": "" }, { "docid": "7454057ff5cb7be6e5a5458a82d8f2f0", "score": "0.4664033", "text": "def set_appointment\n @appointment = Appointment.includes(:client).find_by(id: params[:id])\n end", "title": "" }, { "docid": "a043a430686c90a36c8f18f002428a10", "score": "0.46605924", "text": "def duplicate\n new_application = faa_klass.create(application_params)\n\n application.applicants.each do |applicant|\n create_applicant(applicant, new_application)\n end\n\n update_claimed_as_tax_dependent_by(new_application)\n\n new_application\n end", "title": "" }, { "docid": "0f32bcb2f6cbe4cf71f26a7b3066e27f", "score": "0.4659213", "text": "def initialize( meeting, updated_at = 0 )\r\n @meeting = meeting\r\n @updated_at = updated_at\r\n\r\n @events = Hash.new()\r\n end", "title": "" }, { "docid": "7c7b8359e63aaf7ad9d1fd568ffaa89e", "score": "0.46548748", "text": "def find_meeting\n @meeting = Meeting.find(params[:id], :include => :node).current_version\n end", "title": "" }, { "docid": "f14001219c8e7cb121bbfed23d2e6134", "score": "0.4654869", "text": "def merge(meta_block)\n self.title = meta_block.title if title.blank?\n self.description = meta_block.description if description.blank?\n self.keywords = meta_block.keywords if keywords.blank?\n self.javascript = meta_block.javascript if javascript.blank?\n self.fb_image = meta_block.fb_image unless fb_image?\n self.fb_title = meta_block.fb_title if fb_title.blank?\n self.fb_description = meta_block.fb_description if fb_description.blank?\n self\n end", "title": "" }, { "docid": "41dc0262d0a715ee190638499be24075", "score": "0.46515307", "text": "def get_app\n @app ||= settings.cache.fetch(\"myapp\") do\n # CACHE MISS -- so hit fb graph api and then store result in cache.\n app = @graph.get_object(\"app\")\n settings.cache.set(\"myapp\", @app, 60 * 60) # cache for 1 hour\n app\n end\n end", "title": "" }, { "docid": "3bca4bf04ab72fd982eda5f5db734a6a", "score": "0.46514177", "text": "def data(data = nil)\n return @metadata unless @metadata.nil?\n\n unless data.is_a?(Hash)\n data = {}\n # TODO: Replace load from defaults.yaml to a dedicated meta file def.\n if Lorj.defaults.data.key?(:setup)\n data[:setup] = Lorj.defaults.data[:setup]\n Lorj.defaults.data.delete(:setup)\n end\n if Lorj.defaults.data.key?(:sections)\n data[:sections] = Lorj.defaults.data[:sections]\n Lorj.defaults.data.delete(:sections)\n end\n end\n @metadata = Lorj::MetaAppConfig.new data\n\n @metadata\n end", "title": "" }, { "docid": "1479e6705252f0eab87109aba28c97c4", "score": "0.46495172", "text": "def set_meeting\n #@meeting = Meeting.find(params[:id])\n end", "title": "" }, { "docid": "7cd9bd5095de01c22885bd2b15bf9f3b", "score": "0.46489754", "text": "def set_meeting\n @meeting = Meeting.find(params[:id])\n end", "title": "" }, { "docid": "7cd9bd5095de01c22885bd2b15bf9f3b", "score": "0.46489754", "text": "def set_meeting\n @meeting = Meeting.find(params[:id])\n end", "title": "" } ]
4ef0af96e94cfcf57c7d108144bd29e9
Percentage of Memory used, 0.0 .. 100.0
[ { "docid": "6637d1e0a23cd764ec65d27f484cb9f0", "score": "0.86350507", "text": "def mem_percent\n (100.0 * mem_used / mem_total).round(1)\n rescue\n 0\n end", "title": "" } ]
[ { "docid": "9b4b582eeaaa0f200d29bf31a428c3c5", "score": "0.84862155", "text": "def memory_percentage\n @memory_percentage ||= parts[2].to_f\n end", "title": "" }, { "docid": "03c4dd264aac9f6339188700515eea04", "score": "0.8451853", "text": "def memory_percent\n rss = @proc.memory_info.rss\n @@total_phymem = Memory.virtual_memory.total if @@total_phymem.nil?\n begin\n return (rss / @@total_phymem.to_f * 100).round(2)\n rescue ZeroDivisionError\n return 0.0\n end\n end", "title": "" }, { "docid": "cdc28e16f342cd2a15d6fd1bef77c87d", "score": "0.84242153", "text": "def memory_percent_used\n info = get_device_info\n 100.0 * info[:memory_used] / info[:memory_total]\n end", "title": "" }, { "docid": "339103f7ccf1758f4e4548e8541495c3", "score": "0.8111568", "text": "def memory_percent(mem_total_kb, workingsetsize)\n if !mem_total_kb.nil? && !workingsetsize.nil? && mem_total_kb.to_i > 0\n rss_kb = workingsetsize.to_f / 1024\n return (rss_kb / mem_total_kb.to_f * 100).round(2).to_s\n end\n end", "title": "" }, { "docid": "770020d744534bb42033dbdd1b7c6f05", "score": "0.805063", "text": "def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end", "title": "" }, { "docid": "770020d744534bb42033dbdd1b7c6f05", "score": "0.805063", "text": "def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end", "title": "" }, { "docid": "5f7471c79e3581f4f9e3555513cdaad7", "score": "0.7964815", "text": "def procs_percent\n (procs_used.to_f / procs_avail.to_f) * 100\n end", "title": "" }, { "docid": "ffa29bc2fdd5e1fcb22a603ac3e62bc1", "score": "0.7717799", "text": "def procs_percent\n available_procs > 0 ? (procs_used.to_f / available_procs.to_f) * 100 : 0\n end", "title": "" }, { "docid": "7b2d3764818ad23bf8f0a862c42cdd79", "score": "0.7694205", "text": "def used_percentage\n used.to_f / total.to_f * 100\n end", "title": "" }, { "docid": "cb2e342bb08064e61c9f3ec4eb39e1d3", "score": "0.7637699", "text": "def gc_percent\n count = self.composition\n at = count['a'] + count['t'] + count['u']\n gc = count['g'] + count['c']\n gc = 100 * gc / (at + gc)\n return gc\n end", "title": "" }, { "docid": "37201eeabd1d5e0775ce400f4b8990a1", "score": "0.75022715", "text": "def mem\n '%s%%' % threshold(@mem)\n end", "title": "" }, { "docid": "529a7b9ae005fcf3f26d4adb3ad08fbf", "score": "0.74827874", "text": "def percent_used\n\t\t\t\treturn nil unless swaps_readable?\n\t\t\t\tvalues_t = read_usage\n\n\t\t\t\ttotal = values_t[0].sum\n\t\t\t\treturn 0.0 if total == 0\n\n\t\t\t\tvalues_t[-1].sum.*(100).fdiv(total).round(2)\n\t\t\tend", "title": "" }, { "docid": "96a88a900fa36594e2c39cb987340011", "score": "0.7430912", "text": "def disk_percent_used\n info = get_device_info\n 100.0 * info[:disk_used] / info[:disk_total]\n end", "title": "" }, { "docid": "aa82e2602d8cd0020403d668155ac09e", "score": "0.73837703", "text": "def percent_free\n fsstat.blocks_available * 100 / fsstat.blocks\n end", "title": "" }, { "docid": "eaba659bcc45b0950c173304b5e823bd", "score": "0.73421496", "text": "def memory_total\n %x[free -ot].split[18]\n end", "title": "" }, { "docid": "b6482c736a2ee5198a962e6b4857bc95", "score": "0.72942555", "text": "def nodes_percent\n (nodes_used.to_f / nodes_avail.to_f) * 100\n end", "title": "" }, { "docid": "1846e927287c94c3e56964ab8c4f667e", "score": "0.72362316", "text": "def percent_total_usage\n if limited?\n @total_usage * 100 / @limit\n else\n 0\n end\n end", "title": "" }, { "docid": "1846e927287c94c3e56964ab8c4f667e", "score": "0.72362316", "text": "def percent_total_usage\n if limited?\n @total_usage * 100 / @limit\n else\n 0\n end\n end", "title": "" }, { "docid": "79d14d0fd43edfdb286c035566f384bc", "score": "0.7231355", "text": "def cpu_percentage\n @cpu_percentage ||= parts[1].to_f\n end", "title": "" }, { "docid": "4065f11ceef83e4e67a93b628b560889", "score": "0.71795756", "text": "def mem_usage; end", "title": "" }, { "docid": "38a5684b74299938244f36ba9235bb1c", "score": "0.715803", "text": "def percentage; end", "title": "" }, { "docid": "38a5684b74299938244f36ba9235bb1c", "score": "0.715803", "text": "def percentage; end", "title": "" }, { "docid": "5a5903fdcff3a4b1b7e92411f63fcc98", "score": "0.71358883", "text": "def percent_of(total, used)\n ((used.to_f / total.to_f) * 100).to_i\n end", "title": "" }, { "docid": "f9a597fea485388a9a2d6a57157137ec", "score": "0.71291065", "text": "def percent_of_house\n percent_of(house_capacity)\n end", "title": "" }, { "docid": "834b2ba0066a62163536c0fd5bccd66b", "score": "0.71109694", "text": "def percent_bytes(fs_info)\n if config[:ignore_reserved]\n u100 = fs_info.bytes_used * 100.0\n nonroot_total = fs_info.bytes_used + fs_info.bytes_available\n if nonroot_total.zero?\n 0\n else\n (u100 / nonroot_total + (u100 % nonroot_total != 0 ? 1 : 0)).round(2)\n end\n else\n (100.0 - (100.0 * fs_info.bytes_free / fs_info.bytes_total)).round(2)\n end\n end", "title": "" }, { "docid": "55000e65af5045d4aa807022db97faa5", "score": "0.7096089", "text": "def filesystem_used_perc(name)\n filesystem_search name, 5\n end", "title": "" }, { "docid": "5856b94f8ccf57addbc798ac461d2f45", "score": "0.70416564", "text": "def memory_usage\n run(\"cgroup\", \"memory.usage_in_bytes\").strip.to_i\n end", "title": "" }, { "docid": "48bcbfbd49fc3a0fb71e2dad298000d1", "score": "0.69895", "text": "def gpu_nodes_available_percent\n gpu_nodes > 0 ? ((gpu_nodes - gpu_nodes_free).to_f / gpu_nodes.to_f) * 100 : 0\n end", "title": "" }, { "docid": "ffbd54b80c4e7680f315ba78092bead1", "score": "0.698517", "text": "def mem_used\n mem_total - mem_available\n end", "title": "" }, { "docid": "ad5887bc03a34663506d376a909d0d0c", "score": "0.69790095", "text": "def load_factor\n @counter.to_f / @size.to_f\n end", "title": "" }, { "docid": "9122909fd9d1e6dd7a68c40e73994bfe", "score": "0.6975895", "text": "def memory_usage\n @_host.summary.quickStats.overallMemoryUsage * 1024 * 1024\n end", "title": "" }, { "docid": "88699bdfde6b2e7df8e821f6f80c1238", "score": "0.6950626", "text": "def nodes_percent\n available_nodes > 0 ? (nodes_used.to_f / available_nodes.to_f) * 100 : 0\n end", "title": "" }, { "docid": "f71cf475dd1eb4f5839ec7960948aec2", "score": "0.6949498", "text": "def percentage_component; end", "title": "" }, { "docid": "8e2037ab000a881635463f6fb1fba684", "score": "0.69320184", "text": "def storage_hard_limit_pct\n @storage_hard_limit_pct\n end", "title": "" }, { "docid": "f1db2a65e6c2c65fbd14bef093a81a3d", "score": "0.6927618", "text": "def calc_memory( snmp, oids )\n\t\tinfo = { usage: 0, available: 0 }\n\t\tavail = snmp.get( oid: oids[:avail] ).to_f\n\t\ttotal = snmp.get( oid: oids[:total] ).to_f\n\t\tused = total - avail\n\n\t\treturn info if avail.zero?\n\n\t\tinfo[ :usage ] = (( used / total ) * 100 ).round( 2 )\n\t\tinfo[ :available ] = (( total - used ) / 1024 ).round( 2 )\n\t\treturn info\n\tend", "title": "" }, { "docid": "7dd96da728ac8ba37a6c122eedba3957", "score": "0.6926531", "text": "def memory_bytes_total\n get_device_info[:memory_total]\n end", "title": "" }, { "docid": "d20e52a6e5cb3c9893c955570e1bb8fa", "score": "0.6924951", "text": "def owner_procs_percent\n owner_procs_avail > 0 ? (owner_procs_used.to_f / owner_procs_avail.to_f) * 100 : 0\n end", "title": "" }, { "docid": "e1335c25b040cb3c6c0825175f98e0d5", "score": "0.69226164", "text": "def used_memory\n `ps -o rss= -p #{Process.pid}`.to_i / 1024\n end", "title": "" }, { "docid": "45ac46534573fa3cab597f93cb93841a", "score": "0.6919378", "text": "def ram_total\n %x[free -ot].split[7]\n end", "title": "" }, { "docid": "69ef9d48fb46c3b60b998dd3ec314350", "score": "0.69070244", "text": "def worker_memory(total_memory)\n (total_memory - 1572864 + 204800) / 409600\n end", "title": "" }, { "docid": "8945c221b2bfca399f5636b451ef5a0c", "score": "0.6889414", "text": "def usage_memory\n path = \"/sys/fs/cgroup/memory/#{@lxc_path}/memory.usage_in_bytes\"\n stat = File.read(path).to_i\n\n @metrics[:memory] = stat / 1024\n rescue StandardError\n @metrics[:memory] = 0\n end", "title": "" }, { "docid": "ded061693e4845dcd24157f96453e492", "score": "0.6887129", "text": "def percent; @percent / 10.0; end", "title": "" }, { "docid": "e755895ef01e34b6a61a578576ff3c44", "score": "0.68813443", "text": "def load_factor\n @count / size.to_f\n end", "title": "" }, { "docid": "336b2991249ea421075da740c1ac0a94", "score": "0.6880016", "text": "def cpu_percent\n case RUBY_PLATFORM\n when /darwin/ then `ps -A -o %cpu`.lines.map(&:to_f).inject(:+) / threads\n when /linux/ then proc_diff\n else 0\n end\n rescue\n 0\n end", "title": "" }, { "docid": "bfefd53a75c9487a659f4b25670f9f60", "score": "0.68728954", "text": "def percent; end", "title": "" }, { "docid": "bfefd53a75c9487a659f4b25670f9f60", "score": "0.68728954", "text": "def percent; end", "title": "" }, { "docid": "bfefd53a75c9487a659f4b25670f9f60", "score": "0.68728954", "text": "def percent; end", "title": "" }, { "docid": "cb63a2f2199a7166abe5c64479b5172f", "score": "0.6861161", "text": "def percent_user_usage\n if limited?\n @user_usage * 100 / @limit\n else\n 0\n end\n end", "title": "" }, { "docid": "cb63a2f2199a7166abe5c64479b5172f", "score": "0.6861161", "text": "def percent_user_usage\n if limited?\n @user_usage * 100 / @limit\n else\n 0\n end\n end", "title": "" }, { "docid": "0ab2dd1a2964391280aab7f631ffa784", "score": "0.6859874", "text": "def memory_usage\n # http://stackoverflow.com/questions/7220896/get-current-ruby-process-memory-usage\n rss_k = `ps -o rss= -p #{Process.pid}`.to_i\n (rss_k / 1024.0).round(2)\nend", "title": "" }, { "docid": "52ec301e7541976385dd3b72e61ae95a", "score": "0.6847328", "text": "def memory_usage\n @memory_usage\n end", "title": "" }, { "docid": "36696a8da842491cffe6a44cf0e52c10", "score": "0.6803168", "text": "def load_factor\n @count / size\n end", "title": "" }, { "docid": "52d95c8fa0225327699af5b2d9c73348", "score": "0.67893195", "text": "def database_size_percentage(refresh=-1)\n result = `db2 connect to #{database} > /dev/null ; db2 \"CALL GET_DBSIZE_INFO(?, ?, ?, #{refresh})\" ; db2 connect reset > /dev/null`\n\n lines = result.split(\"\\n\")\n\n percentage = -1\n if lines.count == 13\n size = lines[7].split[3].to_i\n allocated = lines[10].split[3].to_i\n percentage = size * 100 / allocated\n end\n\n percentage\n end", "title": "" }, { "docid": "0ffb7b406cc10c2d502ea8c9249d5d39", "score": "0.6784661", "text": "def mac_mem_usage\n mem_data = Hash.new\n top_output = `top -l1 -n0 -u`\n mem = top_output[/^(?:Phys)?Mem:.+/i]\n \n mem.scan(/(\\d+|\\d+\\.\\d+)([bkmg])\\s+(\\w+)/i) do |amount, unit, label|\n case label\n when 'used'\n mem_data[:used] =\n (amount.to_f * DARWIN_UNITS[unit.downcase]).round\n when 'free', 'unused'\n mem_data[:available] =\n (amount.to_f * DARWIN_UNITS[unit.downcase]).round\n end\n end\n total = mem_data[:used]+mem_data[:available]\n ((mem_data[:used].to_f/total)*100).to_i\n end", "title": "" }, { "docid": "f4882377859389df43c398c422268c6e", "score": "0.6767884", "text": "def get_total_cpu_percentage\n result = execute_wmic(\"wmic cpu get loadpercentage\")\n\n # in the end, the result array should resemble [\"CPUBlahBlahBlah\", \"XXX\"] where XXX is the CPU %\n return result[1]\n end", "title": "" }, { "docid": "6d68176c69398f48a9782e890157d424", "score": "0.6766057", "text": "def percentage\n items_done.to_f / items_size * 100\n end", "title": "" }, { "docid": "ad53b9465b6438c42b4abb3d6c01645a", "score": "0.6755033", "text": "def memory_delta_score; end", "title": "" }, { "docid": "21f8b2d732050bd36826813864a8b02b", "score": "0.6751292", "text": "def storage_soft_limit_pct\n @storage_soft_limit_pct\n end", "title": "" }, { "docid": "0ed214e51fd68a7eb86187d3159f4b65", "score": "0.6750177", "text": "def mem_usage\n a = `ps -o vsz,rss -p #{Process.pid}`.split(/\\s+/)[-2..-1].map{|el| el.to_i}\n [a.first - a.last, a.last]\n end", "title": "" }, { "docid": "693a8462201d8bd06219b962df232b6f", "score": "0.6743727", "text": "def load_factor\n @count/(self.size).to_f\n end", "title": "" }, { "docid": "2bb8aa13977aff5ceb0a7e39992771ea", "score": "0.67359895", "text": "def memory_derived_memory_used\n end", "title": "" }, { "docid": "1aa5fccb6b27b98e2834ab7898e88030", "score": "0.672603", "text": "def load_factor\n # puts @items_ct / self.size.to_f\n return @items_ct / self.size.to_f\n end", "title": "" }, { "docid": "10683fbc3b43b7ed4e0f98ec52361c0c", "score": "0.67241627", "text": "def h_percent; end", "title": "" }, { "docid": "fd3382e33d8a4aaa8c0d524d06e213f7", "score": "0.671909", "text": "def percent\n advanced(0)\n end", "title": "" }, { "docid": "ad6565027ec479833c7e853716067a2a", "score": "0.671361", "text": "def calculate_utilization(processes)\n sum = 0.to_f\n processes.map do |process|\n sum += process['busy'] / process['concurrency'].to_f\n end\n sum / processes.size.to_f\n end", "title": "" }, { "docid": "b53e62d52a24da704dfec61fa7b71769", "score": "0.67092925", "text": "def memory_usage\n return `ps -o rss= #{Process.pid}`.strip.to_i\nend", "title": "" }, { "docid": "45e5ec5dd59ce819070f7c6bc7651200", "score": "0.67084444", "text": "def percent_inodes(fs_info)\n (100.0 - (100.0 * fs_info.inodes_free / fs_info.inodes)).round(2)\n end", "title": "" }, { "docid": "a29118e8ff6d01a44fca9373e2f7f2a9", "score": "0.6697272", "text": "def load_factor\n @count / self.size.to_f\n end", "title": "" }, { "docid": "99f392acb8416d6d4b22c10a1dce6d3b", "score": "0.6697165", "text": "def calculate_memory\n case Sys::Platform::IMPL\n when :linux\n MiqProcess.processInfo[:unique_set_size].to_f / 1.megabyte\n when :macosx\n MiqProcess.processInfo[:memory_usage].to_f / 1.megabyte\n else\n raise \"Method ManageIQ::Util::MemoryLogging#memory_usage not implemented on this platform [#{Sys::Platform::IMPL}]\"\n end\n end", "title": "" }, { "docid": "a349ec784382b06338199b2767fcb4c2", "score": "0.6688525", "text": "def memory_used\n %x[free -ot].split[19]\n end", "title": "" }, { "docid": "8b6003ef0d63047c317fbe4d076dddde", "score": "0.668502", "text": "def ram_used\n total_ram = 0\n @bacct_output.each_line do |line|\n next if !(line =~ /\\s\\d+M$/)\n total_ram += line.match(/\\s(\\d+)M$/)[1].to_i\n end\n (total_ram / 1000).to_s + \"G\"\n end", "title": "" }, { "docid": "24dc3801edeb8664b017d7f6b2a079a1", "score": "0.6684473", "text": "def process_memory_usage\n `ps -o rss= -p #{$$}`.to_i\n end", "title": "" }, { "docid": "615711124a2cccb99617667f124cda57", "score": "0.667858", "text": "def percent_of(n)\n self.to_f / n.to_f * 100.0\n #left_tokens =\n #consumed_tokens = \n #score = consumed_tokens.percent_of(left_tokens)\n end", "title": "" }, { "docid": "0ec334719b13d9055a01ccf910212cff", "score": "0.66753316", "text": "def free_space\n sum = 0\n\n mount_points.each do |mount_point, values|\n sum += RelayRegister::Converter.convert_to_gb(values['size_available'])\n end\n\n \"#{sum.round(1)} GB\"\n end", "title": "" }, { "docid": "21d48f12e336ad61530423055204263d", "score": "0.6674275", "text": "def total_memory\n case operating_system\n when :osx\n `sysctl -n hw.memsize`.to_i / 1024 / 1024\n when :linux\n `awk '$1 == \"MemTotal:\" { print $2 }' /proc/meminfo`.to_i / 1024\n when :windows\n `wmic OS get TotalVisibleMemorySize | more +1`.to_i / 1024\n else\n 0\n end\n end", "title": "" }, { "docid": "21d48f12e336ad61530423055204263d", "score": "0.6674275", "text": "def total_memory\n case operating_system\n when :osx\n `sysctl -n hw.memsize`.to_i / 1024 / 1024\n when :linux\n `awk '$1 == \"MemTotal:\" { print $2 }' /proc/meminfo`.to_i / 1024\n when :windows\n `wmic OS get TotalVisibleMemorySize | more +1`.to_i / 1024\n else\n 0\n end\n end", "title": "" }, { "docid": "a62bb9ae0f3b1dd88b5f483a733556e6", "score": "0.6667233", "text": "def memory_bytes_used\n get_device_info[:memory_used]\n end", "title": "" }, { "docid": "7b2b165351b72f3e7ce66ecfc8402dca", "score": "0.66671664", "text": "def gpus_available_percent\n gpus > 0 ? ((gpus_used).to_f / gpus.to_f) * 100 : 0\n end", "title": "" }, { "docid": "8d80ec97abae35bbbc99f78364ff7660", "score": "0.6666661", "text": "def owner_gpu_nodes_available_percent\n owner_gpu_nodes > 0 ? ((owner_gpu_nodes - owner_gpu_nodes_free).to_f / owner_gpu_nodes.to_f) * 100 : 0\n end", "title": "" }, { "docid": "02a268b323e1c0f943cb40743a81c899", "score": "0.6653641", "text": "def owner_nodes_percent\n owner_nodes_avail > 0 ? (owner_nodes_used.to_f / owner_nodes_avail.to_f) * 100 : 0\n end", "title": "" }, { "docid": "22a8cfa562169f5d3077de83422bb7b3", "score": "0.66524774", "text": "def memory_content(tasks, mem_size)\n tasks_memory = tasks_memory_usage(tasks)\n \"#{tasks_memory} / #{mem_size} = \" +\n \"#{percentage(tasks_memory.to_f / mem_size)}\"\n end", "title": "" }, { "docid": "fd386c0795a1e4401cfa5078111cd317", "score": "0.6651715", "text": "def memory(_)\n query = @client.percent_query_free(\n 'node_memory_MemTotal',\n 'node_memory_MemAvailable'\n )\n prepare_metrics('memory', @client.query(query))\n end", "title": "" }, { "docid": "ec86d8bd36d603841afc103a81303a17", "score": "0.6639655", "text": "def percentage(count)\n ((count.to_f / size) * 100).round(1)\n end", "title": "" }, { "docid": "61530c04d15380fad3febc6d98a49f5b", "score": "0.6635707", "text": "def oom_free_percentage(app, date_start, date_end)\n @client.app.oomfree(app.id, date_start.to_i.to_s, date_end.to_i.to_s, [\"all\"])\n end", "title": "" }, { "docid": "f7d1754e029fd2eb81139dd12b1279de", "score": "0.6627804", "text": "def percent_cpu\n stats = stat\n total_time = stats[:utime].to_i + stats[:stime].to_i # in jiffies\n seconds = uptime - stats[:starttime].to_i / @@hertz\n if seconds == 0\n 0\n else\n ((total_time * 1000 / @@hertz) / seconds) / 10\n end\n rescue # This shouldn't fail is there's an error (or proc doesn't exist)\n 0\n end", "title": "" }, { "docid": "f7d1754e029fd2eb81139dd12b1279de", "score": "0.6627804", "text": "def percent_cpu\n stats = stat\n total_time = stats[:utime].to_i + stats[:stime].to_i # in jiffies\n seconds = uptime - stats[:starttime].to_i / @@hertz\n if seconds == 0\n 0\n else\n ((total_time * 1000 / @@hertz) / seconds) / 10\n end\n rescue # This shouldn't fail is there's an error (or proc doesn't exist)\n 0\n end", "title": "" }, { "docid": "71c7b7cad6197dae06c454b32c91e644", "score": "0.66247797", "text": "def determine_memory_wired\n mem = query('free -m')\n if /^Mem/.match(mem)\n mem = mem.lines.select { |l| l =~ /^Mem/ }.first\n mem = mem.split(/\\s+/).map(&:to_i)\n total = mem[1]\n used = total - mem[3..-1].reduce(&:+)\n used = sprintf(\"%#{total.to_s.length}d\", used)\n percent = ((used.to_f / total) * 100).to_i\n else\n used = 0\n percent = 0\n end\n\n Entry.new('Used RAM', \"#{used} MiB (#{percent}%)\")\n end", "title": "" }, { "docid": "a35c799e872710abbbcd685985150c58", "score": "0.66163373", "text": "def percent_available\n\t\t\t\treturn nil unless swaps_readable?\n\t\t\t\tvalues_t = read_usage\n\n\t\t\t\ttotal = values_t[0].sum\n\t\t\t\treturn 0.0 if total == 0\n\n\t\t\t\ttotal.-(values_t[-1].sum).*(100).fdiv(total).round(2)\n\t\t\tend", "title": "" }, { "docid": "3512b446d6a0370ea700541de3b3f640", "score": "0.6612148", "text": "def percentage(vol)\nreturn vol * 100 / 65536\nend", "title": "" }, { "docid": "5ce33764dc422a16db20267082c03f23", "score": "0.66097254", "text": "def ram_used\n %x[free -ot].split[8]\n end", "title": "" }, { "docid": "7bfbb7dbb137d04db9dda22cb83d2d7c", "score": "0.65984154", "text": "def percentage_reporting\n return percentage_precincts_reporting/100\n end", "title": "" }, { "docid": "613c2452b84878261d5f2f887c57b63f", "score": "0.65925837", "text": "def grade_percentage\n (passed.size/tests.size.to_f) * 100\n end", "title": "" }, { "docid": "c3ab4d868bbb9cb6f45f24d3f8530dd6", "score": "0.6572559", "text": "def mem_total\n case RUBY_PLATFORM\n when /darwin/ then `sysctl -n hw.memsize`.to_i / 1024 / 1024\n when /linux/ then File.read(\"/proc/meminfo\").scan(/MemTotal:\\s*(\\d+)/)[0][0].to_i / 1024\n else 0\n end\n rescue\n 0\n end", "title": "" }, { "docid": "2aff34a2d8e113cd7f5a096417fd38fa", "score": "0.6567642", "text": "def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend", "title": "" }, { "docid": "2aff34a2d8e113cd7f5a096417fd38fa", "score": "0.6567642", "text": "def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend", "title": "" }, { "docid": "c96b1c9ab1e72f6d7024de5133dba704", "score": "0.6559845", "text": "def load_factor\n @item_count.to_f / @size.to_f\n end", "title": "" }, { "docid": "88b47daab8b6fbf4bf32578ad11e5c69", "score": "0.6555116", "text": "def mem_usage\n # all usage\n total_used_memory = IO.popen(\"ps aux\").read.split(\"\\n\").inject 0 do |a, i|\n a += i.split(' ')[3].to_f\n end\n # mysql usage\n tread_desc = IO.popen(\"ps aux|grep mysqld\").read.split(\"\\n\")[0].split \" \" #get total info about mysql-process\n #form json\n render json: {\n rows: [{\n type: \"Memory free\",\n total: 100\n },{\n type: \"Mysql used\",\n total: tread_desc[3].to_f\n },{\n type: 'Other',\n total: total_used_memory-tread_desc[3].to_f\n }]\n }\n end", "title": "" }, { "docid": "ff928cef660733d063e308126fb5fb06", "score": "0.6547307", "text": "def print_memory_usage\n memory_before = `ps -o rss= -p #{Process.pid}`.to_i\n yield\n memory_after = `ps -o rss= -p #{Process.pid}`.to_i\n\n puts \"Memory: #{((memory_after - memory_before) / 1024.0).round(2)} MB\"\nend", "title": "" }, { "docid": "caeff5093f0b4abea06768c8c0cf5842", "score": "0.6543763", "text": "def estimate_space_used(used_height)\n\t\t@formatting ||= self.settings(:export).formatting\n\n\t\treturn 0 unless @formatting[:font_size] > 0\n\n\t\tmargin_height = @formatting[:margin][:top].to_i + @formatting[:margin][:bottom].to_i\n\t\tpage_height = A4_PAGE_HEIGHT - margin_height # 297mm for A4 portrait\n\t\tavailable_height = page_height * self.dmptemplate.settings(:export).max_pages\n\n\t\tpercentage = (used_height / available_height) * 100\n\t\t(percentage / ROUNDING).ceil * ROUNDING # round up to nearest five\n\tend", "title": "" }, { "docid": "caeff5093f0b4abea06768c8c0cf5842", "score": "0.6543763", "text": "def estimate_space_used(used_height)\n\t\t@formatting ||= self.settings(:export).formatting\n\n\t\treturn 0 unless @formatting[:font_size] > 0\n\n\t\tmargin_height = @formatting[:margin][:top].to_i + @formatting[:margin][:bottom].to_i\n\t\tpage_height = A4_PAGE_HEIGHT - margin_height # 297mm for A4 portrait\n\t\tavailable_height = page_height * self.dmptemplate.settings(:export).max_pages\n\n\t\tpercentage = (used_height / available_height) * 100\n\t\t(percentage / ROUNDING).ceil * ROUNDING # round up to nearest five\n\tend", "title": "" } ]
1da3633936c974419d2a2d941ea42dda
GET /maintenances/1 GET /maintenances/1.json
[ { "docid": "ca1703f4d97e7e7b419e4b4fabb28f64", "score": "0.58463943", "text": "def show\n @documents = @maintenance.documents\n end", "title": "" } ]
[ { "docid": "ba9166e9de939019a5760e7514de9754", "score": "0.7732917", "text": "def get_maintenances()\n results = @zabbix.raw_api(\"maintenance.get\", {\"output\" => \"extend\", \"selectHosts\" => \"extend\", \"selectGroups\" => \"extend\"} )\n pp results\n end", "title": "" }, { "docid": "fbb3d1090c914a40ab6f02e6d6d5c462", "score": "0.75392056", "text": "def maintenance_list(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenance/list/' + statuspage_id\n end", "title": "" }, { "docid": "9191d67a9dafc25a096a6194c2e5ac56", "score": "0.7518151", "text": "def maintenance_status\n get \"/setup/api/maintenance\", password_hash\n end", "title": "" }, { "docid": "3c2f66bbb8f77f14b4d1373216c91afc", "score": "0.7283151", "text": "def maintenance_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenances/' + statuspage_id\n end", "title": "" }, { "docid": "54438ec4dea5be0ff090605da0b1d804", "score": "0.71413416", "text": "def get_maintenance(id, opts = {})\n data, _status_code, _headers = get_maintenance_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "38386badf62527d235ee3c9c6316bae9", "score": "0.713612", "text": "def index\n @maintenances = Maintenance.not_expired\n end", "title": "" }, { "docid": "0c997d72f8cd5c970058139e8f596017", "score": "0.70992255", "text": "def list_maintenance_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MaintenanceApi.list_maintenance ...\"\n end\n if @api_client.config.client_side_validation && opts[:'type'] && !['all', 'past', 'non-expired'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of all, past, non-expired'\n end\n # resource path\n local_var_path = \"/v1/maintenance\"\n\n # query parameters\n query_params = {}\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListMaintenanceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MaintenanceApi#list_maintenance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "1efffa44b958d90e4e599d3da475828c", "score": "0.7089156", "text": "def list_maintenance(opts = {})\n data, _status_code, _headers = list_maintenance_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "5619dfed263f598e3129bcfedd9a5d14", "score": "0.70880544", "text": "def index\n @maintenances = @vehicle.maintenances.order('date desc').page(params[:page])\n end", "title": "" }, { "docid": "f809a8f64360db409b94435927537ef9", "score": "0.7055631", "text": "def index\n @device_maintenances = DeviceMaintenance.all\n end", "title": "" }, { "docid": "9689f92b5e3d1158c5e6985c10c87abd", "score": "0.7041144", "text": "def index\n @maintenance_requests = MaintenanceRequest.all\n end", "title": "" }, { "docid": "744b0fcee899b3103b9b3ddea1ed91c6", "score": "0.69902307", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "46894704b999c9ecb4f6daf03265cbd9", "score": "0.69317794", "text": "def maintenances\n @project = Project.find(params[:id])\n @trackers = @project.trackers\n @issue_categories = @project.issue_categories\n @versions = @project.versions\n @issue_statuses = IssueStatus.all\n @issue_priorities = Enumeration.find_all_by_opt(\"IPRI\")\n result = {'trackers' => @trackers, 'statuses' => @issue_statuses, 'versions' => @versions,\n 'categories' => @issue_categories, 'priorities' => @issue_priorities}\n\n respond_to do |format|\n format.html\n format.xml { render :xml => result, :status => :ok}\n format.json { render :json => result }\n end\n\n end", "title": "" }, { "docid": "003a3f29ba736360ab4aca4b512c68dc", "score": "0.692733", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "003a3f29ba736360ab4aca4b512c68dc", "score": "0.692733", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "003a3f29ba736360ab4aca4b512c68dc", "score": "0.692733", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "003a3f29ba736360ab4aca4b512c68dc", "score": "0.692733", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "003a3f29ba736360ab4aca4b512c68dc", "score": "0.692733", "text": "def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end", "title": "" }, { "docid": "15254ddd6878a96924ae502b61e30e0b", "score": "0.6884025", "text": "def maintenance\n @system_messages = SystemMessage.maintenance_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_messages }\n end\n end", "title": "" }, { "docid": "f1edf8a220f3630289fc0c713a7a3a21", "score": "0.6695722", "text": "def index\n @maintenances = @car.maintenances\n end", "title": "" }, { "docid": "b75b3ad56dfb36fb57e82fd1374d2cc2", "score": "0.6672719", "text": "def index\n @maintenance_types = MaintenanceType.all\n end", "title": "" }, { "docid": "c92a53390be3feb605cdca15459aba85", "score": "0.6654526", "text": "def get_current_tenant_maintenance_window \n get(\"/tenants.json/maintenance\")\nend", "title": "" }, { "docid": "e7f48332610b347ac377e9b950da9e49", "score": "0.66300666", "text": "def index\n @maintenances = Maintenance.order(date_start: :desc).page(params[:page])\n \n end", "title": "" }, { "docid": "789eede0ff1421e4a55d2c46ea49e790", "score": "0.65691423", "text": "def create\n @maintenance = Maintenance.new(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5045b2622d020d56c8e1d91aff52832", "score": "0.6563909", "text": "def index\n permission_denied if !is_adm?\n @maintenance_requests = MaintenanceRequest.where(\"app_status = 0\")\n end", "title": "" }, { "docid": "97f47194652347d34e6a34338d862bb5", "score": "0.655716", "text": "def set_maintenance_status(maintenance)\n queries = password_hash\n queries[:query][:maintenance] = \"#{maintenance.to_json}\"\n post \"/setup/api/maintenance\", queries\n end", "title": "" }, { "docid": "ab3551244dc64fff87c930f8501f02ee", "score": "0.65365446", "text": "def create\n @maintenance = Maintenance.new(maintenance_params)\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @maintenance }\n else\n format.html { render action: 'new' }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e64a25f4653804c39452d5771cea8a74", "score": "0.6490278", "text": "def get_maintenance_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MaintenanceApi.get_maintenance ...\"\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 MaintenanceApi.get_maintenance\"\n end\n # resource path\n local_var_path = \"/v1/maintenance/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'GetMaintenanceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MaintenanceApi#get_maintenance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4e559a668cea8d386582bde8fffea49b", "score": "0.64511514", "text": "def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e559a668cea8d386582bde8fffea49b", "score": "0.64511514", "text": "def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af5992d164d5bc00456cbe4c52db4c18", "score": "0.64242154", "text": "def update\n @maintenance = @vehicle.maintenances.find(params[:id])\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to vehicle_maintenances_path(@vehicle), notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ec82fe8bc993ab69e4fb616b5b965aa", "score": "0.63875645", "text": "def show\n @maintenance_item = MaintenanceItem.find(params[:id])\n \n authorize! :read, @maintenance_item\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintenance_item }\n end\n end", "title": "" }, { "docid": "e9e67e1198727c7e983e63f4e8049ba6", "score": "0.63751405", "text": "def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "075b0561724bc45012f63781c1d8887e", "score": "0.6365924", "text": "def maintenance\n @maintenance ||= Maintenance.new(self)\n end", "title": "" }, { "docid": "2b63ce9c55cf5c9c0d1354fd55d379d5", "score": "0.635829", "text": "def create\n @maintenance = @vehicle.maintenances.build(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to [@vehicle, :maintenances], notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb57df54025fe6569b9dae8545f7097a", "score": "0.63407594", "text": "def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e86aa55f66711d4af6bcb8c871b5d74c", "score": "0.63138545", "text": "def index\n @maintenance_parts = MaintenancePart.all\n end", "title": "" }, { "docid": "eec929aa9006c1494b69bf25ee42fba9", "score": "0.62527436", "text": "def maintenance\n end", "title": "" }, { "docid": "fd1700fa1f5399775072251715a92467", "score": "0.6211534", "text": "def maintenance_options\n data[:maintenance_options]\n end", "title": "" }, { "docid": "0f68c37297b50e537c8bca534dec08f4", "score": "0.61977774", "text": "def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end", "title": "" }, { "docid": "612e3951e416fcd3af9769de042ffdc5", "score": "0.6192818", "text": "def acquire_maintenance_data\n result = Diplomat::Health.node(config[:node]).select do |check|\n check['CheckID'] == '_node_maintenance'\n end\n if !result.empty?\n { enabled: true, reason: result.first['Notes'] }\n else\n { enabled: false, reason: nil }\n end\n rescue Faraday::ConnectionFailed => e\n warning \"Connection error occurred: #{e}\"\n rescue Faraday::ClientError => e\n if e.response[:status] == 403\n critical %(ACL token is not authorized to access resource: #{e.response[:body]})\n else\n unknown \"Exception occurred when checking consul service: #{e}\"\n end\n rescue StandardError => e\n unknown \"Exception occurred when checking consul node maintenance: #{e}\"\n end", "title": "" }, { "docid": "4973e2e9a7b25533fb00733ef84034cd", "score": "0.61686283", "text": "def get_tenant_maintenance_window(args = {}) \n get(\"/tenants.json/maintenance/#{args[:tenantId]}\", args)\nend", "title": "" }, { "docid": "6d6d8ce1b90e79332173dfa06e5568a8", "score": "0.6100836", "text": "def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to maintenances_url, notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "43b3a016fe8170a451a970cba58f0858", "score": "0.6095126", "text": "def destroy\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url, notice: \"Maintenance was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a6e51fd2695f0f77cacde356010b2467", "score": "0.60750306", "text": "def index\n # Show all records\n params[:search] = format_date params[:search]\n \n @maintenances = Maintenance.search(params[:search], params[:column]).order(sort_column(Maintenance, 'vehicle_id') + ' ' + sort_direction).page(params[:page]).per(10)\n \n get_params()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maintenances }\n end\n end", "title": "" }, { "docid": "8c42125851642345b6236092a62d93e1", "score": "0.6048247", "text": "def show\n # Show one record\n @maintenance = Maintenance.find(params[:id])\n # Since vehicle id can correspond to truck or trailer, we need to check which one is correct\n # which is set with vehicle type. Use the appropriate query based on the result\n if @maintenance.vehicle_type == 'truck'\n @truck = Truck.find(@maintenance.vehicle_id) rescue nil\n else\n @trailer = Trailer.find(@maintenance.vehicle_id) rescue nil\n end\n @trip = Trip.find(@maintenance.trip_id) rescue nil\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintenance }\n end\n end", "title": "" }, { "docid": "79ed3d4d18c9c875ba651c3367580301", "score": "0.59749967", "text": "def create\n # Logic to createa record\n @maintenance = Maintenance.new(params[:maintenance])\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render json: @maintenance, status: :created, location: @maintenance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80168f696c26314d1d238d0b00271005", "score": "0.5945794", "text": "def create\n @maintenance = @car.maintenances.build(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8a6e51020df6ea6ed911be70836e6aa", "score": "0.59344083", "text": "def index\n @maintenance_ressources = MaintenanceRessource.order(:service_id, :name).page(params[:page])\n end", "title": "" }, { "docid": "8eee835ac1a1bd083d0043b1ca888262", "score": "0.5931687", "text": "def set_device_maintenance\n @device_maintenance = DeviceMaintenance.find(params[:id])\n end", "title": "" }, { "docid": "6d8160b6a341af1ee5661608753bc898", "score": "0.5913768", "text": "def show\n @preventive_maintenance = PreventiveMaintenance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @preventive_maintenance }\n end\n end", "title": "" }, { "docid": "3692bbe918f83a536ba2973303f0102d", "score": "0.5887844", "text": "def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f6060a80ff413c0b46d0b6e1bb1f7b0f", "score": "0.58761245", "text": "def update\n # Logic to update a record\n @maintenance = Maintenance.find(params[:id])\n\n respond_to do |format|\n if @maintenance.update_attributes(params[:maintenance])\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f686972b2ca087324f93b767b205de68", "score": "0.5841694", "text": "def show\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end", "title": "" }, { "docid": "4805a897e27c5544a507a5562cf5dbc9", "score": "0.58413374", "text": "def set_maintenance_type\n @maintenance_type = MaintenanceType.find(params[:id])\n end", "title": "" }, { "docid": "7f3451075d9c4c9c299aac0e176c20ef", "score": "0.58388203", "text": "def maintenance_params\n params.require(:maintenance).permit(:date, :cost, :description, :warranty, :mileage, :vehicle_id, :warranty_status, :maintenance_type)\n end", "title": "" }, { "docid": "ae344017fdda28206b2e90c4bb4ceb5a", "score": "0.5828716", "text": "def maintenance_params\n params.require(:maintenance).permit(:name, :date_start, :date_end, :contact_id, :maintenance_ressource_id)\n end", "title": "" }, { "docid": "18f1eef17c6c07ea4aae9ef1fba2e0a4", "score": "0.5794914", "text": "def maintenance(enable, service = nil, reason = nil)\n if service.nil?\n url = build_agent_url('maintenance')\n else\n if service.instance_of?(Consul::Model::Service)\n service = service.id\n end\n raise ArgumentError.new \"Unable to create request for #{service}\" unless service.respond_to?(:to_str)\n url = build_service_url(\"maintenance/#{service}\")\n end\n params = {:enable => enable}\n params[:reason] = reason unless reason.nil?\n _get url, params\n end", "title": "" }, { "docid": "6a6a6a9700b4d2511d1a5f7f978757cd", "score": "0.57914275", "text": "def set_ac_maintenance\n @ac_maintenance = AcMaintenance.find(params[:id])\n end", "title": "" }, { "docid": "b17c5e67ec2ad478f6903d70b3a6503c", "score": "0.5756871", "text": "def index\n @maintainers = Maintainer.all\n end", "title": "" }, { "docid": "7ee8b76f0db8d489103e29b56c08735c", "score": "0.5754072", "text": "def new\n # Form to create a new record\n @maintenance = Maintenance.new\n @trips = Trip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @maintenance }\n end\n end", "title": "" }, { "docid": "51f293e340407f0f66d346712f77e518", "score": "0.5736482", "text": "def check_maintenance_mode()\n versioning = AppParameter.find_by_code( AppParameter::PARAM_VERSIONING_CODE )\n if versioning.a_bool?\n logger.info('--- MAINTENANCE MODE IS ON! ---')\n respond_to do |format|\n format.html do\n # Do just a redirect (avoid an infinite loop of redirections):\n redirect_to( controller: 'home', action: 'maintenance' ) unless (params[:controller] == 'home') && (params[:action] == 'maintenance')\n end\n format.json { render json: {maintenance: true} and return }\n end\n end\n end", "title": "" }, { "docid": "e2de3513aa79d1ca637d62ea72401d7d", "score": "0.57207125", "text": "def maintenance_update(statuspage_id, maintenance_id, maintenance_details, notifications = 0, message_subject = \"Maintenance Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n data['maintenance_details'] = maintenance_details\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/update',\n :payload => data\n end", "title": "" }, { "docid": "b6210c979e5b63d0aa1b281a00e227bc", "score": "0.57142985", "text": "def create_maintenance(body, opts = {})\n data, _status_code, _headers = create_maintenance_with_http_info(body, opts)\n return data\n end", "title": "" }, { "docid": "32a545d2e33bc70175710126440f97e9", "score": "0.5694884", "text": "def set_maintenance_item\n @maintenance_item = MaintenanceItem.find(params[:id])\n end", "title": "" }, { "docid": "707f7e7bf72fef06713d45c6f50ef98f", "score": "0.5692369", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "title": "" }, { "docid": "2910d65f617eba1a7d3dde913e596396", "score": "0.56539637", "text": "def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_maintenances_path(@vehicle), notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7b642ca7ecbbf441683e54fca5ba3e64", "score": "0.56501734", "text": "def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end", "title": "" }, { "docid": "74bb682abc3d21bde4c1cdb3c3aa39ce", "score": "0.56341213", "text": "def show\n @product_maintenance = ProductMaintenance.find(params[:id])\n @so_detail = SoDetail.new(params[:so_detail])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_maintenance }\n end\n end", "title": "" }, { "docid": "fe584c0d965efbaa5282ef1a2dceee6e", "score": "0.56311697", "text": "def maintenance_schedule\n if maintenance_schedules\n maintenance_schedules.first\n else\n nil\n end\n end", "title": "" }, { "docid": "df4b60b998d06f7d7626e05583c86857", "score": "0.5614031", "text": "def set_maintenance_request\n @maintenance_request = MaintenanceRequest.find(params[:id])\n end", "title": "" }, { "docid": "df4b60b998d06f7d7626e05583c86857", "score": "0.5614031", "text": "def set_maintenance_request\n @maintenance_request = MaintenanceRequest.find(params[:id])\n end", "title": "" }, { "docid": "5becd0e5e24a76930c95685a10862f2f", "score": "0.5603745", "text": "def set_maintenance_history\r\n begin\r\n @maintenance_history = MaintenanceHistory.find(params[:id])\r\n rescue Exception => e\r\n @maintenance_history = nil\r\n end\r\n end", "title": "" }, { "docid": "4582fced6b9e9272db4c901b79f0900e", "score": "0.56011033", "text": "def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to maintenances_url, notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end", "title": "" }, { "docid": "fdca03c40391139d8fd1ff1d16959819", "score": "0.55892915", "text": "def show\n flash.keep\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @service_demand_breakdown }\n end\n end", "title": "" }, { "docid": "5a50ca9ae618b24af9e1d88317b4b57c", "score": "0.5569846", "text": "def update\n \n respond_to do |format|\n if @ac_maintenance.update(ac_maintenance_params)\n format.html { redirect_to @ac_maintenance, notice: 'Ac maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @ac_maintenance }\n else\n format.html { render :edit }\n format.json { render json: @ac_maintenance.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "f2648c1de621f00f6198a3527d378a0a", "score": "0.5564937", "text": "def discovery\n assigned_minions = assigned_with_status\n unassigned_minions = Minion.unassigned_role\n pending_minions = ::Velum::Salt.pending_minions\n retryable_bootstrap_orchestration = Orchestration.retryable? kind: :bootstrap\n retryable_upgrade_orchestration = Orchestration.retryable? kind: :upgrade\n\n respond_to do |format|\n format.html\n format.json do\n hsh = {\n assigned_minions: assigned_minions,\n unassigned_minions: unassigned_minions,\n pending_minions: pending_minions,\n admin: admin_status,\n retryable_bootstrap_orchestration: retryable_bootstrap_orchestration,\n retryable_upgrade_orchestration: retryable_upgrade_orchestration\n }\n render json: hsh, methods: [:update_status]\n end\n end\n end", "title": "" }, { "docid": "78626b0d937722899c091c9f4822a1ac", "score": "0.5558847", "text": "def pending_maintenance_action_details\n data.pending_maintenance_action_details\n end", "title": "" }, { "docid": "45798b849bacc85fd027134d91da4852", "score": "0.5524926", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end", "title": "" }, { "docid": "6af40b5ed7d4c38b7dd0d320247e9425", "score": "0.5524368", "text": "def set_maintenance_ressource\n @maintenance_ressource = MaintenanceRessource.find(params[:id])\n end", "title": "" }, { "docid": "69e320bf6fc963670898017fe9ec101f", "score": "0.551701", "text": "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission }\n end\n end", "title": "" }, { "docid": "fd993cf7d0a43a54173c4fb02bb3c222", "score": "0.5512936", "text": "def maintenance_start(statuspage_id, maintenance_id, maintenance_details, notifications = 0, message_subject = \"Maintenance Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n data['maintenance_details'] = maintenance_details\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/start',\n :payload => data\n end", "title": "" }, { "docid": "77a4be4c63101b3151137b27052f8e37", "score": "0.5512786", "text": "def index\n @activities = Activity\n @pens = Pen\n @new_maintenance = Maintenance.new\n @users = User\n @maintenances = Activity.find_by_sql(\"select x.id, x.user_id, x.pen_id, x.created_at, x.pen_maintenance_check, y.resolved\n from(\n select a.id, a.pen_id, a.created_at, a.user_id, a.pen_maintenance_check from (\n select max(activities.created_at) as created_at from activities group by activities.pen_id\n ) as b\n inner join activities as a on a.created_at = b.created_at) as x\n left outer join maintenances as y on x.id = y.activity_id\n where x.pen_maintenance_check = 1 and (y.resolved = 0 or y.resolved is NULL)\")\n @maintenances = @maintenances.paginate(page: params[:page], per_page: 4)\n\n #.paginate(page: params[:page], per_page: 5)\n end", "title": "" }, { "docid": "dd9f228df56b3979a2a27d58dff4b8a7", "score": "0.55085945", "text": "def index\n if params[:query]\n @ac_maintenances = AcMaintenance.text_search(params[:query]).paginate(page: params[:page]).\n order(date: :asc).per_page(10)\n flash[:notice] = 'Ningún resultado' if @ac_maintenances.empty?\n else\n @ac_maintenances = AcMaintenance.paginate(page: params[:page]).order(date: :asc).per_page(10)\n end\n end", "title": "" }, { "docid": "d7756dd92127ec9a69e7ba8dd26ca16d", "score": "0.55065954", "text": "def show\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @incident }\n end\n end", "title": "" }, { "docid": "17b79dc8a6a9243d70a7d8b8677c1a87", "score": "0.55033165", "text": "def create\n @device_maintenance = DeviceMaintenance.new(device_maintenance_params)\n\n respond_to do |format|\n if @device_maintenance.save\n format.html { redirect_to @device_maintenance, notice: 'Device maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @device_maintenance }\n else\n format.html { render :new }\n format.json { render json: @device_maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10c7410ebd71a8fcd8f3771590b21db0", "score": "0.5500474", "text": "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mission }\n end\n end", "title": "" }, { "docid": "a844357aef93baea3ab0e267af37c1d5", "score": "0.5491721", "text": "def index\n statuses_dashboard\n end", "title": "" }, { "docid": "967c1e05b3d0af3437c301331c176827", "score": "0.54717815", "text": "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "title": "" }, { "docid": "00fbe84bb75640779fd020cd170b89bb", "score": "0.5465875", "text": "def create\n #debugger\n \n @ac_maintenance = AcMaintenance.new(ac_maintenance_params)\n @ac_maintenance.user_id = current_user.id\n\n respond_to do |format|\n if @ac_maintenance.save\n format.html { redirect_to @ac_maintenance, notice: 'Ac maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @ac_maintenance }\n else\n format.html { render :new }\n format.json { render json: @ac_maintenance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28f0185b9dd11f7ab607542f37b9b622", "score": "0.54618615", "text": "def index\n @missions = Mission.all\n end", "title": "" }, { "docid": "28f0185b9dd11f7ab607542f37b9b622", "score": "0.54618615", "text": "def index\n @missions = Mission.all\n end", "title": "" }, { "docid": "28f0185b9dd11f7ab607542f37b9b622", "score": "0.54618615", "text": "def index\n @missions = Mission.all\n end", "title": "" }, { "docid": "28f0185b9dd11f7ab607542f37b9b622", "score": "0.54618615", "text": "def index\n @missions = Mission.all\n end", "title": "" }, { "docid": "fb058711396a52ee93a5b30d0dbb98ec", "score": "0.54526323", "text": "def destroy\n @ac_maintenance.destroy\n respond_to do |format|\n format.html { redirect_to ac_maintenances_url, notice: 'Ac maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "173bfa0cfc2954182bd4da50c59d465f", "score": "0.54429877", "text": "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "title": "" }, { "docid": "059c514d658c77fed1fc0b6beb0b79cc", "score": "0.5436653", "text": "def show\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heartbeat }\n end\n end", "title": "" }, { "docid": "3cac3a170b3a2583daca408ab5286b51", "score": "0.5391589", "text": "def index\n @mission_statuses = MissionStatus.all\n end", "title": "" }, { "docid": "909a553c83705d62da3c5ae7373903f7", "score": "0.53863853", "text": "def show\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_mission }\n end\n end", "title": "" }, { "docid": "d78a5f6ac1646d583f8ec8b141e66c32", "score": "0.5384086", "text": "def check_maintenance_page\n if ENV.key? 'VEC_MAINTENANCE_UNDERWAY'\n redirect_to \"/maintenance.html\"\n end\n end", "title": "" } ]
22f60d81708979184825ab522027e12d
Set the value of the Legend input for this Choreo.
[ { "docid": "f8e903799b8aad4d98768f9a015d6ff3", "score": "0.7911483", "text": "def set_Legend(value)\n set_input(\"Legend\", value)\n end", "title": "" } ]
[ { "docid": "0da865db3fc2705d37a54dfb51793a2e", "score": "0.7557695", "text": "def legend=(legend)\n Validator.validate_type(legend, 'Array')\n @parameters[:legend] = legend\n end", "title": "" }, { "docid": "1957d70f933ab61b48da49271203db2e", "score": "0.7497105", "text": "def legend= value\r\n\t\t@legend = value\r\n\tend", "title": "" }, { "docid": "0b35aa834a2a043c78f6534757d25f07", "score": "0.6449248", "text": "def render_legend(params)\n self.label = legend if self.label.nil? # Can use legend instead of label\n params[\"chl\"] = label if label\n end", "title": "" }, { "docid": "11769aabe4b6ac96b4ceae6a95e2ed4d", "score": "0.64211065", "text": "def put_worksheet_chart_legend( put_worksheet_chart_legend_request, opts = {})\n\n data, _status_code, _headers = put_worksheet_chart_legend_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "223afcb2a5a61c908eafe12a2cab6b43", "score": "0.6414427", "text": "def set_legend\n return set_labels if @type == :pie || @type == :pie_3d\n \n if @legend.is_a?(Array)\n \"chdl=#{@legend.map{|label| \"#{label}\"}.join('|')}\"\n else\n \"chdl=#{@legend}\"\n end\n \n end", "title": "" }, { "docid": "6aea304de615757a36fc44a3867e6270", "score": "0.62487036", "text": "def set_legend(params = {})\n if params.has_key?(:position)\n if params[:position].downcase == 'none'\n @legend[:visible] = 0\n end\n end\n end", "title": "" }, { "docid": "f7aaef80f57468ab9facd9ea46a03a4b", "score": "0.58532923", "text": "def legend\n attributes.fetch(:legend)\n end", "title": "" }, { "docid": "4dd1b0715d0b2e7cc6c59439c888cb3a", "score": "0.5725643", "text": "def legend(text)\n @g.legend(text)\n end", "title": "" }, { "docid": "4dd1b0715d0b2e7cc6c59439c888cb3a", "score": "0.5725643", "text": "def legend(text)\n @g.legend(text)\n end", "title": "" }, { "docid": "338fa19906086241f4202bd7b80d6e5e", "score": "0.5723812", "text": "def show_legend=(v); end", "title": "" }, { "docid": "b143268df32f068712abbf415094702c", "score": "0.56439304", "text": "def legend(args = {})\n config.data[:options][:legend] = {} unless config.data[:options][:legend]\n config.data[:options][:legend][:position] = args[:position] if args [:position]\n config.data[:options][:legend][:display] = true if args[:display]\n config.data[:options][:legend][:display] = false if args[:hidden]\n config.data[:options][:legend][:fullWidth] = true if args[:full]\n config.data[:options][:legend][:reverse] = true if args[:reverse]\n # legend labels\n config.data[:options][:legend][:labels][:boxWidth] = args[:width] if args[:width]\n config.data[:options][:legend][:labels][:fontSize] = args[:size] if args[:size]\n config.data[:options][:legend][:labels][:fontStyle] = args[:style] if args[:style]\n config.data[:options][:legend][:labels][:padding] = args[:padding] if args[:padding]\n end", "title": "" }, { "docid": "76f82d1786163f82211d3fe0c569501a", "score": "0.563084", "text": "def update\n @legend_value = LegendValue.find(params[:id])\n\n if @legend_value.update(params[:legend_value])\n head :no_content\n else\n render json: @legend_value.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4b301724fce49f459422b44f72b7c588", "score": "0.5613491", "text": "def configure_legends\n @legend_box = Rubyplot::Artist::LegendBox.new(\n self, abs_x: legend_box_ix, abs_y: legend_box_iy\n )\n end", "title": "" }, { "docid": "02347d1aade7abfec8de7b5ef8340de3", "score": "0.5588439", "text": "def legend\r\n\t\treturn if ! @legend\r\n\t\t# New canvas size of longest Series name + 2 and height of the No. Series + 2 buffer\r\n\t\tlegendCanvas \t= GraphCanvas.new @seriesSet.seriesNames.sort{|a, b| b.length <=> a.length}.first.length + 4, @seriesSet.length \r\n\t\[email protected] @legendSort\r\n\t\ti \t\t\t\t= 0\r\n\t\[email protected]{|series|\r\n\t\t\t#Series symbol\r\n\t\t\tlegendCanvas.draw GraphText.new(\r\n\t\t\t\tseries.symbol, \r\n\t\t\t\tCanvasCoordinate.new(1, i), \r\n\t\t\t\tseries.colour)\r\n\t\t\t#Series name\r\n\t\t\tlegendCanvas.draw GraphText.new(\r\n\t\t\t\t\" \" + series.name, \r\n\t\t\t\tCanvasCoordinate.new(legendCanvas.width - series.name.length , i), \r\n\t\t\t\t:white)\r\n\t\t\ti += 1\r\n\t\t}\r\n\t\tlegendCanvas\r\n\tend", "title": "" }, { "docid": "e4955a57f0f5947ea536689afcd744e6", "score": "0.5425514", "text": "def legend; end", "title": "" }, { "docid": "e4955a57f0f5947ea536689afcd744e6", "score": "0.5425514", "text": "def legend; end", "title": "" }, { "docid": "ca4bfda796f8e730d88891ccb0005505", "score": "0.5383491", "text": "def legend_tag(contents, attrs = {}) \n tag(:legend, contents, attrs)\n end", "title": "" }, { "docid": "dad063d3a0371abda8993e11a9f61097", "score": "0.5360289", "text": "def post_worksheet_chart_legend( post_worksheet_chart_legend_request, opts = {})\n\n data, _status_code, _headers = post_worksheet_chart_legend_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "def7d13974953274e409bcf28d5bdf60", "score": "0.53127706", "text": "def write_legend\n position = @legend.position\n allowed = %w[right left top bottom]\n delete_series = @legend.delete_series || []\n\n if @legend.position =~ /^overlay_/\n position = @legend.position.sub(/^overlay_/, '')\n overlay = true\n else\n position = @legend.position\n overlay = false\n end\n\n return if position == 'none'\n return unless allowed.include?(position)\n\n @writer.tag_elements('c:legend') do\n # Write the c:legendPos element.\n write_legend_pos(position[0])\n # Remove series labels from the legend.\n # Write the c:legendEntry element.\n delete_series.each { |index| write_legend_entry(index) }\n # Write the c:layout element.\n write_layout(@legend.layout, 'legend')\n # Write the c:overlay element.\n write_overlay if overlay\n # Write the c:spPr element.\n write_sp_pr(@legend)\n # Write the c:txPr element. Over-ridden.\n write_tx_pr_legend(0, @legend.font)\n end\n end", "title": "" }, { "docid": "d7e867e9b1bfa37b26a4e5acad2281b2", "score": "0.5259142", "text": "def get_worksheet_chart_legend( get_worksheet_chart_legend_request, opts = {})\n\n data, _status_code, _headers = get_worksheet_chart_legend_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "f8feb42a0b93d829558af9db28ed689b", "score": "0.5258997", "text": "def store_legend_stream # :nodoc:\n store_legend(*@config[:legend])\n\n store_begin\n store_pos(*@config[:legend_pos])\n store_legend_text_stream\n store_end\n end", "title": "" }, { "docid": "85971d26b1646d4caadd88e470edd241", "score": "0.52315986", "text": "def legend_properties(params)\n legend = Writexlsx::Chart::Legend.new\n\n legend.position = params[:position] || 'right'\n legend.delete_series = params[:delete_series]\n legend.font = convert_font_args(params[:font])\n\n # Set the legend layout.\n legend.layout = layout_properties(params[:layout])\n\n # Turn off the legend.\n legend.position = 'none' if params[:none]\n\n # Set the line properties for the legend.\n line = line_properties(params[:line])\n\n # Allow 'border' as a synonym for 'line'.\n line = line_properties(params[:border]) if params[:border]\n\n # Set the fill properties for the legend.\n fill = fill_properties(params[:fill])\n\n # Set the pattern properties for the legend.\n pattern = pattern_properties(params[:pattern])\n\n # Set the gradient fill properties for the legend.\n gradient = gradient_properties(params[:gradient])\n\n # Pattern fill overrides solid fill.\n fill = nil if pattern\n\n # Gradient fill overrides solid and pattern fills.\n if gradient\n pattern = nil\n fill = nil\n end\n\n # Set the legend layout.\n layout = layout_properties(params[:layout])\n\n legend.line = line\n legend.fill = fill\n legend.pattern = pattern\n legend.gradient = gradient\n legend.layout = layout\n\n @legend = legend\n end", "title": "" }, { "docid": "d62e07ff0c15ad70b798e4f1c4af49d2", "score": "0.522767", "text": "def field_set(legend = nil, form_options = {}, &block)\n @template.send(:field_set_tag, legend, form_options, &block)\n end", "title": "" }, { "docid": "dc031ad461c0a3f7654b4b0df96aed05", "score": "0.5092047", "text": "def show_legend; end", "title": "" }, { "docid": "748e27737273a2ea8e2a5373fbf5e3ff", "score": "0.5047206", "text": "def delete_worksheet_chart_legend( delete_worksheet_chart_legend_request, opts = {})\n\n data, _status_code, _headers = delete_worksheet_chart_legend_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "996a964ef1e2728ef58c28c3c40f273a", "score": "0.5011686", "text": "def legend_font_size=(value)\n @legend_font.size = value\n end", "title": "" }, { "docid": "a1861440a6062b2a47c44245c824054e", "score": "0.5004597", "text": "def store_legend(x, y, width, height, wType, wSpacing, grbit) # :nodoc:\n record = 0x1015 # Record identifier.\n length = 0x0014 # Number of bytes to follow.\n # x # X-position.\n # y # Y-position.\n # width # Width.\n # height # Height.\n # wType # Type.\n # wSpacing # Spacing.\n # grbit # Option flags.\n\n header = [record, length].pack('vv')\n data = [x].pack('V')\n data += [y].pack('V')\n data += [width].pack('V')\n data += [height].pack('V')\n data += [wType].pack('C')\n data += [wSpacing].pack('C')\n data += [grbit].pack('v')\n\n append(header, data)\n end", "title": "" }, { "docid": "722ea7c28fce3da6d500dfff0b58e852", "score": "0.494496", "text": "def set_legendary_action\n @legendary_action = LegendaryAction.find(params[:id])\n end", "title": "" }, { "docid": "cb0baf662ca904c7af146462653c94c9", "score": "0.4882712", "text": "def store_legend_text_stream # :nodoc:\n store_text(*@config[:legend_text])\n\n store_begin\n store_pos(*@config[:legend_text_pos])\n store_ai(0, 1, '')\n\n store_end\n end", "title": "" }, { "docid": "e83e43de968df294dc816c5050dc12c7", "score": "0.4871739", "text": "def hue=(value)\n set(:hue => value)\n end", "title": "" }, { "docid": "cfee822f340bccf18260e64868f07ee7", "score": "0.48627546", "text": "def add_to_legend(seg)\n raise \"Segment is not a string\" unless (seg.is_a? String)\n #if seg isn’t already a key in the Hash legend\n unless @legend.has_key? seg\n @legend[seg] = @segvalue\n @segvalue += 1\n end\n end", "title": "" }, { "docid": "26ec049069413340328a45136af925f8", "score": "0.48281592", "text": "def draw_legend\n return if @hide_legend\n\n @legend_labels = @data.collect {|item| item[DATA_LABEL_INDEX] }\n\n legend_square_width = 20 # small square with color of this item\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n metrics = @d.get_type_metrics(@base_image, @legend_labels.join(''))\n legend_text_width = metrics.width\n legend_width = legend_text_width + (@legend_labels.length * legend_square_width * 2.7)\n legend_left = (@raw_columns - legend_width) / 2\n legend_increment = legend_width / @legend_labels.length.to_f\n\n current_x_offset = legend_left\n @legend_labels.each_with_index do |legend_label, index| \n # Draw label\n @d.fill = @marker_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke = 'transparent'\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image, \n @raw_columns, 24,\n current_x_offset + (legend_square_width * 1.7), 70, \n legend_label.to_s, @scale)\n \n # Now draw box with color of this dataset\n legend_box_y_offset = 2 # Move box down slightly to center\n @d = @d.stroke 'transparent'\n @d = @d.fill @data[index][DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset, 70 + legend_box_y_offset, \n current_x_offset + legend_square_width, 70 + legend_square_width + legend_box_y_offset)\n\n @d.pointsize = @legend_font_size\n metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = metrics.width + (legend_square_width * 2.7)\n current_x_offset += current_string_offset\n end\n @color_index = 0\n end", "title": "" }, { "docid": "5ba81af4885dc4f43a7c697c3181bc25", "score": "0.48238578", "text": "def field_set(legend = nil, options = nil, &block)\n @template.content_tag(:fieldset, options) do\n (legend.blank?? \"\" : @template.content_tag(:legend, legend)) +\n @template.capture(&block)\n end\n end", "title": "" }, { "docid": "19f5548dd7933cfeb7df9b664ee80a52", "score": "0.47918904", "text": "def legend(colorgrad, height=@height/90, width=@width/5, x=@width/30, y=@height*23/27)\n # colorgrad\n stroke = width/colorgrad.colorcount\n lower = y + height\n @gc.stroke_width(1)\n (1..colorgrad.colorcount).each{ |c|\n @gc.stroke(colorgrad.colors[c])\n h = x + (c-1) * stroke\n (0...stroke).each{ |s|\n @gc.line(h+s, y, h+s, lower) \n }\n }\n # labels\n l = stroke * colorgrad.colorcount / x\n @gc.stroke('transparent')\n @gc.fill('#888')\n @gc.font_style(Magick::NormalStyle)\n @gc.font_weight(Magick::NormalWeight)\n @gc.pointsize(x/3)\n # min\n @gc.text(x, lower + x/2, colorgrad.min.to_s)\n\n @gc.text_align(Magick::CenterAlign)\n (1...l).each{ |i|\n @gc.text(x + i*x, lower + x/2, \"#{colorgrad.get_rounded_value(i*x/stroke).floor}\") \n }\n\n # max\n @gc.text(x + stroke*colorgrad.colorcount, lower + x/2, \">#{colorgrad.max.floor}\")\n \n end", "title": "" }, { "docid": "26df5b385af0d717d67f5d4635b7d75e", "score": "0.47717023", "text": "def cells_charts_put_worksheet_chart_legend(name, sheet_name, chart_index, opts = {})\n warn \"Warning: #cells_charts_put_worksheet_chart_legend() is deprecated.\"\n data, _status_code, _headers = cells_charts_put_worksheet_chart_legend_with_http_info(name, sheet_name, chart_index, opts)\n return data\n end", "title": "" }, { "docid": "5080008de028cc8c497eba44d51690f8", "score": "0.47645375", "text": "def test_store_legend\n caption = \" \\tChart: _store_legend()\"\n expected = %w(\n 15 10 14 00 F9 05 00 00 E9 0E 00 00 7D 04 00 00\n 9C 00 00 00 00 01 0F 00\n ).join(' ')\n values = [0x05F9, 0x0EE9, 0x047D, 0x009C, 0x00, 0x01, 0x000F]\n got = unpack_record(@chart.__send__(\"store_legend\", *values))\n assert_equal(expected, got, caption)\n end", "title": "" }, { "docid": "be1e7c2590a8eb35e4fad45aa47dc6aa", "score": "0.47359586", "text": "def draw_legend\n return if @hide_legend\n\n @legend_labels = @data.collect {|item| item[DATA_LABEL_INDEX] }\n\n legend_square_width = @legend_box_size # small square with color of this item\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n label_widths = [[]] # Used to calculate line wrap\n @legend_labels.each do |label|\n metrics = @d.get_type_metrics(@base_image, label.to_s)\n label_width = metrics.width + legend_square_width * 2.7\n label_widths.last.push label_width\n\n if sum(label_widths.last) > (@raw_columns * 0.9)\n label_widths.push [label_widths.last.pop]\n end\n end\n\n current_x_offset = center(sum(label_widths.first))\n current_y_offset = @hide_title ?\n @top_margin + LEGEND_MARGIN :\n @top_margin + TITLE_MARGIN + @title_caps_height + LEGEND_MARGIN\n\n @legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke('transparent')\n @d = @d.fill @data[index][DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset,\n current_y_offset - legend_square_width / 2.0,\n current_x_offset + legend_square_width,\n current_y_offset + legend_square_width / 2.0)\n\n @d.pointsize = @legend_font_size\n metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n label_widths.first.shift\n if label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n label_widths.shift\n current_x_offset = center(sum(label_widths.first)) unless label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if label_widths.length > 0\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n @color_index = 0\n end", "title": "" }, { "docid": "a7fafc09b4e1c9fb1f4cc1cf09bee827", "score": "0.46955866", "text": "def field_set_tag(*args, &block) \n attrs = args.last.is_a?(Hash) ? args.pop : {}\n attrs = add_css_id(attrs, ['fieldset', args.first].compact.join('-'))\n legend_text = args.first.is_a?(String || Symbol) ? args.first : attrs.delete(:legend)\n legend_html = legend_text.blank? ? '' : tag(:legend, legend_text)\n captured_html = block_given? ? capture_html(&block) : ''\n concat_content(tag(:fieldset, legend_html + captured_html, attrs))\n end", "title": "" }, { "docid": "b583e115a48277e700581d1b7e9cb5e9", "score": "0.46419805", "text": "def set_Color(value)\n set_input(\"Color\", value)\n end", "title": "" }, { "docid": "955bc366c08a7788e4a801d2fb18ac91", "score": "0.463898", "text": "def legend_position; end", "title": "" }, { "docid": "5ac9a1b3c7b5cc8fc493f7e808785065", "score": "0.46235308", "text": "def legend\n self.class.title\n end", "title": "" }, { "docid": "e2e83369b4eb95c96d2b1332d7d3b525", "score": "0.46072903", "text": "def print_legend\n str = \"\"\n @legend.each do |key, value|\n str << \"'#{key}':#{value} \"\n end\n puts str\n end", "title": "" }, { "docid": "7483bc522e3d931744c4feb46b49cc3b", "score": "0.46050403", "text": "def legend(str, type, index, line=false, size=nil,\n vx=nil, dx=nil, vy=nil, first=true, mark_size=nil)\n\n size ||= DCL::uzrget(\"rsizel1\") * 0.95\n mark_size ||= size\n\n vpx1,vpx2,vpy1,vpy2 = DCL.sgqvpt\n if first || (!@vy)\n vy ||= vpy2 - 0.04\n vy += vpy2 - 0.04 if vy < 0\n else\n vy ||= @vy - 1.5 * size\n end\n @vy = vy\n\n vx ||= vpx2 + 0.015\n vx = (vpx2 + 0.015) + vx if vx < 0\n\n if line\n dx ||= 0.06\n vx2 = vx + dx\n DCL::sgplzv([vx,vx2],[vy,vy],type,index)\n DCL.sgtxzv(vx2+0.01,vy,str,size,0,-1,3)\n else # --> mark\n DCL::sgpmzv([vx],[vy],type,index,mark_size)\n DCL.sgtxzv(vx+0.015+mark_size*0.5,vy,str,size,0,-1,3)\n end\n nil\n end", "title": "" }, { "docid": "b3838136703a6fd666cc9d54be727844", "score": "0.46047324", "text": "def draw_legend\n return if @hide_legend\n\n legend_labels = store.data.map(&:label)\n legend_square_width = @legend_box_size # small square with color of this item\n legend_label_lines = calculate_legend_label_widths_for_each_line(legend_labels, legend_square_width)\n line_height = [legend_caps_height, legend_square_width].max + @legend_margin\n\n current_y_offset = begin\n if @legend_at_bottom\n @graph_bottom + @legend_margin + labels_caps_height + @label_margin + (@x_axis_label ? (@label_margin * 2) + marker_caps_height : 0)\n else\n hide_title? ? @top_margin + @title_margin : @top_margin + @title_margin + title_caps_height\n end\n end\n\n index = 0\n legend_label_lines.each do |(legend_labels_width, legend_labels_line)|\n current_x_offset = center(legend_labels_width)\n\n legend_labels_line.each do |legend_label|\n unless legend_label.empty?\n legend_label_width = calculate_width(@legend_font, legend_label)\n\n # Draw label\n text_renderer = Gruff::Renderer::Text.new(renderer, legend_label, font: @legend_font)\n text_renderer.add_to_render_queue(legend_label_width,\n legend_square_width,\n current_x_offset + (legend_square_width * 1.7),\n current_y_offset,\n Magick::CenterGravity)\n\n # Now draw box with color of this dataset\n rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: store.data[index].color)\n rect_renderer.render(current_x_offset,\n current_y_offset,\n current_x_offset + legend_square_width,\n current_y_offset + legend_square_width)\n\n current_x_offset += legend_label_width + (legend_square_width * 2.7)\n end\n index += 1\n end\n\n current_y_offset += line_height\n end\n end", "title": "" }, { "docid": "3ddb01df2929eb18b0322c5ed4709b13", "score": "0.45622405", "text": "def legend_left\n legend ? legend.fetch(:left, LEGEND_LEFT_SPACE) : LEGEND_LEFT_SPACE\n end", "title": "" }, { "docid": "e9425fe228085773b61124aab299878e", "score": "0.45168763", "text": "def legend_line\n (legend ? legend.fetch(:line, LEGEND_LINE_SPACE) : LEGEND_LINE_SPACE) + 1\n end", "title": "" }, { "docid": "cbdc5888f4f9da3572257377a3d9f432", "score": "0.45130152", "text": "def fieldset(legend = nil, options = {})\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n yield\n end\n end", "title": "" }, { "docid": "8e8b8892173dc0d374cae893a433509e", "score": "0.45116007", "text": "def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n @legend_position = args[:legend_position] if args.key?(:legend_position)\n @pie_hole = args[:pie_hole] if args.key?(:pie_hole)\n @series = args[:series] if args.key?(:series)\n @three_dimensional = args[:three_dimensional] if args.key?(:three_dimensional)\n end", "title": "" }, { "docid": "8e8b8892173dc0d374cae893a433509e", "score": "0.45116007", "text": "def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n @legend_position = args[:legend_position] if args.key?(:legend_position)\n @pie_hole = args[:pie_hole] if args.key?(:pie_hole)\n @series = args[:series] if args.key?(:series)\n @three_dimensional = args[:three_dimensional] if args.key?(:three_dimensional)\n end", "title": "" }, { "docid": "0f0b1410e2e3e79d97cff3534de08828", "score": "0.44325563", "text": "def set_rgb(rgb_value, effect='smooth', duration=200)\n request({id: 3,method: 'set_rgb', params: [rgb_value,effect,duration]})\n end", "title": "" }, { "docid": "0a5715b90f414057de800b732d6841e9", "score": "0.4422996", "text": "def print_color_legend(with_legend)\n puts \"Legend: %.3f; %.3f; delta = %.3f\" % [@min_value, @max_value, delta]\n @value_legend.each { |value|\n 2.times {print create_output_string_for(value, ' ') }\n }\n\n if (with_legend)\n print_interval_values\n end\n\n puts\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "240e0fa2521078a415b83e3f646289a4", "score": "0.44077575", "text": "def set_leg\n @leg = Leg.find(params[:id])\n end", "title": "" }, { "docid": "5855611fd6bb8d433e73da781ca42485", "score": "0.43938315", "text": "def destroy\n @LegendValue = LegendValue.find(params[:id])\n begin\n if(@LegendValue.destroy)\n render :json =>'Successfully'\n end\n rescue => e\n render :json => \"#{e}\", :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ad4b281f2fd836c7919448a1687cf9bd", "score": "0.4385717", "text": "def legend_info(id)\n get_response(\"/v2/legends#{Utils.format_id(id)}\")\n end", "title": "" }, { "docid": "2b2ab73e920598fbc71f7154e8228219", "score": "0.43703216", "text": "def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end", "title": "" }, { "docid": "2b2ab73e920598fbc71f7154e8228219", "score": "0.43703216", "text": "def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end", "title": "" }, { "docid": "cebf36e70a10e4e4b6f3738f40102477", "score": "0.4364726", "text": "def draw_legend(canvas, ethcolors, ethshapes,xstart, ystart, params)\n\t\trotate = params[:rotate]\n\t\tcoordinates_per_pixel = params[:coordinates_per_pixel]\n\t\tmax_label = params[:max_label]\n legend_start = xstart + @offset_mult * @x_offset + @x_interior_offset\n\n length_x = @diameter * 5\n if rotate\n ystart -= @diameter/2.5\n else\n ystart += -@diameter/3\n end\n\n font_size = standard_font_size * 1\n text_x = @offset_mult * @x_offset + @x_interior_offset\n y_text_adjust=0\n\n if rotate\n rotation = -90\n anchor = 'start'\n length_x = @diameter * 2\n y_text_adjust=@diameter*2\n else\n rotation = 0\n anchor = 'end'\n\t\t\ttext_x = @offset_mult * @x_offset\n end\n\n ethcolors.each do |eth, colorstr|\n\t\t\tlength_x = space_for_text(coordinates_per_pixel,max_label) unless rotate\n\t\t\tif rotate\n\t\t\t\tcanvas.g.translate(xstart, ystart).text(text_x, @y_offset-y_text_adjust).rotate(rotation) do |text|\n\t\t\t\t\ttext.tspan(eth).styles(:font_size => font_size, :text_anchor=>anchor)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tcanvas.g.translate(xstart, ystart).text(text_x+length_x-@diameter/5, @y_offset-y_text_adjust).rotate(rotation) do |text|\n\t\t\t\t\ttext.tspan(eth).styles(:font_size => font_size, :text_anchor=>anchor)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n canvas.g.translate(xstart, ystart) do |box|\n box.styles(:fill=>colorstr, :stroke=>'none', :stroke_width=>1, :fill_opacity=>0.8)\n if rotate\n\t\t\t\t\tif ethshapes[eth]=='square' or ethshapes[eth]=='circle'\n\t\t\t\t\t\tbox.rect(@diameter, @diameter, text_x-@diameter, @y_offset-@diameter)\n\t\t\t\t\telsif ethshapes[eth]=='diamond'\n#\t\t\t\t\t\toffset = @diameter/2.to_f \n\t\t\t\t\t\toffset = @diameter*0.6\n\t\t\t\t\t\tcenterx=text_x-@diameter/2.to_f\n\t\t\t\t\t\tcentery=@y_offset-@diameter/2.to_f\n\t\t\t\t\t\txpts =[centerx,centerx+offset,centerx,centerx-offset]\n\t\t\t\t\t\typts =[centery-offset,centery,centery+offset,centery]\n\t\t\t\t\t\tbox.polygon(xpts,ypts)\n\t\t\t\t\telse\n\t\t\t\t\t\tbox.circle(@diameter/2.to_f,text_x-@diameter/2.to_f,@y_offset-@diameter/2.to_f)\n\t\t\t\t\tend\n else\n\t\t\t\t\tif ethshapes[eth]=='square' or ethshapes[eth]=='circle'\n\t\t\t\t\t\tbox.rect(@diameter, @diameter, text_x+length_x, @y_offset-@diameter)\n\t\t\t\t\tend\n\t\t\t\t\tlength_x += @diameter + space_for_text(coordinates_per_pixel, \" \")\n end\n\n end\n text_x += length_x\n end\n end", "title": "" }, { "docid": "5a13f7e2a808c4536da8d339f5319399", "score": "0.43534976", "text": "def []=( color_tag, constants )\n @scheme[to_symbol(color_tag)] = HighLine::Style.new(:name=>color_tag.to_s.downcase.to_sym,\n :list=>constants, :no_index=>true)\n end", "title": "" }, { "docid": "15d537663cee4ba07f7492b49b49b801", "score": "0.43150914", "text": "def field_set_and_list_wrapping_div_legend(*args, &block) #:nodoc:\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n wrapper_tag = :ol\n wrapper_tag = html_options[:wrapper] if html_options.include?(:wrapper)\n legend = html_options.delete(:name).to_s\n legend %= parent_child_index(html_options[:parent]) if html_options[:parent]\n legend = template.content_tag(:div, template.content_tag(:span, legend), :class=>'legend') unless legend.blank?\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n fieldset = template.content_tag(:fieldset,\n legend << template.content_tag(wrapper_tag, contents),\n html_options.except(:builder, :parent)\n )\n fieldset\n end", "title": "" }, { "docid": "f5526b9078c5a1534bf0f29fece42068", "score": "0.430591", "text": "def edit_legend_field\n @custom = current_login.customs.find(params[:id])\n @dropdown_value = current_login.dropdown_values.find_by_custom_id(@custom.id)\n end", "title": "" }, { "docid": "ddf0154f91999c377aaeac49cfae87d2", "score": "0.43003872", "text": "def font_color=(value)\n @title_font.color = value\n @marker_font.color = value\n @legend_font.color = value\n end", "title": "" }, { "docid": "532a7e84df884bd998363ae51853293f", "score": "0.4291817", "text": "def legend_html\n template.content_tag(:label, control_label_html_options) do\n render_label? ? label_text : \"\".html_safe\n end\n end", "title": "" }, { "docid": "ea4284471c3a57e5678d7001f224c9a0", "score": "0.42776528", "text": "def fieldset(legend, options = {}, &block)\n options[:class] = case options[:class]\n when nil then 'inlineLabels'\n when /(block|inline)Labels/ then options[:class]\n else \"inlineLabels #{options[:class]}\"\n end\n content = @template.capture(&block)\n @template.concat(@template.tag(:fieldset, options, true) + \"\\n\")\n @template.concat(\"\\t\" + @template.content_tag(:legend, legend)) unless legend.blank?\n @template.concat(content)\n @template.concat(\"</fieldset>\")\n end", "title": "" }, { "docid": "46dc950dbac0a6cecb50776907d7574f", "score": "0.4271563", "text": "def cells_charts_put_worksheet_chart_legend_with_http_info(name, sheet_name, chart_index, opts = {})\n warn \"Warning: #cells_charts_put_worksheet_chart_legend_with_http_info() is deprecated.\"\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CellsApi.cells_charts_put_worksheet_chart_legend ...\"\n end\n @api_client.request_token_if_needed\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling CellsApi.cells_charts_put_worksheet_chart_legend\"\n end\n # verify the required parameter 'sheet_name' is set\n if @api_client.config.client_side_validation && sheet_name.nil?\n fail ArgumentError, \"Missing the required parameter 'sheet_name' when calling CellsApi.cells_charts_put_worksheet_chart_legend\"\n end\n # verify the required parameter 'chart_index' is set\n if @api_client.config.client_side_validation && chart_index.nil?\n fail ArgumentError, \"Missing the required parameter 'chart_index' when calling CellsApi.cells_charts_put_worksheet_chart_legend\"\n end\n # resource path\n local_var_path = \"/cells/{name}/worksheets/{sheetName}/charts/{chartIndex}/legend\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'sheetName' + '}', sheet_name.to_s).sub('{' + 'chartIndex' + '}', chart_index.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n #auth_names = []\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CellsCloudResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CellsApi#cells_charts_put_worksheet_chart_legend\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "58d4fd03f73260f72ee8c9a1798f9942", "score": "0.42661643", "text": "def legend_tag(method, options = {})\n if options[:label] == false\n Formtastic::Util.html_safe(\"\")\n else\n text = localized_string(method, options[:label], :label) || humanized_attribute_name(method)\n text += required_or_optional_string(options.delete(:required))\n text = Formtastic::Util.html_safe(text)\n template.content_tag :legend, template.label_tag(nil, text, :for => nil), :class => :label\n end\n end", "title": "" }, { "docid": "8f4cfcd1cde6930208c022fc168d7170", "score": "0.42562643", "text": "def set_Series(value)\n set_input(\"Series\", value)\n end", "title": "" }, { "docid": "d5595c6dacad7f03dba579f023ae11c7", "score": "0.42499122", "text": "def draw_plot_legend(x_start, y_start, is_dprime=true)\n \n labels_array = Array.new\n for i in 0..10 \n labels_array << i * 0.1\n end\n\n current_x=0\n current_y=0\n \n # draw boxes from starting point\n @canvas.g.translate(x_start,y_start) do |legend|\n labels_array.reverse_each do |box_value|\n color_string = get_color_from_score(box_value, 2.1, is_dprime)\n legend.rect(@box_size, @box_size, current_x, current_y).styles(:stroke=>color_string,\n :stroke_width=>1, :fill=>color_string)\n if is_dprime\n color_string = get_color_from_score(box_value, 0, is_dprime)\n legend.rect(@box_size, @box_size, current_x-@box_size, current_y).styles(:stroke=>color_string,\n :stroke_width=>1, :fill=>color_string)\n end\n current_y+=@box_size\n end\n end\n \n current_y=@box_size/2\n font_size = standard_font_size\n \n if is_dprime\n current_x = current_x - @box_size\n end\n \n labels_array.reverse_each do |label|\n @canvas.g.translate(x_start, y_start).text(current_x-2, current_y) do |text|\n text.tspan(\"%.1f\" % [label]).styles(:font_size=>font_size/1.2, :text_anchor=>'end')\n end\n current_y+=@box_size \n end\n \n # place box around the legend\n current_y=0\n width = @box_size\n if is_dprime\n width = @box_size*2\n end\n @canvas.g.translate(x_start, y_start) do |legend|\n legend.rect(width, @box_size*11, current_x, current_y).styles(:stroke=>'black',\n :stroke_width=>1, :fill=>'none')\n end\n \n # write labels on top of columns for d-prime legend\n if is_dprime\n current_y = -2\n current_x = current_x + @box_size/2\n @canvas.g.translate(x_start, y_start).text(current_x, current_y) do | text|\n text.tspan(\"<=2\").styles(:font_size=>font_size/1.2, :text_anchor=>'middle')\n end\n current_x = current_x + @box_size\n @canvas.g.translate(x_start, y_start).text(current_x, current_y) do | text|\n text.tspan(\">2\").styles(:font_size=>font_size/1.2, :text_anchor=>'middle')\n end\n current_y = current_y - @box_size/2\n @canvas.g.translate(x_start, y_start).text(current_x-@box_size/2, current_y) do | text|\n text.tspan(\"LOD\").styles(:font_size=>font_size/1.2, :text_anchor=>'middle')\n end\n end\n \n end", "title": "" }, { "docid": "d0621b8b74b18cf3d8ae3b6bb8ac34eb", "score": "0.42485005", "text": "def hue=(value)\n @hue = value\n hued.value_y = value / 360\n render\n end", "title": "" }, { "docid": "bcf42a9146df721217cbff37d9800f0b", "score": "0.4232988", "text": "def set_SetHour(value)\n set_input(\"SetHour\", value)\n end", "title": "" }, { "docid": "4cb1a5ac29a45a26514ed9e34cbcf254", "score": "0.4212594", "text": "def fieldset(attrs, &blk)\n legend = (l_attr = attrs.delete(:legend)) ? tag(:legend, l_attr) : \"\"\n tag(:fieldset, legend + @origin.capture(&blk), attrs)\n # @origin.concat(contents, blk.binding)\n end", "title": "" }, { "docid": "dc36091478d601d17c337199aa366e48", "score": "0.4211131", "text": "def set_color(light, color, opts={})\n hsl = color.to_hsl\n opts = opts.merge(bri: (hsl.l * 255).to_i,\n sat: (hsl.s * 255).to_i,\n hue: (hsl.h * 360 * 182).to_i)\n write(light, opts)\n end", "title": "" }, { "docid": "0935fc06e21c491356e903b01a43af33", "score": "0.41756263", "text": "def show\n @legend_value = LegendValue.find(params[:id])\n\n render json: @legend_value\n end", "title": "" }, { "docid": "ba8d50114a27ec814a51187663ceb5f2", "score": "0.41727382", "text": "def fill_color=(hash)\n raise ArgumentError, 'cannot set fill color, argument is not a hash' unless hash.is_a? Hash\n raise ArgumentError, 'cannot set fill color, hash does not contain :range or :color key' if hash[:range].nil? or hash[:color].nil?\n set_fill_color hash[:range], hash[:color]\n end", "title": "" }, { "docid": "b8dc32588e90afddeb8365885c7d1902", "score": "0.41512272", "text": "def fieldset(legend: nil, hint: nil)\n content_tag :fieldset, class: 'Fieldset' do\n concat(content_tag(:legend, legend, class: 'Fieldset-legend')) if legend\n concat(\n content_tag(:div, class: 'Fieldset-children') do\n concat(content_tag(:p, hint, class: 'Hint')) if hint\n concat(yield)\n end\n )\n end\n end", "title": "" }, { "docid": "994260da9c0206f8d4f7712fb9b3682e", "score": "0.41433987", "text": "def initialize\n @legend_values = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",'7',\"8\",\"9\"]\n @board_values = Array.new(9, \" \")\n end", "title": "" }, { "docid": "37da5203af58b73c0ae716022d176a7e", "score": "0.41378462", "text": "def create\n if params[:id]\n @legend_value = LegendValue.find(params[:id])\n @legend_value.legend_id= params[:legend_id]\n @legend_value.range= params[:range]\n @legend_value.value= params[:value]\n @legend_value.status =1\n @legend_value.save\n render :json => @legend_value\n else\n @legend_value = LegendValue.new\n @legend_value.legend_id= params[:selected_currency_ID]\n @legend_value.range= params[:currency_percent]\n @legend_value.value= params[:currency_percent_value]\n @legend_value.status =1\n @legend_value.save\n render :json => @legend_value\n end \n end", "title": "" }, { "docid": "f2e3578ba09b1852d7d231d9312bacbf", "score": "0.41346383", "text": "def registry_hive=(value)\n @registry_hive = value\n end", "title": "" }, { "docid": "2a27c1e0d794c1d6a642bb4e5e2ff1fa", "score": "0.41217968", "text": "def set(color)\n @last_color = color\n @light.set(color)\n end", "title": "" }, { "docid": "480e5fe9e7b266ece7317dd6b23322c0", "score": "0.41114944", "text": "def legend_color_new_payer_list\n if @payer_ids_under_processing.include?@new_payer\n color = 'red'\n else\n color = 'white'\n end\n color\n end", "title": "" }, { "docid": "58b3d0d6f8a07544b29b183400be2bd4", "score": "0.4102248", "text": "def category_legend\n category_legend_options.join \", \"\n end", "title": "" }, { "docid": "ec0fbf5da2e24231a521a994cc573363", "score": "0.40910965", "text": "def colour=(arg)\n self.fore_colour = arg\n @pattern = SOLID_PATTERN if @pattern == NO_PATTERN\n end", "title": "" }, { "docid": "1250e44f8b0776f99510f41b8a9aad95", "score": "0.40833274", "text": "def color=(c)\n self[:color] = c\n end", "title": "" }, { "docid": "ae3c26bcc74bfad7d9375db814b58696", "score": "0.4078773", "text": "def show_legend(**options)\n int = Instructions.instructions.sort { |a, b| (a.cc || \"#{a.cc + \".\" + a.mc}\".to_f) <=> (b.cc || \"#{b.cc + \".\" + b.mc}\".to_f)}\n int.map! do |i|\n (i.respond_to? :mc) ? [\"#{i.cc.to_s << \".\" << i.mc.to_s}\".to_f, i.to_s] : [i.cc, i.to_s]\n end\n table = TTY::Table.new header: ['cc', 'name'], rows: int\n puts table.render(:ascii)\n\n nil\n end", "title": "" }, { "docid": "2c3990c758f0cbae0f64c6d1ad738047", "score": "0.4071073", "text": "def set_color color\n attrset COLOR_PAIR(color)\n end", "title": "" }, { "docid": "9298d2dde2b5ac8cee731ba9af92465f", "score": "0.4064399", "text": "def set_color_abs(sym, color)\r\n @colors[sym] = color\r\n end", "title": "" }, { "docid": "873eb5e9307866fe64da5a1625c14c1c", "score": "0.40628278", "text": "def legend_dimensions_given?\n legend.is_a?(Hash) and (legend[:width] or legend[:height])\n end", "title": "" }, { "docid": "d268f014e8187cc7870e9e263e3aba1f", "score": "0.40619302", "text": "def set_GroupDescription(value)\n set_input(\"GroupDescription\", value)\n end", "title": "" }, { "docid": "5c3be1f1c35c0962c70539f4516e1b65", "score": "0.40613228", "text": "def hue=(new_hue)\r\n # Set HSB if Hue is nil\r\n @hue, @saturation, @brightness = to_hsb if @hue == nil\r\n # Ensure domain [0, 360) and set to new hue\r\n @hue = new_hue % 360\r\n # Get RGB Values\r\n rgb = Color.hsb_to_rgb(@hue, @saturation, @brightness)\r\n # Set Red Green And Blue Values by Converting to rgb\r\n self.red, self.green, self.blue = rgb\r\n end", "title": "" }, { "docid": "6b79c3844d997c30bcbd05357624228c", "score": "0.4052357", "text": "def hue=(hue)\n\t\t\thue = (hue * 65536 / 360).to_i & 65535\n\t\t\tset({ 'hue' => hue, 'colormode' => 'hs' })\n\t\tend", "title": "" }, { "docid": "8eee197324521045d402aa8b7be2be27", "score": "0.40486196", "text": "def draw_legend(x_pos,y_pos,data_description,r,g,b,rs=-1,gs=-1,bs=-1,rt=0,gt=0,bt=0,border=true)\n\t\t#Validate the Data and data_description array \n\t\tdata_description = self.validate_data_description(\"draw_legend\",data_description)\n\t\treturn(-1) if (data_description[\"description\"].nil?)\n\t\tc_text_color = allocate_color(@picture, rt, gt, bt)\n\t\t# <-10->[8]<-4->Text<-10-> \n\t\tmax_width = 0\n\t\tmax_height = 8\n\t\tdata_description[\"description\"].each do |key,value|\n\t\t\tposition = image_ftb_box(@font_size,0,@font_name,value)\n\t\t\ttext_width = position[2]-position[6].abs\n\t\t\ttext_height = position[1]-position[7]\n\t\t\tmax_width = text_width if ( text_width > max_width)\n\t\t\tmax_height = max_height + text_height + 4\n\t\tend\n\t\tmax_height = max_height - 5\n\t\tmax_width = max_width + 32\n\t\tif ( rs == -1 || gs == -1 || bs == -1 )\n\t\t\trs = r-30\n\t\t\tgs = g-30\n\t\t\tbs = b-30\n end\n\n\t\tif ( border )\n\t\t\t\n\t\t\tself.draw_filled_rounded_rectangle(x_pos+1,y_pos+1,x_pos+max_width+1,y_pos+max_height+1,5,rs,gs,bs)\n\t\t\tself.draw_filled_rounded_rectangle(x_pos,y_pos,x_pos+max_width,y_pos+max_height,5,r,g,b)\n\t\tend\n\t\ty_offset = 4 + @font_size\n\t\tid = 0\n\n\t\tdata_description[\"description\"].each do |key,value|\n\t\t\tself.draw_filled_rounded_rectangle(x_pos+10,y_pos+y_offset-4 , x_pos+14, y_pos+y_offset-4, 2, @palette[id][\"r\"], @palette[id][\"g\"], @palette[id][\"b\"])\n\t\t\timage_ttf_text(@picture, @font_size,0, x_pos+22, y_pos+y_offset, c_text_color, @font_name, value)\n\t\t\tposition = image_ftb_box(@font_size,0,@font_name,value);\n\t\t\ttext_height = position[1]-position[7]\n\t\t\ty_offset = y_offset + text_height + 4\n\t\t\tid=id+1\n\t\tend\n\tend", "title": "" }, { "docid": "896719318fc7f4de726c9290778afede", "score": "0.40443513", "text": "def blue=(val)\n @color.blue = val\n end", "title": "" }, { "docid": "14fdf697efe57235fd2975696438c089", "score": "0.40360737", "text": "def set_default_properties # :nodoc:\n @legend = {\n :visible => 1,\n :position => 0,\n :vertical => 0,\n }\n\n @chartarea = {\n :visible => 0,\n :fg_color_index => 0x4E,\n :fg_color_rgb => 0xFFFFFF,\n :bg_color_index => 0x4D,\n :bg_color_rgb => 0x000000,\n :area_pattern => 0x0000,\n :area_options => 0x0000,\n :line_pattern => 0x0005,\n :line_weight => 0xFFFF,\n :line_color_index => 0x4D,\n :line_color_rgb => 0x000000,\n :line_options => 0x0008,\n }\n\n @plotarea = {\n :visible => 1,\n :fg_color_index => 0x16,\n :fg_color_rgb => 0xC0C0C0,\n :bg_color_index => 0x4F,\n :bg_color_rgb => 0x000000,\n :area_pattern => 0x0001,\n :area_options => 0x0000,\n :line_pattern => 0x0000,\n :line_weight => 0x0000,\n :line_color_index => 0x17,\n :line_color_rgb => 0x808080,\n :line_options => 0x0000,\n }\n end", "title": "" }, { "docid": "5a71bb9779d15394607fc7f47325cb4f", "score": "0.40315253", "text": "def hue(val=nil)\n if val\n h, s, b, a = get_hsb\n set_hsb(val, s, b, a)\n self\n else\n @rgb.hueComponent\n end\n end", "title": "" }, { "docid": "92cf668eef6ae039941a3c9fee66474f", "score": "0.4012837", "text": "def set_legislation\n @legislation = Legislation.find(params[:id])\n end", "title": "" } ]
7cf0be3cc0b9f11fe8bbc74052d28ba1
if := 'if' ('else' )?
[ { "docid": "d671731233ada5e19ea8e280f6e404a5", "score": "0.7436544", "text": "def if_\n\t\tnext_if(:keyword, 'if') or return\n\t\tcond = expression or raise 'missing condition for `if` statement'\n\t\tif_true = block or raise 'missing true block for `if` statement'\n\t\tif next_if(:keyword, 'else')\n\t\t\tif_false = block or raise 'missing false block for `if` statement'\n\t\tend\n\n\t\tNode::If.new(cond, if_true, if_false)\n\tend", "title": "" } ]
[ { "docid": "f72d3b1f613d1592f131d6dd8cb512b1", "score": "0.82311654", "text": "def if(condition, if_true, if_false); end", "title": "" }, { "docid": "f4fbc48554c0ffa1fef7e739fed6fdb9", "score": "0.76251465", "text": "def elsif_conditional?; end", "title": "" }, { "docid": "f4fbc48554c0ffa1fef7e739fed6fdb9", "score": "0.76251465", "text": "def elsif_conditional?; end", "title": "" }, { "docid": "0be578f824e127a8bdbff1c3f822b41a", "score": "0.7565093", "text": "def if_branch; end", "title": "" }, { "docid": "0be578f824e127a8bdbff1c3f822b41a", "score": "0.7565093", "text": "def if_branch; end", "title": "" }, { "docid": "f1d29ed4e20802040c0abd120f8e16f2", "score": "0.7547013", "text": "def translate_if_else(sexp)\n var = next_var_name\n cond = translate_generic_sexp sexp[1]\n if_true = @symbol_table.in_block { translate_generic_sexp sexp[2] }\n if_false = @symbol_table.in_block { translate_generic_sexp sexp[3] }\n return_type = determine_if_else_types if_true.value_type, if_false.value_type\n filtered_stmts(\n s(:decl, :'Object*', var),\n cond,\n s(:if,\n boolean_value(cond.value_sexp),\n filtered_block(if_true, s(:asgn, s(:var, var), if_true.value_sexp)),\n filtered_block(if_false, s(:asgn, s(:var, var), if_false.value_sexp)))\n ).with_value s(:var, var), return_type\n end", "title": "" }, { "docid": "dc86ab638827c5df746f1ade55f56c4a", "score": "0.7337545", "text": "def if_state\n skip_token(\"if\")\n condition = simple_exp(:KEYWORD,\"then\")\n skip_token(\"then\")\n then_ = self.send(:block)\n skip_token(:EOL) if current_tk.tag == :EOL\n if current_tk .value == \"else\"\n skip_token \"else\"\n else_ = self.send(:block)\n else\n return Statement.if_statement(condition,then_)\n end\n return Statement.if_statement(condition,then_,else_)\n end", "title": "" }, { "docid": "7b22f8a27d86382f35e4d3ffcda101df", "score": "0.7275094", "text": "def if\n end", "title": "" }, { "docid": "2aef434907285ddc504b101963c1d516", "score": "0.7274447", "text": "def parse_if_statement\n if_tok = @tokenizer.token\n unless if_tok.is_type? :if\n return show_error \"Expected if keyword!\"\n end\n @tokenizer.get_next\n cond = parse_expression\n @tokenizer.get_next\n stmts = parse_block\n if @tokenizer.is_next_an? :else\n @tokenizer.get_next\n estmts = parse_block\n return AST::If.new(if_tok, cond, stmts, estmts)\n else\n return AST::If.new(if_tok, cond, stmts)\n end\n end", "title": "" }, { "docid": "b39483e1c9ca0b312091c13970c33d25", "score": "0.7209801", "text": "def elsif?; end", "title": "" }, { "docid": "b39483e1c9ca0b312091c13970c33d25", "score": "0.7209801", "text": "def elsif?; end", "title": "" }, { "docid": "0b1c15cd435d910254676d9379963545", "score": "0.71633255", "text": "def parseIfStatement()\n check(Token::T_IF, \"Expected IF\")\n parseLexpr()\n check(Token::T_THEN, \"Expected THEN\")\n parseStatements(Token::T_ELSE)\n check(Token::T_ELSE, \"Expected ELSE\")\n parseStatements(Token::T_END)\n check(Token::T_END, \"Expected END\")\nend", "title": "" }, { "docid": "4eb39e070d5ac0c80690359c3d4eaee0", "score": "0.7154285", "text": "def process_if(exp)\n cond_exp = process exp.shift\n then_exp = process exp.shift\n else_exp = process exp.shift rescue nil # might be empty\n\n cond_exp.c_type.unify CType.bool\n begin\n then_exp.c_type.unify else_exp.c_type unless then_exp.nil? or else_exp.nil?\n rescue TypeError\n puts \"Error unifying #{then_exp.inspect} with #{else_exp.inspect}\"\n raise\n end\n\n # FIX: at least document this\n type = then_exp.c_type unless then_exp.nil?\n type = else_exp.c_type unless else_exp.nil?\n\n return t(:if, cond_exp, then_exp, else_exp, type)\n end", "title": "" }, { "docid": "308f58ab7b705d9878cdfe0f87c07db6", "score": "0.71506166", "text": "def ruby2kif (sexp, var)\n return unless sexp \n case sexp[0]\n when :defn then ruby2kif(sexp[3],sexp[2][1]) #(:defn name (:args v1 v2...) stmt)\n when :scope then ruby2kif(sexp[1],var)\n when :block then parseBlock(sexp, var) #There could be more than one satement in the block \n when :call then rubyterm2kif(sexp, var)\n when :return then pk(\" \"); ruby2kif(sexp[1],var)\n when :true then pk(\"true\")\n when :false then pk(\"false\")\n when :if # then sexp # (:if cond then else)\n if sexp[2]\n op; pk(\"=> \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl;\n end\n if sexp[3] # else\n op;pk(\"=> \" ); op;pk(\"not \"); ruby2kif(sexp[1],var);cl; sp; ruby2kif(sexp[3],var);cl\n end\n \n when :and #(:and x y)\n op; pk(\"and \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl\n when :or #(:or x y)\n op; pk(\"or \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl\n when :not #(:not x)\n op; pk(\"not \"); ruby2kif(sexp[1],var); cl\n when :case # (:case variable case1 case2 case3.....)\n parseCase(sexp,var)\n when :array then rubyobj2kif(sexp[1],var) #TODO this is probably bad...\n when :when then # hehe \n ruby2kif(sexp[1],var); \n \n else log_sexp(sexp)\n end # throw error when found unknown operator\n end", "title": "" }, { "docid": "da7edd58f1fe9d89006f7ea4bfa2b4b6", "score": "0.71461153", "text": "def ifnode(arg, body, elsebody)\n @c << \"if (\"\n yield arg\n @c << \") {\\n\"\n yield body\n if !(elsebody.nil?)\n @c << \"} else {\\n\"\n yield elsebody\n @c << \"}\\n\"\n else\n @c << \"}\\n\"\n end\nend", "title": "" }, { "docid": "5315880f2bc9bc92ee8f9e97b06eebb6", "score": "0.714609", "text": "def _if(bool, ifTrue, ifFalse)\nbool ? ifTrue.call : ifFalse.call\nend", "title": "" }, { "docid": "ee966d6848e54d7f5ffc5eba093bc54f", "score": "0.7145725", "text": "def if_else_stmt\n else_label = asm.mklabel(:end_or_else)\n end_label = else_label # only generated if else clause\n # present\n condition\n skip_any_whitespace\n asm.jz(else_label)\n block\n if @token == :keyword && @value == 'else'\n skip_any_whitespace\n end_label = asm.mklabel(:endif) # now we need the 2nd label\n asm.jmp(end_label)\n asm.deflabel(else_label)\n block\n end\n match_word('end')\n asm.deflabel(end_label)\n end", "title": "" }, { "docid": "a1c02e63a42fd385f04f2a4d1ff6919e", "score": "0.71433663", "text": "def elseif!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = ELSEIF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 382:10: 'elseif'\n match( \"elseif\" )\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__, 28 )\n\n end", "title": "" }, { "docid": "0babe5786f1dc0b716cb7264ef804fca", "score": "0.71308935", "text": "def else_clause; end", "title": "" }, { "docid": "56b5256331dea7c86618bc56b212ddda", "score": "0.71254593", "text": "def if?; end", "title": "" }, { "docid": "56b5256331dea7c86618bc56b212ddda", "score": "0.71254593", "text": "def if?; end", "title": "" }, { "docid": "47818f0ec8d4af88043206d60ba063dd", "score": "0.7119381", "text": "def my_if(condition, then_clause, else_clause)\n if condition\n then_clause.call\n else\n else_clause.call\n end\nend", "title": "" }, { "docid": "47818f0ec8d4af88043206d60ba063dd", "score": "0.7119381", "text": "def my_if(condition, then_clause, else_clause)\n if condition\n then_clause.call\n else\n else_clause.call\n end\nend", "title": "" }, { "docid": "47818f0ec8d4af88043206d60ba063dd", "score": "0.7119381", "text": "def my_if(condition, then_clause, else_clause)\n if condition\n then_clause.call\n else\n else_clause.call\n end\nend", "title": "" }, { "docid": "bd2da01fe55da2e5ecb783f76f7e766b", "score": "0.7115654", "text": "def IfNode(predicate, statements, consequent); end", "title": "" }, { "docid": "29083d19f67862d602e8e08df0a4c9c6", "score": "0.71127933", "text": "def elsif\n end", "title": "" }, { "docid": "2c718e475f9f73ac435328c1ae1218fb", "score": "0.7079119", "text": "def if_statement()\n\tif (evaluateNextToken(\"IF_STMNT\"))\n\t\tif evaluateNextToken(\"OPENPAREN\")\n\t\t\tboolean_expr()\n\t\t\tif evaluateNextToken(\"CLOSEPAREN\") \n\t\t\t\tstatement()\n\n\t\t\t\tif evaluateNextToken(\"ELSE\")\n\t\t\t\t\tstatement()\n\t\t\t\tend\n\n\t\t\t\t# Exit part!\n\t\t\t\tif evaluateNextToken(\"END_IF\")\n\n\t\t\t\telse\n\t\t\t\t\terror(\"EXPECTING END_IF\")\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\terror(\"Missing Close Parenthesis\")\t\n\t\t\tend\n\t\telse\n\t\t\terror(\"Missing Open Parenthesis\") #Right Hand Side Doesn't Match\n\t\tend\n\n\telse\n\t\terror(\"The first token is not if\")\n\tend\nend", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "b0e06f6f6770eca8399965ae553bfbab", "score": "0.7066483", "text": "def else_branch; end", "title": "" }, { "docid": "cce5545fbfaa6cafe3d1554ccde2a7f2", "score": "0.70651776", "text": "def on_ifop(statement, value, else_statement)\n else_statement = Token::StatementToken.new(\n :type => :else,\n :value => [else_statement],\n :line => else_statement.line,\n :column => else_statement.column,\n :code => code(else_statement.line)\n )\n\n return Token::StatementToken.new(\n :type => :if,\n :statement => statement,\n :value => [value],\n :line => statement.line,\n :column => statement.column,\n :code => code(statement.line),\n :else => else_statement\n )\n end", "title": "" }, { "docid": "5a27357958ce778a29b009941fe8a65d", "score": "0.706456", "text": "def conditional_statement\n if :if == node_type\n self[1]\n end\n end", "title": "" }, { "docid": "1040825dcace4393d560b37c577a22c1", "score": "0.70583624", "text": "def if_statement\n if check(\"keyword\", \"if\") \n next!\n if check(\"left_paren\", \"(\")\n next!\n if expression\n if check(\"right_paren\", \")\")\n next!\n if check(\"keyword\", \"then\")\n next! \n until check(\"keyword\", \"else\") || check(\"keyword\", \"end\") || !program_statement\n next!\n end\n if check(\"keyword\", \"else\")\n next!\n until !program_statement\n next!\n end\n end\n next!\n if check(\"keyword\", \"if\")\n next! \n return true\n else\n error(\"keyword end if\")\n end\n else\n error(\"keyword then\")\n end\n else\n error(\"right paren\")\n end\n else\n error(\"expression\")\n end\n else\n error(\"left paren\")\n end\n else\n error(\"keyword if\")\n end\n end", "title": "" }, { "docid": "da095376aacdfe1ec3fc76677ea8fee8", "score": "0.7040987", "text": "def if_node; end", "title": "" }, { "docid": "f4fc8a389c14ff29b94bd2744a5188b9", "score": "0.70366085", "text": "def if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n\n\n type = IF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 41:5: 'if'\n match( \"if\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n\n end", "title": "" }, { "docid": "fd7d9546298a11652666fa06a86b6a4a", "score": "0.7035459", "text": "def if?\n keyword == 'if'\n end", "title": "" }, { "docid": "90973e4e903131d549762b2c7da7af27", "score": "0.7034136", "text": "def visit_if(node)\n s(\n :if,\n [\n visit_predicate(node.predicate),\n visit(node.statements),\n visit(node.consequent)\n ],\n if node.modifier?\n smap_keyword_bare(\n srange_find_between(node.statements, node.predicate, \"if\"),\n srange_node(node)\n )\n else\n begin_start = node.predicate.end_char\n begin_end =\n if node.statements.empty?\n node.statements.end_char\n else\n node.statements.body.first.start_char\n end\n\n begin_token =\n if buffer.source[begin_start...begin_end].include?(\"then\")\n srange_find(begin_start, begin_end, \"then\")\n elsif buffer.source[begin_start...begin_end].include?(\";\")\n srange_find(begin_start, begin_end, \";\")\n end\n\n else_token =\n case node.consequent\n when Elsif\n srange_length(node.consequent.start_char, 5)\n when Else\n srange_length(node.consequent.start_char, 4)\n end\n\n smap_condition(\n srange_length(node.start_char, 2),\n begin_token,\n else_token,\n srange_length(node.end_char, -3),\n srange_node(node)\n )\n end\n )\n end", "title": "" }, { "docid": "12ef1399a4359006cd3743ab94fa02ff", "score": "0.7025911", "text": "def if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n\n type = IF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 44:5: 'if'\n match( \"if\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n\n end", "title": "" }, { "docid": "4615a9fb1c1f61e6f6edc6399844dba7", "score": "0.7018025", "text": "def if_statement\n\t\ttemp = []\n\t\tpost\n\t\ttemp << \"if\"\n\t\ttemp << add_to_list(\"lf_paren\", 1, 1, 0)\n\t\ttemp << condition_expression(0)\n\t\ttemp << add_to_list(\"rt_paren\", 1, 1, 0)\n\t\t@temp_list.insert(-1,temp)\n\t\tcur_label = newlabel\n\t\t@temp_list.insert(-1, \"goto \" + cur_label + \"t;\")\n\t\t@temp_list.insert(-1, \"goto \" + cur_label + \"f;\")\n\t\t@temp_list.insert(-1, cur_label + \"t:;\")\n\t\tblock_statements\n\t\t@temp_list.insert(-1, cur_label + \"f:;\")\n\t\tif match_name(\"else\")\n\t\t\tpost\n\t\t\ttemp << block_statements\n\t\tend\n\t\treturn \"\"\n\tend", "title": "" }, { "docid": "7b09b88f82f9c10982894e91bd0140bc", "score": "0.70163417", "text": "def else_keyword; end", "title": "" }, { "docid": "d97ccbc3be3b6b34142dc43cf44995d8", "score": "0.7005667", "text": "def if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n\n type = IF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 27:6: 'if'\n match( \"if\" )\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__, 19 )\n\n end", "title": "" }, { "docid": "11217a49f86bf567af426bd0c909ee05", "score": "0.6973788", "text": "def if(condition, if_true, if_false)\n if condition.to_bool\n if_true\n else\n if_false\n end\n end", "title": "" }, { "docid": "c13b7be24b965960e5657a6019d2b577", "score": "0.6973643", "text": "def func_if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 28)\n\n type = FUNC_IF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 372:10: 'IF'\n match(\"IF\")\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__, 28)\n\n end", "title": "" }, { "docid": "373dac49b0bd413bab84370457214c71", "score": "0.69686043", "text": "def if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = IF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 379:6: 'if'\n match( \"if\" )\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__, 25 )\n\n end", "title": "" }, { "docid": "f09dde1f33fc17065ced500970c6aa01", "score": "0.6948773", "text": "def ruby2kif (sexp, var)\n\tif sexp \n \t\tcase sexp[0]\n \t\twhen :defn then ruby2kif(sexp[3],sexp[2][1]) #(:defn name (:args v1 v2...) stmt)\n \t\twhen :scope then ruby2kif(sexp[1],var)\n \t\twhen :block then ruby2kif(sexp[1],var)\n \t\twhen :call then rubyterm2kif(sexp, var)\n\t\twhen :if # then sexp # (:if cond then else)\n\t\t\tif sexp[2]\n\t\t\t op; pk(\"=> \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl;\n\t\t\tend\n\t\t\tif sexp[3] \n\t\t\t\top;pk(\"=> \" ); op;pk(\"not \"); ruby2kif(sexp[1],var);cl; sp; ruby2kif(sexp[3],var);cl\n\t\t\tend\n\t\twhen :and #(:and x y)\n\t\t\top; pk(\"and \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl\n\t\twhen :or #(:or x y)\n\t\t\top; pk(\"or \"); ruby2kif(sexp[1],var); sp; ruby2kif(sexp[2],var); cl\n\t\twhen :not #(:not x)\n\t\t\top; pk(\"not \"); ruby2kif(sexp[1],var); cl\n \t\telse puts sexpr; raise \"unknown sexpr type\"; # drop any unknown things\n \t\tend\n \tend\n end", "title": "" }, { "docid": "15f0a31be6ab171903984f688b292162", "score": "0.6938012", "text": "def grammar_if_else\n builder = Rley::RGN::GrammarBuilder.new do\n add_terminals('IF', 'THEN', 'ELSE')\n add_terminals('FALSE', 'TRUE', 'INTEGER')\n\n rule 'program' => 'stmt'\n rule 'stmt' => 'IF boolean THEN stmt'\n\n # To prevent dangling else issue, the ELSE must match the closest preceding IF\n # rule 'stmt' => 'IF boolean THEN stmt ELSE{closest IF} stmt'\n rule 'stmt' => 'IF boolean THEN stmt ELSE { match_closest: \"IF\" } stmt'\n rule 'stmt' => 'literal'\n rule 'literal' => 'boolean'\n rule 'literal' => 'INTEGER'\n rule 'boolean' => 'FALSE'\n rule 'boolean' => 'TRUE'\n end\n\n builder.grammar\n end", "title": "" }, { "docid": "f8adb137d1f1dcc8661cdaf5fcab6339", "score": "0.691152", "text": "def visit_if_op(node)\n s(\n :if,\n [visit(node.predicate), visit(node.truthy), visit(node.falsy)],\n smap_ternary(\n srange_find_between(node.predicate, node.truthy, \"?\"),\n srange_find_between(node.truthy, node.falsy, \":\"),\n srange_node(node)\n )\n )\n end", "title": "" }, { "docid": "acca826f857e4b52bb2d5c49c57fe7be", "score": "0.6905284", "text": "def _if(bool, ifTrue, ifFalse)\n bool ? ifTrue.call : ifFalse.call\nend", "title": "" }, { "docid": "acca826f857e4b52bb2d5c49c57fe7be", "score": "0.6905284", "text": "def _if(bool, ifTrue, ifFalse)\n bool ? ifTrue.call : ifFalse.call\nend", "title": "" }, { "docid": "5eeb0f60bcefc8bb3316ad07850aa512", "score": "0.690198", "text": "def greet_if_then_no_else\n if @hello then 'Hello World! (if then)' end\n end", "title": "" }, { "docid": "09b67684c364f7de482e10d27170330b", "score": "0.68561107", "text": "def if_expression(flag)\n if flag\n \"NG\"\n else\n \"OK\"\n end\nend", "title": "" }, { "docid": "fb892dc39ccce622596733004b6d6cbf", "score": "0.68254125", "text": "def elsif?\n keyword == 'elsif'\n end", "title": "" }, { "docid": "bc6114dd58a1191b21cf4abefc249787", "score": "0.68144083", "text": "def visit_if(statement)\n if is_truthy?(evaluate(statement.condition))\n execute(statement.then_branch)\n elsif !statement.else_branch.nil?\n execute(statement.else_branch)\n end\n\n return nil\n end", "title": "" }, { "docid": "f5d2db4ebe5c2fa80659d6f2feb9fc47", "score": "0.6782388", "text": "def conditional flag\n if flag == 1\n puts \"If clause\"\n elsif flag == 2\n puts \"Else if clause\"\n else\n puts \"Else clause\"\n end \nend", "title": "" }, { "docid": "aa3d7ccb36d04ad73c4a4d291a99ada7", "score": "0.67515546", "text": "def if_fn(env, cond, a, b=nil)\n if eval_token(cond, env)\n return eval_token(a, env)\n else\n return eval_token(b, env)\n end\nend", "title": "" }, { "docid": "23717516031cd1e69cf4c27dfa8b6395", "score": "0.67276335", "text": "def parseIfExpr token\n #puts \"parseIfExpr #{token}\"\n from = token\n token = token.next # eat the if.\n return nil unless condition = parseExpression(token)\n token = condition.to\n return mismatch(\"then\" , token) if (token.value != \"then\")\n token = token.next # eat the then\n return nil unless _then = parseExpression(token)\n token = _then.to\n return mismatch(\"else\" , token) if (token.value != \"else\")\n token = token.next # eat the else\n return nil unless _else = parseExpression(token) # eat the else\n token = _else.to\n return IfExprAST.new(condition, _then, _else)\n end", "title": "" }, { "docid": "0cad8b9b921e648e49e1dc50f62c9ce2", "score": "0.67242146", "text": "def if_statement\n print 'if statement'\n consume(TokenType::LEFT_PAREN, \"Expext '(' after 'if'.\")\n condition = expression\n consume(TokenType::RIGHT_PAREN, \"Expect ')' after if condition.\")\n\n then_branch = statement\n else_branch = nil\n else_branch = statement if match(TokenType::ELSE)\n Stmt::If.new(condition, then_branch, else_branch)\n end", "title": "" }, { "docid": "c2b0057bcdbd2dca2e241fe8881cd847", "score": "0.6716462", "text": "def execute_if(code, flag)\r\n test = check_test(code)\r\n check_for(\"then\", code)\r\n if test && flag\r\n do_instruction_list(code, true)\r\n if code[0] == 'else'\r\n code.shift\r\n do_instruction_list(code, false)\r\n end\r\n else\r\n do_instruction_list(code, false)\r\n if code[0] == 'else'\r\n code.shift\r\n do_instruction_list(code, flag)\r\n end \r\n end\r\n check_for(\"end\", code)\r\n end", "title": "" }, { "docid": "c7e2fbb0ace31b59c9a8d1b5f0d64b51", "score": "0.66954106", "text": "def process_if exp\n process exp.then_clause if sexp? exp.then_clause\n process exp.else_clause if sexp? exp.else_clause\n exp\n end", "title": "" }, { "docid": "c5d9c308031c78e13ff8062126acc490", "score": "0.6694287", "text": "def visit_if_op(node); end", "title": "" }, { "docid": "5aee3d8f85aa2c5928c8ff84e34b2af6", "score": "0.6681851", "text": "def visit_if_stmt(stmt)\n resolve_expr(stmt.condition)\n resolve_stmt(stmt.then_branch)\n resolve_stmt(stmt.else_branch) unless stmt.else_branch.nil?\n nil\n end", "title": "" }, { "docid": "0d4be445cab2a0780ea6d7ae926667df", "score": "0.66446805", "text": "def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 37:7: 'else'\n match( \"else\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n\n end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "9f58c78a6aee91b31ab085c9d4e8af83", "score": "0.6637782", "text": "def else?; end", "title": "" }, { "docid": "81b2c12ab8230b2fbd420c7984f9e432", "score": "0.6637603", "text": "def if_with_then?(line)\n /[[:space:]]+if[[:space:]]+/.match(line) && /[[:space:]]+then[[:space:]]+/.match(line)\nend", "title": "" }, { "docid": "eb1e6d2f56ac00c13c59388d3b07de14", "score": "0.66352904", "text": "def on_else(statements); end", "title": "" }, { "docid": "a0f1f1e222ef95ca8a23afa9685ee80b", "score": "0.66185015", "text": "def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 45:7: 'else'\n match( \"else\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n\n end", "title": "" }, { "docid": "d0c4992b8715df6f78071d058dba8edd", "score": "0.6614367", "text": "def greet_if_else\n if @hello\n 'Hello World! (if else)'\n else\n # Compound expressions should be preserved\n # (i.e. not evaluated too early or in the wrong context)\n 'Good' + 'bye (if else)'\n end\n end", "title": "" }, { "docid": "64c49c68d541ef091c555c5bd920e6d0", "score": "0.660761", "text": "def visit_elsif(node)\n begin_start = node.predicate.end_char\n begin_end =\n if node.statements.empty?\n node.statements.end_char\n else\n node.statements.body.first.start_char\n end\n\n begin_token =\n if buffer.source[begin_start...begin_end].include?(\"then\")\n srange_find(begin_start, begin_end, \"then\")\n elsif buffer.source[begin_start...begin_end].include?(\";\")\n srange_find(begin_start, begin_end, \";\")\n end\n\n else_token =\n case node.consequent\n when Elsif\n srange_length(node.consequent.start_char, 5)\n when Else\n srange_length(node.consequent.start_char, 4)\n end\n\n expression = srange(node.start_char, node.statements.end_char - 1)\n\n s(\n :if,\n [\n visit(node.predicate),\n visit(node.statements),\n visit(node.consequent)\n ],\n smap_condition(\n srange_length(node.start_char, 5),\n begin_token,\n else_token,\n nil,\n expression\n )\n )\n end", "title": "" }, { "docid": "54eb9308674484c6e617332f95f6c808", "score": "0.65929604", "text": "def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 380:8: 'else'\n match( \"else\" )\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__, 26 )\n\n end", "title": "" }, { "docid": "f6cd3cce8282118409602b430aebc619", "score": "0.65877914", "text": "def parse_if_body(type)\n pos = position\n ws\n cond = parse_condition or expected(\"condition for '#{type.to_s}' block\")\n nolfws; literal(\";\")\n nolfws; keyword(:then); ws;\n exps = parse_opt_defexp\n ws\n\n # FIXME: Workaround for intialization error\n elseexps = nil\n if keyword(:elsif)\n # We treat \"if ... elif ... else ... end\" as shorthand for \"if ... else if ... else ... end; end\"\n elseexps = [parse_if_body(:if)]\n else\n if keyword(:else)\n ws\n elseexps = parse_opt_defexp\n end\n keyword(:end) or expected(\"expression or 'end' for open 'if'\")\n end\n ret = E[pos,type.to_sym, cond, E[:do].concat(exps)]\n ret << E[:do].concat(elseexps) if elseexps\n return ret\n end", "title": "" }, { "docid": "18b02e343843ccd9b547ed051e5caa2e", "score": "0.6580602", "text": "def process_if(exp)\n condition, then_branch, else_branch = exp\n case\n when else_branch.nil?\n Statement::If.new(process(condition), process(then_branch))\n when then_branch.nil?\n Statement::If.new(Operator::Logical::Not.new(process(condition)), process(else_branch))\n else\n Statement::If.new(process(condition), process(then_branch), process(else_branch))\n end\n end", "title": "" }, { "docid": "5d48621931b3bde539612fa3e32dff15", "score": "0.6579587", "text": "def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 28:8: 'else'\n match( \"else\" )\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__, 20 )\n\n end", "title": "" }, { "docid": "b0f6b09fd6e4258d42cf3c59eb43e6c2", "score": "0.65697527", "text": "def IfOp(predicate, truthy, falsy); end", "title": "" }, { "docid": "830f4f1385256f07c720f1d8a48ddd00", "score": "0.65611905", "text": "def else\n raise ArgumentError, \"More than one 'else' to IfCommand\" if @switched\n @in_else = ! @in_else\n @switched = true\n end", "title": "" }, { "docid": "830f4f1385256f07c720f1d8a48ddd00", "score": "0.65611905", "text": "def else\n raise ArgumentError, \"More than one 'else' to IfCommand\" if @switched\n @in_else = ! @in_else\n @switched = true\n end", "title": "" }, { "docid": "fbf3d1929f014bc19577056e1f0e7841", "score": "0.6549957", "text": "def _IfTok\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"if\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_IdentifierPart)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_IfTok unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "83b3cb7b7c18e974118cd43643091567", "score": "0.65484375", "text": "def visit_elsif(node); end", "title": "" }, { "docid": "6feec21e9af8b3e3d426e019e6e747c8", "score": "0.65341574", "text": "def if(condition)\n self << \"if(#{condition}){\"\n yield self\n self << \"}\"\n end", "title": "" }, { "docid": "ae728696162a2416be4e325b6f25b4c3", "score": "0.65279377", "text": "def process_if(match, func, type_table)\n\n unless func.is_a? Function\n raise \"if statement must be used inside a function\"\n end\n\n # Try to process the condition\n expression = match[1]\n value = process_condition(expression, func.ident_list, type_table)\n\n instruction = IfInstruction.new(value, func)\n func.add_instruction(instruction)\n\n return true\nend", "title": "" }, { "docid": "402d60ce0d47d90a6eeb224b666e985c", "score": "0.6526781", "text": "def if\n end", "title": "" }, { "docid": "f328a964aafb66f5ff76862c29ffe0c6", "score": "0.65054905", "text": "def Else(keyword, statements); end", "title": "" }, { "docid": "4e6f4938b126a39f89429c7427835196", "score": "0.6498675", "text": "def on_if(statement, value, rest)\n source = code(statement.line)\n col = calculate_column(source, 'if')\n\n else_statement = nil\n elsif_statements = []\n\n if rest and rest.respond_to?(:each)\n rest.each do |token|\n next if token.nil?\n\n if token.type == :elsif\n elsif_statements << token\n else\n else_statement = token\n end\n end\n end\n\n return Token::StatementToken.new(\n :type => :if,\n :statement => statement,\n :value => value,\n :line => statement.line,\n :column => col,\n :else => else_statement,\n :elsif => elsif_statements.reverse,\n :code => source\n )\n end", "title": "" }, { "docid": "46a43ecc673bb16c15f2cfc726ec3729", "score": "0.64975023", "text": "def new_string_starting_if(value)\n if value.index('if') == 0\n value\n else\n \"if#{value}\"\n end\nend", "title": "" }, { "docid": "1fc5fb8aba94be0c0dbd0bf0cded9867", "score": "0.6487725", "text": "def on_if(predicate, statements, consequent); end", "title": "" }, { "docid": "1b9024ae11440a9042cac7f0ffd0e5f1", "score": "0.64851177", "text": "def visit_else(node); end", "title": "" }, { "docid": "e08df20f78b2e5a084d303c6ffa65461", "score": "0.64789563", "text": "def do_if(tex,blck,filter)\n i,cond=-1,nil\n#p blck\n begin\n filter.outType=\":rb\"\n case blck[i+=1]\n when :if, :elsif\n#puts \"do_if:blck[i+1]\";p blck[i+1]\n cond=eval_args(blck[i+=1],filter)\n when :unless\n cond=!eval_args(blck[i+=1],filter)\n when :else\n cond= true\n end\n filter.outType=nil\n i,*b2=next_block(blck,i)\n tex << parse(b2,filter) if cond\n end while !cond and i<blck.length-1\n#puts \"tex\";p tex\n end", "title": "" }, { "docid": "6673dc90a5bc2d9e40fd25b7daee76c8", "score": "0.64463365", "text": "def t__91!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 69)\n\n type = T__91\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 75:9: 'if'\n match(\"if\")\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__, 69)\n\n end", "title": "" }, { "docid": "6e9921370299f87ea2f1cbbe5ebdea21", "score": "0.64438593", "text": "def on_elsif(predicate, statements, consequent); end", "title": "" } ]
46a8a8c20bbc295a96e527717b78fa05
title Cannot be repeated by the same artist in the same year release_year Optional if released is false release_year Must be less than or equal to the current year
[ { "docid": "d840f75a0732779a18d175b434389daa", "score": "0.0", "text": "def current_year\n Time.current.year\n end", "title": "" } ]
[ { "docid": "5e6546f1917c631a7aa8a8e206f3b99f", "score": "0.75408995", "text": "def title_unique?\n song = Song.find_by(title: self.title)\n if song && song.release_year == self.release_year\n errors.add(:title, \"Artist cannot release same song in one year.\")\n end\n end", "title": "" }, { "docid": "8c48d83d797a20a357e51a9e70502c70", "score": "0.6674324", "text": "def same_year? \n same_year_songs = Song.all.select{|song| song.release_year == release_year}\n same_year_songs.select!{|song| song.title == title}\n !same_year_songs.nil?\n end", "title": "" }, { "docid": "95e2cf93ff4d858196bff619cdb8ccb7", "score": "0.6596271", "text": "def should_have_year?\n self.released\n end", "title": "" }, { "docid": "bea82af3e8c8f7874dc481b75d2c62f7", "score": "0.6419892", "text": "def released?\n released\n # errors[:release_year] << \"Release Year can't be blank.\"\n # end\n end", "title": "" }, { "docid": "796dd418bf6a92f84c2629759e27c655", "score": "0.6414532", "text": "def appropriate_year?\n if released\n if release_year.nil?\n errors.add(:release_year, \"Release year must exist if it is released\")\n elsif release_year > Time.now.year\n errors.add(:release_year, \"Release year must be less than or equal to the current year\")\n end\n end\n end", "title": "" }, { "docid": "f35e4cbb1fd1a46151ff7dae1228d2f9", "score": "0.6394522", "text": "def show_publication_year? _field_config, doc\n doc['journal_title_ts'].blank? && doc['conf_title_ts'].blank? && doc['publisher_ts'].blank?\n end", "title": "" }, { "docid": "ec755cc1d979b408c3cc7c0bd53c66cd", "score": "0.6357666", "text": "def title\n \"#{artist.name} - #{name} [#{release.catalog_number}]\"\n end", "title": "" }, { "docid": "0f52cc6c205b110b85c01aa6eb184b9c", "score": "0.6312536", "text": "def released_boolean\n if released == true && !release_year\n errors.add(:released, \"cannot be empty if true\")\n end\n end", "title": "" }, { "docid": "e5dbf8b921892ee5e1bf5c10ec0daf64", "score": "0.62280613", "text": "def release_not_future_year\n #invalid, if released and release_year is greater than current year\n if release_year && release_year.to_i > Time.now.strftime(\"%Y\").to_i\n errors.add(:release_year, \"cannot be in the future\")\n end\n end", "title": "" }, { "docid": "95e3f29bf7b23e232231148c469e9994", "score": "0.5904702", "text": "def publication_year\n end", "title": "" }, { "docid": "33af085baa3c985769a266e4180e1fdd", "score": "0.58945054", "text": "def initialize(title, year)\n @title = \"#{title}\"\n @year_released = \"#{year}\"\n @years_ago = 2015 - @year_released\n end", "title": "" }, { "docid": "99dabe12081aa36a8d546f5b621afa0a", "score": "0.5680325", "text": "def year? = unit == 'year'", "title": "" }, { "docid": "7aa0ba62dab2aa914c1aaafa6c34a3aa", "score": "0.56749636", "text": "def has_year?\r\n is_category_type? %w(asset vehicle)\r\n end", "title": "" }, { "docid": "b6a1df77c07855f0666665cf92e26833", "score": "0.5643155", "text": "def year\n #movie_year = '2014'\n # @movie_year = params[:movie_year] # in order to be available in the view\n movies = search_query([], %[\n FILTER regex(?release_date, '^#{query_param(true)}')\n ])\n @groups = {nil => movies} unless movies.empty?\n render 'results', locals: {title: \"Movies released in #{query_param}\"}\n end", "title": "" }, { "docid": "81f29d4038e38c0f89ebf644c80f0ab2", "score": "0.5610868", "text": "def release_summary title = nil\n datestamp_title = title ? Time.now.strftime(\"(%-m/%d) #{title}:\") : Time.now.strftime(\"%-m/%d:\")\n\n if done_cards.empty?\n datestamp_title + \" Nada. 😢\"\n else\n ([datestamp_title] + done_cards.map { |card| '- ' + card['note'] }).join \"\\n\"\n end\nend", "title": "" }, { "docid": "88a07faf0678164fdb08ae45e2593e63", "score": "0.56099135", "text": "def release_params\n params.require(:release).permit(:title, :catalogue_number, :format, :country_code, :released_at, :image_data, :artist_id, :query)\n end", "title": "" }, { "docid": "2c69c8c78a9a6b5809ccc6295025c6dc", "score": "0.5558377", "text": "def create\n @release = Release.new(release_params)\n\n # release_title = release_params[:title]\n # artist_name = @artist.name\n #\n # discogs_api_key = ENV.fetch('DISCOGS_API_KEY')\n # discogs_secret_api_key = ENV.fetch('DISCOGS_SECRET_API_KEY')\n #\n # response = HTTParty.get(\"https://api.discogs.com/database/search?release_title=#{release_title}&artist=#{artist_name}&key=#{discogs_api_key}&secret=#{discogs_secret_api_key}\")\n\n # byebug\n\n response['results'].each do |result|\n if result['format'].include? \"Vinyl\"\n @release.artist_id = @artist\n\n release_title = response['title'].split(' - ').last\n @release.title = release_title\n\n format_array = response['format'].split(' ')\n format_type = format_array.select { |format| format == \"LP\" }\n @release.format = format_type.join\n\n @release.released_at = response['year']\n @release.image_data = response['images'][0]['resource_url']\n @release.country_code = response['id']\n @release.format = response['id']\n @release.artist_id = response['id']\n end\n end\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render :show, status: :created, location: @release }\n else\n format.html { render :new }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44a84c67334b38c30d0baa04bf846fa7", "score": "0.5547915", "text": "def all_same_year?(tags)\n all_same_tag?(tags, :year)\n end", "title": "" }, { "docid": "826115a0630a6a4b55d85646def9e1d6", "score": "0.5545122", "text": "def release_params\n params.require(:release).permit(:title, :subtitle, :released_on, :body)\n end", "title": "" }, { "docid": "ca8ac6c80c1dd13263b04aee902359c2", "score": "0.5496935", "text": "def update_title\n title_params = { year: params[:year],\n min_bid_reserve: params[:min_bid_reserve],\n pre_accident_value: params[:pre_accident_value],\n buy_now: params[:buy_now],\n sale_doc_application_date: params[:sale_doc_application_date],\n sale_doc_at_copart_date: params[:sale_doc_at_copart_date],\n sale_doc_given_to_buyer_date: params[:sale_doc_given_to_buyer_date] }\n if @vehicle.homeowner_group?\n title_params.merge!(vehicle_description: params[:vehicle_description])\n else\n title_params.merge!(license_plate_num: params[:license_plate_num],\n vehicle_registration_num: params[:vehicle_registration_num],\n registration_certificate_num: params[:registration_certificate_num],\n verify_vehicle_identification_num: params[:verify_vehicle_identification_num],\n ownership_transfer_type_id: params[:ownership_transfer_type].present? ? params[:ownership_transfer_type][:id] : nil,\n original_doc_country_id: params[:original_doc_country].present? ? params[:original_doc_country][:id] : nil,\n original_doc_type_id: params[:original_doc_type].present? ? params[:original_doc_type][:id] : nil,\n documented_odometer_hour: params[:documented_odometer_hour],\n documented_odometer_unit_id: params[:documented_odometer_unit].present? ? params[:documented_odometer_unit][:id] : nil,\n original_odometer_brand_id: params[:original_odometer_brand].present? ? params[:original_odometer_brand][:id] : nil,\n documented_odometer_brand_id: params[:documented_odometer_brand].present? ? params[:documented_odometer_brand][:id] : nil,\n sale_doc_country_id: params[:sale_doc_country].present? ? params[:sale_doc_country][:id] : nil,\n sale_doc_type_id: params[:sale_doc_type].present? ? params[:sale_doc_type][:id] : nil,\n original_doc_state: params[:original_doc_state],\n sale_doc_state: params[:sale_doc_state],\n original_odometer_hour: params[:original_odometer_hour],\n original_odometer_unit_id: params[:original_odometer_unit].present? ? params[:original_odometer_unit][:id] : nil)\n if @vehicle.marine_or_recreational_or_industrial_or_homeowner_group?\n title_params.merge!(custom_make: params[:custom_make],\n custom_model: params[:custom_model], custom_trim: params[:custom_trim])\n end\n end\n # Replace masking value with the original\n title_params.keys.each do |key|\n replace_value = replace_mask_val_with_orginal(key.to_s, @vehicle)\n title_params[key] = replace_value if !replace_value.nil?\n end\n @vehicle.update_attributes(title_params)\n @vehicle.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT,\n I18n.t(\"system_notes.user_activity.ownership_transfer_update\"),\n current_employee, true)\n\n if @vehicle.save\n @vehicle.reload\n respond_to do |format|\n format.html { redirect_to @vehicle }\n format.json { render json: { vehicle: @vehicle.as_json(include_all: \"yes\") }, \n status: :created, \n location: @vehicle }\n end\n else\n logger.info(\"Errors exist: #{@vehicle.errors.messages}\")\n respond_to do |format|\n format.html { render action: :new }\n format.json { render json: { errors: @vehicle.errors }, \n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95742a981c9eb63eabb9e9ef026927ca", "score": "0.5491639", "text": "def has_title?(library, title)\n\nend", "title": "" }, { "docid": "2f72a754f4ea2c44c8b6d077d04b1950", "score": "0.5464912", "text": "def uniqueness_of_title\n if project\n relation = self.class.for_projects_and_groups([project_id], [project.group&.id])\n elsif group\n relation = self.class.for_projects_and_groups(group.projects.select(:id), [group.id])\n end\n\n title_exists = relation.find_by_title(title)\n errors.add(:title, _(\"already being used for another group or project %{timebox_name}.\") % { timebox_name: timebox_name }) if title_exists\n end", "title": "" }, { "docid": "be94aa2e4384ba6892d3b6574947c7a8", "score": "0.5452668", "text": "def year?\n @year\n end", "title": "" }, { "docid": "0d189e6c64a80f37e6a42a3388eae450", "score": "0.54325014", "text": "def title\n alternate_title.blank? ? quarter.title : alternate_title\n end", "title": "" }, { "docid": "15a80e54d226f50e7d90a8072741e5b9", "score": "0.5427185", "text": "def could_be_year?(year); end", "title": "" }, { "docid": "f3945986d139d072a1056716474fb49b", "score": "0.5402101", "text": "def multi_year?\n (multi_year)\n end", "title": "" }, { "docid": "e27fa7bc565fcd1cbc6eb71cfc9dd9b6", "score": "0.53973275", "text": "def to_release\n user.releases.find_or_initialize_by(discogs_release_id: discogs_release_id).tap do |release|\n release.catalog_number = catalog_number\n release.label = label\n release.artist = artist\n release.name = name\n release.year = year\n release.genre = genre\n release.format = format\n release.format_quantity = format_quantity\n release.discogs_community_have = discogs_community_have\n release.discogs_community_want = discogs_community_want\n release.discogs_lowest_price = discogs_lowest_price\n release.discogs_number_for_sale = discogs_number_for_sale\n release.discogs_cover_thumb_url = discogs_cover_thumb_url\n release.discogs_api_resource_url = discogs_api_resource_url\n release.discogs_uri = discogs_uri\n end\n end", "title": "" }, { "docid": "5f878301c6e7ddb30e684a293c01a19c", "score": "0.5394497", "text": "def title?\n !name? && tagline\n end", "title": "" }, { "docid": "804a903ed2b9e79f58f70e9b16eef834", "score": "0.53884643", "text": "def release_params\n params.require(:release).permit(:title, :release_date)\n end", "title": "" }, { "docid": "ef09eff2caf81c715d34d25b77438e96", "score": "0.53870416", "text": "def fetch_title_marvel(publisher, title, url, date = nil) \n log(\"retrieving title information for [#{title}]\", :debug)\n doc = Hpricot(open(url))\n \n display_description = (doc/\"font[@class=plain_text]\").innerHTML\n\n title = RubyPants.new(title, -1).to_html\n display_name, display_number = title.split('#')\n display_name = check_title(display_name)\n display_number = display_number.split(' ')[0] unless display_number.nil?\n \n new_record = false\n \n if display_number.nil?\n # SoloBook\n model = SoloBook.find_by_name(display_name)\n \n if model.nil?\n model = SoloBook.new(:name => display_name, \n :publisher => publisher)\n new_record = true\n end\n \n else\n # Episode\n series = Series.find_by_name(display_name)\n \n if series.nil?\n # Series doesn't exist, create new Series\n series = Series.create!(:name => display_name, \n :publisher => publisher)\n log(\"created new series [#{display_name}]\", :info)\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n # Add episode to existing series\n if series.find_episode(display_number).nil?\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n model = series.find_episode(display_number)\n end\n end\n end\n \n display_talent, display_description = display_description.split(\"<strong>THE STORY:</strong>\")\n display_description ||= \"\" # if description was empty make sure it's non-nil\n display_description = display_description.split(\"<strong>PRICE:</strong>\")[0]\n \n model.talent = html2text(display_talent).strip.titleize\n model.description = html2text(display_description).strip\n model.published_on = date\n \n model.save!\n new_record ? log(\"created new book [#{title}]\", :info) : log(\"updated existing book [#{title}]\", :debug)\n \n if model.cover_image.nil?\n # get cover image (if we don't have one already)\n image_element = (doc/\"img\").select { |elem| elem.attributes['src'].match(/thumb/) }\n image_url = nil\n \n unless image_element.empty?\n image_url = image_element[0].attributes['src']\n image_url = \"#{URL_Marvel}#{image_element[0].attributes['src'].gsub('_thumb', '_full')}\" # full size art\n end\n \n get_cover_image(model, image_url)\n end\n \n rescue ActiveRecord::RecordInvalid => e\n log(\"failed to create book [#{title}]\", :info)\n log(\"errors: #{model.errors.full_messages.join(', ')}\", :info)\n return false\n end", "title": "" }, { "docid": "b8cb263eece5ae2611c18e22821a46d2", "score": "0.538544", "text": "def get_movie_info (title_parts, categories)\n title = ''\n # We could have multiple years, save all that we find\n years_found = Hash.new\n # We know that the quality is always the fourth category.\n quality = categories[3]\n\n # Iterate over all the title parts looking for years (there could be many!)\n title_parts.each_with_index do |title_part, title_index|\n if title_part =~ /^[0-9]{4}$/\n years_found[title_index] = title_part\n end\n end\n\n # If we have a year, brilliant, let's use it!\n if years_found.length > 0\n # Only the final year will be the year of the movie\n year = years_found.values[-1]\n title_boundary = years_found.keys[-1]\n else\n # If no year, we have a problem, let's try find a word with capitals\n # and assume that as the title boundary (e.g. 'UNRATED')\n title_boundary = nil\n year = -1\n\n title_parts.each_with_index do |title_part, title_index|\n if title_part =~ /^[A-Z]{2}/\n title_boundary = title_index\n break\n end\n end\n end\n\n # If there's nothing at this point, make a wild guess and try using the\n # quality as the boundary.\n if title_boundary.nil?\n # See if the quality is in the title.\n title_parts.each_with_index do |title_part, title_index|\n if title_part == quality\n title_boundary = title_index\n break\n end\n end\n end\n\n # If we still have nothing, sorry, there's nothing I can do\n # @TODO: Throw exception instead\n if title_boundary.nil?\n $logger.debug \"Could not parse movie info for title '#{title_parts.join('.')}'\"\n return nil\n end\n\n actual_title_parts = title_parts.slice(0, title_boundary)\n title = actual_title_parts.join(' ')\n\n return {\n title: title,\n year: year,\n quality: quality\n }\nend", "title": "" }, { "docid": "bd4bb3fdeef21da4f0bc297437a8aaf0", "score": "0.53597045", "text": "def title_check\n \n\n if self.title\n \n if !self.title.include? \"Believe\" || \"Won't\" || \"Secret\"\n true\n else\n false\n end\n else\n false\n end\n end", "title": "" }, { "docid": "8b394293066ea3d052790f8eba78ebd4", "score": "0.534427", "text": "def count\n @count ||= Date.current.year - @release_date.year\n end", "title": "" }, { "docid": "37e7a835522eed7fc35f3ea71d7611af", "score": "0.53314424", "text": "def existing_title\n valid = true\n existing_title = DATABASE.execute(\"SELECT * FROM anime_series WHERE title = '#{title}';\")\n \n if !existing_title.empty?\n valid = false\n end\n return valid\n end", "title": "" }, { "docid": "5649be1090ef3f6b4fe6e5b987b06b3f", "score": "0.5301569", "text": "def initialize(title, author,year=\"unknown\", edition=\"unknown\")\n @title = title\n @author = author\n @checked_out = false\n @current_patron = nil\n @year_published = year\n @edition = edition\n @reviews = {}\n end", "title": "" }, { "docid": "1218b9798c48254f6d015abbf8d4d9a5", "score": "0.52913517", "text": "def search_movie_by_year\n @year = params[:year]\n if @year\n @movies_result = Movie.where(year: @year)\n # if @movies_result.length > 1 #this is working well for year that has more than 2 movies\n # @multiple_movies = @movies_result\n # elsif @movies_result.length > 0 # this is not working\n # @single_movie = @movies_result.first\n # else\n # @error = \"Sorry, you don't have any favorite movie in this year.\"\n # end\n end\n end", "title": "" }, { "docid": "ad11671d038ca2f8c10383a87a6584d0", "score": "0.5284976", "text": "def release?(release_name, package_id)\n id = @release_ids[[release_name,package_id]]\n return id if id\n\n release_id = nil\n\n page = \"/frs/admin/showreleases.php\"\n\n form = {\n \"package_id\" => package_id,\n \"group_id\" => group_id\n }\n scrape = http_post( page, form )\n\n restr = ''\n restr << Regexp.escape( %{\"editrelease.php?group_id=#{group_id}} )\n restr << Regexp.escape( %{&amp;package_id=#{package_id}} )\n restr << Regexp.escape( %{&amp;release_id=} )\n restr << '(\\d+)'\n restr << Regexp.escape( %{\">#{release_name}} )\n re = Regexp.new( restr )\n\n md = re.match( scrape )\n if md\n release_id = md[1]\n end\n\n @release_ids[[release_name,package_id]] = release_id\n end", "title": "" }, { "docid": "98c8664bebe7c37b5b9a5d08ddc22765", "score": "0.5277793", "text": "def continues?\n year > specialization.study_length\n end", "title": "" }, { "docid": "391bdac39cc0914f7feb772bceb3dfa0", "score": "0.5274841", "text": "def titled?\n title.present? && (title != DEFAULT_TITLE)\n end", "title": "" }, { "docid": "71069b5bbc9f554e5155fc216f2f7006", "score": "0.52678585", "text": "def fetch_title_dc(publisher, title, url, date = nil)\n log(\"retrieving title information for [#{title}]\", :debug)\n doc = Hpricot(open(url))\n \n # span.display_talent = \"Written by, Art by... \"\n # span.display_copy = \"A final confrontation pits...\"\n # span.display_data = \"DC Universe &nbsp;|&nbsp;32pg. &nbsp;|&nbsp;&nbsp;Color &nbsp;|&nbsp;&nbsp;$2.99&nbsp;US\"\n # span.display_copy = \"On sale June 6, 2007\"\n \n display_talent = ((doc/\"#content-col2\")/\"p:first strong\").innerHTML\n display_copy = (doc/\"#content-col2\").innerHTML\n display_date = ((doc/\"#content-col2\")/\"p:last\").innerHTML\n \n title = RubyPants.new(title, -1).to_html\n display_name, display_number = title.split('#')\n display_name = check_title(display_name)\n display_number = display_number.split(' ')[0] unless display_number.nil?\n \n new_record = false\n \n if display_number.nil?\n # SoloBook\n model = SoloBook.find_by_name(display_name) \n\n if model.nil?\n model = SoloBook.new(:name => display_name, \n :publisher => publisher)\n new_record = true\n end\n \n else\n # Episode\n series = Series.find_by_name(display_name)\n \n if series.nil?\n # Series doesn't exist, create new Series\n series = Series.create!(:name => display_name, \n :publisher => publisher)\n log(\"created new series [#{display_name}]\", :info)\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n # Add episode to existing series\n if series.find_episode(display_number).nil?\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n model = series.find_episode(display_number)\n end\n end\n end\n \n model.talent = html2text(display_talent)\n model.description = html2text(display_copy)\n model.published_on = Date.parse(display_date.downcase.sub('on sale', '').gsub(/\\s+/, ' ').strip)\n \n model.save!\n new_record ? log(\"created new book [#{title}]\", :info) : log(\"updated existing book [#{title}]\", :debug)\n \n if model.cover_image.nil?\n # get cover image (if we don't have one already)\n image_element = (doc/\"img\").select { |elem| elem.attributes['src'].match(/media\\/product\\/.*180x270.jpg/) }\n image_url = nil\n\n unless image_element.empty?\n image_url = image_element[0].attributes['src']\n image_url = \"#{URL_DC_Media}#{image_url.gsub(/180x270/,'400x600')}\" # full size art\n end\n\n get_cover_image(model, image_url)\n end\n \n rescue ActiveRecord::RecordInvalid => e\n log(\"failed to create or update book [#{title}]\", :info)\n log(\"errors: #{model.errors.full_messages.join(', ')}\", :info)\n return false\n end", "title": "" }, { "docid": "70be6125bd0227ac3b8e3e9378facd0c", "score": "0.52645856", "text": "def release_groups\n return @artist_data[\"release-groups\"].sort_by { |hash| hash[\"first-release-date\"]}\n end", "title": "" }, { "docid": "717096e0cdd33845f3103b8f26c44eae", "score": "0.5264235", "text": "def year?(v = nil)\n super(v || value)\n end", "title": "" }, { "docid": "4c4623e12f6e12c334d7310776790e1d", "score": "0.52566904", "text": "def hasTitle\n if @title then\n true\n else\n false\n end\n end", "title": "" }, { "docid": "e13934ea7343e5e43461a69ba1196a80", "score": "0.5239461", "text": "def validate_year_not_submitted_yet(record, attribute, year)\n incident = record.incident.target\n\n # Only perform this check if the GeneralInfo model has an associated incident\n # (this may not be the case, i.e. when the incident is being created via bulk upload).\n if incident.present?\n submitted_years = AgencyStatus.find_or_create_by_ori(incident.ori)\n .complete_submission_years\n\n if submitted_years.include? year\n record.errors[attribute] << \"ORI #{ori} has already submitted for this year\"\n end\n end\n end", "title": "" }, { "docid": "0b0751d610e4d90aca7578ffecf377fb", "score": "0.5223723", "text": "def title_valid(title)\n if !title.empty?\n self.title = title\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "2b5c79888fcd0f553d12e88793657565", "score": "0.52055067", "text": "def year\n result = title.split('-')[0]\n result ? result.to_i : nil\n end", "title": "" }, { "docid": "21a88f13ca2d46911e011c0411aa5b27", "score": "0.51915574", "text": "def title_is(title = nil)\n title_is_empty if title.nil? || title.empty?\n @title = title\n end", "title": "" }, { "docid": "f55d865a7d6d479f6acf248345843af3", "score": "0.5190234", "text": "def title\n title = \"#{name}\"\n title << \" #{quarter_offered.title}\" if quarter_offered\n title\n end", "title": "" }, { "docid": "78f44daf4a590cd4e5b0965d18ed5b68", "score": "0.51844215", "text": "def title_create?(title)\n if create?\n not titles_create_exception.include? title\n else\n titles_create_exception.include? title\n end\n end", "title": "" }, { "docid": "bd5b853df591bad90f502d87d41a6cbf", "score": "0.51683915", "text": "def update(name, artist, year, genre)\n self.name = name.length > 0 ? name : self.name\n self.artist = artist.length > 0 ? artist : self.artist\n self.year = year.length > 0 ? year : self.year\n self.genre = genre.length > 0 ? genre : self.genre\n @@albums[self.id] = Album.new(self.name, self.artist, self.year, self.genre, self.id)\n end", "title": "" }, { "docid": "1125f9a44ca6da2ac8298c44dd9e390d", "score": "0.51633614", "text": "def year_person? = unit == 'year-person'", "title": "" }, { "docid": "ffcc1fbcf16a0488d310c387f424deda", "score": "0.5161488", "text": "def is_title\n false\n end", "title": "" }, { "docid": "db4acbe11593dd4a85504ca32e79224c", "score": "0.5155479", "text": "def year\n @year ||= details.at(\"h1[itemprop='name'] span#titleYear a\").text.parse_year rescue nil\n end", "title": "" }, { "docid": "1f059a53f2f22a9b17509e6c4a582144", "score": "0.51426727", "text": "def title?; end", "title": "" }, { "docid": "3cd859b8766718086bd90e5c6fb6541b", "score": "0.5135042", "text": "def bib_results_filter(result, year)\n missed_years = []\n result.each do |r|\n item = r.fetch\n item.fetched = Date.today.to_s\n return { ret: item } if !year\n\n item.date.select { |d| d.type == \"published\" }.each do |d|\n return { ret: item } if year.to_i == d.on(:year)\n\n missed_years << d.on(:year)\n end\n end\n { years: missed_years }\n end", "title": "" }, { "docid": "19c7295e2bd4ee04d583927c5d2fd77e", "score": "0.5120425", "text": "def title\n \"#{@artist} - #{@name} (#{@length})\"\n end", "title": "" }, { "docid": "74657e5eb67178cc7dfac61065cd11cf", "score": "0.5119779", "text": "def year\n result = self.title.split('-')[0]\n result ? result.to_i : nil\n end", "title": "" }, { "docid": "f99e693516bba0a562c42dcf4beeb81d", "score": "0.5085839", "text": "def our_songs\r\n\t@title = \"Our Songs\"\r\n end", "title": "" }, { "docid": "b0577203778b205f1abfe8a435162fb9", "score": "0.5083875", "text": "def title\n t = nil\n # default to long title\n long_titles = self.courses.map(&:long_title)\n return t if (t = long_titles.find(&:present?)).present?\n\n # then try specific title. then short title\n return self.specific_title if self.specific_title.present?\n\n short_titles = self.courses.map(&:short_title)\n return t if (t = short_titles.find(&:present?)).present?\n\n return '(Title Unavailable)'\n end", "title": "" }, { "docid": "47b521a72fd998cda0323f3b66056e8c", "score": "0.5082514", "text": "def title=(v)\n if @title != v\n @needs_commit = true\n @title = v\n end\n end", "title": "" }, { "docid": "9cb3c3b294b40f2b392c6da69a5e1922", "score": "0.5081287", "text": "def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end", "title": "" }, { "docid": "466ff6fc94ee76bd80c8bf8e1dfd1649", "score": "0.5050756", "text": "def define_on_distro_release(distro, release, name, version=nil)\n distro_releases[[distro, release]] << [name, version]\n end", "title": "" }, { "docid": "799f87daaedba9a5d4197888ad78b5a3", "score": "0.5048423", "text": "def add_historical_name\n last_year = Date.today.year - 1\n if !@old_name.blank? && results_before_this_year? && !self.historical_names.any? { |name| name.year == last_year }\n self.historical_names.create(:name => @old_name, :year => last_year)\n end\n end", "title": "" }, { "docid": "799f87daaedba9a5d4197888ad78b5a3", "score": "0.5048423", "text": "def add_historical_name\n last_year = Date.today.year - 1\n if !@old_name.blank? && results_before_this_year? && !self.historical_names.any? { |name| name.year == last_year }\n self.historical_names.create(:name => @old_name, :year => last_year)\n end\n end", "title": "" }, { "docid": "85a9092af9b85b0217ef361bb4e082ba", "score": "0.5047289", "text": "def add_song date, artist, title\n if known_time date\n trace \"Duplicate: %s\" % [date]\n return true\n end\n detail = lookup_song artist, title\n unless detail.nil?\n trace \"Known artist/song combo; reusing existing information\"\n detail[0] = date\n $songs << detail\n puts \"Added song #%d (%s by %s)\" % [$songs.size, title, artist]\n return true\n end\n song_num = build_song_info date, artist, title\n if song_num\n puts \"Added song #%d (%s by %s)\" % [song_num, title, artist]\n else\n raise\n end\n false\nend", "title": "" }, { "docid": "efab27ca235b19da3376d659644bc63a", "score": "0.5046953", "text": "def derive_authors_year\n add_author_year(author_year_string) \n end", "title": "" }, { "docid": "b58e772df5755dba6d3677e4fe073c81", "score": "0.50435585", "text": "def slug_candidates\n [\n :title,\n [:title, :year],\n ]\n end", "title": "" }, { "docid": "a5d2affb556976ec68a39680d97488f7", "score": "0.5042031", "text": "def pub_year_display_str(ignore_approximate = false)\n single_pub_year(ignore_approximate, :year_display_str)\n\n # TODO: want range displayed when start and end points\n # TODO: also want best year in year_isi fields\n # get_main_title_date\n # https://github.com/sul-dlss/SearchWorks/blob/7d4d870a9d450fed8b081c38dc3dbd590f0b706e/app/helpers/results_document_helper.rb#L8-L46\n\n # \"publication_year_isi\" => \"Publication date\", <-- do it already\n # \"beginning_year_isi\" => \"Beginning date\",\n # \"earliest_year_isi\" => \"Earliest date\",\n # \"earliest_poss_year_isi\" => \"Earliest possible date\",\n # \"ending_year_isi\" => \"Ending date\",\n # \"latest_year_isi\" => \"Latest date\",\n # \"latest_poss_year_isi\" => \"Latest possible date\",\n # \"production_year_isi\" => \"Production date\",\n # \"original_year_isi\" => \"Original date\",\n # \"copyright_year_isi\" => \"Copyright date\"} %>\n\n # \"creation_year_isi\" => \"Creation date\", <-- do it already\n # {}\"release_year_isi\" => \"Release date\",\n # {}\"reprint_year_isi\" => \"Reprint/reissue date\",\n # {}\"other_year_isi\" => \"Date\",\n end", "title": "" }, { "docid": "d18a8287ad209fc7bb6060da95a72aa7", "score": "0.5037354", "text": "def press_release_params\n params.require(:press_release).permit(:title, :article, :published_on)\n end", "title": "" }, { "docid": "29b7dd1022da8627e02c608f0b020f9f", "score": "0.50372946", "text": "def slug_candidates\n [\n :title,\n [:title, year],\n [:title, full_date]\n ]\n end", "title": "" }, { "docid": "d8378ce170c49aa10a01407e4be670ad", "score": "0.50301176", "text": "def release_params\n params.require(:release).permit(:name, :description, :project_id, :deadline)\n end", "title": "" }, { "docid": "36d33a16878864d22f40dafc367121ff", "score": "0.5027361", "text": "def has_title?\n @title != nil\n end", "title": "" }, { "docid": "a81565bf28e19d52edf2c295cb65d7ba", "score": "0.50259686", "text": "def offered\n self.term.titleize + \" \" + self.year.to_s\n end", "title": "" }, { "docid": "a03ba8c60faa75f1f48761ec0d82bb94", "score": "0.5022556", "text": "def year_integer\n return self.year_of_publication if !self.year_of_publication.nil?\n return self.source.year if !self.source_id.nil?\n nil\n end", "title": "" }, { "docid": "473dab394d1bb891a6e4fd69e169faaf", "score": "0.50071555", "text": "def set_fund_item_title\n return if @set_fund_item_title\n if title? && ( perspective == PERSPECTIVES.first )\n fund_item.title = title if title? && fund_item.title != title\n @set_fund_item_title = true\n fund_item.save\n @set_fund_item_title = false\n end\n end", "title": "" }, { "docid": "de5d3ae68b76ec3dc5255926a168e12e", "score": "0.5005606", "text": "def duplicate_title\n\t\tif Contest.find_by title: title\n\t\t\terrors.add(:title, \"has already been taken\")\n\t\tend\n\tend", "title": "" }, { "docid": "cad543a20be50ac8e92fc74b8ef66d3e", "score": "0.5002879", "text": "def first_post_exists?(year)\n # TODO\n return nil\n end", "title": "" }, { "docid": "369697f66e49bb3bc228e0a01b9ee993", "score": "0.49971512", "text": "def release_before_date?\n # All PermissionTemplate embargoes are dynamically determined release before dates\n release_period == RELEASE_TEXT_VALUE_BEFORE_DATE || release_max_embargo?\n end", "title": "" }, { "docid": "f8af5448301624acc82e63c07eb6280f", "score": "0.49934515", "text": "def production_year\n self.end.nil? ? nil : self.end.year\n end", "title": "" }, { "docid": "7b863d3318b56b5841d039df12b92f68", "score": "0.49922577", "text": "def event_of_year?(event)\n event.include? year\n end", "title": "" }, { "docid": "287cf97282effbd5d02141ac325edb66", "score": "0.49888757", "text": "def match_year?(doc, date)\n return true unless year\n\n idate = RelatonBib.parse_date doc[\"issued-date\"], false\n idate.between? date, date.next_year.prev_day\n end", "title": "" }, { "docid": "f369c7cdd0099abffd4dbc02b358a5b4", "score": "0.49764138", "text": "def release_url(api_url, title)\n # \"subject\": {\n # \"title\": \"v1.4.4\",\n # \"url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"latest_comment_url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"type\": \"Release\"\n # },\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n releases_index = api_url.index(\"releases\")\n\n # https://github.com/typed-ember/ember-cli-typescript/releases/tag/v1.4.4\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..releases_index + \"releases\".length] +\n \"tag/#{title}\"\n html_url\n end", "title": "" }, { "docid": "56246f20cc48c968b3bfef66cb32990a", "score": "0.49708667", "text": "def index\n year = params[:year_of_release][0].split('-') unless params[:year_of_release].nil?\n starting_year = year[0] unless year.nil? || year.empty?\n ending_year = year[year.length - 1] unless year.nil? || year.empty?\n language = params[:language][0] unless params[:language].nil?\n quality = params[:quality][0] unless params[:quality].nil?\n genre = params[:genre][0] unless params[:genre].nil?\n rating = params[:rating][0] unless params[:rating].nil?\n order_by = params[:order_by][0] unless params[:order_by].nil?\n @movies = Movie.includes(:cover_photo).search_on_title(params[:title]).search_on_language(language).search_on_starting_year(\n starting_year\n ).search_on_ending_year(ending_year).search_on_video_quality(quality).search_on_genre(\n genre\n ).search_on_rating(rating).order_on_filter(order_by)\n end", "title": "" }, { "docid": "e081de0149a17a663d15d88dfca536de", "score": "0.4966953", "text": "def author_year\n au = author_year_string\n return nil if au.nil?\n (self.parens == true) ? \"(#{au})\" : au\n end", "title": "" }, { "docid": "abc59991a2abe2691649fb45d7b2df62", "score": "0.49637726", "text": "def prerelease?\n [email protected]? && [email protected]?\n end", "title": "" }, { "docid": "67448cae37995584f9a0ba20bcaf66bf", "score": "0.4962964", "text": "def generate_slug\n [\n :title,\n [:title, :year]\n ]\n end", "title": "" }, { "docid": "dfed0afd3f2fd2b015a22bb39a088736", "score": "0.49628094", "text": "def validate_title\n if self.title.length < 3\n errors.add :base, :invalid, message: \"The title is invalid\"\n end\n end", "title": "" }, { "docid": "146a4bf8a2eb79320eda37eced3b629f", "score": "0.4962777", "text": "def titles(library)\nend", "title": "" }, { "docid": "2416c9729a2a882e1f5511219093a26f", "score": "0.4961557", "text": "def check_title\n if title.to_s == '' && audio_file.present?\n str = File.basename(audio_file_url).gsub(/[_]/, ' ') \n self.title = str.gsub(/[.mp3]/, '')\n self.save\n end\n end", "title": "" }, { "docid": "e710563bf727eb362b6e382f8ca92867", "score": "0.49571258", "text": "def make_prerelease\n fail AlreadyPreRelease if prerelease?\n @special = PRE_RELEASE.first\n end", "title": "" }, { "docid": "7940d9d3f75cb3c8995c2c653b051fb2", "score": "0.49564114", "text": "def publication_year\n super(:dc_date)\n end", "title": "" }, { "docid": "7820bf4ed6d9246cf922d2bcbe96d9ec", "score": "0.49498394", "text": "def title?\n !title.nil? && !title.empty?\n end", "title": "" }, { "docid": "7820bf4ed6d9246cf922d2bcbe96d9ec", "score": "0.49498394", "text": "def title?\n !title.nil? && !title.empty?\n end", "title": "" }, { "docid": "6b650f0ba8d969b6ead8b881fb97f113", "score": "0.49485636", "text": "def year() end", "title": "" }, { "docid": "2beca59144f240b4b08362b3fde9130a", "score": "0.49397916", "text": "def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n self.title = (st.yield :Title, st.sampleURL)[:Title] || \"\"\n self.title = self.trimmed_title\n else\n self.title\n end\n end", "title": "" }, { "docid": "1c44864499fb6cbfc054dd43bf9186de", "score": "0.49372312", "text": "def title?\n [email protected]_s.empty?\n end", "title": "" }, { "docid": "9ff1d78bf7c5a83a28e63e433a0e1788", "score": "0.49340624", "text": "def get_publication_year\n\t\treturn publication_year.year if !publication_year.nil?\n\tend", "title": "" }, { "docid": "8b9585c6be185f7fcd4bdeebab7d7b67", "score": "0.4933588", "text": "def buildYearMaxed \n maxYear = data_package.schemas[\"sca_e_projections_by_sd\"][\"maxYear\"]\n\n project.build_year > maxYear ? maxYear : project.build_year\n end", "title": "" }, { "docid": "9829181313048a3c1e426380e355f30e", "score": "0.4930818", "text": "def include_year_in_dates?\n if @time.year != Date.today.year\n # If the year was in the past, always include the year\n return true\n end\n\n if @time.year == Date.today.year && @time.month < (Date.today.month - 4)\n # If the year is this year, include if it happened more than 6 months\n # ago.\n return true\n end\n end", "title": "" }, { "docid": "5c9c5a70d4df9af7a9463ee063379501", "score": "0.4925502", "text": "def title\n\t\t\"#{artist.try(:name)} - #{event.try(:title)}\"\n\tend", "title": "" }, { "docid": "7b3445810abe1f06827093a25398c86f", "score": "0.49218726", "text": "def add title, artist\n $albums.each do |album, status|\n # screen for duplicates\n if album[0].downcase == title.downcase\n puts \"You already have a song by that name.\"\n return nil\n end\n end\n album = [title, artist]\n $albums[album] = \"unplayed\"\n # artist = artist.gsub('\"', '')\n puts \"Added #{title} by #{artist.gsub('\"', '')}\"\n return album\nend", "title": "" } ]
d5eaf035fb342e64d9ebd4716c2430ec
GET /petrol_pump_stations/1 GET /petrol_pump_stations/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0d39e001e763b125f2fc0092f9d5b197", "score": "0.71741617", "text": "def index\n @petrol_pump_stations = PetrolPumpStation.all\n end", "title": "" }, { "docid": "e9b99826c75a12d72b4463df793f991b", "score": "0.66828376", "text": "def show\n @stalltalkian = Stalltalkian.find(params[:id])\n @poopstations = @stalltalkian.poopstations\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stalltalkian }\n format.mobile\n end\n end", "title": "" }, { "docid": "74550b671c824e1161f1f74381a902f3", "score": "0.65269536", "text": "def show\n @station = Station.find_by_id!(params[:id])\n render json: @station\n end", "title": "" }, { "docid": "77fea1a367101c572e25a846786deb61", "score": "0.6491903", "text": "def index\n @police_stations = PoliceStation.all\n end", "title": "" }, { "docid": "710b9c5c8fe60c2e6e6f56e169e40a2a", "score": "0.64805686", "text": "def show\n @snotel_station = SnotelStation.find(params[:id])\n @snotel_station.update_weather\n @snotel_station.update_snowfall_aggregates!\n\n render json: { snotel_station: @snotel_station.as_json(include_snowfall_data: true, include_weather_data: true) }\n end", "title": "" }, { "docid": "1d59e15429b7eace24ebd16875739bd4", "score": "0.641701", "text": "def index\n @stations = Station.all\n\t@connection = Connection.new\n\t@station = Station.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "title": "" }, { "docid": "960e691d90a0694027b246288d06796f", "score": "0.6359684", "text": "def show\n @station = Station.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "960e691d90a0694027b246288d06796f", "score": "0.6359684", "text": "def show\n @station = Station.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "960e691d90a0694027b246288d06796f", "score": "0.6359684", "text": "def show\n @station = Station.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "c1fe4aecc8c6512632d89a3709eb96ca", "score": "0.632849", "text": "def index\n @awon_stations = AwonStation.all\n respond_to do |format|\n format.html\n format.json {render json: @awon_stations}\n end\n end", "title": "" }, { "docid": "25bbe6605e203c071cd8ed4300ad7654", "score": "0.6288233", "text": "def index\n if @route.nil?\n @stations = Station.all\n else\n @stations = @route.stations\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "title": "" }, { "docid": "39d14f5be69e37f0258e2720848e5ae5", "score": "0.6215987", "text": "def index\n respond_to do |format|\n format.html { @stations = Station.all.paginate :page => params[:page] }\n format.json { @stations = Station.all }\n end\n end", "title": "" }, { "docid": "0733adfec210fc1f9b210459706984de", "score": "0.62069654", "text": "def index\n @station = Station.find(params[:station_id])\n @ups = @station.ups\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ups }\n end\n end", "title": "" }, { "docid": "eddf894a468fc4ef6032f6331165a441", "score": "0.6197647", "text": "def index\n @station = Station.find(params[:station_id])\n @batteries = @station.batteries\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batteries }\n end\n end", "title": "" }, { "docid": "371fc070c4911261700aaca84ec15463", "score": "0.61899614", "text": "def set_petrol_pump_station\n @petrol_pump_station = PetrolPumpStation.find(params[:id])\n end", "title": "" }, { "docid": "5a5e69068acb982a982fd7f9122d27c5", "score": "0.6129977", "text": "def show\n @battery = Battery.find(params[:id])\n @station = @battery.station\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @battery }\n end\n end", "title": "" }, { "docid": "375e2be3a5972636a038b29fa2a275fd", "score": "0.6125398", "text": "def stations\n # build request path\n path = 'points/%2.4f%%2C%2.4f/stations' % [@y, @x]\n\n get(path)['features'].map { |row|\n WeatherSage::Weather::Station.from_json(@ctx, row)\n }\n end", "title": "" }, { "docid": "0ccd92d8d5b48efd43b80bcf4bac4bf0", "score": "0.61178446", "text": "def show\n render 'api/v1/weather_stations/show', params: @weather_station\n end", "title": "" }, { "docid": "b6fa4b67a92ed14a1be2cc4580a59821", "score": "0.6094656", "text": "def index\n @tunneltemps = Tunneltemp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunneltemps }\n end\n end", "title": "" }, { "docid": "0ac72aa86482a20da1bf10c54853510f", "score": "0.6094642", "text": "def index\n @parkingramps = @Parkingramp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parkingramps }\n end\n end", "title": "" }, { "docid": "566f3e199b8efeb21b88fdfcd7f79ea3", "score": "0.60696626", "text": "def index\n @train_visiting_stations = TrainVisitingStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @train_visiting_stations }\n end\n end", "title": "" }, { "docid": "207cdb1ce9ec66d28749737af97aa7ac", "score": "0.60685605", "text": "def get_station_list\n uri = URI.parse(\"http://www.citibikenyc.com/stations/json\")\n res = Net::HTTP.get_response(uri)\n json_response = JSON.parse(res.body)\n json_response[\"stationBeanList\"]\n end", "title": "" }, { "docid": "5ea1ea6e93a458e70ff93a0f2af71cf5", "score": "0.6043209", "text": "def show\n @service = Service.get_service params[:service_id]\n\n if params[:journey_id]\n @journey = Journey.find(params[:journey_id])\n render_403 and return if @journey.user_id != current_user.id\n\n @journey_leg = JourneyLeg.new\n @url = \"/journeys/#{@journey.id}/legs\"\n elsif params[:journey_leg]\n @journey_leg = JourneyLeg.new(journey_leg_params)\n @url = \"/journeys\"\n else\n @journey_leg = JourneyLeg.new\n @url = \"/journeys\"\n end\n\n @method = :POST\n\n @stations = []\n @service.calling_points.each do |calling_point|\n @stations << calling_point.station if calling_point.station\n end\n\n respond_to do |format|\n format.html\n format.xml { render xml: @service }\n format.json { render json: @service, callback: params['callback'] }\n end\n end", "title": "" }, { "docid": "83bc07fdb9ab4b34b6ba54431c619116", "score": "0.60277414", "text": "def index\n @stations = Station.all\n end", "title": "" }, { "docid": "83bc07fdb9ab4b34b6ba54431c619116", "score": "0.60277414", "text": "def index\n @stations = Station.all\n end", "title": "" }, { "docid": "e809f5acd2898205df905f511489d5f7", "score": "0.60205495", "text": "def stations\n resp = self.connection.request(\n :get,\n Citibike::Station.path\n )\n\n return resp if @options[:unwrapped]\n\n Citibike::Responses::Station.new(resp)\n end", "title": "" }, { "docid": "7b6d030250270d12a877bddb804c9972", "score": "0.6019382", "text": "def create\n @petrol_pump_station = PetrolPumpStation.new(petrol_pump_station_params)\n\n respond_to do |format|\n if @petrol_pump_station.save\n format.html { redirect_to @petrol_pump_station, notice: 'Petrol pump station was successfully created.' }\n format.json { render :show, status: :created, location: @petrol_pump_station }\n else\n format.html { render :new }\n format.json { render json: @petrol_pump_station.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb51d7d875202e2ed81607721fd654b3", "score": "0.6017313", "text": "def index\n @weather_stations = WeatherStation.all\n render 'api/v1/weather_stations/index', params: @weather_stations\n end", "title": "" }, { "docid": "8ff973c8e553a2484b81c58ace619e55", "score": "0.6011391", "text": "def index\n @parkings = Parking.all\n json_response(@parkings)\n end", "title": "" }, { "docid": "9c2e391f2aab422bf7d998c44e97b25c", "score": "0.6010244", "text": "def show\n @punch = Punch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch }\n end\n end", "title": "" }, { "docid": "302d956ff1768524726fde18b9755a0c", "score": "0.6008362", "text": "def fetch_stations\n @new_stations = FmiStations.fetch_stations\n redirect_to :back, notice:\"Observation stations updated according to latest available info.\"\n end", "title": "" }, { "docid": "907c38dca002d626f03519f2d02b05b0", "score": "0.5994971", "text": "def show\n @stations = Station.where(rent_house_id: set_rent_house.id).all\n end", "title": "" }, { "docid": "f60ea1126e699bd4eff017ea878d8dfe", "score": "0.5994591", "text": "def index\n @stomping_grounds = @traveler.present? ? @traveler.stomping_grounds : []\n \n render(success_response(@stomping_grounds,\n root: \"stomping_grounds\"))\n end", "title": "" }, { "docid": "69ddb8ce7d6a2b5759971e32c541e0a3", "score": "0.59793407", "text": "def show\n @train_visiting_station = TrainVisitingStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @train_visiting_station }\n end\n end", "title": "" }, { "docid": "2948a5c3e970c2d8d2d12d8ee3788c81", "score": "0.59697175", "text": "def index\n @metro_stations = MetroStation.all\n end", "title": "" }, { "docid": "34fd442f56ea55660a0d4caf388223ac", "score": "0.59614134", "text": "def index\n @generators = Generator.all\n\t\t@station = Station.find(params[:station_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generators }\n end\n end", "title": "" }, { "docid": "6d30d61df11146ec9cef5fca133e2058", "score": "0.5949876", "text": "def show\n workstation = Workstation.find(params[:id])\n\t\t\t\trender json: {status: 'SUCCESS', message:'Loaded ', data:workstation},status: :ok\n end", "title": "" }, { "docid": "e13cf0e480de6580dcb98491416f3864", "score": "0.59280336", "text": "def show\n @stations = @building.stations\n end", "title": "" }, { "docid": "04a0715f282d7ab7a7ba36740f7c6756", "score": "0.59243214", "text": "def index\n @rectifiers = Rectifier.all\n\t\t@station = Station.find(params[:station_id])\n \n\t respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rectifiers }\n end\n end", "title": "" }, { "docid": "139895eefed107c212318095b90bb79a", "score": "0.5908501", "text": "def get_singers #needs room as param\n room_url = @@room_ips[params[:room].to_i]\n res = HTTParty.get(\"#{room_url}singers\")\n list = []\n case res.code\n when 200\n parsed_res = Nokogiri::PList(res)\n parsed_res[\"Playlists\"][0][\"Playlist Items\"].each do |e| \n unless (e[\"SNGR\"].blank? || e[\"siID\"].blank?) \n list << {name: e[\"SNGR\"], siID: (e[\"siID\"]+1)}#I think it's +1 because drop has siID's 0 indexed but singers returns them 1 indexed?\n end\n end\n render json: list\n when 404\n render json: \"404 error\"\n when 500...600\n render json: \"ERROR #{response.code}\"\n end\n end", "title": "" }, { "docid": "f90aa5115f34aaa279a735dfb7139fb5", "score": "0.5906398", "text": "def skier_pings_index \n @pings = Skier.find(params[:id]).pings\n render json: @pings \n end", "title": "" }, { "docid": "c566d2b38c5a5c322d0b32a52619ae11", "score": "0.59036607", "text": "def show\n # render :text=> params.to_json\n if params[:station_id].present?\n @estimation = Estimation.where(\"station_id = ?\" , params[:station_id])\n end\n end", "title": "" }, { "docid": "96386d3ae9c248cb89878049c971b76f", "score": "0.5893367", "text": "def police()\n source = \"https://data.cityofboston.gov/resource/23yb-cufe.json\"\n resp = Net::HTTP.get_response(URI.parse(source))\n data = resp.body\n police_stations = Array.new\n station = Struct.new(:latitude, :longitude, :address)\n JSON.parse(data).each do |item|\n human_address = JSON.parse(item[\"location\"][\"human_address\"])\n police_stations.push(station.new(item['location']['latitude'], item['location']['longitude'], human_address[\"address\"]))\n end\n return police_stations\n end", "title": "" }, { "docid": "c44b38d863ad044856ba7c540897908a", "score": "0.58880734", "text": "def show\n @station = Station.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @station }\n format.xml { render :xml => @station }\n end\n end", "title": "" }, { "docid": "31d7e4b3745f4337a7431a4e03f12a70", "score": "0.58817416", "text": "def show\n @station = Station.find(params[:id])\n\t\n\tputs @station.client_id\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @station }\n\t format.json { render :json => @station }\n end\n end", "title": "" }, { "docid": "40226cde8a164e4600556b7a7deaaa82", "score": "0.5881099", "text": "def show\n @battery_daily_test = BatteryDailyTest.find(params[:id])\n\t\ttest_battery = Battery.find(params[:battery_id])\n\t\t@station = test_battery.station\t\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @battery_daily_test }\n end\n end", "title": "" }, { "docid": "3f5c99c947e5c3fbef6cc06efa1400e0", "score": "0.5870256", "text": "def index\n @turing_machines = TuringMachine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @turing_machines }\n end\n end", "title": "" }, { "docid": "43ac2dc23a3ed4039ddcc5ab993f5594", "score": "0.5865758", "text": "def show\n @stations = @property.stations\n end", "title": "" }, { "docid": "5af390246b25831ccb4804373e477ff4", "score": "0.58645713", "text": "def new\n @station = Station.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "6b4ff9d9bcfb12d9a99d3fb2531a01c1", "score": "0.5862014", "text": "def index\n @power_stations = PowerStation.all\n end", "title": "" }, { "docid": "9cb7a486432aef95662869aae325c3d5", "score": "0.58590704", "text": "def index\n @stations = current_user.stations\n end", "title": "" }, { "docid": "1afb232888d1b715c7a794992487dd3c", "score": "0.5852994", "text": "def show\n @line = Line.find(params[:id])\n @lineStations = LineStation.where( :line_id => params[:id])\n \n @stations = Array.new\n @lineStations.each do |ls|\n @stations << Station.find(ls.station_id)\n end\n \n render :json => { :line => @line, :stations => @stations }\n end", "title": "" }, { "docid": "74ae72b306cfc3a5dfab1c0ec8ee7338", "score": "0.58504945", "text": "def show\n @station = Station.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "3185a7af8d1cb6b5990e569cfe67e421", "score": "0.58461577", "text": "def index\n @rounds = Round.all\n @stations = Station.all\n end", "title": "" }, { "docid": "5d12747080edbc6ab0ba510eca1839c5", "score": "0.5839659", "text": "def get_data\n uri = URI(\"https://taskboardv2.herokuapp.com/station1.json\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n JSON.parse(response.body)\nend", "title": "" }, { "docid": "1f2e79c61402376c57c0c707b1aea310", "score": "0.58392906", "text": "def doStationsRequest(_params)\n res = doIPRequest(params)\n ip = JSON.parse(res)\n res = doLocationRequest({\"type\"=>\"station\",\"transportations[]\"=>\"ec_ic\",\"transportations[]\"=>\"ice_tgv_rj\",\"transportations[]\"=>\"ir\",\"transportations[]\"=>\"re_d\", \"x\" => ip[\"lat\"].to_s, \"y\" => ip[\"lon\"].to_s})\n location = JSON.parse(res)\n station = (location[\"stations\"].sort_by { |hash| hash['distance'].to_i }).first\n if station.nil?\n return doError('No station was found!')\n else\n departing_station_name = station[\"name\"]\n # Get the stationboard with the next 5 trains leaving from the given station.\n res = doStationboardRequest({\"id\"=>station[\"id\"].to_s, \"limit\"=>\"5\", \"transportations[]\"=>\"ec_ic\", \"transportations[]\"=>\"ice_tgv_rj\", \"transportations[]\"=>\"ir\", \"transportations[]\"=>\"re_d\"})\n stationboard = JSON.parse(res)\n # StationsRequest param limit=5 can respond more than 5 elements (if on same time)\n # therefore the filter first(5) must be applied\n return ({ departing_station_name: departing_station_name, stationboard: stationboard[\"stationboard\"].first(5) }.to_json)\n end\nend", "title": "" }, { "docid": "d2a08605800e6789dfbb40161c1c03fa", "score": "0.5827657", "text": "def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "d2a08605800e6789dfbb40161c1c03fa", "score": "0.5827657", "text": "def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "d2a08605800e6789dfbb40161c1c03fa", "score": "0.5827657", "text": "def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "title": "" }, { "docid": "34a219dd1440a1f9c3dfdc72727da51b", "score": "0.5802533", "text": "def show\n @splatt = Splatt.find(params[:id])\n\n render json: @splatt\n end", "title": "" }, { "docid": "211887a04c3fd915effcda15c4433a79", "score": "0.5800658", "text": "def index\n @punches = user_signed_in? ? current_user.punches.latest.first(10) : []\n @punch = user_signed_in? ? current_user.punches.new : Punch.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @punches }\n end\n end", "title": "" }, { "docid": "02531daab11cc928da1f2d1986d790b6", "score": "0.5800224", "text": "def polster\n\t\turi =\"http://elections.huffingtonpost.com/pollster/api/polls.json?question=16-NY-Pres-GE%20TrumpvClinton\"\n @response = HTTParty.get(uri) \n respond_to do |format|\n \tformat.json {render json: @response}\n end\n end", "title": "" }, { "docid": "96b5ac008b6205fdc4eb602d411327bd", "score": "0.5798303", "text": "def show\n uri = URI('https://api.ridemetro.org/data/CalculateItineraryByPoints')\n\n query = URI.encode_www_form({\n # Request parameters\n 'lat1' => '',\n 'lon1' => '',\n 'lat2' => '',\n 'lon2' => '',\n 'startTime' => `datetime'#{Time.now.utc.iso8601}'`,\n '$format' => 'JSON',\n '$orderby' => 'EndTime',\n '$expand' => 'Legs'\n })\n\n if uri.query && uri.query.length > 0\n uri.query += '&' + query\n else\n uri.query = query\n end\n\n request = Net::HTTP::Get.new(uri.request_uri)\n # Request headers\n request['Ocp-Apim-Subscription-Key'] = '6741c2454ce544309f5020fbd7b6e4ca'\n # Request body\n request.body = \"{body}\"\n\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n\n puts \"response.body:\", response.body\n puts \"you made a get request I think?? (to #show or /itineraries/1?\"\n render json: response.body\n\n end", "title": "" }, { "docid": "9507be8f7eb30efd3d8292a26ba9b579", "score": "0.5798125", "text": "def index\n @service_stations = ServiceStation.all\n end", "title": "" }, { "docid": "524246703fc163bf572ebb06dfce21ed", "score": "0.57943344", "text": "def index\n workstations = Workstation.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'sucesso', data:workstations},status: :ok\n end", "title": "" }, { "docid": "54822af98bfff782a907b37c15a26c70", "score": "0.57925755", "text": "def index\n render json: Roomservice.where(stay_id: params[:stay_id])\n end", "title": "" }, { "docid": "9b35a4872c5e366479646e932a4ffd25", "score": "0.57787126", "text": "def index\n @polling_station_masters = PollingStationMaster.all\n end", "title": "" }, { "docid": "1a094a385a776e3eb83bed05dc087c7f", "score": "0.57779455", "text": "def index\n @singers = Singer.all\n render :json => @singers\n end", "title": "" }, { "docid": "422c6ded017f96d0525778769f3565f9", "score": "0.57770896", "text": "def index\n #@stations = Station.all\n @stations = Station.page(params[:page]).order(:id)\n end", "title": "" }, { "docid": "35b754971049066d9d5808c238abaf35", "score": "0.576623", "text": "def show\n @station = Station.find(params[:id])\n @lineStations = LineStation.where( :station_id => params[:id])\n \n @lines = Array.new\n @lineStations.each do |ls|\n @lines << Line.find(ls.line_id)\n end\n\n render :json => { :station => @station, :lines => @lines }\n end", "title": "" }, { "docid": "144dfd589df221a8efd5b8e2e242b2ef", "score": "0.57635385", "text": "def show\n @lift = Lift.find(params[:id])\n\n render json: @lift\n end", "title": "" }, { "docid": "1e2f3b321abb3665ed61e24b454253ca", "score": "0.5760185", "text": "def get_stations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StationsApi.get_stations ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/stations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'userSelectable'] = opts[:'user_selectable'] if opts[:'user_selectable']\n query_params[:'webRtcUserId'] = opts[:'web_rtc_user_id'] if opts[:'web_rtc_user_id']\n query_params[:'id'] = opts[:'id'] if opts[:'id']\n query_params[:'lineAppearanceId'] = opts[:'line_appearance_id'] if opts[:'line_appearance_id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StationsApi#get_stations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3f654ea4ce8842b29d85903ecafe3fd6", "score": "0.57587117", "text": "def get_and_trim_stations(city)\n form_param = {}\n form_param[:station] = city\n form_param['transportations[]'] = %w(ice_tgv_rj ec_ic ir re_d) # Only trains\n code, data = get_response(TRANSPORT_EP, '/stationboard?', form_param)\n if code != 200\n halt_errors code, data['errors'].map { |err| err['message'] }\n elsif data['stationboard'].empty?\n halt_errors 404, %[Cannot find any train connections leaving from \"#{city}\"]\n end\n data['stationboard'] = data['stationboard'][0..4]\n data\nend", "title": "" }, { "docid": "fcb53f383f6f73ee493093295ce9f17a", "score": "0.57535", "text": "def index\n @gios_stations = GiosStation.all.paginate(:page => params[:page], :per_page => 142)\n end", "title": "" }, { "docid": "b0bc8b97453a25ee78b73e187ebc214a", "score": "0.5748203", "text": "def nearest_station\n #=== Instructions ===================================\n # Use the Divvy API to display all stations that have at least\n # 5 bikes available\n #\n # Bonus: Sort the stations by distance from a user-submitted\n # address\n #\n # Ref: http://www.divvybikes.com/stations/json/\n #================================================\n\n result = open(\"http://www.divvybikes.com/stations/json/\").read\n parsed_result = JSON.parse(result)\n @stations = []\n parsed_result['stationBeanList'].each do |stations_hash|\n if stations_hash['availableBikes'] >= 5\n @stations << \"#{stations_hash['stationName']} - #{stations_hash['availableBikes']} bikes\"\n end\n end\n end", "title": "" }, { "docid": "6d5f6af7f5caf4206c36f46b45846d23", "score": "0.57476914", "text": "def set_stations(url)\n response = JSON.load(open(url))\n streamURLs = {}\n response[\"data\"].each do |station|\n streamURLs[station[\"callSign\"]] = station[\"streamURL\"]\n end\n return streamURLs\nend", "title": "" }, { "docid": "44edd6726aaf802a8defded559108cdc", "score": "0.57475966", "text": "def index\n @railway_stations = RailwayStation.all\n end", "title": "" }, { "docid": "5f13a1e036c4339bf91c2f041c3e6d7d", "score": "0.57366836", "text": "def show\n @lifting = Lifting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifting }\n end\n end", "title": "" }, { "docid": "86641e43f9567b9955c7a8fb2c017346", "score": "0.57357126", "text": "def index\n @splatts = Splatt.all\n\n render json: @splatts\n end", "title": "" }, { "docid": "9bad709d5e0b36881a550c27cc647360", "score": "0.5734677", "text": "def index\n if params[:name].present?\n plants = Plant.find_by(name: params[:name])\n else\n plants = Plant.all\n end\n #\n # THis is the string to add to the end of the URL to filer: (separate by \"&\")\n # ?id=9&name=Touch%20Me%20Not\n #\n # plants = Plant.find_by(apistring)\n\n render json: plants\n end", "title": "" }, { "docid": "234c571b534309049d4b1316aa6956b5", "score": "0.5728915", "text": "def update\n respond_to do |format|\n if @petrol_pump_station.update(petrol_pump_station_params)\n format.html { redirect_to @petrol_pump_station, notice: 'Petrol pump station was successfully updated.' }\n format.json { render :show, status: :ok, location: @petrol_pump_station }\n else\n format.html { render :edit }\n format.json { render json: @petrol_pump_station.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fce283aba01e6a08878bd4bca018685", "score": "0.5727757", "text": "def show\n @nearest_stations = @rent_house.nearest_stations\n end", "title": "" }, { "docid": "568e044b19752e8ca26f8ba0192894bb", "score": "0.57205415", "text": "def index\n @print_stations = PrintStation.all\n @statuses = Status.all\n end", "title": "" }, { "docid": "0ff789e76ab815818fa98ad2983aad61", "score": "0.5716246", "text": "def index\n @service_stations = ServiceStation.all\n @service_stations = @service_stations.order(:name).page(params[:page] || 1)\n end", "title": "" }, { "docid": "31326db3edee3317df4bd31f5efece89", "score": "0.57145274", "text": "def index\n @gw_stations = GwStation.all\n end", "title": "" }, { "docid": "d6a879df85abc965945f045bb2476ecc", "score": "0.5714089", "text": "def larves\n self.class.get('/monstre_larve.json')\n end", "title": "" }, { "docid": "8c68d405e6865f2eacf6254d1ba3a360", "score": "0.57061267", "text": "def index\n @parkings = Parking.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @parkings }\n format.xml { render :xml => @parkings }\n end\n end", "title": "" }, { "docid": "eba38160e4db69ba45d7c845de3726cc", "score": "0.5705073", "text": "def index\n @no_of_stations = current_user.stations.length\n @station = DataGateway.find(params[:gateway_id]) rescue @stations.try(:first)\n @station = current_user.stations.first if current_user.is_broadcaster? && @station.blank?\n if @station.present?\n @entryways = @station.data_entryways.page(params[:page]).per(DIDS_PAGE_SIZE)\n @station_id = @station.id\n end\n end", "title": "" }, { "docid": "047a2e5b9beba303245550ae264ae0f5", "score": "0.56960315", "text": "def index\n @stations = Station.all\n if(@stations.empty?)\n get_station\n @stations = Station.all\n end\n gon.stations = @stations\n gon.your_int = 1\n end", "title": "" }, { "docid": "bcc5ddbec9b2f76ac49188e5e6d77d2b", "score": "0.5695803", "text": "def index\n @nearest_stations = NearestStation.all\n end", "title": "" }, { "docid": "0eaed5ebc80b3681beaa27fe41b2b8af", "score": "0.56956106", "text": "def index\n @stations = Station.find(:all, order: japanese? ? \"kana\" : \"ascii\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "title": "" }, { "docid": "0e2b3270808df0ff31fa1a1d9c877ff1", "score": "0.5683982", "text": "def list_pallet_label_stations\n\treturn if authorise_for_web(program_name?,'read') == false\n\n\tlist_query = \"@pallet_label_stations = PalletLabelStation.find(:all)\"\n\tsession[:query] = list_query\n\trender_list_pallet_label_stations\nend", "title": "" }, { "docid": "01285fa87d30eeb05c72c5cd0fbc04a8", "score": "0.5683464", "text": "def index\n @sensor_stations = SensorStation.all\n end", "title": "" }, { "docid": "892ffc5e5caa8738d638e2296f042c46", "score": "0.5683153", "text": "def show\n @punch_type = PunchType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch_type }\n end\n end", "title": "" }, { "docid": "1c133d7a2de12e8184b0dbdaa3b8b285", "score": "0.56805784", "text": "def show\n source_station = Station.find_by(name: vehicle_params[:source])\n destination_station = Station.find_by(name: vehicle_params[:destination])\n bus_stations = @vehicle.bus_stations.order(sequence: :asc)\n stations = bus_stations.map{ |bus_station| bus_station.as_json.merge({\n name: bus_station.station.name,\n status: bus_station.sequence <= destination_station.bus_stations.find_by(\n vehicle_id: @vehicle.id).sequence && bus_station.sequence >= source_station.\n bus_stations.find_by(vehicle_id: @vehicle.id).sequence\n })}\n render json: {status: true, stations: stations}\n end", "title": "" }, { "docid": "eec65398933089dd0348f8e3acc2b0b1", "score": "0.5675168", "text": "def stations\n if params['lat'] and params['lng']\n @stations = []\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @stations, callback: params[:callback] }\n format.xml { render xml: @stations }\n end\n end", "title": "" }, { "docid": "f2464a382261241fcb25271af3408577", "score": "0.56744534", "text": "def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @forecast, serializer: ForecastWithStationSerializer }\n end\n end", "title": "" }, { "docid": "287526df18eddd660edd934cdb9b6ef2", "score": "0.56683666", "text": "def show\n @tunneltemp = Tunneltemp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunneltemp }\n end\n end", "title": "" }, { "docid": "830986b49532ace0558a275da3e4d28b", "score": "0.56638956", "text": "def show\n respond_to do |format|\n format.any(:trips_json, :json) do\n render json: @trip\n end\n end\n end", "title": "" }, { "docid": "56db25d89eb79527aa0adb5daa86827f", "score": "0.5663389", "text": "def show\n @petrol_pump = PetrolPump.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @petrol_pump }\n end\n end", "title": "" }, { "docid": "14a9569babc9d5f9fa8b3da83171ba7a", "score": "0.56607264", "text": "def index\n @rainfalls = Rainfall.all\n respond_to do |format|\n format.html { render json: @rainfalls} \n end\n end", "title": "" } ]
ca2a156c35727e1b3287a90f149946d2
wait for search results loaded
[ { "docid": "859837cfe465a67b68e553372da299c8", "score": "0.7197217", "text": "def results_loaded?\r\n # Watir::Wait.until { emc_loading('loading').present? }\r\n sleep 2\r\n emc_loading('loading').wait_while_present \r\n\r\n end", "title": "" } ]
[ { "docid": "95fdf90e6bcb647b2efddaef6b918192", "score": "0.83664995", "text": "def wait_for_search_results\n wait_for_spinner\n results_count\n end", "title": "" }, { "docid": "6582a0371b491a3c671eb5ab49a338b0", "score": "0.7881906", "text": "def wait_results_load\n sleep 2\n end", "title": "" }, { "docid": "63a4e9140092812b3a0bdef093809d21", "score": "0.7773229", "text": "def get_search_results\n\t\twait_until_page_loads\n\t\[email protected]_elements(@locs[:results_item])\n\tend", "title": "" }, { "docid": "5970f9530582563cbf093fc1398cefd7", "score": "0.76584774", "text": "def wait_for_search_result_section_to_load\n wait_for_element_present(SEARCH_RESULT_SECTION)\n end", "title": "" }, { "docid": "88fd292fe46d7a37e9eee05a4ece4f56", "score": "0.69769096", "text": "def wait_for_note_search_result_rows\n wait_until(Utils.short_wait) { note_search_result_elements.any? }\n end", "title": "" }, { "docid": "be482df4e9459836392bc98138e27c96", "score": "0.69646347", "text": "def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end", "title": "" }, { "docid": "e2bbbe481f5d1165e952a8727ab80c89", "score": "0.6828974", "text": "def on_txtSearch_changed_wait\n return nil if @gui[\"window\"].destroyed?\n \n @enum = nil\n @result_i = 0\n @results = []\n \n text = @gui[\"txtSearch\"].text\n words = text.split(/\\s+/).map{|ele| ele.downcase}\n \n if !words.empty?\n #Need to use threadded enumerator because of fiber failure otherwise.\n @enum = Threadded_enumerator.new(:enum => @args[:rdo].plugin.send(:text => text, :words => words))\n end\n \n self.update_res\n end", "title": "" }, { "docid": "4eee9caa94a3de29af949f72ee42deb0", "score": "0.67732877", "text": "def wait_for_search(search_term)\n wait = Selenium::WebDriver::Wait.new(:timeout => 45)\n assert_nothing_raised(Selenium::WebDriver::Error::TimeOutError, \"Error waiting for search for url #{@driver.current_url} view #{@view} and tab #{@tab}.\") {\n wait.until {\n begin\n @driver.find_element(:id, \"metasearch_results_results\")\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n login_page?\n end\n }\n }\n end", "title": "" }, { "docid": "f71e1163c5bd936d70b0ccbc016ea059", "score": "0.65763545", "text": "def wait_for_ajax_complete\n wait_for_page_load\n wait_for_ajax\n end", "title": "" }, { "docid": "8a439ba820543667a0e1d0599cb7f440", "score": "0.6573005", "text": "def waitLoading\r\n puts \"Loading data ...\"\r\n\r\n self.browser.div(:xpath => \"//div[@class='temp-container']/div[@class='placeholder-loader' and not (@id='interviewCount')]\").wait_while_present\r\n end", "title": "" }, { "docid": "8a439ba820543667a0e1d0599cb7f440", "score": "0.6573005", "text": "def waitLoading\r\n puts \"Loading data ...\"\r\n\r\n self.browser.div(:xpath => \"//div[@class='temp-container']/div[@class='placeholder-loader' and not (@id='interviewCount')]\").wait_while_present\r\n end", "title": "" }, { "docid": "379710e96a466b07a4f93ce9ec7331d5", "score": "0.6546805", "text": "def wait_results_searched_out(keyword:, exact_match: false, match_content: :title, timeout: 3*60)\n wait_results_load\n @browser.wait_until { results_keyword.present? }\n\n start_time = Time.now\n while(!first_result_match?(keyword, exact_match, match_content))\n break if (Time.now - start_time) > timeout\n sleep 5\n\n @browser.refresh\n\n @browser.wait_until { results_keyword.present? }\n end\n end", "title": "" }, { "docid": "d599274161f510fbf0ca3301b8beca56", "score": "0.6527001", "text": "def execute_search\n conduct_search_btn.click\n sleep 5\n end", "title": "" }, { "docid": "06ddf2c5fb74e263358eb6c66a4777b5", "score": "0.65110683", "text": "def complete(_search); end", "title": "" }, { "docid": "06ddf2c5fb74e263358eb6c66a4777b5", "score": "0.65110683", "text": "def complete(_search); end", "title": "" }, { "docid": "371737b4f314a7cc24be999537b76299", "score": "0.64984745", "text": "def fetch_search_results_page\n search_page = @agent.get(@search_url)\n search_form = search_page.forms[0]\n\n maximized_search_form = mark_search_form_with_max_values(search_form)\n\n search_results_page = @agent.submit(\n maximized_search_form, maximized_search_form.buttons.first\n )\n\n @search_results_page = search_results_page\n end", "title": "" }, { "docid": "4e97e27e825e8f3432bc5a52babd51a2", "score": "0.64608496", "text": "def search_messages\n search_button_element.click\n self.wait_for_ajax\n end", "title": "" }, { "docid": "23b108d8e5768dfde46354f936ed630f", "score": "0.6454063", "text": "def wait_for_page_to_load\n @wait_on.each { |element| wait_for_element(element) }\n end", "title": "" }, { "docid": "55fc8860540c45212aaabcaa496090c2", "score": "0.6438388", "text": "def get_first_search_results_div\r\n\r\n # When the page first loads, if this sleep statement is not there, when the 'text' method is called on this element, it may not get the expected text, might get something like the profile type as noticed earlier, as that is the text displayed prior to the titles of the test results\r\n sleep(1)\r\n\r\n LynxAutoHelper.get_browser_instance.div(class: ElementNames::SEARCH_RESULT_ROW_DIV_CLASS_NAME)\r\n\r\n end", "title": "" }, { "docid": "05244e8e1fe9bd0010fe4e0cfdbdd97c", "score": "0.6431436", "text": "def wait_for_search_field()\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until {\n begin\n search_field\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n false\n end\n }\n end", "title": "" }, { "docid": "f0690d773e582b64184e07c434ad9f07", "score": "0.6410439", "text": "def wait_for_search(search_term)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until {\n begin\n search_field\n driver.title.eql?(\"BobCat - #{search_term}\")\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n false\n end\n }\n end", "title": "" }, { "docid": "ba3212ea07854af17bb98d63ed89c3f2", "score": "0.6390706", "text": "def fetch_search\n tweets = Twitter::Search.new(@keyword, :page => @page).fetch\n tweets.results.each do |tweet|\n puts JSON.dump(tweet)\n logger.info \"Fetched tweet ##{tweet.id} via Search API\"\n logger.info \"Job Status: #{@count}/#{@limit}\"\n if @limit and @count >= @limit\n logger.info \"Limit reached (#{@count} out of #{@limit})\"\n return\n else\n @count += 1\n end\n end\n @page += 1\n fetch_search\n end", "title": "" }, { "docid": "2e58c487076e08ee7ad155a3c57b59a4", "score": "0.638216", "text": "def fetch_results\n @results = []\n fetch_task_results\n fetch_project_results\n @results\n end", "title": "" }, { "docid": "4d73c413e82f6612967641b3984aa504", "score": "0.6366915", "text": "def wait_for_elements\n adapter.wait_for_elements\n end", "title": "" }, { "docid": "b24c54f79770eda228afa912e18149c8", "score": "0.63487643", "text": "def wait_for_search(search_term)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n assert_nothing_raised(Selenium::WebDriver::Error::TimeOutError, \"Error waiting for search for url #{@driver.current_url} view #{@view} and tab #{@tab}.\") {\n wait.until {\n begin\n search_field\n @driver.title.eql?(\"BobCat - #{search_term}\")\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n false\n end\n }\n }\n end", "title": "" }, { "docid": "1dac67e039a43b1f350dbd2585bbb264", "score": "0.6296633", "text": "def wait_for_elements\n @wait_on << :title\n @wait_on << :document_id\n super\n end", "title": "" }, { "docid": "9ef30d65c1d78f915395560df54a100c", "score": "0.6288669", "text": "def wait_for_search_field()\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n assert_nothing_raised(Selenium::WebDriver::Error::TimeOutError, \"Error waiting for search field for url #{@driver.current_url} view #{@view} and tab #{@tab}.\") {\n wait.until {\n begin\n search_field\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n false\n end\n }\n }\n end", "title": "" }, { "docid": "9ef30d65c1d78f915395560df54a100c", "score": "0.6288669", "text": "def wait_for_search_field()\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n assert_nothing_raised(Selenium::WebDriver::Error::TimeOutError, \"Error waiting for search field for url #{@driver.current_url} view #{@view} and tab #{@tab}.\") {\n wait.until {\n begin\n search_field\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n false\n end\n }\n }\n end", "title": "" }, { "docid": "e96b2c6a9f537dd581a9bd75f8a073b7", "score": "0.62490875", "text": "def wait_until_loaded\n wait_for_ajax Watir.default_timeout,\"\\n#{self.class.name}: wait until loaded.\"\n # wait_for.each {|lmnt| self.send(lmnt).wait_until_present } unless wait_for.nil?\n Watir::Wait.until {wait_for.each {|lmnt| self.send(lmnt).present?}} unless wait_for.nil?\n true\n end", "title": "" }, { "docid": "7f0ac3bd29fc91c80659b33954a3390f", "score": "0.62331474", "text": "def wait_until_visible\n wait_for_ajax\n end", "title": "" }, { "docid": "d72e35c78f549652af7aed668bfe552a", "score": "0.6229613", "text": "def search\n self.search_button\n sleep 2.5\n end", "title": "" }, { "docid": "e798649b516aa56b5996b910cdec6291", "score": "0.62260884", "text": "def search_results(load: true)\n Bookmark.search(body: search_body, load: load)\n end", "title": "" }, { "docid": "e1662b31aef93db3e214e850ffd22119", "score": "0.6192749", "text": "def search_pending\n rpc(:search_pending, _access: :started) == 1\n end", "title": "" }, { "docid": "e0d6eb5b1ed760b5b0109d6556ec0bb3", "score": "0.6186045", "text": "def wait_results(*results)\n result ::Libuv::Q.all(@reactor, *results.flatten)\n end", "title": "" }, { "docid": "9aeb900f14361653b4099520c4dd7719", "score": "0.61707664", "text": "def wait_for_loading\n sleep 1\n end", "title": "" }, { "docid": "4d73a2e7abd8ed52e13a2f9e1f24530f", "score": "0.61509424", "text": "def performSearch()\r\n begin\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div[2]/div/nav/div/div[2]/div[1]/form/div[3]/div/button[2]\").click\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div[2]/div/nav/div/div[2]/div[1]/form/div[3]/div/ul/li[1]\").click\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div[2]/div/nav/div/div[2]/div[1]/form/div[3]/input[2]\").click\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div[2]/div/nav/div/div[2]/div[1]/form/div[3]/input[2]\").send_keys(@@configuration['configuration']['keyword'])\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div[2]/div/nav/div/div[2]/div[1]/form/div[3]/input[2]\").send_keys(:return)\r\n return ResultsPage.new(@@driver)\r\n rescue\r\n puts 'Find Jobs Version'\r\n end\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div/nav/div[1]/div[2]/div[1]/div[1]/form/div/div/div[2]/span\").click\r\n @@driver.find_element(:xpath => \"/html/body/div[1]/div/nav/div[1]/div[2]/div[1]/div[1]/form/div/ul/li[1]/a\").click\r\n @@driver.find_element(:xpath => \"//*[@id='q']\").click\r\n @@driver.find_element(:xpath, \"//*[@id='q']\").send_keys(@@configuration['configuration']['keyword'])\r\n @@driver.find_element(:xpath, \"//*[@id='q']\").send_keys(:return)\r\n $stderr.puts(\"Performs a search on the home page\")\r\n return ResultsPage.new(@@driver)\r\n end", "title": "" }, { "docid": "91a1063fe8746ee4a3410e98d77d6328", "score": "0.6088129", "text": "def wait_for_elements\n @wait_on << :title\n end", "title": "" }, { "docid": "10f26ccbe003e0032d2e19ab9ff2aaf9", "score": "0.6077902", "text": "def results\n if @scroll_id\n scroll_request\n else\n initial_search\n end\n rescue StandardError => e\n raise e\n end", "title": "" }, { "docid": "1d2579bce6540a079420149efc761a73", "score": "0.60698944", "text": "def wait_for(seconds=5)\r\n Selenium::WebDriver::Wait.new(:timeout => seconds).until { results() }\r\n end", "title": "" }, { "docid": "fc57820a412e0a72569b556142806449", "score": "0.6066748", "text": "def survive_es_asynchonicity\n NeedSearch.refresh_search_index\n end", "title": "" }, { "docid": "12ba959fbb4277b997c82836495d5176", "score": "0.6053317", "text": "def get_and_search_url\n #Thread.new {\n # 1 get a head of the queue\n url = @url_queue.shift\n sync_puts url\n # 2 search the url\n if url = nil || filtered?(url)\n return\n end\n\n sync_puts \"##new a thread and search the url\"\n #search_page_use_hpricot(url)\n search_page_use_capybara(url)\n\n # set the if downloaded flag to be true\n @downloaded_url[\"#{url.hash}\"] = true\n sync_puts \"##new search url thread end\"\n #}\n end", "title": "" }, { "docid": "ddc23e249fc4dde8cedeee65f50875f2", "score": "0.6049427", "text": "def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end", "title": "" }, { "docid": "5016e4be9c9c685c5af49df6b73716e9", "score": "0.60393476", "text": "def search_in_results(additional_search_term = @search_term.to_s)\n # find all result elements\n elements = @driver.find_elements(:css,'h3>a')\n\n # search for the requested term inside\n # the results.\n # if additional_search_term is on the page\n # then click on it, save success message and set found trigger into true\n elements.each do |el|\n if el.text == additional_search_term\n el.click\n sleep 3\n @result = \"The request '#{@search_term}' was found on #{@page_number} page.\"\n @found = true\n end\n end\n\n # in case if current page doesn't contain additional_search_term\n # (found trigger is false)\n # switch to the next result page\n unless @found\n @search_term = additional_search_term\n next_page()\n end\n end", "title": "" }, { "docid": "d2721f69f213dfefb47e8b8bd6eafe86", "score": "0.6032756", "text": "def wait_page_load\n browser.wait_for_load\n end", "title": "" }, { "docid": "3407bf29aa9f244b7b6ad68932c12349", "score": "0.6028558", "text": "def results\n # do search \n found = []\n search_methods.each do |meth|\n Rails.logger.debug \"calling #{meth}...\"\n if res = self.send(meth)\n Rails.logger.debug \"#{meth} returned #{res.size} items\"\n found += res\n end\n end\n Rails.logger.debug \"Done fetching items.\"\n # Conver to unique list of timeline event objects\n post_process_results(found)\n end", "title": "" }, { "docid": "f3059480e1f413639f3484c1e1fe94bf", "score": "0.6024324", "text": "def search_results(load: true)\n Tag.search(body: search_body, load: load)\n end", "title": "" }, { "docid": "8de8cc8f1917900cc16377a526437b25", "score": "0.6018742", "text": "def wait_for_completion( result )\n\n\tend", "title": "" }, { "docid": "e91565f1d56725a5d99f5c169c0d32b2", "score": "0.6006298", "text": "def wait_for_elements\n super\n @wait_on << :location_field\n end", "title": "" }, { "docid": "f9f7aced54f66018874bac3d5a7d1930", "score": "0.5996421", "text": "def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end", "title": "" }, { "docid": "2aec1d998664581e34edf34228edf559", "score": "0.59906536", "text": "def wait_for_elements\n super\n end", "title": "" }, { "docid": "2e982df4e286c735b3e38ce461b41967", "score": "0.59900445", "text": "def search\n STEPS.each do |step_klass|\n step_klass.execute(results_builder)\n break if results_builder.complete?\n end\n\n record_search\n if results_builder.errors.blank?\n results_builder.results\n else\n @errors = results_builder.errors\n false\n end\n end", "title": "" }, { "docid": "9ab0440e0717f9851221f3039d02eaec", "score": "0.5982697", "text": "def search\n @drivers = @current_knowledge.drivers\n param_drivers_selected = params[:drivers_selected] || []\n @drivers_selected = @drivers.select { |d| param_drivers_selected.include?(d.source) }\n @drivers_selected = @drivers if @drivers_selected.size == 0\n no_time = Time.now - (60 * 60 * 24 * 365 * 10)\n label_invite = \"\"\n @query_string = params[:query_string]\n if @query_string and @query_string.size > 3 and @query_string != label_invite\n #there is a search requested\n @results_as_driver_products = []\n @results_hash_time = {}; t0_total = Time.now\n threads = @drivers_selected.collect do |d|\n Thread.new do\n t0 = Time.now\n driver_results = d.search(@query_string)\n @results_hash_time[d.source] = Time.now - t0\n @results_as_driver_products.concat(driver_results)\n end\n end\n # wait for each thread to finish\n threads.each(&:join)\n @time_total = Time.now - t0_total \n @results_as_driver_products.sort! { |d1, d2| (d2.written_at || no_time) <=> (d1.written_at || no_time)}\n else\n # there is no search\n @query_string = label_invite\n @results_as_driver_products = nil\n end\n end", "title": "" }, { "docid": "f4e0b86f81dd98d0ee0d06290fb938b4", "score": "0.5978779", "text": "def collect_results(timeout=120)\n wait_until_done(timeout)\n results = get_testset_results\n return results\n end", "title": "" }, { "docid": "8b8e0bb9ff446858050de9ba29c8b7c4", "score": "0.5973289", "text": "def wait_until_done!\n return if done?\n\n ensure_service!\n loop do\n query_results_gapi = service.job_query_results job_id, location: location, max: 0\n if query_results_gapi.job_complete\n @destination_schema_gapi = query_results_gapi.schema\n break\n end\n end\n reload!\n end", "title": "" }, { "docid": "b3d0523f15f20b7080dfa0015b0cf412", "score": "0.5971376", "text": "def results_count\n sleep 1\n results_element.when_visible Utils.short_wait\n results.split[0].to_i\n end", "title": "" }, { "docid": "34f9fcc6df06bd226d4b348685550d1c", "score": "0.59564716", "text": "def result\n wait_for :all\n end", "title": "" }, { "docid": "9c30189777fd54d164173bc35b842cde", "score": "0.59442556", "text": "def wait_for_student_list\n begin\n start_time = Time.now\n sleep 1\n wait_until(Utils.medium_wait) { player_link_elements.any? }\n logger.debug \"Took #{Time.now - start_time} seconds for users to appear\"\n rescue\n logger.warn 'There are no students listed.'\n end\n end", "title": "" }, { "docid": "5b2b1d0224c3722d2441eaf60e2a2307", "score": "0.59430635", "text": "def run_search\n\t\t\tsearch.search\n\t\tend", "title": "" }, { "docid": "371a6967b59ec365fdba39291fad70b2", "score": "0.59381914", "text": "def verify_search_results(found)\n # wait up to 30 seconds for search busy indicator to disappear\n wait_not_busy(30)\n # search results expected\n if found\n search_data = FlightSearch.current\n # wait for results to be displayed\n if search_data.flexible.to_bool\n fare_calendar_table.wait_until_visible(45)\n else\n flight_results_list.wait_until_visible(45)\n end\n # build hash of objects that are common to all search results\n ui = {\n origin_field => { visible: true, value: { contains: search_data.origin } },\n destination_field => { value: { contains: search_data.destination } },\n search_nearby_button => { visible: false },\n error_message_label => { visible: false }\n }\n # parse the departure date into a meaningful localized date value\n unless search_data.depart_date.blank?\n depart_date_value = search_data.depart_date.to_s.format_date_time(:abbrev)\n ui[departure_date_field] = { visible: true, value: depart_date_value }\n end\n # parse the return date into a meaningful localized date value\n unless search_data.return_date.blank?\n return_date_value = search_data.return_date.to_s.format_date_time(:abbrev)\n ui[return_date_field] = { visible: true, value: return_date_value }\n end\n # verify correct search results lists are displayed\n if search_data.flexible.to_bool\n ui[fare_calendar_table] = { visible: true, rowcount: { greater_than_or_equal: 1 } }\n ui[flight_results_list] = { visible: false }\n else\n ui[flight_results_list] = { visible: true, itemcount: { greater_than_or_equal: 1 } }\n ui[fare_calendar_table] = { visible: false }\n end\n # verify that search results are correctly displayed\n verify_ui_states(ui)\n else\n # no results expected\n error_message_label.wait_until_visible(30)\n ui = {\n error_message_label => { visible: true, caption: { translate: 'search_results.no_flights_found' } },\n search_nearby_button => { visible: true, caption: { translate: 'search_results.search_nearby' } },\n nearby_error_message => { visible: true, caption: { translate: 'search_results.nearby_search_error' } },\n flight_results_list => { visible: false }\n }\n # verify that search error message is correctly displayed and translated\n verify_ui_states(ui)\n end\n end", "title": "" }, { "docid": "2f50ffc07b178692aa1917ed3f7c7775", "score": "0.5936513", "text": "def wait_for_term(term)\n found, retry_attempt = false, 0\n while !found && retry_attempt < 40\n search_for_term term\n if all_rows.at(1).text.downcase == term.downcase\n all_rows.at(1).click\n wait_for_all_buttons\n found = true\n break\n else\n sleep 3\n retry_attempt += 1\n clear_filter.click\n end\n end\n raise \"Term Not Found after 120 seconds! Hmm... web service sucks maybe? :D\" if found == false\n end", "title": "" }, { "docid": "e3484b4f1b5a6a38385909473b0cf9cc", "score": "0.5932621", "text": "def on_search\n # restart current search\n @end_time = Time.now + $cfg.search_delay\n @restart_search = true\n @gui.search_label.enabled = false\n return if @search_thread && @search_thread.status\n\n @search_thread = Thread.new(@search_thread) do\n begin\n @gui.search_label.enabled = false\n # wait untill deadline\n while (t = (@end_time - Time.now)) > 0\n sleep(t)\n end\n\n @data.gui_mutex.synchronize do\n # the thread has to use the gui mutex inside\n @restart_search = false\n\n match_data = get_match_data\n\n # remove all items\n @gui.packet_list.dirty_clear\n\n # add all items that match the search criteria\n status_text_deadline = Time.now + $cfg.status_line_update_interval\n @data.items.each do |item|\n #item.parent = @gui.packet_list if match?(item, match_data)\n if match?(item, match_data)\n item.show\n now = Time.now\n if now > status_text_deadline\n update_search_status_text\n status_text_deadline = now + $cfg.status_line_update_interval\n end\n end\n break if @restart_search\n end\n update_search_status_text\n\n if (@gui.packet_list.numItems > 0)\n @gui.packet_list.setCurrentItem(0)\n @gui.packet_list.selectItem(0)\n @gui.main.show_info(@gui.packet_list.getItem(0).packet_item.data)\n end\n @gui.search_label.enabled = true\n\n end # synchronize\n end while @restart_search# || match_data != @gui.search_field.text.downcase.split\n end #thread.new\n end", "title": "" }, { "docid": "428c4e46e91843c3e11691cacaf192f0", "score": "0.5925991", "text": "def update\n\n @search.results.each { |result| @search.results.destroy(result) }\n\n begin\n count_pages = 1\n index_page = 1\n @search.execute(index_page, count_pages)\n\n Thread.new {# on pourrait utiliser 2 thread mais cela coute plus cher en ressource navigateur chez Saas\n count_pages = 1\n index_page = 2\n @search.execute(index_page, count_pages)\n # on pourrait aussi faire une recherche avec count_page = 2 pour eviter 2 appel ; la difference =\n # les pages serait rangé sur le même index = 2, les liens serait classé en mélangeant des pages ; est ce un pb ?\n index_page = 3\n @search.execute(index_page, count_pages)\n }\n rescue Exception => e\n logger.debug e.message\n else\n ensure\n respond_to do |format|\n format.js {}\n end\n end\n end", "title": "" }, { "docid": "6f761bf8c8a531f3c695d4fe5abb97b0", "score": "0.59199244", "text": "def fetch_results\n result = false\n until @client.is_busy\n single_result = @client.blocking_get_result\n if one_result_mode?\n result = single_result\n break\n elsif single_result.nil?\n if result = @last_result\n result.check\n end\n break\n end\n @last_result.clear if @last_result\n @last_result = single_result\n end\n rescue Exception => e\n handle_error e\n else\n if result == false\n @readable_timestamp = Time.now if @timer\n else\n cancel_timer\n self.notify_readable = false unless @notify_deferrable\n df = @deferrable\n @deferrable = @send_proc = nil\n df.succeed result\n end\n end", "title": "" }, { "docid": "400003c956f3f76f7de330bce13ccb3a", "score": "0.59138405", "text": "def perform_search\n if query.present?\n do_searches unless email_found\n end\n results\n end", "title": "" }, { "docid": "f5f366a27710aec8aac6b818e831c17b", "score": "0.5905067", "text": "def cmd_search(results)\n count = 0\n results.each do |result|\n count += 1\n \n @io_out.puts \"Result #{count} - #{result.title}\"\n @io_out.puts \"URL: #{result.url}\"\n @io_out.puts \" \"\n \n if count >= 8\n @io_out.puts \"The maximum of 8 results was found. Please be more specific.\"\n break\n end\n end\n \n if count <= 0\n @io_out.puts \"No results was found (which is very very weird).\"\n end\n \n @io_out.puts \"\"\n end", "title": "" }, { "docid": "a18e4c8b257e647036d3028ea54a40d0", "score": "0.5900519", "text": "def wait_for_list_to_load\n wait_until(Utils.short_wait) { player_link_elements.any? }\n begin\n tries ||= Utils.canvas_enrollment_retries\n count = player_link_elements.length\n logger.debug \"There are now #{count} students visible\"\n scroll_to_bottom\n wait_until(Utils.short_wait) { player_link_elements.length > count }\n logger.info \"There are #{player_link_elements.length} students displayed\"\n rescue\n (tries -= 1).zero? ? fail : retry\n end\n end", "title": "" }, { "docid": "bb2cf634feefbd28c8a5356ab74935cd", "score": "0.58991945", "text": "def on_start search\n lambda do\n search.callback(DbConnection.using { search.data_for_start_event })\n end\n end", "title": "" }, { "docid": "00879d38d259ad66c30695779b822a9b", "score": "0.5896667", "text": "def perform_search(capy_session, first_name, last_name, city, state)\n rand_pause\n capy_session.visit(SEARCH_URL)\n\n puts \"Main True People Search page loaded. Filling in person info.\"\n\n capy_session.fill_in 'Name', with: \"#{first_name} #{last_name}\"\n capy_session.fill_in 'CityStateZip', with: \"#{city}, #{state}\"\n capy_session.click_button \"btnSubmit\"\n\n puts \"Clicked the search button. Waiting\"\n\n flex_pause(15)\n capy_session.current_url\n end", "title": "" }, { "docid": "281cf0d2cd6e0b3c66ab98b67f9e2438", "score": "0.58928424", "text": "def start_search(url)\n @starttime = Time.now # visit the page and read the page.\n # start timer thread\n=begin\n timer = Thread.new { \n while @queue_empty_timeout < 30\n sleep 1\n @queue_empty_timeout += 1\n sync_puts \"time tick :#{@queue_empty_timeout}\"\n end\n }\n=end\n # add the urls into a queue\n # start producer thread\n \n #Thread.new {\n #search_page_use_hpricot(url)\n search_page_use_capybara(url)\n #}\n\n \n\n # start consumer thread\n #consumer = Thread.new {\n #consume_loop\n #}\n end", "title": "" }, { "docid": "af36744dd5ec99a1046182f2be14a9d1", "score": "0.58875215", "text": "def show\n @results = Result.find(params[:id])\n @search = @results.search\n\n if Result.find_by_id(@results.id.next.next.next) # on controle que la page + 3 est déjà chargée\n # doit être égal au nombre de result fait la premiere fois dans search, sinon risque de trou si > ou reduction nombre prechargé\n Thread.new {\n\n begin\n count_pages = 1\n index_page = @results.index + 3 # on controle que la page + 3 est déjà chargée\n # doit être égal au nombre de result fait la premiere fois dans search, sinon risque de trou si > ou reduction nombre prechargé\n\n @search.execute(index_page, count_pages)\n\n rescue Exception => e\n logger.debug e.message\n\n else\n format.js {}\n\n end\n }\n end\n end", "title": "" }, { "docid": "f7ff4cf36179212a28309536614904b4", "score": "0.587991", "text": "def find_more_people\n active_div.link(:text=>\"Find more people\").click\n self.wait_for_ajax\n ExplorePeople.new @browser\n end", "title": "" }, { "docid": "f64d0461d8b9449d35ca4aae1e5e248e", "score": "0.5878922", "text": "def wait_for_page_to_load(timeout=@@timeout)\n super(timeout)\n wait_for_body_text\n end", "title": "" }, { "docid": "3c676f9deba03db9d10240abe202b305", "score": "0.5877994", "text": "def wait_for_loading(timeout = 20)\n wait_until(timeout) { find('.loading', visible: false).present? }\nend", "title": "" }, { "docid": "8c9b19ee53e50613b62218eb34052239", "score": "0.5876147", "text": "def wait_for_elements\n @wait_on << :title\n super\n end", "title": "" }, { "docid": "cfa9a31a88daaf3650b88e95ba5bba86", "score": "0.5867213", "text": "def parse_search_results(page)\n libraries_available = []\n\n body = Nokogiri::HTML(page)\n links = body.css(\"ol[class=result] li[class=clearfix] h3 a\")\n links.each do |link|\n fetch_result = fetch(\"#{LIBRARY_BASE_URL + (link.attr 'href')}\")\n response_body = Zlib::GzipReader.new(StringIO.new(fetch_result[:response].body)).read\n libraries_available.concat parse_detail(response_body)\n\n # should we go to the next link? do we already know if it's available at our library?\n return [LIBRARY_MY_STRING] if libraries_available.include? LIBRARY_MY_STRING\n end\n\n libraries_available\nend", "title": "" }, { "docid": "cc4d6f45d4faa6b2c93589f5eabe08e4", "score": "0.58616585", "text": "def perform_search(capy_session, first_name, last_name, city, state)\n\n unless capy_session.current_url == BASE_URL\n fail \"Unexpected starting url #{capy_session.current_url} for home page\"\n end\n\n capy_session.visit(SEARCH_URL)\n\n flex_pause(5)\n\n puts \"Main Ref Usa search page loaded. Filling in person info.\"\n\n\n capy_session.fill_in 'firstName', with: first_name\n capy_session.fill_in 'lastName', with: last_name\n capy_session.fill_in 'city', with: city\n capy_session.select(state, from: 'stateProvince')\n\n capy_session.click_link(\"View Results\")\n\n puts \"Clicked the View results button. Waiting\"\n\n long_pause\n\n capy_session.current_url\n end", "title": "" }, { "docid": "7c062ef9ab0570a22a39c064ab1e8519", "score": "0.58605826", "text": "def process_google_results(results, query)\n candidates = select_responses(results, query)\n select_best_response(candidates)\n end", "title": "" }, { "docid": "7aafb6e1aa67eb6fc56d32af37560635", "score": "0.58595204", "text": "def load_from_google_places_if_exists?\n Timeout::timeout(GOOGLE_API_TIMEOUT) do\n self.google_results = GooglePlaces.new(user_lat, user_long, keyword)\n google_results.load\n end\n es_results.update_in_background(google_results)\n self.autocomplete_list = google_results.autocomplete_list\n update_cache\n end", "title": "" }, { "docid": "f457ac090f43e3f2471ca7b362f66376", "score": "0.58386195", "text": "def search(basic_search_term = '')\n # page number counter\n @page_number = 1\n\n # open http://www.google.co.uk\n @driver.navigate.to 'http://www.google.co.uk'\n\n # find search field element\n search_field = @driver.find_element(:name,'q')\n\n # put basic_search_term into the field\n search_field.send_keys(basic_search_term)\n\n # find search button\n search_button = @driver.find_element(:name,'btnG')\n\n # click on the search_button\n search_button.click\n\n # wait result to load\n sleep(2)\n end", "title": "" }, { "docid": "a958a91fea69ce8fb577acecf3b766e5", "score": "0.5837954", "text": "def search_result\n search.execute\n end", "title": "" }, { "docid": "7ab859c3ed5c183c5a74a63701c1914d", "score": "0.5834577", "text": "def search_results\n begin\n \tsearch_text = params[:search_text].strip\n search_ticket_param = params[:ticketSearchField].downcase\n search_user_param = params[:userSearchField].downcase\n search_organization_param = params[:organizationSearchField].downcase\n\n if(search_ticket_param.eql?(\"none\") && search_user_param.eql?(\"none\") && search_organization_param.eql?(\"none\"))\n message = \"Please select a search parameter.\"\n end\n\n @filtered_tickets = assign_item_values(@tickets, search_ticket_param, search_text)\n @filtered_users = assign_item_values(@users, search_user_param, search_text)\n @filtered_organizations = assign_item_values(@organizations, search_organization_param, search_text)\n\n @no_results = ( is_item_empty?(@filtered_tickets) && is_item_empty?(@filtered_users) && is_item_empty?(@filtered_organizations) ) ? true : false\n render :partial => \"search_results\", :locals => { :ticket_results => @filtered_tickets, \n \t :user_results => @filtered_users, \n :org_results => @filtered_organizations,\n :no_results => @no_results,\n :message => message}\n rescue StandardError => e\n logger.error(e.to_s)\n redirect_to search_index_path\n end\n end", "title": "" }, { "docid": "813220c7f3d955903dc577c1990d7c08", "score": "0.58211726", "text": "def wait_for_elements\n @wait_on << :loan_button\n @wait_on << :item_field\n end", "title": "" }, { "docid": "6907a357cb398e73b62ffb617de4e9b4", "score": "0.58200294", "text": "def search(page = 1)\n sleep(0.5)\n puts build_url(page)\n results = organize(agent.get(build_url(page)))\n #results << search(page + 1) if results.length > 0\n end", "title": "" }, { "docid": "d60fa82de5123a59c76e4ca82e50d10a", "score": "0.5805889", "text": "def getsearchresults\n query=params['q'].gsub(' ','+')\n query=query.gsub('/','%2F')\n if params[:site]=='metacritic'\n doc=Nokogiri::HTML(open(\"http://metacritic.com/search/game/#{query}/results\"))\n doc.encoding='utf-8'\n @results=doc.css(\"li.result\").inner_html\n elsif params[:site]=='gamerankings'\n doc=Nokogiri::HTML(open(\"http://www.gamerankings.com/browse.html?search=#{query}&numrev=3\"))\n @results=doc.at_css(\"div#main_col > div.pod\").inner_html\n end\n respond_to do |format|\n format.js {render :layout => false}\n end\n end", "title": "" }, { "docid": "b437e072c232318fb8a9cdb3c54f41f3", "score": "0.5796804", "text": "def results\n @results ||= load_results\n end", "title": "" }, { "docid": "b45784c07ef192d0630f71f87036ebb7", "score": "0.5779855", "text": "def wait_until(args = {})\n sleep args[:delay] || DELAY_BEFORE_ACTION\n time = args[:time] || TIME_TO_SEARCH\n selector_type = args.keys.first\n time.times do\n search_results = find_elements selector_type, args[selector_type]\n return true if search_results.count.positive?\n\n sleep 1\n end\n false\n end", "title": "" }, { "docid": "77a6fb5a4ae503abe0a3b9905aefbb27", "score": "0.57792985", "text": "def scrape_jobs(results_page)\n results_page.search(\"#search-results-control .serp-result-content\")\n end", "title": "" }, { "docid": "27b65520ac054b5b8a2bb2d05abc2d3b", "score": "0.5774633", "text": "def getResults(par_bing, par_ent, par_blek, query)\n\t\tarray = Array.new(3)\n\t\tthreads = []\n\t\t\n\t\t \n\t\t\t\t\n\t\t\tif par_bing\n\t\t\t\tthreads << Thread.new {\n\t\t\t\t\tarray[0] = bing_search(query)\n\t\t\t\t\t}\n\t\t\tend\n\t\n\t\t\tif par_ent\n\t\t\t\tthreads << Thread.new{\n\t\t\t\t\tarray[1] = entireweb_search(query)\n\t\t\t\t}\n\t\t\tend\n\t\n\t\t\tif par_blek\n\t\t\t\tthreads << Thread.new {\n\t\t\t\t\tarray[2] = blekko_search(query)\n\t\t\t\t}\n\t\t\tend\n\t\t\t\n\t\t\tthreads.each { |aThread| aThread.join }\n\t\t\t\n\t\tarray\n\tend", "title": "" }, { "docid": "4f9d1cd84352680f3270ed98842c94fd", "score": "0.57714885", "text": "def results\n @results ||= fetch_results\n end", "title": "" }, { "docid": "ed41f25da34c848d613853a1cce49d7b", "score": "0.5770654", "text": "def wait_for_ajax\n Timeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end", "title": "" }, { "docid": "8eab7fe2474d32b64cb6d9e2e6128ced", "score": "0.5768068", "text": "def wait_for_page_to_load(text, time_out)\n begin\n wait_poll({:until_exists => $g_query_txt+\"contentDescription:'#{text}.'\", :timeout => time_out}) do\n puts \"wait_for_page_to_load: checking text #{text}\"\n end\n rescue\n return false\n end\n return true\n end", "title": "" }, { "docid": "22f4bbe3fadc3eed271b966b40c3f592", "score": "0.5763525", "text": "def execute_search\n if @aml_search_obj.steps_done_array.include?(GlobalConstant::AmlSearch.search_step_done)\n @aml_matches = AmlMatch.using_shard(shard_identifier: @shard_identifier).where(aml_search_uuid: @aml_search_obj.uuid).all\n return success\n end\n\n r = process_search(aml_search_params)\n if r.success?\n r.data[:aml_response][:matches].each do |aml_match|\n @aml_matches << create_an_entry_in_aml_match(aml_match)\n end\n else\n update_aml_search_as_failed(r)\n return error_with_identifier('could_not_proceed', 'c_ap_s_es_1')\n end\n\n mark_step_done(GlobalConstant::AmlSearch.search_step_done)\n success\n end", "title": "" }, { "docid": "b7103d560464a33e5d24a94944e5e2c1", "score": "0.5762326", "text": "def wait_for_loaded\n Watir::Wait.until(message: \"Timeout waiting for #{self} to load\") do\n loaded?\n end\n self\n end", "title": "" }, { "docid": "3e644e94e125cf1f70b05e4ec8dd273d", "score": "0.57612264", "text": "def wait_for_page_to_load(timeout=@timeout)\n do_command(\"waitForPageToLoad\", [timeout,])\n end", "title": "" }, { "docid": "6eaebe4608133685eb8ba102c5de4aa7", "score": "0.5758677", "text": "def wait_until_ready\n # this method may be left unimplemented if that is applicablelog\n end", "title": "" }, { "docid": "2bc7e6d1b90b41aa7dc6e350decaa2d3", "score": "0.57462376", "text": "def perform_search(sender)\n NSLog(\"searching for #{@search_box.to_s}\")\n begin\n refs = DocSet.search(@search_box.to_s)\n rescue DocSetError => error_message\n alert(:message => \"Missing documentation\", :info => error_message.to_s) \n else\n # loading the table view\n result_store.add_results(@result_table_view, refs)\n if refs.first.respond_to?(:full_path)\n @web_view.url = refs.first.full_path\n search_box.text = ''\n else\n alert :message => \"No documentation found\", :info => \"Sorry, we couldn't find anything about #{@search_box.to_s}, please use another term and try again.\"\n search_box.text = ''\n end\n end\n end", "title": "" }, { "docid": "9f1c702b97bcb533315fb5d4a1ecd012", "score": "0.57422215", "text": "def poll_results_file\n return handle_results(@resulting_xml)\n end", "title": "" }, { "docid": "71a01db62f6c235efb0e2191c0622009", "score": "0.57415503", "text": "def results\n @results_mutex.synchronize do\n @results\n end\n end", "title": "" }, { "docid": "a1b8da282534c4e3062715020952eab6", "score": "0.5734274", "text": "def search_and_load(start_url)\n agent = Mechanize.new\n puts start_url\n\n # Initialize results page\n results_page = agent.get(start_url)\n\n # Load the results for that page\n load_results(results_page)\n\n # Get the 'Next' button if it exists\n form = results_page.forms.first\n buttons = form ? form.buttons_with(:value => /Next/) : []\n\n # While there are more pages\n while buttons.length > 0\n puts \"Next\"\n\n # Get the next results page\n results_page = agent.submit(form, buttons.first)\n\n # Load the results for that page\n load_results(results_page)\n\n # Get the 'Next' button if it exists\n form = results_page.forms.first\n buttons = form ? form.buttons_with(:value => /Next/) : []\n end\nend", "title": "" }, { "docid": "a1b8da282534c4e3062715020952eab6", "score": "0.5734274", "text": "def search_and_load(start_url)\n agent = Mechanize.new\n puts start_url\n\n # Initialize results page\n results_page = agent.get(start_url)\n\n # Load the results for that page\n load_results(results_page)\n\n # Get the 'Next' button if it exists\n form = results_page.forms.first\n buttons = form ? form.buttons_with(:value => /Next/) : []\n\n # While there are more pages\n while buttons.length > 0\n puts \"Next\"\n\n # Get the next results page\n results_page = agent.submit(form, buttons.first)\n\n # Load the results for that page\n load_results(results_page)\n\n # Get the 'Next' button if it exists\n form = results_page.forms.first\n buttons = form ? form.buttons_with(:value => /Next/) : []\n end\nend", "title": "" } ]
c6fa91b5cfad9beb809dcf3d476de082
Has the puzzle been solved? In other words, have all the cells been assigned numbers?
[ { "docid": "f1a8cfe1be78001069a5ed73f75633a3", "score": "0.84574145", "text": "def solved?\n all? { |cell| cell.number }\n end", "title": "" } ]
[ { "docid": "e4f6bf354ef4c772bbba49580e84cde0", "score": "0.8529565", "text": "def solved?\n\t\tall? { |cell| cell.number }\n\tend", "title": "" }, { "docid": "8bc07b233e4c2823904dc7fa5e77a15a", "score": "0.8177407", "text": "def solved?\n @cells.each_value do |value|\n return false if value.class != Fixnum\n end\n\n return true\n end", "title": "" }, { "docid": "8ede7d646c60e96807fa397427be0a79", "score": "0.8162861", "text": "def solved?\n @cells.each_value do |value|\n return false if value.class != Fixnum\n end\n \n return true\n end", "title": "" }, { "docid": "44e60e8ecbfdeb220bf779279cdb64d0", "score": "0.8133679", "text": "def solved\n @sudoku.values.compact.size == 81\n end", "title": "" }, { "docid": "33b0e4cd86a92c8f1f2190e92dffb190", "score": "0.79729515", "text": "def is_solved?\n for x in 0...9\n arr = []\n for y in 0...9\n arr << @board[x][y].value.to_i\n end\n if !no_dups(arr)\n return false\n end\n end\n\n # checks all columns\n for x in 0...9\n arr = []\n for y in 0...9\n arr << @board[y][x].value.to_i\n end\n if !no_dups(arr)\n return false\n end\n end\n # check nine 3x3 regions\n if !check_all_regions\n return false\n end\n true\n end", "title": "" }, { "docid": "ada436a4e95769c38e3f1922e53a01ed", "score": "0.78648007", "text": "def solved?\n @cells.each do |cell|\n if(cell.empty?)\n return false\n end\n end\n return true\n end", "title": "" }, { "docid": "925c454efc3b914759ca38f598d51736", "score": "0.776986", "text": "def solved?\n # Sufficient because the algorithm doesn't put add any numbers if they're already\n # in a row, column, or box. This means we just need to make sure there are no blank\n # squares. Adding up all numbers in all the rows is sufficient; they cannot add up\n # to 45 if there are blank squares\n @puzzle.reduce {|ans, row| ans &&= (row.reduce {|sum, num| sum += num} == 45)}\n end", "title": "" }, { "docid": "ecae5cd7080e197f063b949845484fcd", "score": "0.7714494", "text": "def solved?\n peg_count = 0\n\n @board.each do |row|\n row.each do |square|\n peg_count += 1 if square == \"x\"\n return false if peg_count > 1\n end\n end\n\n true\n end", "title": "" }, { "docid": "c5f6ffb14d298d069f3cfb276f328509", "score": "0.7700313", "text": "def solved?\n [email protected]? && @grid.missing == 0\n end", "title": "" }, { "docid": "a2842db97e763f76e87d4e824ead9fc4", "score": "0.7683078", "text": "def solved?\n return @squares.size == 13\n end", "title": "" }, { "docid": "21c1f5a74321c72b95f2e8d6c2ff08e2", "score": "0.76772785", "text": "def solved?\n # A Sudoku puzzle is finished when all cells have been filled with a number\n # between 1 and 9 and none of the constraints are in conflict.\n\n # First, make sure all the cells are filled.\n @board.each do |row|\n row.each do |cell|\n unless POSSIBLE_VALUES.include? cell.value\n return false\n end\n end\n end\n\n # Next, make sure none of the constraints are in conflict.\n if not consistent?\n return false\n end\n\n return true\n end", "title": "" }, { "docid": "19a422f41da51a04d2e7fb1243957675", "score": "0.76056665", "text": "def solved?\n self.each_cell do |_,_,cell|\n return false if cell == :_\n end\n return true\n end", "title": "" }, { "docid": "279b52d488500505c0648f7e964d0dbe", "score": "0.7570299", "text": "def solved? \n @grid.each_with_index do |subArr, row|\n subArr.each_with_index do |ele, column|\n if @grid[row][column] == \"0\"\n return false\n end \n end \n end \n return true\n end", "title": "" }, { "docid": "3f31dca5a9897f1dd1f5c19315955962", "score": "0.75380373", "text": "def isSolved()\n\t\[email protected] do |index|\n\t\t\tif(index.value == 0)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend", "title": "" }, { "docid": "cfddaebe50241f87b19538073d96f403", "score": "0.75078046", "text": "def solved?\n [email protected]? && @grid.missing.zero?\n end", "title": "" }, { "docid": "efa2bb89195672d2d5db323f1441de24", "score": "0.742038", "text": "def validated?() determine_cells.count == determine_cells.map(&:number).uniq.count end", "title": "" }, { "docid": "373e142c66b1efdf1eb2148871e3be3a", "score": "0.74195516", "text": "def solved?\n # trivially reject us if we're invalid.\n return false unless self.valid?\n\n # every row must contain (1..9)\n @board.each do |row|\n return false unless row.sort == [1,2,3,4,5,6,7,8,9]\n end\n # every col must contain (1..9)\n @board.transpose.each do |col|\n return false unless col.sort == [1,2,3,4,5,6,7,8,9]\n end\n # every block must containt (1..9)\n 3.times do |by|\n 3.times do |bx|\n block = []\n 3.times do |y|\n 3.times do |x|\n block.push @board[by*3+y][bx*3+x]\n end\n end\n return false unless block.sort == [1,2,3,4,5,6,7,8,9]\n end\n end\n end", "title": "" }, { "docid": "26721efa4c07d62613c4708b0ecd4af1", "score": "0.7396195", "text": "def solved?\n all_rows_solved?(@public_board) && \n all_cols_solved?(@public_board) && \n all_three_by_three_grids_solved?(@public_board)\n end", "title": "" }, { "docid": "54b682cc73c694af9617aa83e0b8f122", "score": "0.7392134", "text": "def solved?(board)\n \n 9.times do |row_id|\n return false if check_row?(board, row_id) == false\n end\n\n 9.times do |column_id|\n return false if check_column?(board, column_id) == false\n end\n\n 9.times do |box_id|\n return false if check_box?(board, box_id) == false\n end\n \n return true \nend", "title": "" }, { "docid": "d83227c1964480876fc1982e2c69fbae", "score": "0.73855853", "text": "def check_solution\n violations = 0\n @board.each_with_index do |row, row_index|\n row.each_with_index do |n, column_index|\n violations += check_violations([row_index, column_index]) if @board[row_index][column_index] == 1\n end\n end\n violations == 0 ? true : false\n end", "title": "" }, { "docid": "3749fb4b09edce21d542f43bf0bcd28b", "score": "0.73678815", "text": "def solved\n \tempty, row, col = still_empty?(@board_arr)\n \tif (!empty)\n \t\treturn true\n \tend\n \tfor num in 1..9\n \t\tif(is_valid_slot?(@board_arr, row, col, num.to_s))\n \t\t\t@board_arr[row][col] = num.to_s\n \t\t\tif solved\n \t\t\t\treturn true\n \t\t\telse\n \t\t\t\t@board_arr[row][col]='0'\n \t\t\tend\n \t\tend\n \tend\n \treturn false\n end", "title": "" }, { "docid": "56e67cb9aa74327101dd90ede3f87b2a", "score": "0.73577774", "text": "def squares_solved?\n nums_arr = (1..9).to_a\n new_grid = @grid.map { |row| row.each_slice(3).to_a }\n squares = new_grid.transpose\n squares = squares.flatten.each_slice(9).to_a\n squares.all? do |square|\n square.map(&:value).sort == nums_arr \n end \n # p new_grid \n end", "title": "" }, { "docid": "3c726f85ef5544d36d1e4e82c83db695", "score": "0.73529905", "text": "def solved?\n ! @board.include?(0.to_s)\n end", "title": "" }, { "docid": "9221ee088c738f90dae7065f049d2030", "score": "0.73294955", "text": "def solved?(board)\n # This will be true if all the elements in the board array are integers. This means that in our possibility array, if we flatten it, it should be completely empty.\nend", "title": "" }, { "docid": "7aabc47bc38f1646a23b739ec42a4811", "score": "0.73111236", "text": "def solved?\n units_fine(BOX_INDEXES) &&\n units_fine(COL_INDEXES) &&\n units_fine(ROW_INDEXES)\n end", "title": "" }, { "docid": "83d558ae9c6fd97be127e0574cc5d967", "score": "0.72955704", "text": "def solved?\n # You will want to know if each row, column, and\n # 3x3 square has been solved.\n # solved_rows? && solved_columns? && solved_squares?\n unless solved_rows?\n puts \"not solved rows\"\n return false\n end\n\n unless solved_columns?\n puts \"not solved columns\"\n return false\n end\n\n unless solved_squares?(0, 2) && solved_squares?(3, 5) && solved_squares?(6, 8)\n puts \"not solved some square\"\n return false\n end\n\n true\n end", "title": "" }, { "docid": "cf29e0a8e0355d91e1e4bdc667940bd6", "score": "0.7292291", "text": "def valid_puzzle?\n valid = true\n # check rows for duplicates\n @puzzle.each do |row|\n te = row.reject {|num| num == 0} # remove zeroes\n valid = false if te.uniq.size != te.size # not valid if there are dupes\n end\n\n # check columns for duplicates\n 9.times do |i| # for columns 0 thru 8\n col = [] # column\n @puzzle.each {|row| col << row[i]} # fill column\n col.reject! {|num| num == 0} # remove zeroes\n valid = false if col.uniq.size != col.size # check dupes\n end\n\n # check boxes for duplicates\n puz = []\n puz << @puzzle[0][0, 3] + @puzzle[1][0, 3] + @puzzle[2][0, 3]\n puz << @puzzle[0][3, 3] + @puzzle[1][3, 3] + @puzzle[2][3, 3]\n puz << @puzzle[0][6, 3] + @puzzle[1][6, 3] + @puzzle[2][6, 3]\n puz << @puzzle[3][0, 3] + @puzzle[4][0, 3] + @puzzle[5][0, 3]\n puz << @puzzle[3][3, 3] + @puzzle[4][3, 3] + @puzzle[5][3, 3]\n puz << @puzzle[3][6, 3] + @puzzle[4][6, 3] + @puzzle[5][6, 3]\n puz << @puzzle[6][0, 3] + @puzzle[7][0, 3] + @puzzle[8][0, 3]\n puz << @puzzle[6][3, 3] + @puzzle[7][3, 3] + @puzzle[8][3, 3]\n puz << @puzzle[6][6, 3] + @puzzle[7][6, 3] + @puzzle[8][6, 3]\n\n puz.each do |box| # for all boxes\n box.reject! {|num| num == 0} # remove zeroes\n valid = false if box.uniq.size != box.size # check dupes\n end\n\n # nums = row_nums(empty) & col_nums(empty) & reg_nums(empty)\n\n return valid\n end", "title": "" }, { "docid": "b6a533d319134b11c3c7cef4c9b80a0c", "score": "0.7287453", "text": "def solve\n\n # If the puzzle is solved, we're done.\n if solved?\n return true\n end\n\n # If not, select the next empty cell.\n unknown = unsolvedCells.first\n\n # If it has no possible values, the puzzle is inconsistent. \n if unknown.possibleValues.empty?\n # We made a mistake and have to backtrack.\n return false\n end\n\n # Try every possible value.\n unknown.possibleValues.shuffle.each do |value|\n unknown.value = value\n if solve() == true\n return true\n else\n unknown.value = 0\n end\n end\n\n # If none of the possible values worked, we made a mistake even further back\n # and have to backtrack more.\n return false\n end", "title": "" }, { "docid": "e849f7670add2d5448464f86bac4d964", "score": "0.7274366", "text": "def solved_set?(tiles)\r\n nums = []\r\n tiles.each do |tile|\r\n nums << tile.value.to_i\r\n end\r\n\r\n nums.sort == (1..9).to_a\r\n end", "title": "" }, { "docid": "6374b015bb751fa7d1a6728223f2c39d", "score": "0.7243486", "text": "def solved?(board)\n board.all? { |row| row.flatten.length == 9 }\nend", "title": "" }, { "docid": "28f0d14a994f9dc198e6bca6883f4349", "score": "0.7190227", "text": "def check_puzzle\n 9.times do |index|\n return false unless Sudoku.check_row @puzzle[index] \n \n mat_arr = []\n 9.times do |mat_ind|\n row = 3 * (index / 3) + mat_ind / 3\n col = 3 * (index % 3) + mat_ind % 3\n mat_arr << @puzzle[row][col] \n end\n \n return false unless Sudoku.check_row mat_arr\n return false unless Sudoku.check_col @puzzle, index\n end\n p @puzzle\n true\n end", "title": "" }, { "docid": "58a668dcdb75f2969bced219b6fef98c", "score": "0.7183904", "text": "def solved?\n solved_rows? && solved_cols? && solved_squares?\n end", "title": "" }, { "docid": "7a43f4d9d863d1eab5771d3da18d2930", "score": "0.71802497", "text": "def solve_one_easy_cell\n each do |cell|\n an = cell.available_numbers\n if an.size == 1\n #puts \"Put #{an.to_a.first} at (#{cell})\" if @verbose\n cell.number = an.to_a.first\n return true\n end\n end\n return false\n end", "title": "" }, { "docid": "45be18bf6cda6c0f573f37399deae3af", "score": "0.713614", "text": "def solve_one_easy_cell\n\t\teach do |cell|\n\t\t\tan = cell.available_numbers\n\t\t\tif an.size == 1\n\t\t\t\t#puts \"Put #{an.to_a.first} at (#{cell})\" if @verbose\n\t\t\t\tcell.number = an.to_a.first\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "title": "" }, { "docid": "c360bbae00d3ad08735e48d0db904d44", "score": "0.71336967", "text": "def solution?\n for i in [email protected]\n for j in 0..@board[i].size-1\n if @board[i][j]==0\n return false\n end\n end\n end\n return true\n end", "title": "" }, { "docid": "ce287fbeb16a417a6465b006d96e7356", "score": "0.712844", "text": "def solved?\n return false if check_rows? == false\n return false if check_columns? == false\n return false if check_grids? == false\n return true\n end", "title": "" }, { "docid": "68eb91701d4887b104e08350c689a37a", "score": "0.71233034", "text": "def solved?(board)\n\t\tif board.include?('0')\n\t \treturn false\n\t else\n\t \treturn true\n\t end\n\tend", "title": "" }, { "docid": "816057cddd7aa89689656c57141e4eb4", "score": "0.71069413", "text": "def all_cells_cleared?\n cell_count = 0\n (0..@row_count).each do |row|\n (0..@col_count).each do |column|\n if cell_cleared?(row, column) || contains_bomb?(row, column)\n cell_count += 1\n end\n end\n end \n (row_count * col_count) == cell_count\n end", "title": "" }, { "docid": "3e05d6e6aee727ac7d69af91d500f965", "score": "0.71049595", "text": "def incorrect_cells_seen?\n # TODO: Move this into the hint responsibility\n hints.any? do |hint|\n next unless hint.value\n highest_cell = 0\n cells_seen = 0\n cells_with_values = 0\n cells_in_lane_of(hint).each do |cell|\n cells_with_values += 1 if cell.value\n if cell.value.to_i > highest_cell\n cells_seen += 1\n highest_cell = cell.value\n end\n end\n (cells_with_values < power && cells_seen > hint.value) ||\n (cells_with_values == power && cells_seen != hint.value)\n end\n end", "title": "" }, { "docid": "0e8e8f80df95c760ee175e290793c372", "score": "0.7097407", "text": "def completed?\n return true if all_cells_used?\n\n !winner.nil?\n end", "title": "" }, { "docid": "9ca6a1045545f227728b6d2ddff116ea", "score": "0.70814234", "text": "def solved?(board)\n partial = false\n return true if board.all? { |row| row.join.chars.sort.join == \"123456789\" } &&\n board.transpose.all? { |col| col.join.chars.sort.join == \"123456789\" } &&\n make_squares_transpose(board).all? { |sq| sq.join.chars.sort.join == \"123456789\" }\n partial\nend", "title": "" }, { "docid": "7cf931f202b1aea2ede62feff7bb8e31", "score": "0.70734465", "text": "def game_won?\n if uniq_rows() && uniq_cols() && uniq_sq()\n puts \"Sudoku Puzzle Solved!\"\n return true\n end\n return false\n end", "title": "" }, { "docid": "d35d4c2793d4697187761e2208dcccbf", "score": "0.7070735", "text": "def valid_grid?(row_range, column_range, board)\n numbers = Array.new(9, 0)\n\n row_range.each do |r|\n column_range.each do |c|\n numbers[board[r][c]] += 1\n\n next if board[r][c] == 0\n return false if numbers[board[r][c]] > 1\n end\n end\n\n true\nend", "title": "" }, { "docid": "a84ddabf7caeaf779ac47222c80d8e39", "score": "0.70467037", "text": "def solved?(board)\n row_solve?(board) && column_solve?(board)\nend", "title": "" }, { "docid": "5665c36870b99f6ea8509624f928aadd", "score": "0.70457804", "text": "def solution?\n\t\t# complete assigns are those that have >= min row/col assignment, <= max row/col assignment\n\t\t# is that it???\n\n\t\t# so that you don't have to repeatedly call these methods within the select scripts below\n\t\tmin_row_assignment = self.min_row_assignment\n\t\tmax_row_assignment = self.max_row_assignment\n\t\tmin_col_assignment = self.min_col_assignment\n\t\tmax_col_assignment = self.max_col_assignment\n\n\t\treturn self.select {|row| \n\t\t\trow.count(\"!\") < min_row_assignment || row.count(\"!\") > max_row_assignment\n\t\t}.empty? && self.transpose.select {|col|\n\t\t\tcol.count(\"!\") < min_col_assignment || col.count(\"!\") > max_col_assignment\n\t\t}.empty?\n\tend", "title": "" }, { "docid": "5665c36870b99f6ea8509624f928aadd", "score": "0.70457804", "text": "def solution?\n\t\t# complete assigns are those that have >= min row/col assignment, <= max row/col assignment\n\t\t# is that it???\n\n\t\t# so that you don't have to repeatedly call these methods within the select scripts below\n\t\tmin_row_assignment = self.min_row_assignment\n\t\tmax_row_assignment = self.max_row_assignment\n\t\tmin_col_assignment = self.min_col_assignment\n\t\tmax_col_assignment = self.max_col_assignment\n\n\t\treturn self.select {|row| \n\t\t\trow.count(\"!\") < min_row_assignment || row.count(\"!\") > max_row_assignment\n\t\t}.empty? && self.transpose.select {|col|\n\t\t\tcol.count(\"!\") < min_col_assignment || col.count(\"!\") > max_col_assignment\n\t\t}.empty?\n\tend", "title": "" }, { "docid": "5665c36870b99f6ea8509624f928aadd", "score": "0.70457804", "text": "def solution?\n\t\t# complete assigns are those that have >= min row/col assignment, <= max row/col assignment\n\t\t# is that it???\n\n\t\t# so that you don't have to repeatedly call these methods within the select scripts below\n\t\tmin_row_assignment = self.min_row_assignment\n\t\tmax_row_assignment = self.max_row_assignment\n\t\tmin_col_assignment = self.min_col_assignment\n\t\tmax_col_assignment = self.max_col_assignment\n\n\t\treturn self.select {|row| \n\t\t\trow.count(\"!\") < min_row_assignment || row.count(\"!\") > max_row_assignment\n\t\t}.empty? && self.transpose.select {|col|\n\t\t\tcol.count(\"!\") < min_col_assignment || col.count(\"!\") > max_col_assignment\n\t\t}.empty?\n\tend", "title": "" }, { "docid": "ae1f56158e682b14a3a5992378f0c43d", "score": "0.69962066", "text": "def solved?(board)\nend", "title": "" }, { "docid": "ae1f56158e682b14a3a5992378f0c43d", "score": "0.69962066", "text": "def solved?(board)\nend", "title": "" }, { "docid": "ae1f56158e682b14a3a5992378f0c43d", "score": "0.69962066", "text": "def solved?(board)\nend", "title": "" }, { "docid": "7d0959a1c91f24c8063f31c55cdf4ce3", "score": "0.6981952", "text": "def unsolvable?\n 9.times do |y|\n 9.times do |x|\n next unless @board[y][x].zero?\n return true if self.possible_values(x,y).nil?\n end\n end \n false\n end", "title": "" }, { "docid": "388f383df2c41ed0ac3243fb3a9c00c6", "score": "0.6953764", "text": "def solved?\t\t\n b = true\n @problem.myH.each do |x|\n b = b && x.guessed?\n if !b\n return b\n end\n end\n return b\n end", "title": "" }, { "docid": "10c1e05ceda9578a9b4e4c2f1c33eec6", "score": "0.6953307", "text": "def solved?(board)\n return true if solve(board)\n false\nend", "title": "" }, { "docid": "13a54b1d1d65a4d42f520ff39dbf6e13", "score": "0.6946057", "text": "def find_possible\n @sudoku.unsolved.each do |current|\n row = current.location/9\n column = current.location%9\n check = @sudoku.values_for_location(row, column)\n if check_array(check, current)\n return true\n end\n end\n end", "title": "" }, { "docid": "0e4cdaf8115fea4f6767ce17f2cd2326", "score": "0.6940366", "text": "def solution?\n board = Board.new(@arr)\n @arr.all? && board.valid?\n end", "title": "" }, { "docid": "a8eea3388b224215171c9a1b698e739d", "score": "0.69345725", "text": "def solved?\n solved = true\n 0.upto(@side-1) do |x|\n 0.upto(@side-1) do |y|\n 0.upto(@side-1) do |z|\n solved &&= points[x][y][z] || occupied.include?([x,y,z]) || goal == [x,y,z]\n end\n end\n end\n solved\n end", "title": "" }, { "docid": "354209ae0d562cf0cfe8aa7451f35d21", "score": "0.6930039", "text": "def all_cells_cleared?\n x_cordinates = (0...row_count)\n y_cordinates = (0...column_count)\n success = row_count * column_count - mine_count\n counter = 0\n x_cordinates.each do |x|\n y_cordinates.each do |y|\n if game_board[x][y] == 'x' && visible_board[x][y] == 'S'\n counter += 1\n if counter == success\n return true\n end\n end\n end\n end\n false\n end", "title": "" }, { "docid": "e7df3241e223f4461d01a34d2bc6c15f", "score": "0.69299185", "text": "def solved?\n return false unless @board[-1][-1] == 0\n @board == goal_state\n end", "title": "" }, { "docid": "652cbea8828eee698a9ac53eb9743302", "score": "0.692665", "text": "def checkDone\n d = true\n @board.each do |hash|\n d=false if hash.has_value?(0)\n end\n d\n end", "title": "" }, { "docid": "1ee5323188e1c46f2f8780ded9077826", "score": "0.6920699", "text": "def checkCells\n (@cellsToCheck & occupiedCells).length > 0 \n end", "title": "" }, { "docid": "600ab248655d33d37d3a283a702cd229", "score": "0.69073856", "text": "def puzzle_not_solvable?\n inverse_count = 0\n i = 0\n numbers = @squares.map(&:number)\n while i < numbers.length - 2\n inverse_count += 1 if numbers[i] > numbers[i + 1]\n i += 1\n end\n return true if inverse_count.odd?\n false\n end", "title": "" }, { "docid": "cf887a51c05d91808e0764d81ea0c9d6", "score": "0.68784493", "text": "def possible_locations\n success = false\n sets = [:row,:column,:square]\n nums = (1..9).to_a\n sets.each do |set|\n nums.each do |num|\n cells = get_cells set, num\n solved_values = get_values cells\n unsolved_values = nums - solved_values\n # check if any values only have one possible cell\n unsolved_values.each do |val|\n possible_cells = cells.select {|cell| val.in? cell.possibilities}\n if possible_cells.length == 1\n possible_cells[0].possibilities = [val]\n success = true\n end\n end\n end\n end\n success\n end", "title": "" }, { "docid": "cc72f6297ec000caf7dd26e11653cf04", "score": "0.6875064", "text": "def validSolution(board)\n m = 9\n board.all? { |x| x.uniq.length == m } &&\n board.transpose.all? { |y| y.uniq.length == m } &&\n sub_grid(board).all? { |s| s.uniq.length == m }\nend", "title": "" }, { "docid": "735b1ca894dee17fbec5481f912bb61a", "score": "0.6850602", "text": "def is_complete?\n for x in 0...9\n for y in 0...9\n if @board[x][y]==0\n return false\n end\n end\n end\n true\n end", "title": "" }, { "docid": "7bbbda79231bef4fbdcb41ef0e4e3e7b", "score": "0.6835842", "text": "def filled?\n each_cell do |column, row|\n return false if is_value_unassigned? at(column, row)\n end\n\n # If there are no more 0 numbers, return #true.\n true\n end", "title": "" }, { "docid": "1b54c2ec68126ceedfb944d48e723fbc", "score": "0.68272144", "text": "def occupied?\n @number_of_soldiers > 0\n end", "title": "" }, { "docid": "1bd1a796e5749fbc5a74c4af77e1b519", "score": "0.6819739", "text": "def scan_board\n find_empty_cells.each { |coord| return true if calculate_cell([coord.first, coord.last]) }\n false\n end", "title": "" }, { "docid": "eb8b8bfe6287ed25ffe0d0af3659f610", "score": "0.680792", "text": "def is_solved\n self.state.count(0) == 1\n end", "title": "" }, { "docid": "30805842beb9ca31d72ba8c4ac2e0575", "score": "0.6794107", "text": "def rows_solved?(matrix)\n matrix.each do |row|\n return false unless row_solved?(row)\n end\n\n true\nend", "title": "" }, { "docid": "f04ddbf919f612bb7f6a4a398b4fb561", "score": "0.67923284", "text": "def solved?\n\t\tcolSolved = (0...@nCol).all? {|i|\n\t\t\tgetSolverCol(i).solved?\n\t\t}\n\n\t\trowSolved = (0...@nRow).all? {|i|\n\t\t\trowSolved?(i)\n\t\t}\n\n\t\treturn colSolved && rowSolved\n\tend", "title": "" }, { "docid": "4f04b6b2fb32141b790a0cc6951481a5", "score": "0.67856294", "text": "def any_left_through_iteration?\n @board.each do |cell_obj|\n return false unless cell_obj.possibles.length == 1\n end\n end", "title": "" }, { "docid": "c5cbe3db6ffb83ac7f46abbbb63a0ff9", "score": "0.6785057", "text": "def check(puzzle)\n\treturn false if puzzle.flatten.include?(0)\n\treturn true\nend", "title": "" }, { "docid": "79724f99c35c440aa9d50279db77cb20", "score": "0.67821825", "text": "def unsolvable?\n @cells.any? { |cell| cell.empty? && cell.available_values.size == 0 }\n end", "title": "" }, { "docid": "715edfddffce007a800051abd5a768ee", "score": "0.67814857", "text": "def solved?\n # We're assuming no invalid boards, but that makes this easier.\n # If you make an invalid board then that's ALL YOUR FAULT and I don't care\n # if this is wrong. :)\n @diamonds_foundation.size == 13 && @spades_foundation.size == 13 &&\n @hearts_foundation.size == 13 && @clubs_foundation.size == 13\n end", "title": "" }, { "docid": "0fa68af50eddc4a8f0ffcdcda3b964dc", "score": "0.67720187", "text": "def all_cells_cleared?\n win_count = @row_count * @column_count - @mine_count\n count_clicked = 0\n (1..@row_count).each do |x|\n (1..@column_count).each do |y|\n count_clicked += 1 if @clicked[x][y] && !@is_mine[x][y]\n end\n end\n return count_clicked == win_count\n end", "title": "" }, { "docid": "b3e70704a438563c0c93f63910ab08af", "score": "0.6770443", "text": "def solved?(board_array)\n\treturn valid?(board_array) && valid?(board_array.transpose)\nend", "title": "" }, { "docid": "cd785deb782d8ff440ecfd886190fc26", "score": "0.67129683", "text": "def all_cells_cleared?\n @full_board = @clicked + @mines\n full_board.size == (@row_count+1) * (@column_count+1)\n end", "title": "" }, { "docid": "44a24cd53e4c3b59d1a15888691a55a4", "score": "0.6706815", "text": "def solved?(board)\n true_array = []\n board.each do |row|\n true_array << row.sort.join.include?(\"123456789\")\n end\n\n board.transpose.each do |row|\n true_array << row.sort.join.include?(\"123456789\")\n end\n boxes = [\n [[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0], [2,1], [2,2]],\n [[0,3], [0,4], [0,5], [1,3], [1,4], [1,5], [2,3], [2,4], [2,5]],\n [[0,6], [0,7], [0,8], [1,6], [1,7], [1,8], [2,6], [2,7], [2,8]],\n [[3,0], [3,1], [3,2], [4,0], [4,1], [4,2], [5,0], [5,1], [5,2]],\n [[3,3], [3,4], [3,5], [4,3], [4,4], [4,5], [5,3], [5,4], [5,5]],\n [[3,6], [3,7], [3,8], [4,6], [4,7], [4,8], [5,6], [5,7], [5,8]],\n [[6,0], [6,1], [6,2], [7,0], [7,1], [7,2], [8,0], [8,1], [8,2]],\n [[6,3], [6,4], [6,5], [7,3], [7,4], [7,5], [8,3], [8,4], [8,5]],\n [[6,6], [6,7], [6,8], [7,6], [7,7], [7,8], [8,6], [8,7], [8,8]]]\n boxes.each do |row_locations|\n box_array = []\n row_locations.each do |location|\n box_array << board[location[0]][location[1]]\n end\n true_array << box_array.sort.join.include?(\"123456789\")\n end\n\n return true if !true_array.include?(false)\n\n\n end", "title": "" }, { "docid": "81e387eca771d0b63d656d74498ccdf0", "score": "0.67065156", "text": "def all_cells_cleared?\n total_cells = row_count * column_count\n cells_cleared = 0\n field.each_with_index do |row,r_i|\n row.each_with_index do |col,c_i|\n if field[r_i][c_i] != MINE\n if (field[r_i][c_i] < 0)\n cells_cleared += 1\n end\n end\n end\n end\n cells_cleared + 38 == total_cells ? (return true) : (return false)\n end", "title": "" }, { "docid": "0df526d305daa69abefa2fad0714e28c", "score": "0.66967547", "text": "def solved?\n @light_state.count(true) == 0\n end", "title": "" }, { "docid": "2f9b985df482b8b1bf88ff583738a1af", "score": "0.6690681", "text": "def has_cells?\n not @cells.empty?\n end", "title": "" }, { "docid": "73b5aa7023cc93b9d7b92dbe24703e03", "score": "0.6685982", "text": "def puzzle_is_valid(puzzle)\n puzzle.length == 81\nend", "title": "" }, { "docid": "2c2e8febd9d04f8bb63b7d6a964f770c", "score": "0.6685252", "text": "def solve\n coords = find_empty\n x, y = coords\n\n return board unless coords\n\n numbers.each do |number|\n if is_valid?(number: number, x: x, y: x)\n board[y][x] = number\n\n if solve\n return board\n end\n\n board[y][x] = 0\n end\n end\n\n false\n end", "title": "" }, { "docid": "cae38889451c6e664c362a25851a17f0", "score": "0.6681004", "text": "def solved?(solution)\n solution.compact.count == solution.count\n end", "title": "" }, { "docid": "36733ef14fbfbfa20b4853cb17c4e9e4", "score": "0.66796315", "text": "def solver?(cell)\n\t\n\t\t# Go thru each possible candidate value, evaluating if the selected candidate is\n\t\t# possible for the cell and if the resulting branch solves\n\t\tcell.candidates.each do |candidate|\n\t\t\tcell.try_value = candidate\n\t\t\t@message = \"Testing cell ##{cell.index} with #{candidate}\\n#{cell.candidates} available\"\n\t\t\tself.to_s\n\t\t\t\n\t\t\t# If the current cell is last in the @cells array, check only the validity of the candidate.\n\t\t\tif cell != @cells.last \n\t\t\t\tif candidate_is_valid?(cell) and solver?(next_cell(cell))\n\t\t\t\t\n\t\t\t\t\t# This cell has been solved - set value and return true back up the state space\n\t\t\t\t\t#cell.set_value = candidate\n\t\t\t\t\treturn true\n\t\t\t\t\t\n\t\t\t\telse\t\n\t\t\t\t\t\n\t\t\t\t\t# The cell has not been solved, restore it to nil (it must not affect other decisions)\n\t\t\t\t\tcell.try_value = nil\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif candidate_is_valid?(cell)\n\t\t\t\t\t# This is the base case where there are no other cells to check, so we can send true\n\t\t\t\t\t# back up the recursion levels \n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# If all candidates have been evaluated without success, this branch has failed; need to backtrack\n\t\treturn false\n\t\t\t\n\tend", "title": "" }, { "docid": "123602de0ced59814f1b274f23529bd7", "score": "0.66790426", "text": "def solved?\n return true unless board_string.include?(\"0\")\n end", "title": "" }, { "docid": "b0e1981e26fc38af9232dff8dc1348ff", "score": "0.6660398", "text": "def finished?\n !self.board.all? { |row| row.include?(0) }\n end", "title": "" }, { "docid": "59574fb7fb0d32d615716d1556a35a8f", "score": "0.6637182", "text": "def valid_sudoku?(board)\n\n numbers = Array.new(10, 0)\n\n #Rows\n (0..8).each do |r|\n (0..8).each do |c|\n numbers[board[r][c]] += 1\n\n next if (board[r][c]) == 0\n return false if numbers[board[r][c]] > (r + 1)\n end\n end\n\n numbers = Array.new(9, 0)\n\n #Columns\n (0..8).each do |c|\n (0..8).each do |r|\n numbers[board[r][c]] += 1\n\n next if board[r][c]== 0\n return false if numbers[board[r][c]] > (c + 1)\n end\n end\n\n #Grids\n (0..2).each do |r|\n (0..2).each do |c|\n row_range = (r * 3)..((r + 1) * 3) - 1\n column_range = (c * 3)..((c + 1) * 3) - 1\n\n return false !valid_grid( row_range, column_range, board)\n end\n end\n\n true\nend", "title": "" }, { "docid": "40b5133fb676283fefdf8371e247bd4e", "score": "0.6637083", "text": "def filled_out?\n @value == 0 ? false : true\n # it may be convenient (depending on your design) to use\n # 0 as the \"unsolved\" value for the cell. This way\n # you won't have to differentiate between numbers and nil\n # values when you calculate neighbours.\n end", "title": "" }, { "docid": "87edf288de730bb2414e7c277f71fbc7", "score": "0.6633189", "text": "def all_cells_cleared?\n @board.flatten.all? { |cell| !cell.contains_mine? && cell.revealed? }\n end", "title": "" }, { "docid": "90c1b05589ce50e8da5f430858e4084b", "score": "0.66278577", "text": "def all_cells_cleared?\n @cleared_cell_count == ((@row_count * @column_count) - @mine_count) && @mines_revealed == false\n end", "title": "" }, { "docid": "f61a811d749ba95691a7d652382bd7a9", "score": "0.6625795", "text": "def all_rows_solved?(board)\n match = [1,2,3,4,5,6,7,8,9]\n\n board.all? do |row|\n current_row = row.map {|tile| tile.value}\n current_row.sort == match\n end\n end", "title": "" }, { "docid": "4013d589b3b46fc4a153956d131165fd", "score": "0.661461", "text": "def won?\n @board.grid.each do |row|\n row.each { |tile| return false unless tile.revealed? || tile.has_mine? }\n end\n true\n end", "title": "" }, { "docid": "2a02546796689af2c52e10525a3dd41d", "score": "0.6612009", "text": "def all_cells_cleared?\n (0..(row_count - 1)).each do |row|\n (0..(column_count - 1)).each do |column|\n cell = { row: row, column: column }\n return false unless @mines.include?(cell) || @cleared.include?(cell)\n end\n end\n true\n end", "title": "" }, { "docid": "3606689930913b46db514c512b870dca", "score": "0.66092813", "text": "def game_won? \n @board.count_mines == @board.count_unrevealed_cells\n end", "title": "" }, { "docid": "97ee5347ac0a278c7159e1ef57b91eb4", "score": "0.65860486", "text": "def valid_grid?\n each do |x, y, val|\n next if val.zero?\n return false unless valid_cell? x, y, val\n end\n \n true\n end", "title": "" }, { "docid": "2911cce842f42f228bebaad2527d7fc3", "score": "0.6577474", "text": "def solve_easy_cells\n\t\twhile solve_one_easy_cell\n\t\tend\n\tend", "title": "" }, { "docid": "a816d28cdc116a0ad4a23ae0d786e534", "score": "0.6572901", "text": "def solve\r\n 9.times do |i|\r\n 9.times do |j|\r\n if board[[i,j]] == \"0\"\r\n (1..9).each do |k|\r\n if board.isValid(i, j, k)\r\n board[[i, j]].to(k.to_s)\r\n if solve\r\n return true\r\n end\r\n board[[i, j]] = \"0\"\r\n end\r\n end\r\n return false\r\n end\r\n end\r\n end\r\n return true\r\n end", "title": "" }, { "docid": "82f63a75df2b7362baf9394c21c301ee", "score": "0.65676403", "text": "def column_is_occupied\n column = @board.map {|row| row[column_index]}\n return true if column.compact.count > 0 \nend", "title": "" }, { "docid": "ba8d38408a5550cee11f4e0c2f8ed0a5", "score": "0.6562616", "text": "def all_cells_cleared?\n total_open_cells = @column_count * @row_count - @mine_count\n @clear_locations.length == total_open_cells\n end", "title": "" } ]
f2bf1debe62fc71b48204912cc31c514
gets the storage related information
[ { "docid": "b8fb655345710d972adde3bc2b363294", "score": "0.6761097", "text": "def print_storage_info()\n # cloning the database configuration\n storage_info = @db_config.clone()\n\n # hiding database password\n storage_info['password'] = 'PRIVATE'\n\n # printing information\n storage_info.each{ |key| puts(\"#{key}#{storage_info[key] }\") }\n end", "title": "" } ]
[ { "docid": "e56ff13f1e45cd4082883f230d0b086a", "score": "0.74746174", "text": "def storage() @storage; end", "title": "" }, { "docid": "47fbbd7e6c813e9bdcde429c155219e1", "score": "0.7402731", "text": "def storage\n Boom.storage\n end", "title": "" }, { "docid": "ee443494288391cc4577fd1a94f146ea", "score": "0.7384662", "text": "def current_storage\n @attributes[:current_storage]\n end", "title": "" }, { "docid": "62104a1b6a0fd672c9321abea4a6a7d3", "score": "0.7360844", "text": "def storage_names\n @storage_names\n end", "title": "" }, { "docid": "13470775dee5482b723f14ebbf026374", "score": "0.7315028", "text": "def storages\n IbmCloudRest.get \"#{@uri}/storage\"\n end", "title": "" }, { "docid": "43e0369949caabb596f450bdc1932e37", "score": "0.72765493", "text": "def storage\n uploader.storage\n end", "title": "" }, { "docid": "de764c44f46756b358dbd8475dc51de0", "score": "0.7259093", "text": "def storage; end", "title": "" }, { "docid": "fa1861edc20bbb089bdff52cddc1cc9a", "score": "0.7251071", "text": "def storages(type: nil)\n response = get(type && \"storage/#{type}\" || \"storage\")\n data = JSON.parse response.body\n data[\"storages\"][\"storage\"]\n end", "title": "" }, { "docid": "262f7b5ee9bdb5fc054204f75b20b06f", "score": "0.7222187", "text": "def storage_instance; end", "title": "" }, { "docid": "652a16fdf95b37d8abaeb6d08a60bbe0", "score": "0.7220836", "text": "def storage_options; end", "title": "" }, { "docid": "da53d9f3d36ef571de436256cb048edf", "score": "0.70771396", "text": "def print_storage_info()\n # empty --> this is like an abstract class method\n end", "title": "" }, { "docid": "03ef96f1d5f7f2d42bf51300ad439379", "score": "0.7043586", "text": "def storage_type\n data[:storage_type]\n end", "title": "" }, { "docid": "03ef96f1d5f7f2d42bf51300ad439379", "score": "0.7043586", "text": "def storage_type\n data[:storage_type]\n end", "title": "" }, { "docid": "bfeed1203049065eb8ecc415fd862381", "score": "0.7040213", "text": "def show_storage\n\t\t\treturn @player_data_db.execute( \"select * from storage\" )\n\t\tend", "title": "" }, { "docid": "d35f0987eeec20771491ea7ca5af53d4", "score": "0.70378643", "text": "def storage\n @storage ||= in_memory\n end", "title": "" }, { "docid": "d35f0987eeec20771491ea7ca5af53d4", "score": "0.70378643", "text": "def storage\n @storage ||= in_memory\n end", "title": "" }, { "docid": "acaecea902877b9d0205cf7f02c31a60", "score": "0.703134", "text": "def storage\n @storage ||= Fog::Storage.new(storage_config)\n end", "title": "" }, { "docid": "14eba4dd5d69244e861907b373b4880d", "score": "0.6998357", "text": "def storage_attributes\n JSON.parse self.storage.to_json\n end", "title": "" }, { "docid": "8ed5a87a4fa38d1236bb7d906f754955", "score": "0.69851726", "text": "def storage\n @storage ||= in_memory\n end", "title": "" }, { "docid": "8ed5a87a4fa38d1236bb7d906f754955", "score": "0.69851726", "text": "def storage\n @storage ||= in_memory\n end", "title": "" }, { "docid": "8ed5a87a4fa38d1236bb7d906f754955", "score": "0.69851726", "text": "def storage\n @storage ||= in_memory\n end", "title": "" }, { "docid": "ad293233a61de67852ee1d4b4f47249a", "score": "0.69448304", "text": "def storage\n ManagedImage.variants_storage\n end", "title": "" }, { "docid": "95a9628cc0539bb99071fc1f11879d0f", "score": "0.6898937", "text": "def storage_location\n return @storage_location\n end", "title": "" }, { "docid": "d194f12b2c4b4332e4a88e38f2f466e7", "score": "0.68781227", "text": "def allocated_storage\n data[:allocated_storage]\n end", "title": "" }, { "docid": "d194f12b2c4b4332e4a88e38f2f466e7", "score": "0.68781227", "text": "def allocated_storage\n data[:allocated_storage]\n end", "title": "" }, { "docid": "acc3b7c6f095784ebc7a91fffd1de245", "score": "0.68326485", "text": "def storage\n @_storage ||= in_memory\n end", "title": "" }, { "docid": "049a70617c6b9c49aaf90a777b84c7ef", "score": "0.67994463", "text": "def get_storage_class\n return @m_storage_class\n end", "title": "" }, { "docid": "c9406baf99a95a6583e6d2219a940343", "score": "0.6798767", "text": "def deleted_files_storage\n @attributes[:deleted_files_storage]\n end", "title": "" }, { "docid": "e8154ed40d338399b9ef2c830b85ac8d", "score": "0.67136747", "text": "def storage_hash\n JSON.parse(@bot.storage.reload.content || '{}')\n end", "title": "" }, { "docid": "e1f6e76f9269e5c3a9272b29dbc48406", "score": "0.66855913", "text": "def all\n storage\n end", "title": "" }, { "docid": "d73d93b65bb61079d012e015dc45b801", "score": "0.6662418", "text": "def root_storage\n @attributes[:root_storage]\n end", "title": "" }, { "docid": "320429ac69e7dfeca6f9d4617a191034", "score": "0.66609997", "text": "def create_storages\n @storages = []\n @encryption_info = @ms_off_crypto.encryption_info\n @encrypted_package = @ms_off_crypto.encrypted_package\n\n @storages << Storage.new('EncryptionInfo', :data=>encryption_info, :left=>3, :right=>11) # example shows right child. do we need the summary info????\n @storages << Storage.new('EncryptedPackage', :data=>encrypted_package, :color=>Storage::COLORS[:red])\n @storages << Storage.new([6].pack(\"c\")+\"DataSpaces\", :child=>5, :modified =>129685612740945580, :created=>129685612740819979)\n @storages << version\n @storages << data_space_map\n @storages << Storage.new('DataSpaceInfo', :right=>8, :child=>7, :created=>129685612740828880,:modified=>129685612740831800)\n @storages << strong_encryption_data_space\n @storages << Storage.new('TransformInfo', :color => Storage::COLORS[:red], :child=>9, :created=>129685612740834130, :modified=>129685612740943959)\n @storages << Storage.new('StrongEncryptionTransform', :child=>10, :created=>129685612740834169, :modified=>129685612740942280)\n @storages << primary \n # @storages << summary_information\n # @storages << document_summary_information\n\n # we do this at the end as we need to build the minifat stream to determine the size. #HOWEVER - it looks like the size should not include the padding?\n @storages.unshift Storage.new('Root Entry', :type=>Storage::TYPES[:root], :color=>Storage::COLORS[:red], :child=>1, :data => mini_fat_stream)\n\n end", "title": "" }, { "docid": "7734c32923fe0f2a3057b85152902cca", "score": "0.6653451", "text": "def storage_get(storage_id)\n filters = []\n filters << { name: 'volume-id', values: [storage_id] }\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n volumes = @ec2_client.describe_volumes(filters: filters).volumes\n volume = volumes ? volumes.first : nil\n return nil unless volume\n\n storage_parse_backend_obj(volume)\n end\n end", "title": "" }, { "docid": "41e341a83ea1e0f98b52ebabf8b8c24a", "score": "0.66424996", "text": "def get_local_storage\n storage = {:hostname => Socket.gethostname, :mounts => [], :vgs => []}\n\n LVM::LVM.new({:command => \"/usr/bin/sudo /sbin/lvm\"}) do |lvm|\n lvm.volume_groups.each do |vg|\n vg.logical_volumes.each do |lv|\n mnt = get_mount(lv.name)\n fs = {:mount => mnt.mount_point, :fs => mnt.name, :lv => lv.name, :vg => vg.name}\n storage[:mounts] << fs\n end\n\n volg = {:vg => vg.name, :pvs => []}\n vg.physical_volumes.each do |pv|\n volg[:pvs] << {:pv => pv.name}\n end\n storage[:vgs] << volg\n end\n end\n storage\n end", "title": "" }, { "docid": "21b81652d731e1046d3e0efcabc336f7", "score": "0.66117483", "text": "def look\n puts \"Storage:\"\n print storage\n end", "title": "" }, { "docid": "feb718d587af84f8ff476cfe5a5de13b", "score": "0.65912104", "text": "def storage(domain)\n host = vhost(domain)\n host ? host.storage : @null\n end", "title": "" }, { "docid": "bf9ad5ec5d44d15dac29eea08c1235a0", "score": "0.65849805", "text": "def storage \n Trole::Storage::BaseOne\n end", "title": "" }, { "docid": "c8024d2ce0dcf9c48bfafee875e544fe", "score": "0.6580537", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "4acc9670b9424e976d97424812e909b4", "score": "0.6562021", "text": "def storage_url\n self.auth_response[:storage_url]\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.6542985", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.6542985", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.6542985", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.6542985", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "eb603eaa7f1793ea65681fe3bf43f595", "score": "0.653501", "text": "def storage_items\n @storage_items[@storage_name].keys.sort.collect {|id| $data_items[id] }\n end", "title": "" }, { "docid": "d75524004d964e5276379f14692f0e9f", "score": "0.6517171", "text": "def get_storage_types\n JSON.parse(RestClient.get(\"https://#{region.sub(/-\\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types\", headers))[region]\n end", "title": "" }, { "docid": "0219ae070372ac15019dadaa4d8c8f57", "score": "0.6515125", "text": "def storage_name\n @storage_name || name\n end", "title": "" }, { "docid": "61ee4cc3f96c875fdfebb297c0e2a02f", "score": "0.65119815", "text": "def parse\n physical_storage_families\n physical_storages\n storage_resources\n storage_services\n cloud_volumes\n end", "title": "" }, { "docid": "0ccdf537bdffa2d84a87c3c509b4b0af", "score": "0.64441186", "text": "def storages\n storage_list = CopyStaging::RestoreWork::ORIGINALS_STORAGE + CopyStaging::RestoreWork::DERIVATIVES_STORAGE\n Hash[ storage_list.collect { |shrine_storage_key| [shrine_storage_key.to_s, shrine_config(shrine_storage_key) ] } ]\n end", "title": "" }, { "docid": "fb38486b773104f3a74d402605c32cbe", "score": "0.64346856", "text": "def storage(domain)\n @config.storage(domain)\n end", "title": "" }, { "docid": "0cd693e04fa1ec2b193f3d52dbbb3c23", "score": "0.6421425", "text": "def size\n storage.size\n end", "title": "" }, { "docid": "dda21aad0c2b9950d129c76c25b2622b", "score": "0.6417156", "text": "def storage_servers\n self.client.get('gh.storage.servers').split(',')\n end", "title": "" }, { "docid": "8ad600fb406feb07e9735419126875ff", "score": "0.64075935", "text": "def storage_list(mixins = nil)\n storages = Occi::Core::Resources.new\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n volumes = @ec2_client.describe_volumes.volumes\n volumes.each do |volume|\n next unless volume\n storages << storage_parse_backend_obj(volume)\n end if volumes\n end\n\n storages\n end", "title": "" }, { "docid": "2b073cabeb751ace715d25a94d0efaeb", "score": "0.6406742", "text": "def storage_throughput\n data[:storage_throughput]\n end", "title": "" }, { "docid": "cf577ab0c20e4b6cfb58af38a1cebe6f", "score": "0.6394684", "text": "def info\n result = FFI::Libvirt::StoragePoolInfo.new\n FFI::Libvirt.virStoragePoolGetInfo(self, result.to_ptr)\n result\n end", "title": "" }, { "docid": "4f9255227012d413dd586859a1cf49ab", "score": "0.6363373", "text": "def storage\n @storage ||= Set.new\n end", "title": "" }, { "docid": "4f9255227012d413dd586859a1cf49ab", "score": "0.6363373", "text": "def storage\n @storage ||= Set.new\n end", "title": "" }, { "docid": "3c8e583a6fd47c3fea689e7ed14babfb", "score": "0.63097435", "text": "def storage_class\n raise NotImplementedError\n end", "title": "" }, { "docid": "5c9a54cf80d508ffb99944db038306d9", "score": "0.6291548", "text": "def storage_type\n @dbi.storage_type\n end", "title": "" }, { "docid": "5c9a54cf80d508ffb99944db038306d9", "score": "0.6291548", "text": "def storage_type\n @dbi.storage_type\n end", "title": "" }, { "docid": "74c13d29846ce2f7ba2a57e9a8b30480", "score": "0.6289868", "text": "def store_information\n get('store')\n end", "title": "" }, { "docid": "7d35afdd9bbba41a41ded5e756dc4b2f", "score": "0.62888575", "text": "def metadata\r\n self.class.service_instance.get_blob_properties(path)\r\n end", "title": "" }, { "docid": "7242340f7506f47dc8a96cce320a8132", "score": "0.6282311", "text": "def size\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "b412e94ba93a9e6c4a2878790c00cce1", "score": "0.627969", "text": "def storage_encrypted\n data[:storage_encrypted]\n end", "title": "" }, { "docid": "b412e94ba93a9e6c4a2878790c00cce1", "score": "0.627969", "text": "def storage_encrypted\n data[:storage_encrypted]\n end", "title": "" }, { "docid": "76a716c8bafe1dc5f8a856318190cf80", "score": "0.6275948", "text": "def allocated_storage\n @dbi.allocated_storage\n end", "title": "" }, { "docid": "76a716c8bafe1dc5f8a856318190cf80", "score": "0.6275948", "text": "def allocated_storage\n @dbi.allocated_storage\n end", "title": "" }, { "docid": "8148b1f90550ecd889f4ac1a359838e2", "score": "0.62581354", "text": "def get_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n rc = image.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n return to_occi_xml(image, :code=>200)\n end", "title": "" }, { "docid": "6042642076265e2048f71fcf48fd2b6f", "score": "0.6255076", "text": "def get_real_storage\n\n @application_context[:s_expression_storage__1]\n end", "title": "" }, { "docid": "c56c8bf99cb724b9ebe0a40b99928824", "score": "0.6252761", "text": "def size\n\t\treturn @storage.size\n\tend", "title": "" }, { "docid": "59dd1adb4a596f3e49bc4d2771540970", "score": "0.62246555", "text": "def roby_storage\n env.fetch(\"roby.storage\")\n end", "title": "" }, { "docid": "0d3a7529733dc457569f42c38e433043", "score": "0.6213031", "text": "def lookup_storage(key)\n { memory: Storage::Memory, redis: Storage::Redis }[key]\n end", "title": "" }, { "docid": "8d9731fb8f68c1a910786d30a9399192", "score": "0.6209069", "text": "def service\n softlayer_client[:Network_Storage].object_with_id(self.id)\n end", "title": "" }, { "docid": "962db606c86bf0e0703010c0f700a5de", "score": "0.619533", "text": "def backing_store\n \tbs = {}\n\tnoko_details.xpath('/domainsnapshot/domain/devices/disk').map do |ddsk|\n\t next if ddsk.xpath('@device').text != \"disk\"\n\t next if ddsk.xpath('@snapshot').text == \"external\"\n\t sf = ddsk.xpath('source/@file').text\n\t td = ddsk.xpath('target/@dev').text\n\t bs[td] = sf\n\tend\n\tbs\n end", "title": "" }, { "docid": "8557951fe1c137ef1ef930ae605f48d9", "score": "0.6187483", "text": "def show\n @storage = @client.storages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storage }\n end\n end", "title": "" }, { "docid": "8720f021c03746570350202d8ddadf99", "score": "0.6186478", "text": "def get_usage\n\t\t\[email protected](:usage).to_i\n\t\tend", "title": "" }, { "docid": "9f125515df39131c903133c5ff80140b", "score": "0.61843956", "text": "def get_storage_names\n # This gets all the non view tables, but has to strip column 0 out of the two column response.\n select(\"SHOW FULL TABLES FROM #{options[:path][1..-1]} WHERE Table_type = 'BASE TABLE'\").map { |item| item.first }\n end", "title": "" }, { "docid": "060af1a9d306f2def360150293cbb8c1", "score": "0.6177619", "text": "def get_extensions\n read_extensions 'storage', @options.model_extensions_dir\n end", "title": "" }, { "docid": "3724356afa61fa4de92d388b8cc743b6", "score": "0.6172107", "text": "def dumpStorage(storage)\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> Begin Attributes [storage.attributes]\")\n storage.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Storage:<#{storage.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> End Attributes [storage.attributes]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> Begin Associations [storage.associations]\")\n storage.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - Storage:<#{storage.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> End Associations [storage.associations]\")\n $evm.log(\"info\",\"\")\n\n unless storage.tags.nil?\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> Begin Tags [storage.tags]\")\n storage.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - Storage:<#{storage.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> End Tags [storage.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> Begin Virtual Columns [storage.virtual_column_names]\")\n storage.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - Storage:<#{storage.name}> Virtual Columns - #{vcn}: #{storage.send(vcn)}\")}\n $evm.log(\"info\",\"#{@method} - Storage:<#{storage.name}> End Virtual Columns [storage.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end", "title": "" }, { "docid": "9565fcc99d93188de0dc1692216ce66a", "score": "0.61539006", "text": "def metas_storage\n Thread.current[:metas]\n end", "title": "" }, { "docid": "ec7e7af91ce2fa14029df46c5e2b0c9a", "score": "0.61528116", "text": "def storage\n require 'yaml/store'\n Storage[object_id] ||= YAML::Store.new(STORAGE_FILE)\n end", "title": "" }, { "docid": "a5d07fc94b15ea03a5607f2bdf590a22", "score": "0.61410797", "text": "def storage_all_items\n storage_items + storage_equip_items\n end", "title": "" }, { "docid": "2c08e3b0503a7ed9f15aa88f6380bdaf", "score": "0.61384016", "text": "def find(options = {})\n raise \"Unable to locate the storage named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_storage, \"<storageId>#{options[:id]}</storageId>\"\n Profitbricks::Storage.new(response.to_hash[:get_storage_response][:return])\n end", "title": "" }, { "docid": "e19fbbc39d7d4c67656616d774c0d225", "score": "0.6135738", "text": "def quota_info\n end", "title": "" }, { "docid": "d5d21ce632e1d5ebba453cb99ff3988f", "score": "0.61257166", "text": "def storage_block_removable_storage\n return @storage_block_removable_storage\n end", "title": "" }, { "docid": "6f35478e801260d1522e4b5efd7b8f23", "score": "0.61181694", "text": "def storage_class\n @storage_class || storage_loader.storage_class\n end", "title": "" }, { "docid": "b1cc86f59824fadbb1d872ea16c0a310", "score": "0.6118025", "text": "def index\n @storages = Storage.all\n end", "title": "" }, { "docid": "b1cc86f59824fadbb1d872ea16c0a310", "score": "0.6118025", "text": "def index\n @storages = Storage.all\n end", "title": "" }, { "docid": "a4f7745cfb6b378b18ee29fa86d347e7", "score": "0.6111777", "text": "def storage(arg=nil)\n set_or_return(:storage, arg, :kind_of => String)\n end", "title": "" }, { "docid": "455790079ec39c030adf75fda3a3c1c3", "score": "0.61117613", "text": "def get_storage_account_properties(name)\n request_path = \"/services/storageservices/#{name}\"\n request = client.management_request(:get, request_path)\n response = request.call\n Serialization.storage_services_from_xml(response).first\n end", "title": "" }, { "docid": "e815edaa1d80179a009c24c60e7da2dc", "score": "0.61098874", "text": "def storage_path\n return nil unless db.running?\n db.storage_path\n end", "title": "" }, { "docid": "4539f8c47789415c74da368459c212a3", "score": "0.61059994", "text": "def storage_config\n YAML.load_file(Rails.root.join('config', 'storage.yml'))[Rails.env]\n end", "title": "" }, { "docid": "d6f881e60554092da8dac702f57fd484", "score": "0.60820127", "text": "def storage\n @plugins.detect { |p| p.is_a? BaseStorage }\n end", "title": "" }, { "docid": "a5d42a716515ae1cbb762b296d8b32de", "score": "0.60742074", "text": "def get_proper_storage_for_create(size, local_path = nil)\n FC::Storage.select_proper_storage_for_create(get_create_storages, size) do |storages|\n local_storages = storages.select{|storage| FC::Storage.curr_host == storage.host}\n # find same storage device as local_path device\n if local_path && !local_storages.empty?\n dev = File.stat(local_path).dev\n dev_storage = local_storages.select{|storage| dev == File.stat(storage.path).dev}.first\n local_storages = [dev_storage] if dev_storage\n end\n # if no local storages - use all storages\n local_storages = storages if local_storages.empty?\n local_storages\n end\n end", "title": "" }, { "docid": "efc107f50e507131b850ae22ac782f5a", "score": "0.6073674", "text": "def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end", "title": "" }, { "docid": "a6f3724ce3e3473acf7b9ad90435fbb8", "score": "0.60687697", "text": "def find_storage_locations\n if setting_ok_storage_locations\n $config[\"settings\"][\"storage destinations\"][\"tv\"].each do |directory|\n files_secondary = find_files(true,directory) \n shows_on_storage_device(directory,files_secondary).keys.each do |show|\n $show_storage[show] = directory\n end\n end\n end\nend", "title": "" }, { "docid": "379cf4646cfc230479719dcf6e150a1c", "score": "0.60625076", "text": "def storage_type\n @grpc.default_storage_type\n end", "title": "" }, { "docid": "6bb379791a1c98a19ae4c6be0ee488f8", "score": "0.60598534", "text": "def filesystem_data\n self['filesystem2'] || self['filesystem']\n end", "title": "" }, { "docid": "ba2a6c1fd334c833e16cb4ace6dc4876", "score": "0.6056615", "text": "def storage\n Imgurr.storage\n end", "title": "" }, { "docid": "61dd3206ddb43d022a88f5aa0473a1b9", "score": "0.60516083", "text": "def get_proper_storage_for_copy(size, exclude = [])\n FC::Storage.select_proper_storage_for_create(get_copy_storages, size, exclude)\n end", "title": "" }, { "docid": "61dd3206ddb43d022a88f5aa0473a1b9", "score": "0.60516083", "text": "def get_proper_storage_for_copy(size, exclude = [])\n FC::Storage.select_proper_storage_for_create(get_copy_storages, size, exclude)\n end", "title": "" } ]
a792b9e3508f3c4c8541233c28f985c0
PATCH/PUT /registrations/1 PATCH/PUT /registrations/1.json
[ { "docid": "462a2dab8cc459f401dee2859d9c5c24", "score": "0.6451722", "text": "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "638d8b3f17f1eca730bb179a35bd6549", "score": "0.66154", "text": "def update\n respond_to do |format|\n if @registration.update(registration_params)\n\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "a07595bea31592abef68b4fcb9b5b20d", "score": "0.6601693", "text": "def update\n @registration_request = RegistrationRequest.find(params[:id])\n\n if @registration_request.update(registration_request_params)\n head :no_content\n else\n render json: @registration_request.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a66e1edb59531ad57a41666cd55d361b", "score": "0.6597018", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to registrations_path, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9e9680eeacd5fcd0504c98e178393fe", "score": "0.65405804", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to @registration, :notice => 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6dfe851dc24fde37e5c3720e1cacbbc3", "score": "0.6505548", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac3114a08bc16a2bc7bdf7f2d20e0588", "score": "0.64812416", "text": "def update\n respond_to do |format|\n if @registration.update(_registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91a9ffea2dff32e0e1f14bb456545a13", "score": "0.64715356", "text": "def update\n respond_to do |format|\n if @registrer.update(registrer_params)\n format.html { redirect_to @registrer, notice: 'Registrer was successfully updated.' }\n format.json { render :show, status: :ok, location: @registrer }\n else\n format.html { render :edit }\n format.json { render json: @registrer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37560c60f3575d9759df38c69e905898", "score": "0.64564294", "text": "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: \"Registration was successfully updated.\" }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25c74b563dde07bee688ee6ca3dc8b3f", "score": "0.6445232", "text": "def update\n @registry = @user.registries.find(params[:id])\n\n respond_to do |format|\n # if @registry.update_attributes(params[:registry])\n if @registry.update_attributes(registry_params)\n flash[:notice] = 'Registry was successfully updated.'\n format.html { redirect_to([@user,@registry]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registry.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ace9ac770725ddaf5b49a8b7e77746de", "score": "0.6445094", "text": "def update\n @registry = Registry.find(params[:id])\n\n respond_to do |format|\n if @registry.update_attributes(user_params)\n format.html { redirect_to @registry, notice: 'Registry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "046c7d89bfee6c2a80168624d51f2f93", "score": "0.64450014", "text": "def update\n respond_to do |format|\n if @reg.update(reg_params)\n format.html { redirect_to @reg, notice: 'Reg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b713f7f3a96610b55bd603f23e6db97", "score": "0.6415015", "text": "def update\n respond_to do |format|\n if @registered.update(registered_params)\n format.html { redirect_to @registered, notice: 'Registered was successfully updated.' }\n format.json { render :show, status: :ok, location: @registered }\n else\n format.html { render :edit }\n format.json { render json: @registered.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edaa93d2b3d7a3776e518a6bb5e5c894", "score": "0.6387105", "text": "def update\n if @registration.update(registration_params)\n render :show, status: :ok, location: @registration\n else\n render json: @registration.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a8ccc0383fc00dae109e685e76c520c3", "score": "0.6336852", "text": "def update\n respond_to do |format|\n if @reg.update(reg_params)\n format.html { redirect_to @reg, notice: 'Reg was successfully updated.' }\n format.json { render :show, status: :ok, location: @reg }\n else\n format.html { render :edit }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "760d62fcf8b63176541df500f07538b8", "score": "0.63254404", "text": "def update\n respond_to do |format|\n if @registry.update(registry_params)\n format.html { redirect_to @registry, notice: 'Cadastro atualizado com sucesso' }\n format.json { render :show, status: :ok, location: @registry }\n else\n format.html { render :edit }\n format.json { render json: @registry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de4ec177b02c24ddc0009ae8d14aed61", "score": "0.6212051", "text": "def update\n @users = User.find(params[:id])\n\n respond_to do |format|\n if @users.update_attributes(params[:regist])\n format.html { redirect_to @users, notice: 'Regist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f6a0d99dca7c89c15c3bbfb0ee8ad59", "score": "0.61791635", "text": "def update\n respond_to do |format|\n if @register.update(register_params)\n format.html { redirect_to @register, notice: 'Register was successfully updated.' }\n format.json { render :show, status: :ok, location: @register }\n else\n format.html { render :edit }\n format.json { render json: @register.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c39144bb7e248136d909e77166be3889", "score": "0.6172604", "text": "def update\n respond_to do |format|\n if @registration_form.update(registration_form_params)\n format.html { redirect_to @registration_form, notice: 'Registration form was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_form }\n else\n format.html { render :edit }\n format.json { render json: @registration_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27d01c8e76117e1d95ea33e2450b00bc", "score": "0.61630225", "text": "def update\n respond_to do |format|\n if @preregistration.update(preregistration_params)\n format.html { redirect_to @preregistration, notice: 'Preregistration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @preregistration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5145dea6b9fb0d96b4a896236a1e982", "score": "0.615974", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to [:competitive, @registration], notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e78ece147e2e66add9b9a4498acb7366", "score": "0.61499274", "text": "def update\n respond_to do |format|\n if @registrant.update(registrant_params)\n format.html { redirect_to @registrant, notice: 'Registrant was successfully updated.' }\n format.json { render :show, status: :ok, location: @registrant }\n else\n format.html { render :edit }\n format.json { render json: @registrant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7e230b7fdc538ddf9ece223e19fbfb0", "score": "0.6132841", "text": "def update\n respond_to do |format|\n if @event_registration.update(event_registration_params)\n format.html { redirect_to @event_registration, notice: 'Registration successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f120f71cb6f09c615a3a5dc184833e59", "score": "0.6124618", "text": "def update\n respond_to do |format|\n if @registrant.update_attributes(registrant_update_params)\n format.html { redirect_to registrant_registrant_expense_items_path(@registrant), notice: 'Registrant was successfully updated.' }\n format.json { head :no_content }\n else\n edit\n format.html { render action: \"edit\" }\n format.json { render json: @registrant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "385683d70c125a88361e7d3f1bfec8d0", "score": "0.60631", "text": "def update\n @registration_status = RegistrationStatus.find(params[:id])\n\n respond_to do |format|\n if @registration_status.update_attributes(params[:registration_status])\n format.html { redirect_to @registration_status, :notice => 'Estado de registro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @registration_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77abaa02e145bed86446ed7749e73ec9", "score": "0.60595787", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to(@registration, :notice => 'Registration was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0df3df4c266fa6f71d1e2421a69665b5", "score": "0.6054305", "text": "def update\n @all_registration = AllRegistration.find(params[:id])\n\n respond_to do |format|\n if @all_registration.update_attributes(params[:all_registration])\n format.html { redirect_to @all_registration, notice: 'All registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @all_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56f8f1264dae0808b57aaa6a4bf8cdf7", "score": "0.60491705", "text": "def update\n respond_to do |format|\n if @myregistration.update(myregistration_params)\n format.html { redirect_to @myregistration, notice: 'Myregistration was successfully updated.' }\n format.json { render :show, status: :ok, location: @myregistration }\n else\n format.html { render :edit }\n format.json { render json: @myregistration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e212bef42c732592cdbaa4d11dc0571e", "score": "0.6048877", "text": "def update\n respond_to do |format|\n if @preregistration.update(preregistration_params)\n format.html { redirect_to @preregistration, notice: \"Preregistration was successfully updated.\" }\n format.json { render :show, status: :ok, location: @preregistration }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @preregistration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b16c60c75d1054573b462146bfbbdb57", "score": "0.599156", "text": "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to member_path(@registration.member_id), notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n @member = Member.find(@registration.member_id)\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7278076fd971afaff559bc3ba2b7b87c", "score": "0.59882057", "text": "def update\n respond_to do |format|\n if @registo.update(registo_params)\n format.html { redirect_to @registo, notice: 'Registo actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @registo }\n else\n format.html { render :edit }\n format.json { render json: @registo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6975f59ca47f539120688f92f58a6f6a", "score": "0.598647", "text": "def update\n respond_to do |format|\n if @rego.update(rego_params)\n format.html { redirect_to @rego, notice: 'Rego was successfully updated.' }\n format.json { render :show, status: :ok, location: @rego }\n else\n format.html { render :edit }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37cd8a343529780f84f33968578629d6", "score": "0.59844154", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Påmeldingen ble oppdatert!'\n format.html { redirect_to(registrations_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e6c313db4c4c2868dc6b737b2d1ab6f", "score": "0.5981111", "text": "def update\n @admin_registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @admin_registration.update_attributes(params[:registration])\n format.html { redirect_to [:admin, @admin_registration], notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23a904e6ddd4b6b07c4b53353e78cf93", "score": "0.5954062", "text": "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "title": "" }, { "docid": "d15d0ff55b8abfa0228e375342afd2f6", "score": "0.59532946", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to(@registration) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d15d0ff55b8abfa0228e375342afd2f6", "score": "0.59532946", "text": "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to(@registration) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "363c5945c080d1d8060b8828f5c10a86", "score": "0.5944294", "text": "def update\n respond_to do |format|\n if @registration_detail2.update(registration_detail2_params)\n format.html { redirect_to @registration_detail2, notice: 'Registration detail2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_detail2 }\n else\n format.html { render :edit }\n format.json { render json: @registration_detail2.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98257c62228e4102d7526267bba523e6", "score": "0.593116", "text": "def update\n respond_to do |format|\n if @registro.update(registro_params)\n format.html { redirect_to registros_path, notice: 'Codigo: UPD005 - Informacion del usuario actualizada.' }\n format.json { render :show, status: :ok, location: @registro }\n format.js\n else\n format.html { redirect_to registros_path, notice: 'Codigo: ERR006 - Email esta vacio. Por favor comprueba los campos del formulario.' }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "08d2c35acb04ce6093121a71f48af3ae", "score": "0.5929491", "text": "def update\n respond_to do |format|\n if @gt_registration.update(gt_registration_params)\n format.html { redirect_to index_with_payed_gt_race_gt_category_gt_registrations_path(@gt_race,0), notice: 'Gt registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @gt_registration }\n else\n format.html { render :edit }\n format.json { render json: @gt_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df67552fa3ef559fb528c63d528ea18d", "score": "0.5921912", "text": "def update\n respond_to do |format|\n if @device_registration.update(device_registration_params)\n format.html { redirect_to @device_registration, notice: 'Device registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_registration }\n else\n format.html { render :edit }\n format.json { render json: @device_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02238e462f35e91cff024c60401f58ce", "score": "0.5917131", "text": "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf87955bdb96892e402306c7f637f0c8", "score": "0.5901725", "text": "def update\n respond_to do |format|\n if @registrar.update(registrar_params)\nformat.html{redirect_to@registrar,notice:'Registrar was successfully updated.'}\n format.json { render :show, status: :ok, location: @registrar }\n else\n format.html { render :edit }\nformat.json { render json: @registrar.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c15f55ecfe0e8f54e5b013d140b511f1", "score": "0.58989745", "text": "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "title": "" }, { "docid": "e992aca2d78621c1af684dcf162f9a50", "score": "0.588817", "text": "def update\n # byebug\n current_user.update(registration_params)\n redirect_to root_path\n end", "title": "" }, { "docid": "ca1f04d265c06053298d9f7cdc765dbf", "score": "0.58870274", "text": "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3742bd09d94555ab04f4d9125937ba2f", "score": "0.5871398", "text": "def update\n respond_to do |format|\n if @regattum.update(regattum_params)\n format.html { redirect_to @regattum, notice: 'Regattan har uppdaterats.' }\n format.json { render :show, status: :ok, location: @regattum }\n else\n format.html { render :edit }\n format.json { render json: @regattum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab8b56736b77f176aef9b46288816867", "score": "0.58593655", "text": "def update\n\n respond_to do |format|\n if @register.update_attributes(params[:register])\n flash[:notice] = 'Register was successfully updated.'\n format.html { redirect_to(@register) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @register.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ff33cb4d3c219cf63b3f671144d9e9c", "score": "0.5858729", "text": "def update\n @registry = Registry.find(params[:id])\n @registry.update_attributes(update_params)\n redirect_to admin_registries_path, notice: \"Registry updated successfully!\"\n end", "title": "" }, { "docid": "e022e5149ac76a90fcba4651097be0e5", "score": "0.58502495", "text": "def update\n @person.authorizer = current_person\n\n respond_to do |format|\n if @person.update(person_params)\n @person.invite!(current_person) if params['resend_invite']=='true' \n \n format.html { redirect_to :people, notice: 'Profile successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d761c8e49e1731b7fc3313570d381a7a", "score": "0.5847898", "text": "def update\n p = params[:node_registration]\n @registration = NodeRegistration.find(params[:id])\n if permitted_to?(:set_owner, @registration)\n @registration.owner_id = p[:owner_id]\n else\n @registration.owner = current_user\n end\n @registration.updater = current_user\n\n respond_to do |format|\n if @registration.update_attributes(latitude: p[:latitude],longitude: p[:longitude],\n operator_name: p[:operator_name], operator_email: p[:operator_email],\n name: p[:name], node_at: p[:node_at],notice: p[:notice],\n loc_str: p[:loc_str], osm_loc: p[:osm_loc])\n \n format.html { redirect_to nodes_path, notice: 'Registrierung erfolgreich gespeichert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76cd76a1ce3e85bb656cd96e53b3f517", "score": "0.5843598", "text": "def update\n\n respond_to do |format|\n if @registrant_group.update_attributes(registrant_group_params)\n format.html { redirect_to @registrant_group, notice: 'Registrant group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registrant_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7773fb11bee2f00b939e6b07a9fae026", "score": "0.5839873", "text": "def update\n respond_to do |format|\n if @regdetail.update(regdetail_params)\n format.html { redirect_to @regdetail, notice: 'Regdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @regdetail }\n else\n format.html { render :edit }\n format.json { render json: @regdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c41b16d40daa4801fee48da95a28feae", "score": "0.5837382", "text": "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "title": "" }, { "docid": "9721bbbb9524f28d3178f84487fc5288", "score": "0.5835154", "text": "def update\n @registration_contract = Registration::Contract.find(params[:id])\n\n respond_to do |format|\n if @registration_contract.update_attributes(params[:registration_contract])\n format.html { redirect_to @registration_contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registration_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eddf15605851198cb1f19714d1003f9", "score": "0.58322185", "text": "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "title": "" }, { "docid": "70c5a1142c8110a0d8a6f7276b44a1d5", "score": "0.5826967", "text": "def update\n respond_to do |format|\n if @registration.update_attributes(params[:registration].only('outcome_type_id','outcome','inflection_date','outcome_date'))\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to([@patient]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab62e21abe05f80213639c0c57ea2677", "score": "0.5825014", "text": "def update\n @enregistrement = Enregistrement.find(params[:id])\n\n respond_to do |format|\n if @enregistrement.update_attributes(params[:enregistrement])\n format.html { redirect_to @enregistrement, notice: 'Enregistrement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enregistrement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87738e772151dfcf78b9186b6d415331", "score": "0.5824728", "text": "def update\n respond_to do |format|\n if @registro.update(registro_params)\n format.html { redirect_to @registro, notice: \"Registro was successfully updated.\" }\n format.json { render :show, status: :ok, location: @registro }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "360a48cfa7ecea0b1d565c1c7cc7d6b6", "score": "0.582429", "text": "def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end", "title": "" }, { "docid": "8d7cda5bb29809375fc26b63f1519d3e", "score": "0.5823532", "text": "def update\n @register_group = RegisterGroup.find(params[:id])\n\n respond_to do |format|\n if @register_group.update_attributes(params[:register_group])\n format.html { redirect_to @register_group, notice: 'Register group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @register_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d48746ef6f220c62df4719337a31708", "score": "0.58182204", "text": "def update\r\n respond_to do |format|\r\n if @comite_registro.update(comite_registro_params)\r\n format.html { redirect_to @comite_registro, notice: 'Su petición para registrar su comité tutorial fue actualizada.' }\r\n format.json { render :show, status: :ok, location: @comite_registro }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @comite_registro.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "7049a654e6fcfbfbb18df8d1356d9ee6", "score": "0.58180064", "text": "def update\n respond_to do |format|\n if @registrant_group.update_attributes(registrant_group_params)\n format.html { redirect_to @registrant_group, notice: 'Registrant group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registrant_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5659420b511942247fe33646ddf62a98", "score": "0.57978034", "text": "def reg_organisation_profile_update\n @organisation = Organisation.find_organisation_user(params[:id]).first\n respond_to do |format|\n if @user.update_attributes(params[:users1]) && @organisation.update_attributes(params[:organisations]) && @location.update_attributes(params[:locations1])\n format.html { redirect_to(dashboards_path, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :editing_user_profile }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ee290653d732cff93cca3bf949ba30b", "score": "0.5789698", "text": "def update\n respond_to do |format|\n if @registro.update(registro_params)\n format.html { redirect_to @registro, notice: 'Registro was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro }\n else\n format.html { render :edit }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e0e59715d19dce2a47fccc2c67326dd", "score": "0.5773656", "text": "def patch!\n request! :patch\n end", "title": "" }, { "docid": "c52f3915b93e5855d0d98c66cefdbbe3", "score": "0.5773132", "text": "def update\n respond_to do |format|\n if @registration_table.update(registration_table_params)\n format.html { redirect_to @registration_table, notice: 'Registration table was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_table }\n else\n format.html { render :edit }\n format.json { render json: @registration_table.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d365d69c78f3b2e5c97a41a083a14a4", "score": "0.57680655", "text": "def update\n authorize! :update, HoursRegistration\n respond_to do |format|\n if @hours_registration.update(hours_registration_params)\n format.html { redirect_to @hours_registration, notice: 'Hours registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @hours_registration }\n else\n format.html { render :edit }\n format.json { render json: @hours_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0426b474e83b8a07dcf9ec1f008e7ad1", "score": "0.5766866", "text": "def update\n respond_to do |format|\n if @registration.update(registration_params)\n if params[:action] == \"update\" && params[:registration][\"group_id\"]\n format.html { redirect_to @registration, notice: \"El colono \\\"#{@registration.colonist_name}\\\" ha sido movido exitosamente al \\\"#{@registration.group.nombre}\\\".\" }\n format.json { render :show, status: :ok, location: @registration }\n else \n format.html { redirect_to @registration, notice: 'Se actualizarón los datos correctamente.' }\n format.json { render :show, status: :ok, location: @registration }\n end\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39f6e7a7f228a3628d2e6df742e7c0dc", "score": "0.5749069", "text": "def update\n respond_to do |format|\n if @registration_number.update(registration_number_params)\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_number }\n else\n format.html { render :edit }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1087ea3bfc069d40b8f4d4c5f158cfcf", "score": "0.57471997", "text": "def update\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n if @one_reg_institution.update_attributes(params[:one_reg_institution])\n format.html { redirect_to @one_reg_institution, notice: 'One reg institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_reg_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e60042d222e12428108a5a42daff5cc", "score": "0.57362854", "text": "def update\n @devise = Devise.find(params[:id])\n\n respond_to do |format|\n if @devise.update_attributes(params[:devise])\n #API CALL GOES HERE\n format.html { redirect_to @devise, notice: 'Devise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @devise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8273800d82deb5de5402812d26d795f6", "score": "0.5735671", "text": "def update\n if @registration.update(registration_params)\n flash[:success] = \"The update was successful\"\n redirect_to @registration\n else\n render action: 'edit' \n end\n end", "title": "" }, { "docid": "5cded3b40b53c3f1b52eb9ccfa84bce6", "score": "0.5728815", "text": "def reg_personal_profile_update\n respond_to do |format|\n if @user.update_attributes(params[:users]) \n format.html { redirect_to(dashboards_path, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :editing_user_profile }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4781fa7337315133553edb54194e6202", "score": "0.5728322", "text": "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "title": "" }, { "docid": "07159ee8c5dbf9fcb7a8f4a306a44c19", "score": "0.5718911", "text": "def update\n if @registration.update(registration_params)\n redirect_to events_url\n else\n render :edit\n end\n end", "title": "" }, { "docid": "d0677deb429289072f1f1c66ca72b8f2", "score": "0.5717967", "text": "def update\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n if @familium.update_attributes(params[:familium])\n format.html { redirect_to @familium, notice: 'Familia fue actualizada existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "921da36ffb75909f4c54605c84af94a2", "score": "0.57132834", "text": "def update\n respond_to do |format|\n if @registering_agency.update(registering_agency_params)\n format.html { redirect_to @registering_agency, notice: 'Registering agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registering_agency.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "327bea782dd34b661e4adb5de93c634a", "score": "0.57011086", "text": "def update\n respond_to do |format|\n if @regulatory.update(regulatory_params)\n format.html { redirect_to @regulatory, notice: 'Regulatory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @regulatory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2cbddbd1d463dbc1378310fb9013fe2", "score": "0.569971", "text": "def update\n @check_register = CheckRegister.find(params[:id])\n\n respond_to do |format|\n if @check_register.update_attributes(check_register_params)\n format.html { redirect_to @check_register, notice: 'Check register was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @check_register.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7663d0348b74542ff1d2f4fd96156fe", "score": "0.5691437", "text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "title": "" }, { "docid": "ded21604b6570af7da19fb864d94a663", "score": "0.56841063", "text": "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "620d59798b698aa9acfe767955de35ee", "score": "0.5682123", "text": "def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e35bdf98dec69b7ead0559ecefbb978", "score": "0.5674484", "text": "def update\n @registro.update(registro_params)\n respond_with @registro\n # respond_to do |format|\n # if @registro.update(registro_params)\n # format.html { redirect_to @registro, notice: 'Registro was successfully updated.' }\n # format.json { render :show, status: :ok, location: @registro }\n # else\n # format.html { render :edit }\n # format.json { render json: @registro.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "a13ad5ed16cb395bd31f1165b3ab3d7a", "score": "0.56579465", "text": "def update\n @regulation = Regulation.find(params[:id])\n\n respond_to do |format|\n if @regulation.update_attributes(params[:regulation])\n format.html { redirect_to @regulation, notice: 'Regulation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @regulation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a908e1cf70ecca5d1b37a5ecf9ae846e", "score": "0.56562275", "text": "def update\n respond_to do |format|\n if @user.update(register_params)\n format.html { redirect_to admin_users_path, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97ab6e5de522cca4037b15302a59fbce", "score": "0.5655228", "text": "def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bb8e339a0b4d3f668416176341a5441", "score": "0.5653797", "text": "def update\n respond_to do |format|\n if @gclife_registration_flatdetail.update(gclife_registration_flatdetail_params)\n format.html { redirect_to @gclife_registration_flatdetail, notice: 'Gclife registration flatdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @gclife_registration_flatdetail }\n else\n format.html { render :edit }\n format.json { render json: @gclife_registration_flatdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c5016d326236ed301b06ba704a77077", "score": "0.56517345", "text": "def update \n respond_to do |format|\n if @requisition.update_attributes(requisition_params) and @requisition.valid?\n ap requisition_params\n format.html { redirect_to @profile, notice: 'Tu solicitud fue actualizada' }\n format.json { render :show, status: :ok, location: @requisition }\n else\n format.html { render :edit }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39ce8fe46dadc51a2c9c090404352db4", "score": "0.5647143", "text": "def update\n @registration = Registration.find_by_id(params[:id])\n if @form.update_attributes(registration_params)\n flash[:success] = \"Registration was successfully updated.\"\n redirect_to @registration\n else\n render action: 'edit'\n end\n end", "title": "" }, { "docid": "62ef9b7d01d95c654d5dfa03df8990b8", "score": "0.56464374", "text": "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n\n if resource.update_with_password(resource_params)\n sign_in resource_name, resource, :bypass => true\n if resource.email_unconfirmed?\n set_msg t(:updated_email, :scope => 'myinfo.devise.messages')\n else\n set_msg t(:updated, :scope => 'devise.registrations')\n end\n else\n clean_up_passwords resource\n respond_to do |format|\n format.js { render :action => \"failed_edit\" }\n end\n end\n end", "title": "" }, { "docid": "e91edfa946c98b2f262ab5571693acd5", "score": "0.56462663", "text": "def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ddd81407f753c5f02c9f2f261040fe6", "score": "0.56447184", "text": "def update\n @registration_form = RegistrationForm.find(params[:id])\n\n respond_to do |format|\n if @registration_form.update_attributes(params[:registration_form])\n flash[:notice] = 'RegistrationForm was successfully updated.'\n format.html { redirect_to(@registration_form) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "576f27e4c99d0868b0454fedc7deba0c", "score": "0.5636534", "text": "def update # PATCH\n raise NotImplementedError\n end", "title": "" }, { "docid": "fd5545f68c8e4d8390cd8e8e9c1d92ab", "score": "0.5632889", "text": "def update\n respond_to do |format|\n if @regra.update(regra_params)\n format.html { redirect_to @regra, notice: 'Regra was successfully updated.' }\n format.json { render :show, status: :ok, location: @regra }\n else\n format.html { render :edit }\n format.json { render json: @regra.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd84e4820a3385df8545ff0b65e8a075", "score": "0.56325984", "text": "def update\n @registration = Registration.find(params[:id])\n student = Student.find(@registration.student_id).id\n err = @registration.save_registration(params[:registration], student)\n redirect_to registrations_path\n end", "title": "" }, { "docid": "aa9d0b0ca6116043535673470427a2fe", "score": "0.56320804", "text": "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "title": "" }, { "docid": "47259f46e3600d8d12288ed4e478002b", "score": "0.56295806", "text": "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_resource_owner\").to_key)\n prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)\n\n resource_updated = update_resource(resource, configure_account_update_params)\n yield resource if block_given?\n\n if params[:additional_emails].present?\n resource.additional_emails.destroy_all\n additional_emails = []\n params[:additional_emails].each do |email|\n additional_emails << {email: email}\n end\n end\n \n if resource_updated\n\n resource.additional_emails.create(additional_emails) if params[:additional_emails].present?\n avatar = url_for(resource.avatar) if resource.avatar.attached?\n\n # set_flash_message_for_update(resource, prev_unconfirmed_email)\n bypass_sign_in resource, scope: resource_name #if sign_in_after_change_password?\n respond_to do |format|\n format.json { \n render json: resource.as_json.merge(additional_emails: resource.additional_emails.pluck(:email)).merge(avatar: avatar) # , location: after_sign_up_path_for(resource)\n }\n format.html {respond_with resource, location: after_update_path_for(resource)}\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_to do |format|\n format.json { render json: { error_messages: resource.errors.full_messages.join(', ') }, status: 422 }\n format.html {respond_with resource}\n end\n end\n end", "title": "" }, { "docid": "44ef917f89cc81fd0e104a83e90b31d5", "score": "0.5624452", "text": "def update\n @regform = Regform.find(params[:id])\n\n respond_to do |format|\n if @regform.update_attributes(params[:regform])\n format.html { redirect_to(@regform, :notice => 'Regform was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @regform.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
d3f03a7a47286a85a98c00227212c7e8
privato. Usato sia per articolo che preview (anche se non pubblico il project ed issue)
[ { "docid": "fac265388379b4244b89ac988d1f7419", "score": "0.0", "text": "def other_articolo_datas()\n @attachements = @articolo.attachments\n\n #singolo articolo\n @section_id = @articolo.section_id\n @icount = Issue.all_public_fs.with_filter(\"#{Section.table_name}.id = \" + @section_id.to_s).count()\n if @icount > 3\n @artsimilar = Issue.all_public_fs.with_filter(\"#{Section.table_name}.id = \" + @section_id.to_s).all(\n :limit => 7)\n else\n @artsimilar = Issue.all_public_fs.with_filter(\"#{TopSection.table_name}.id = \" + @articolo.section.top_section.id.to_s).all(\n :limit => 7)\n end\n\n if @articolo.news_id\n @quesito = News.all_quesiti_fs.find_by_id(@articolo.news_id)\n end\n\n end", "title": "" } ]
[ { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.7540045", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.7538989", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.7538989", "text": "def preview; end", "title": "" }, { "docid": "98c6a79aff36e16054c44d46ceb02e91", "score": "0.7492016", "text": "def setup_preview\n \n end", "title": "" }, { "docid": "d435d8817d2e9ce84f63a2b1494f6ced", "score": "0.74529636", "text": "def preview\n # TODO\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.734013", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.734013", "text": "def preview\n end", "title": "" }, { "docid": "5e3a048d2fbd3eb6971329c146a5d6b3", "score": "0.7339574", "text": "def preview\n end", "title": "" }, { "docid": "7619c8b365240bc000e5e748aaf07ae2", "score": "0.6867382", "text": "def enable_preview\n control(:action => \"enablepreview\")\n end", "title": "" }, { "docid": "6ca2ba021b49dc42c4a8520927aad7a7", "score": "0.6734899", "text": "def preview\n show 10\n end", "title": "" }, { "docid": "19d872bb083742e35628fff5ccec7583", "score": "0.671061", "text": "def prepare_preview\n @page = Georgia::Page.from_url(params[:request_path]).first || not_found\n @page = Georgia::PageDecorator.decorate(@page)\n @page.current_revision = Georgia::Revision.find(params[:r])\n authorize @page, :preview?\n end", "title": "" }, { "docid": "b7c7bd62a555c92867381cae966ad2ef", "score": "0.6706833", "text": "def preview\n authorize @page\n redirect_to preview_url\n end", "title": "" }, { "docid": "fcb6e49325631dd6eb28d536616643d2", "score": "0.66700333", "text": "def preview(object)\n \n end", "title": "" }, { "docid": "92791e625c54924f2f84ffae2429befd", "score": "0.6653094", "text": "def enabled_in_preview?\n true\n end", "title": "" }, { "docid": "6121ad8cd0bd8084487c7cdbebde86ac", "score": "0.66477555", "text": "def preview_name; end", "title": "" }, { "docid": "2bbd10eedf23aaf87fdc3ce7359a8261", "score": "0.6573817", "text": "def preview\n #if @fiddle.file_path && !authenticate_with_http_basic { |u, p| u == \"rara\" && p == \"shift123!@#\" } then\n # render :file => \"public/401\", :status => :unauthorized\n #else\n l = @fiddle.lang.title\n if l == \"Markdown\" then\n render :markdown\n elsif l == \"Textile\" then\n render :textile\n elsif l == \"Less\" then\n render :less\n elsif l == \"Scss\" then\n render :scss\n else\n render :text => @fiddle.code, :content_type => @fiddle.lang.content_type\n end\n #end\n end", "title": "" }, { "docid": "86221619f2dbc1e6f99be6597dbfdaa4", "score": "0.65033823", "text": "def preview(**options); end", "title": "" }, { "docid": "4604ee1b9d96780b5bf65b73a7df2a5a", "score": "0.65021247", "text": "def create_preview(x,y,w,h)\n STDERR.puts \"CREATING PREVIEW\"\n \n # self.meta['versions'] << 'preview'\n end", "title": "" }, { "docid": "4013918d12b3517766ab7ad63646d24d", "score": "0.64775836", "text": "def preview(**options)\n raise NotImplementedError\n end", "title": "" }, { "docid": "5fa3d3f7ee3f77048a0b4bda718ae25c", "score": "0.6471898", "text": "def preview()\n merge(preview: 'true')\n end", "title": "" }, { "docid": "f14163a761420ba6df55e0ee672fe1eb", "score": "0.6468134", "text": "def large_picture_preview_for_company_admin\n \n \n @picture = Picture.find_by_id(params[:picture_id])\n @project = @picture.project\n # @project_membership = @project.get_project_membership_for(current_user)\n ensure_project_membership\n end", "title": "" }, { "docid": "9a986f9e5562b40698f842f96a3427df", "score": "0.6450666", "text": "def preview\n \n @content = acquire_content_object\n \n render :layout => 'preview'\n \n end", "title": "" }, { "docid": "af8279cf0cdfa5c24618eb4023bea4db", "score": "0.641796", "text": "def preview()\n if @phase == :invite\n previewInvitation()\n elsif @phase == :discuss\n previewDiscussion()\n elsif @phase == :vote\n previewVote()\n end\n end", "title": "" }, { "docid": "7558926736fe6d9fd98a822e615247a5", "score": "0.64028966", "text": "def preview\n authorize Page, :edit?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "title": "" }, { "docid": "f7403c9ec029d887493215bc0f208928", "score": "0.6391277", "text": "def preview\n @private_post = Thredded::PrivatePost.new(private_post_params)\n @private_post.postable = Thredded::PrivateTopic.friendly_find!(params[:private_topic_id])\n authorize @private_post, :create?\n render_preview\n end", "title": "" }, { "docid": "400e38d30e7815f7927730f745692463", "score": "0.63645965", "text": "def preview\n frm.button(:value=>\"Preview\").click\n SyllabusPreview.new(@browser)\n end", "title": "" }, { "docid": "400e38d30e7815f7927730f745692463", "score": "0.63642496", "text": "def preview\n frm.button(:value=>\"Preview\").click\n SyllabusPreview.new(@browser)\n end", "title": "" }, { "docid": "4f8498c1cf2fa35af7578e29ab109629", "score": "0.6355531", "text": "def preview\r\n @preview = true\r\n render \"index\"\r\n end", "title": "" }, { "docid": "d589e79d0a1d60d8f883fb10ab6c1b86", "score": "0.6296717", "text": "def start_preview\n Preview.new(bare_repo)\n end", "title": "" }, { "docid": "9cc3e488f1892966384f1e64fe29d829", "score": "0.62900853", "text": "def content_preview\n #\"#{self.intro} \" + self.current_products.collect{|p| p.name}.join(\", \")\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "6852b152f98b89ee271d1258609770a9", "score": "0.62532926", "text": "def content_preview\n self.description\n end", "title": "" }, { "docid": "6852b152f98b89ee271d1258609770a9", "score": "0.62532926", "text": "def content_preview\n self.description\n end", "title": "" }, { "docid": "9a6f3e9d1c2a8103ccb8931c0c41d791", "score": "0.6220622", "text": "def preview_enabled?\n PREVIEW_ENABLED\n end", "title": "" }, { "docid": "47162dc2dceae9d41ffc963a1159751b", "score": "0.6210431", "text": "def preview\n # Replace media hooks in html with media urls\n htmlstring = @slide_asset.slide_template.markup\n @slide_asset.slide_media_hooks.each { |slide_media_hook|\n htmlstring.gsub! slide_media_hook.hook, slide_media_hook.media_asset.asset_file.url\n }\n\n # Replace addon hooks (includes) in html with addon urls\n htmlstring.gsub!(/__INCLUDE__(.+)__/) { \n templateaddon = TemplateAddon.where(hook: $1, organization_id: 0).first()\n templateaddon = TemplateAddon.where(hook: $1, organization_id: @slide_asset.organization.id).first() if templateaddon == nil \n templateaddon ? templateaddon.file.url : $1\n }\n\n render html: htmlstring.html_safe, layout: false\n end", "title": "" }, { "docid": "9960e4a23cf004e998a0eaa35357d408", "score": "0.62064904", "text": "def prepare_preview\n \n # 1. create preview object and stick it in the session\n preview = Preview.acquire(content_object.to_s, current_user)\n \n # 2. save some data into it\n preview.store(params[:content])\n \n # 3. tickle the content (for the sake of renderable)\n @content.run_callbacks(:save) { false }\n \n # 4. render to screen\n render :action => :preview, :layout => 'preview'\n end", "title": "" }, { "docid": "b18a9dd8bc68ec1f67ba514c741d7611", "score": "0.62043846", "text": "def preview\n @project = Project.where(:id => params[\"id\"].to_i).first\n projectpicture = Projectpicture.new(projectpicture_params)\n description = params[\"description\"].values.first\n binding.pry\n if params[\"projectpicture\"]\n picture = params[\"projectpicture\"].values.first\n projectpicture = Projectpicture.new(description: description, picture: picture)\n else\n projectpicture = Projectpicture.new(description: description)\n end\n projectpicture.project = @project\n if projectpicture.save\n binding.pry\n render partial: \"projects/thumbnailbar\", object: @project, as: \"project\"\n else\n render status: :internal_server_error\n end\n end", "title": "" }, { "docid": "8da3fc5a1602e56bf7a622069bee3ee1", "score": "0.6183157", "text": "def preview\n preview_html=''\n preview_html = preview_documentation if options.meta # defined in meta.rb\n call_browser(\"data:text/html,#{CGI::escape(preview_html).gsub(/\\+/,'%20')}\")\n end", "title": "" }, { "docid": "7379dab35aea5af40ca3105ff58da31e", "score": "0.6178764", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new(params[:post])\n @post.user_id = monologue_current_user.id\n @revision = @post.posts_revisions.first\n @revision.post = @post\n @revision.published_at = Time.zone.now\n \n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6173709", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6173709", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "ea616651d05a8be66adc2eb0b73599f8", "score": "0.6162062", "text": "def check_have_preview\n\n unless @asset.preview.exists?\n \n if action_name.downcase == 'preview'\n essence = @asset.preview \n else\n essence = @asset.thumbnails[action_name.to_sym]\n end\n \n send_file essence.missing_path, \n :type => \"image/#{essence.format}\", \n :disposition => \"inline\", \n :status => 202\n end\n \n \n \n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.6160584", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.6160584", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "599a73a6212dca2405f6e7f01233521a", "score": "0.61508834", "text": "def preview(force = false)\n return unless force || preview_enabled?\n html_div('', class: UPLOADER[:preview])\n end", "title": "" }, { "docid": "a1121f45e71ae4379a90ad9cb0d3b99c", "score": "0.6147802", "text": "def is_preview?\n return (@version == :preview)\n end", "title": "" }, { "docid": "19519bbf4ddc093a02dd024d39236225", "score": "0.6147802", "text": "def preview\n @theme ||= Theme.find(params[:id])\n raise Discourse::InvalidAccess.new() if !guardian.can_hotlink_user_theme?(@theme)\n\n redirect_to path(\"/?preview_theme_id=#{@theme.id}\")\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.6131676", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.6131676", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "8060db2f6565b5053ebab8615fc6bb27", "score": "0.61225796", "text": "def preview\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # preview.html.erb\n end\n end", "title": "" }, { "docid": "db4a09d2a2ec61a996c3f12e5d44b885", "score": "0.6094309", "text": "def show\n @call_for_ideas = @project.call_for_ideas\n unless current_user.viewed(@project)\n add_viewer(user_id=current_user.id, [email protected], idea_id=0, survey_id=0, call_for_idea_id=0, actuality_id=0)\n end\n end", "title": "" }, { "docid": "43ece825474005c0bdbbcdad3491f8d2", "score": "0.60818124", "text": "def editorial_markup\r\n\t\r\n\tend", "title": "" }, { "docid": "c66982e9b92187ae09e9fba27b9f91f9", "score": "0.6075297", "text": "def preview\n # mockup our models for preview.\n @post = Post::ViewAdapter.new(post_repo.create)\n @post.assign_attributes(params[:post])\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "786f9b527bb7e77fd7bf1f81e715062f", "score": "0.60715634", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "786f9b527bb7e77fd7bf1f81e715062f", "score": "0.60715634", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "dfaadca25c4826bd3b07c292811a0aac", "score": "0.606113", "text": "def preview \r\n render :layout => false\r\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.60480803", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.60480803", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.60480803", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.60480803", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "1af21a1b580dee3d95d93eb02e328e0d", "score": "0.6029272", "text": "def generate_preview(entry)\n #Log.log.debug(\">>>> #{entry}\".red)\n # folder where previews will be generated for this particular entry\n local_entry_preview_dir=String.new\n # prepare generic information\n gen_infos=@preview_formats_to_generate.map do |preview_format|\n {\n :preview_format => preview_format,\n :base_dest => preview_filename(preview_format)\n }\n end\n # lets gather some infos on possibly existing previews\n # it depends if files access locally or remotely\n if @access_remote\n get_infos_remote(gen_infos,entry,local_entry_preview_dir)\n else # direct local file system access\n get_infos_local(gen_infos,entry,local_entry_preview_dir)\n end\n # here we have the status on preview files\n # let's find if they need generation\n gen_infos.select! do |gen_info|\n # if it exists, what about overwrite policy ?\n if gen_info[:preview_exist]\n case @option_overwrite\n when :always\n # continue: generate\n when :never\n # never overwrite\n next false\n when :mtime\n # skip if preview is newer than original\n next false if gen_info[:preview_newer_than_original]\n end\n end\n # need generator for further checks\n gen_info[:generator]=Aspera::Preview::Generator.new(@gen_options,gen_info[:src],gen_info[:dst],@tmp_folder,entry['content_type'])\n # get conversion_type (if known) and check if supported\n next false unless gen_info[:generator].supported?\n # shall we skip it ?\n next false if @skip_types.include?(gen_info[:generator].conversion_type)\n # ok we need to generate\n true\n end\n return if gen_infos.empty?\n # create folder if needed\n FileUtils.mkdir_p(local_entry_preview_dir)\n if @access_remote\n raise 'missing parent_file_id in entry' if entry['parent_file_id'].nil?\n # download original file to temp folder\n do_transfer('receive',entry['parent_file_id'],entry['name'],@tmp_folder)\n end\n Log.log.info(\"source: #{entry['id']}: #{entry['path']})\")\n gen_infos.each do |gen_info|\n gen_info[:generator].generate rescue nil\n end\n if @access_remote\n # upload\n do_transfer('send',@previews_folder_entry['id'],local_entry_preview_dir)\n # cleanup after upload\n FileUtils.rm_rf(local_entry_preview_dir)\n File.delete(File.join(@tmp_folder,entry['name']))\n end\n # force read file updated previews\n if @option_folder_reset_cache.eql?(:read)\n @api_node.read(\"files/#{entry['id']}\")\n end\n rescue => e\n Log.log.error(\"#{e.message}\")\n Log.log.debug(e.backtrace.join(\"\\n\").red)\n end", "title": "" }, { "docid": "b66d9ded61d3570fc3cadd927b6f5f6a", "score": "0.60271025", "text": "def show\n @document = Document.friendly.find(params[:id])\n @contents = GitHub::Markdown.render_gfm(open(@document.link).read)\n\n mixpanel.track(\"Doc Page Viewed\", \"Page Title\" => @document.name )\n # prepare the suggested edit URL from the document.link\n @gitlink = @document.link.dup\n @gitlink = @gitlink.gsub(\"raw.githubusercontent\",\"github\")\n @gitlink = @gitlink.sub('master', 'blob/master')\n\n end", "title": "" }, { "docid": "fcd459d3562b101a7a3e437356007e79", "score": "0.60237944", "text": "def preview\n entity[:preview]\n end", "title": "" }, { "docid": "de1a7fe6a984d4329321fdad54e94a51", "score": "0.602041", "text": "def preview\n render :layout => false\n end", "title": "" }, { "docid": "de1a7fe6a984d4329321fdad54e94a51", "score": "0.602041", "text": "def preview\n render :layout => false\n end", "title": "" }, { "docid": "de1a7fe6a984d4329321fdad54e94a51", "score": "0.602041", "text": "def preview\n render :layout => false\n end", "title": "" }, { "docid": "de1a7fe6a984d4329321fdad54e94a51", "score": "0.602041", "text": "def preview\n render :layout => false\n end", "title": "" }, { "docid": "0c20e5faebee3afd740a75b243c2301f", "score": "0.601428", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n load_data_for_preview\n render '/monologue/posts/show',\n layout: @post.site.layout || '/layouts/monologue/application'\n end", "title": "" }, { "docid": "8436fcb400ee3b0b42fb243a53f203ca", "score": "0.6008517", "text": "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "title": "" }, { "docid": "9218b311c56591ced9c2ea5324b6fbbc", "score": "0.60068315", "text": "def content_preview\n self.description.present? ? self.description : self.content\n end", "title": "" }, { "docid": "da0f165b02d40db8aceb767095f24883", "score": "0.6002263", "text": "def ensure_edit_preview(path)\n referer = env['HTTP_REFERER']\n development_preview = Spontaneous.development? && site.model::Page.has_root?\n return true if development_preview || referer || params.key?('preview')\n home = find_page_by_path(path)\n # Need to handle the site initialisation where there is no homepage\n # so we want to force a load of the CMS to offer up the 'add home'\n # dialogue\n if home.nil?\n redirect NAMESPACE\n return false\n end\n redirect \"#{NAMESPACE}/#{home.id}/preview\"\n false\n end", "title": "" }, { "docid": "f0639e38889a52b5bf1d5cb589e963c7", "score": "0.5962078", "text": "def preview\n render '_preview', layout: 'xhr'\n end", "title": "" }, { "docid": "9d14e90df03167b5abc29735e85cf5fd", "score": "0.5961518", "text": "def preview\n @post = Thredded::Post.new(post_params)\n @post.postable = Thredded::Topic.friendly_find!(params[:topic_id])\n authorize @post, :create?\n render_preview\n end", "title": "" }, { "docid": "aa2cd97bf1c3bbcfc1ad66f1a6bb2500", "score": "0.59577894", "text": "def idea_preview\n @idea = Idea.find(params[:idea_id])\n @idea_chat_msgs = @idea.chat_messages.order(\"id DESC\").limit(IDEA_LAYOUT_PREVIEW_NUM_CHATS).reverse\n\n @curr_user_idea_link = current_user.user_ideas.where(\"idea_id =?\", @idea.id).first\n\n @has_idea = false;\n if current_user.ideas.exists?(@idea.id)\n @has_idea = true;\n end\n\n respond_to do |format|\n format.html {\n render :partial => \"idea_preview\"\n }\n end\n \n end", "title": "" }, { "docid": "c95da8b54429473f497c09639c197a9f", "score": "0.5954632", "text": "def display_preview?\n @display_preview\n end", "title": "" }, { "docid": "b31f6e281e5c32188de3858f7eb3861b", "score": "0.5905578", "text": "def preview(options={})\n building_message('preview', options)\n builder_for('preview').build!\n end", "title": "" }, { "docid": "3cf13f059144efae221e21660bbf59a2", "score": "0.5903437", "text": "def preview\n respond_to do |format|\n format.html { render action: 'new' }\n end\n end", "title": "" }, { "docid": "e5ebeffc56b6d762d4101b9f6d2bdef6", "score": "0.58981514", "text": "def preview_slug\n flash.keep\n \n redirect_to preview_version_path(:id => @draft_version.id)\n end", "title": "" }, { "docid": "73952bdc0c7a83ce6c9dd53bc2d5a1d8", "score": "0.5873774", "text": "def content_preview\n \"#{self.intro} \" + self.current_products.collect{|p| p.name}.join(\", \")\n end", "title": "" }, { "docid": "23b5998f3252fa190b33f462782282cd", "score": "0.58507663", "text": "def remove_preview\n @post.remove_preview\n render :edit, notice: \"Vignette supprimée\"\n end", "title": "" }, { "docid": "bda5db423a240d7b29b0d137d53bc412", "score": "0.58494216", "text": "def preview_script\n render js: render_script(preview: true)\n end", "title": "" }, { "docid": "fd2fa4ca5a6f36e56176aa5754265e76", "score": "0.58477634", "text": "def preview_text\n text = \"\"\n begin\n my_contents = my_description[\"contents\"]\n unless my_contents.blank?\n content_flagged_as_preview = my_contents.select{ |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select{ |content| content.name == content_to_take_as_preview[\"name\"] }.first\n unless preview_content.blank?\n if preview_content.essence_type == \"EssenceRichtext\"\n text = preview_content.essence.stripped_body.to_s\n elsif preview_content.essence_type == \"EssenceText\"\n text = preview_content.essence.body.to_s\n elsif preview_content.essence_type == \"EssencePicture\"\n text = (preview_content.essence.picture.name rescue \"\")\n elsif preview_content.essence_type == \"EssenceFile\" || preview_content.essence_type == \"EssenceFlash\" || preview_content.essence_type == \"EssenceFlashvideo\"\n text = (preview_content.essence.file.name rescue \"\")\n else\n text = \"\"\n end\n else\n text = \"\"\n end\n end\n rescue\n logger.error(\"#{$!}\\n#{[email protected]('\\n')}\")\n text = \"\"\n end\n text.size > 30 ? text = (text[0..30] + \"...\") : text\n text\n end", "title": "" }, { "docid": "657fc2d0deef98890dcc75e80bbc0035", "score": "0.5838639", "text": "def preview\n respond_to do |format|\n format.all { render \"show.full.erb\", :layout => 'veditor.full' }\n end\n end", "title": "" }, { "docid": "4d256febb8a8de08e4c01190f048853e", "score": "0.58290863", "text": "def uhook_new_asset_sidebar asset\n show_translations(asset, :hide_preview_link => true)\n end", "title": "" }, { "docid": "5163e4dcd15b9fd16d6e220e02cbca2c", "score": "0.58247554", "text": "def uhook_edit_asset_sidebar asset\n show_translations(asset, :hide_preview_link => true)\n end", "title": "" }, { "docid": "9fb93797e4b8bba94e2c11c98350dafa", "score": "0.5818913", "text": "def preview\n redirect_to get_path(@scene.preview.url)\n end", "title": "" }, { "docid": "07817aabec45396cc74761f7cbde0164", "score": "0.5816685", "text": "def preview\r\n\t\t\trender(\"option_#{self.id}_preview\")\r\n\t\tend", "title": "" }, { "docid": "4fb497098ed049dbf474f97d1922f567", "score": "0.5816126", "text": "def content_preview\n if description.present?\n description\n elsif headline.present?\n headline\n else\n name\n end\n end", "title": "" }, { "docid": "1a813741e06555db48ed9619db78379e", "score": "0.5812143", "text": "def build_preview\n trigger_build_hook :before_build\n build_cli.action Middleman::Cli::BuildAction.new(build_cli, {})\n trigger_build_hook :after_build\n end", "title": "" }, { "docid": "cbfaf93e8dfde016fae0186e7ae256c8", "score": "0.58038783", "text": "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "title": "" }, { "docid": "95f0cad6815ec7bc1cc762637264f758", "score": "0.5798274", "text": "def preview\n find_identifier\n @identifier[:html_preview] = @identifier.preview\n @is_editor_view = true\n render :template => 'ddb_identifiers/preview'\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.5798227", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.5798227", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.5798227", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "d2817fa7c25c8410f78e3ee33dbefad2", "score": "0.5787296", "text": "def fabricate!\n issue.visit!\n\n Page::Project::Issue::Show.perform do |issue|\n issue.add_design(filepath)\n end\n end", "title": "" }, { "docid": "cc395c791ed2a1faae1418b1fbfa9683", "score": "0.5784954", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "83578b846b8bc517db7f6b9ebea51034", "score": "0.57843256", "text": "def show\n define_titulo_pagina TITULO_VISUALIZACAO\n end", "title": "" }, { "docid": "83578b846b8bc517db7f6b9ebea51034", "score": "0.57843256", "text": "def show\n define_titulo_pagina TITULO_VISUALIZACAO\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.57748705", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.57748705", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.5759688", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.5759688", "text": "def show() end", "title": "" } ]
dcc5151f6f9c184cc320543ea81f45f5
"reference week", used in fugit for cron modulo notation
[ { "docid": "1abd705802fba7ef00ec84a61b3ab70d", "score": "0.0", "text": "def rday\n\n ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / DAY_S)\n .floor + 1\n end", "title": "" } ]
[ { "docid": "54f5c244b729713312644322cdcf0a27", "score": "0.7614943", "text": "def week() @week end", "title": "" }, { "docid": "f2cb3a06f55e1a77697325a02da87141", "score": "0.758877", "text": "def week; end", "title": "" }, { "docid": "514899eced8a8017a59b9e238ffcf490", "score": "0.7342992", "text": "def week(date) = date(date).cweek", "title": "" }, { "docid": "a719c60df811ac8002bb911a8113ae22", "score": "0.7214308", "text": "def week\n ((yday + change(:month => 1, :day => 1).wday - 1) / 7) + 1\n end", "title": "" }, { "docid": "15e4316dfbb31c0cc78b894826e15a95", "score": "0.7187023", "text": "def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end", "title": "" }, { "docid": "2b031c8e947727d633baa32244e19372", "score": "0.7127657", "text": "def week_ord\n ((day - wday) / 7) + 1\n end", "title": "" }, { "docid": "e7b9c5d2ebc166d7252e6479c51cd02b", "score": "0.71227396", "text": "def week\n end", "title": "" }, { "docid": "e7b9c5d2ebc166d7252e6479c51cd02b", "score": "0.71227396", "text": "def week\n end", "title": "" }, { "docid": "bb42ee0e5994cdac7fd19a51c3259ce9", "score": "0.71071845", "text": "def beginning_of_week; end", "title": "" }, { "docid": "6bac1faf98087cdc89b4583408dbb66d", "score": "0.70967263", "text": "def week\n cweek\n end", "title": "" }, { "docid": "ce1b21a4fc81856b57d0c7764dc9a8fa", "score": "0.70722634", "text": "def weeks; end", "title": "" }, { "docid": "6e7438cb27b688c13da4907f2ce4d2d1", "score": "0.70639515", "text": "def weeks ; self * 7.days ; end", "title": "" }, { "docid": "baa9b93bb08d627fc89f41fd97072af1", "score": "0.70563406", "text": "def week\n start = range.begin + (1 - (range.begin.wday%7))\n start...(start+7)\n end", "title": "" }, { "docid": "f84bde8449e3127547db04ff51f63215", "score": "0.70421135", "text": "def day_of_week; end", "title": "" }, { "docid": "583c22fd28b44a2597041e50b91c71d2", "score": "0.70169586", "text": "def beginning_of_week=(_arg0); end", "title": "" }, { "docid": "a6d191024302dbf08e73068d48a77fb7", "score": "0.6988797", "text": "def week_from_fixed(f_date)\n quotient(day_from_fixed(f_date), 7) + 1\n end", "title": "" }, { "docid": "700f12e187d0c0fd7dd1a60c80598044", "score": "0.6933933", "text": "def get_fo_week() self.fo_week = 7 * (fo.to_f / duration) unless (duration.to_i == 0) || (!fo) end", "title": "" }, { "docid": "d639c5638abdd184f5d57f1697da756c", "score": "0.6925855", "text": "def week\n days 7\n end", "title": "" }, { "docid": "d639c5638abdd184f5d57f1697da756c", "score": "0.6925855", "text": "def week\n days 7\n end", "title": "" }, { "docid": "651c885b0a26e9b9a3591a37a9442376", "score": "0.6822808", "text": "def day_in_week\n diw = @time.strftime(\"%w\").to_i\n if diw == 0\n diw = 6\n else\n diw -= 1\n end\n \n return diw\n end", "title": "" }, { "docid": "f6e885497c2031b50624c595d4d54f35", "score": "0.68130964", "text": "def beginning_of_week=(week_start); end", "title": "" }, { "docid": "f6e885497c2031b50624c595d4d54f35", "score": "0.68130964", "text": "def beginning_of_week=(week_start); end", "title": "" }, { "docid": "bbf1ffd1451003d6ea11ceb6acc1c820", "score": "0.67960423", "text": "def ws_unadj(number, week_start)\n\t\t((number + week_start + 5) % 7) + 1\n\tend", "title": "" }, { "docid": "8f56bbeff0630990ab025304cd1a303a", "score": "0.67909014", "text": "def beginning_of_week_default; end", "title": "" }, { "docid": "8f56bbeff0630990ab025304cd1a303a", "score": "0.67909014", "text": "def beginning_of_week_default; end", "title": "" }, { "docid": "b0423bf0f4d7a384aab4a577fd451cb7", "score": "0.67692727", "text": "def get_week(week)\n #check how much cweeks the current year has\n year = @@htwk[\"semester\"].scan /\\d+/\n cweek_count = Date.civil(year[0].to_i,12,31).cweek\n\n week = week.to_i\n\n if week > cweek_count and cweek_count != 1 then\n week -= cweek_count\n end\n week\nend", "title": "" }, { "docid": "b2bb502d40d97e315d53f241faf03116", "score": "0.6753745", "text": "def in_weeks; end", "title": "" }, { "docid": "b2bb502d40d97e315d53f241faf03116", "score": "0.6753745", "text": "def in_weeks; end", "title": "" }, { "docid": "a2015d48c8e623226b276276c354f4ad", "score": "0.6741492", "text": "def week(*weeks)\n TExp::Week.new(Util.normalize_weeks(weeks))\n end", "title": "" }, { "docid": "8cca87f8666455f17ea203e1c947db41", "score": "0.6737559", "text": "def full_week\n\tdate = $DATE\n\tday = $DAY\n\tmonth = $MONTH\n\tyear = $YEAR\n\n\t5.times do\n\t\t$TOGGL_API.create_time_entry({\n\t\t\t'pid' => '12822555',\n\t\t\t'duration' => 28800,\n\t\t\t'start' => $TOGGL_API.iso8601(DateTime.new(year,month,day,15,30,0)),\n\t\t\t'created_with' => 'Toggl Time Entry Script'\n\t\t})\n\t\tdate = date.next_day\n\t\tday = date.day\n\t\tmonth = date.mon\n\t\tyear = date.year\n\tend\nend", "title": "" }, { "docid": "f82c2db5c0748d05815782ff4bfa46ec", "score": "0.6728339", "text": "def next_week(num = 1)\n num = num.floor\n return self if num.zero?\n\n self + (7 * num)\n end", "title": "" }, { "docid": "e5345f6caf55dd940e84f1922834aaf8", "score": "0.6725807", "text": "def week(*weeks)\n TExp::Week.new(normalize_weeks(weeks))\n end", "title": "" }, { "docid": "1e1623761c5cc0bced7503a7473384c7", "score": "0.67234284", "text": "def week2\n week\n end", "title": "" }, { "docid": "7efdf4e7dc419ba8aac0d16a7ca82e30", "score": "0.67227054", "text": "def week\n @interval = 'week'\n self\n end", "title": "" }, { "docid": "b42e2a17a0c7ce679c4121bf4dbc90aa", "score": "0.671284", "text": "def get_week\n date.strftime('%W').to_i\n end", "title": "" }, { "docid": "6623f8554ba9c4dc93d79f3d27066e88", "score": "0.66995823", "text": "def biweek\n if cweek.odd?\n (cweek + 1) / 2\n else\n cweek / 2\n end\n end", "title": "" }, { "docid": "61154b19f8fac31c6efac3f761f5e89b", "score": "0.6688184", "text": "def week\n Week.compute_week\n render text: 'Week computed'\n end", "title": "" }, { "docid": "95521eec6ee8e3b865244b327a400e72", "score": "0.668768", "text": "def week_number\n\t\tstart_date.cweek\n\tend", "title": "" }, { "docid": "52231857ec66e7caeea7f4830484c2a5", "score": "0.66761416", "text": "def wday\n (jd + 1) % 7\n end", "title": "" }, { "docid": "837629210039a9f2717fd19fbae7c1ad", "score": "0.6674215", "text": "def week\n @year || date_part_or_default(:cweek) { Date.today.cweek }\n end", "title": "" }, { "docid": "e68de7e82d25b198317c1c7228177c30", "score": "0.66679573", "text": "def fweek\n month_text = StartMonth.first.month\n month_num = Date::MONTHNAMES.index(month_text)\n\n start_of_fy = Date.new(self.year, month_num, 1)\n\n if self < start_of_fy\n start_of_fy = start_of_fy - 1.year\n end\n\n diff = start_of_fy.cweek - 1\n \n if self.cweek > diff\n fweek = self.cweek - diff\n else\n fweek = self.cweek + (num_weeks(self.year) - diff)\n end\n fweek\n end", "title": "" }, { "docid": "f1903b95046c180b76c76a9e97642295", "score": "0.6664737", "text": "def start_week\n start_date.strftime('%W').to_i\n end", "title": "" }, { "docid": "f1903b95046c180b76c76a9e97642295", "score": "0.6664737", "text": "def start_week\n start_date.strftime('%W').to_i\n end", "title": "" }, { "docid": "85495a8457d5acfe473c7efe41f98ae0", "score": "0.6662505", "text": "def rweek\n\n ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / WEEK_S)\n .floor + 1\n end", "title": "" }, { "docid": "dd71721850bed301b2f55aea558ea763", "score": "0.6639099", "text": "def get_week_goal_days(current_week)\n \tend", "title": "" }, { "docid": "b9b96701859f655ed8c9c12d3934ee63", "score": "0.6634381", "text": "def week_day(day)\n DayWeek.find(day+1).description\n end", "title": "" }, { "docid": "807f4bfe8226764a48e283db744fa4a5", "score": "0.66323644", "text": "def beginning_of_week_default=(_arg0); end", "title": "" }, { "docid": "807f4bfe8226764a48e283db744fa4a5", "score": "0.66323644", "text": "def beginning_of_week_default=(_arg0); end", "title": "" }, { "docid": "0f425187106d1b587067c8a3bfc8b103", "score": "0.6628017", "text": "def of_week_as_s() WEEKDAYS_AS_STR[of_week_as_i] end", "title": "" }, { "docid": "1081dcfe9a3df3ed4842cf4529486bdb", "score": "0.66218776", "text": "def beginning_of_week\r\n days_to_monday = self.wday!=0 ? self.wday-1 : 6\r\n result = self - days_to_monday\r\n self.acts_like?(:time) ? result.midnight : result\r\n end", "title": "" }, { "docid": "e72d26cd2629993815a34fc563776cd4", "score": "0.66162384", "text": "def cfp_weeks\n if program\n program.cfp.weeks\n else\n 0\n end\n end", "title": "" }, { "docid": "4ad9561ce0da14dcd438e43674ba6dfb", "score": "0.65948206", "text": "def adjust_week_for_viewing_picks(week)\n time = Time.now\n if (time.wday <= 2)\n week = week.to_i - 1\n end\n \n return week\n end", "title": "" }, { "docid": "3680461d1d3efc740d201529fd287475", "score": "0.65943736", "text": "def of_week_as_i() date.wday + 1 end", "title": "" }, { "docid": "9a8173cdd9dc153a05634bb46c2275c8", "score": "0.6590828", "text": "def week\n PayPeriod.period(date, 7)\n end", "title": "" }, { "docid": "00e02677f9c173be4aa9a6ba537b743a", "score": "0.65737724", "text": "def weeks_since(weeks); end", "title": "" }, { "docid": "00e02677f9c173be4aa9a6ba537b743a", "score": "0.65737724", "text": "def weeks_since(weeks); end", "title": "" }, { "docid": "15f0d8938a4963f4c0a37c98cb50c0de", "score": "0.65718895", "text": "def weeks(language)\n\t\t\t\t::Chronos::Duration::Gregorian.new(0, self*7, 0, language)\n\t\t\tend", "title": "" }, { "docid": "a1d273ece717a0f1f8f3cd521c4178b3", "score": "0.6568217", "text": "def after_weeks(num)\n @base_date + num * 7\n end", "title": "" }, { "docid": "de39f09f239ce4cf497382abaa4fda5e", "score": "0.6559761", "text": "def of_week_as_sym() WEEKDAYS_AS_SYM[of_week_as_i] end", "title": "" }, { "docid": "fd2870f6828c4d864ae8cddca8a0a5c4", "score": "0.6556727", "text": "def weeks\n self * 604800\n end", "title": "" }, { "docid": "595972c175a9378feeb0722a33ed65c8", "score": "0.6553741", "text": "def day_of_week\n DAYS[(@day_of_year - 1) % 5]\n end", "title": "" }, { "docid": "c33e087326a5ca008e1c1c6261d242c5", "score": "0.6518629", "text": "def week\n ArelExtensions::Nodes::Duration.new \"w\", self\n end", "title": "" }, { "docid": "597540e8f847d8d393bfbf2c67b6d126", "score": "0.65168995", "text": "def week_of(date)\n (date.day - 1) / 7 + 1\n end", "title": "" }, { "docid": "e6a08b88b97bd958bf2529107e908fb8", "score": "0.65010947", "text": "def calendar_week(time)\n # %W calculates weeks based on starting Monday and not Sunday, %U is Sunday and %V is ???.\n # This produces year-week string.\n return 30.days.ago.strftime('%Y-%W') if time.nil? || !time.is_a?(Time)\n\n time.strftime('%Y-%W')\n end", "title": "" }, { "docid": "66bcee8846b379023b0a9f2f3dab77d9", "score": "0.6486793", "text": "def get_week_workout_days(current_week)\n \tend", "title": "" }, { "docid": "39b28a9762a4402d1912bd4795dc2e9d", "score": "0.64838547", "text": "def beginning_of_fall_semester\n week = 4\n\n date = Chronic.parse(\"#{week}th thursday last august\")\n while date\n week += 1\n date = Chronic.parse(\"#{week}th thursday last august\")\n end\n\n Chronic.parse(\"#{week - 1}th thursday last august\").to_datetime\n end", "title": "" }, { "docid": "7d390e8f4b3369dd4827f0de708d2b01", "score": "0.6482293", "text": "def ws_adj(number, week_start)\n\t\t((number - week_start) % 7) + 1\n\tend", "title": "" }, { "docid": "e978c9ae5cad8cea3509c0d164074c85", "score": "0.6479085", "text": "def week_adjustment(next_wday)\n next_wday <= base_wday ? 7 : 0\n end", "title": "" }, { "docid": "03f915f998892c86523a2f21f6dd245a", "score": "0.64751226", "text": "def week? = unit == 'week'", "title": "" }, { "docid": "509e9230259543a642bbfffa1ccac4ed", "score": "0.64675397", "text": "def first_wday\n @first_dow ||= (7 - 1)%6 + 1\n end", "title": "" }, { "docid": "e5e523cc5a3026ffaee3abdb03c79770", "score": "0.64599526", "text": "def set_training_start\n @trainingStart = @current_formatted_marathon_date - 125\n @week_one = @trainingStart.strftime(\"%W\")\nend", "title": "" }, { "docid": "5c18ffe255f65e573583d0e22836f0ca", "score": "0.6458705", "text": "def assign_week\n self.week ||= Checkin.week_integer_for_time(self.created_at || Time.current, self.startup.present? ? self.startup.checkin_offset : Checkin.default_offset)\n true\n end", "title": "" }, { "docid": "0c6e15bf88606709f063acc0e7ddba56", "score": "0.6452767", "text": "def day_of_week\n Date::DAYNAMES[self.day]\n end", "title": "" }, { "docid": "52c28d5c754411c957c851d3243f1b6c", "score": "0.644726", "text": "def day_of_the_week(time)\n Date::DAYNAMES[time.wday]\nend", "title": "" }, { "docid": "18149a6eb52414684ea11dfcc65d815f", "score": "0.64390326", "text": "def next_weekday; end", "title": "" }, { "docid": "18149a6eb52414684ea11dfcc65d815f", "score": "0.64390326", "text": "def next_weekday; end", "title": "" }, { "docid": "1670b6a122620ca0e3f1cb757907834d", "score": "0.6434683", "text": "def week_of(year,month,day)\r\n date = Runt::PDate.day(year,month,day)\r\n @time_range = Runt::DateRange.new(date, date + 6)\r\n end", "title": "" }, { "docid": "4a324d062022824c9636c80e357a309b", "score": "0.6432316", "text": "def next_fortnight(reference_date=nil)\n beginning_of_fortnight(reference_date) + 2.weeks\n end", "title": "" }, { "docid": "68a8b60ed6062141e6643f6aea39f379", "score": "0.6427709", "text": "def format_week week\n label = \"\"\n label += week.first.strftime \"%b %-d\"\n label += week.first.strftime \", %Y\" if week.year_differs?\n label += DATE_RANGE_SEPARATOR\n label += week.last.strftime \"%b \" if week.month_differs?\n label += week.last.strftime \"%-d, %Y\"\n end", "title": "" }, { "docid": "dbd36c36d354167b55abb2588dab2fc2", "score": "0.6426889", "text": "def saptawara_from_fixed(f_date)\n (day_from_fixed(f_date) % 7) + 1\n end", "title": "" }, { "docid": "61c610c71f4113c09324310008a26033", "score": "0.6426445", "text": "def fortnights ; self * 2.weeks ; end", "title": "" }, { "docid": "a7c47227f3105d27cc3c19546af5d384", "score": "0.6424658", "text": "def week_of(date)\n range date...(date+7)\n end", "title": "" }, { "docid": "c08545dd43e22218ebf7ce0a545c33f7", "score": "0.6421338", "text": "def number\n if Week.start_of_week == :monday\n @start.cweek # Starts on Monday\n else\n (@start + 1.day).cweek # Starts on Sunday\n end\n end", "title": "" }, { "docid": "b5bacd8a7837be0f6ba37dca1f0b7e52", "score": "0.6414151", "text": "def test_16_format_week0\n calendar = Cal.new(4, 2013)\n assert_equal(\" 1 2 3 4 5 6\", calendar.format_week(0, 4, 2013))\n end", "title": "" }, { "docid": "ae394266e881cd9308ec5b7241580036", "score": "0.6409599", "text": "def diweek(sym)\n Runt::DIWeek.new(DAYS[sym])\n end", "title": "" }, { "docid": "81c20237b6a36eab28458b7c96957c1b", "score": "0.6400033", "text": "def sadwara_from_fixed(f_date)\n (day_from_fixed(f_date) % 6) + 1\n end", "title": "" }, { "docid": "2939e2453e8c0e88dc97ef314cf0b8d3", "score": "0.6378699", "text": "def start_of_week\n @start_of_week ||= (start_of_month + (7 * (week - 1)))\n end", "title": "" }, { "docid": "ecea4b069af23760a36ca04abf590559", "score": "0.6367395", "text": "def prev_occurring(day_of_week); end", "title": "" }, { "docid": "ecea4b069af23760a36ca04abf590559", "score": "0.6367395", "text": "def prev_occurring(day_of_week); end", "title": "" }, { "docid": "d04162879474efa4392f36adf28b8661", "score": "0.63618743", "text": "def last_week\n self - 7\n end", "title": "" }, { "docid": "e45536b5f56069585a531566e119e776", "score": "0.6352517", "text": "def cweek\n start = Date.civil(year, 1, 1)\n ((jd - start.jd + start.cwday - 5) / 7.0).ceil\n end", "title": "" }, { "docid": "628e6a2697aa7ea8508a88854bf3099d", "score": "0.635186", "text": "def week(date, base=nil)\n date = _to_date_for_note(date)\n y,m,d = date.cal_date\n dow = d*0 == 0 ? (d<=28 ? (d-1) % 7 : d-22) : 8\n length = (base||date).length(When::MONTH) - 21\n index = (length == 7 || m == 13) ? dow : IndexOfWeek[dow]\n {:value=>@days_of_week[dow], :position=>[index, length]}\n end", "title": "" }, { "docid": "cc6fcf653f289f4df3e263ec09f4e4a6", "score": "0.6349265", "text": "def beginning_of_week(start_day = T.unsafe(nil)); end", "title": "" }, { "docid": "cc6fcf653f289f4df3e263ec09f4e4a6", "score": "0.6349265", "text": "def beginning_of_week(start_day = T.unsafe(nil)); end", "title": "" }, { "docid": "d2753cee9c3b0b069cca801e93491e1f", "score": "0.6343008", "text": "def end_of_fortnight(reference_date=nil)\n (beginning_of_fortnight(reference_date) + 1.week).end_of_week\n end", "title": "" }, { "docid": "84af4f04808e881986b5e13036ab237e", "score": "0.634003", "text": "def cweek\n @cweek || commercial[1]\n end", "title": "" }, { "docid": "3370e656ad3b410f2fe1105e8f7a303e", "score": "0.6337202", "text": "def weekend_special()\n \n end", "title": "" }, { "docid": "efe9f9fbac1605cb61c5a6840c21ca87", "score": "0.63329446", "text": "def wday; end", "title": "" }, { "docid": "2e946db4d474a8739c2dcb7c61f04c56", "score": "0.63300246", "text": "def weeks\n @scope = 1.week\n reset_on_base 7\n \n return self\n end", "title": "" }, { "docid": "532d00e62cbf9a9242850545f58e901d", "score": "0.63299304", "text": "def week_count\n date = Date.new(index, 12, 31)\n \n date = date - 7 if date.cweek == 1\n \n date.cweek\n end", "title": "" }, { "docid": "656ebc451a92753657dee69d6e451f85", "score": "0.6326415", "text": "def getDayOfWeek(totaldays)\n\treturn totaldays % 7\nend", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "8f2b11d8523251b574d7e0bb6eb63217", "score": "0.0", "text": "def qline_params\n params.require(:qline).permit(:qgroup_id, :cat, :item, :quantity, :unit, :rate, :price, :vat_id, :vat_due, :total, :note, :linetype, :line_order)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6887521", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.67666084", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.671326", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6705381", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.66164786", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.66156906", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.65888846", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6575757", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6572969", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572365", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.65321475", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.65129966", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.65128386", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.64990044", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.6491305", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6489574", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6476191", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.645836", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.64389294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6431918", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.642512", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.63736504", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6336598", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6319846", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.63113743", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.6290657", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.62724084", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6266407", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.6265082", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6262119", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6258491", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6243215", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62372005", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.6226018", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.62250364", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.62147176", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.62035644", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.61931455", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.618889", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6180647", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.6180104", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175616", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.61731255", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.61730814", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.6172509", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.6172386", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6163843", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.6146083", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.6145458", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.61444825", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.61364955", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.61280644", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6113519", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6112032", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6106793", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61061025", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6105072", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6092409", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.60909486", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.60895824", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6083517", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.6081807", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6079226", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077248", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.60767365", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.60746986", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.60703695", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6070048", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.6069783", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.6063365", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.6047726", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.60399187", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.6033119", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6029004", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.6025425", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9ca24439626d26d2f35e1ed3a4123c1a", "score": "0.0", "text": "def flat_params\n params.require(:flat).permit(:name, :address)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74939764", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6955084", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69205093", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6891745", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67835", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6742323", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.66817623", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6635011", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66280156", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66248137", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.6561888", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6489396", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64763314", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64523757", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.63985187", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6379674", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.636227", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6337434", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6335199", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.63245684", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63194174", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6313726", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63134545", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6304745", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6299775", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.62989247", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.6294581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62786806", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.62717277", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.62658894", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6254184", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.625358", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62506795", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.62342095", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62271494", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62269396", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226112", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6224588", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.62000334", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.619004", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6182373", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.61777395", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61629707", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160594", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61548823", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6153307", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61359197", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61332136", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6117462", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.6113605", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61102164", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6085571", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.608522", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6084166", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.60775006", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6073921", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6067218", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065894", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6064601", "text": "def need_params\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6064436", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.60631806", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6061806", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6060409", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6056974", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6047898", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.604599", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041073", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60329294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6029157", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.602574", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.60209215", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.60183305", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6016583", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.6013783", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.6007249", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6005397", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6003378", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6001586", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.5999887", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.5998492", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.5992997", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5992662", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.59919816", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59903735", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59890324", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
a8d56a9a63f1e843fcdcc4a2b6274229
Register the macro under the given name.
[ { "docid": "c9da75d2829755d3e3f9eb15322e5613", "score": "0.81865513", "text": "def register(name)\n Assertion.register_macro name, self\n end", "title": "" } ]
[ { "docid": "279a624ffa96cc098af9f719c0a01c3c", "score": "0.7765948", "text": "def register(name, *args, &block)\n macro = Macro.new(name, args: args, block: block)\n super(name, macro, call: false, &nil)\n self\n end", "title": "" }, { "docid": "cab9077410f5ce2d2da0b0ba7562207b", "score": "0.75582796", "text": "def register_macro(name, assertion_macro)\n macros[name.to_s] = assertion_macro\n end", "title": "" }, { "docid": "011de0b5f4b53e9d57fe1d69cd6d4bed", "score": "0.716265", "text": "def macro(name, *args)\n (macros.key?(name) ? macros[name] : Macros[name]).with(args)\n end", "title": "" }, { "docid": "b47b42fc9fcc69ddc7c87ca6508456b0", "score": "0.7015658", "text": "def register(name)\n self.registered_name = name.to_s\n self.registered_ns = namespace\n @@registrations[[self.registered_name, self.registered_ns]] = self\n end", "title": "" }, { "docid": "b47b42fc9fcc69ddc7c87ca6508456b0", "score": "0.7015658", "text": "def register(name)\n self.registered_name = name.to_s\n self.registered_ns = namespace\n @@registrations[[self.registered_name, self.registered_ns]] = self\n end", "title": "" }, { "docid": "34c92ed91e92fa5719d32931e4414dfb", "score": "0.69971734", "text": "def register( name )\n RegisterValue.new(name , infer_type(name) ).set_compiler(compiler)\n end", "title": "" }, { "docid": "fe9c83eb718c6fc29e61589003ec8968", "score": "0.6823102", "text": "def macro(name, &block)\n name = name.to_sym if name.is_a?(String)\n @@available_macros[name] = @@desc || ''\n @@desc = nil\n raise \"Can not create a macro without a block!\" unless block_given?\n Definitions.send :define_method, \"macro_#{name}\".downcase, &block\n end", "title": "" }, { "docid": "621e43b801013996053e898e6b328b58", "score": "0.67320985", "text": "def batch_macro(name, &blk)\n raise \"#{name} is invalid macro name (duplicate or defined method)\" if respond_to?(name.to_sym)\n eigenclass = class << self\n self\n end\n @macros[name] = blk\n eigenclass.send(:define_method, name, &blk)\n end", "title": "" }, { "docid": "cf70837d6c54ec34db29bc2f8c136918", "score": "0.6728974", "text": "def macro(name, *registers, &mblock)\n raise Syntax, \"Macro may be defined only in main program context.\" if @contexts.size > 1\n raise Syntax, \"A label: #{name} is already allocated.\" if @labels.has_key?(label.to_s)\n m = lambda do |*args, &block|\n if args.first.is_a?(Symbol)\n n = args.shift\n end\n ns(n) do |eoc|\n registers.each {|rr| push rr}\n mblock.call eoc, *args, &block\n registers.reverse.each {|rr| pop rr}\n end\n end\n define_singleton_method(name.to_sym, &m)\n end", "title": "" }, { "docid": "882044991e734503ea19ee45a8cf6070", "score": "0.67215514", "text": "def macro(name, &proc)\n @macros[@visibility] ||= {}\n @macros[@visibility][name.to_sym] = proc\n end", "title": "" }, { "docid": "798e75ca7467c9d25ce077815090c310", "score": "0.65978885", "text": "def register(name)\n System.manager.delete(@registered) if @registered\n @registered = name.to_sym\n System.manager[@registered] = self\n self\n end", "title": "" }, { "docid": "eb55a5f5cc4c23c1c3a4e0f70c6bd51e", "score": "0.65731514", "text": "def register( name )\n registry[name] ||= self\n end", "title": "" }, { "docid": "480661eb37c4f93572130aa14ce830dd", "score": "0.657167", "text": "def define(macro)\n add_code(\"#define #{macro}\")\n end", "title": "" }, { "docid": "e5671967deef8ed188d0995837c6ece3", "score": "0.6558602", "text": "def create_macro(name, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"macros\",options)\n if response['success']\n return response['results']['macro']\n else\n return response\n end\n end", "title": "" }, { "docid": "3eec877d033914d460c1d0530f5a186c", "score": "0.6470992", "text": "def register(name, &block)\n registered[name] = block\n end", "title": "" }, { "docid": "9ac0af5981274d6473c8ce14f45645f2", "score": "0.6378858", "text": "def register(name, klass)\n # convert camelCase name to underscore style\n key = underscore_name(name)\n\n # warn if replacing an existing class\n if $VERBOSE and (existing = @registry[key])\n warn \"warning: replacing registered class #{existing} with #{klass}\"\n end\n\n @registry[key] = klass\n key.dup\n end", "title": "" }, { "docid": "7c72d4f19c12f4698a1e786cc0c39e16", "score": "0.63781524", "text": "def register_by_name(register=true)\n opts[:register_by_name] = register\n end", "title": "" }, { "docid": "9b5fdb5fdfe0cdd89506f0b2165d06be", "score": "0.6375598", "text": "def find(macro_name)\n Registry.at('.macro.' + macro_name.to_s)\n end", "title": "" }, { "docid": "07fa5d1a1dceab9d31bbb9455c9eb9ce", "score": "0.63257045", "text": "def register_name(name, klass = self)\n @@types[name] = klass\n end", "title": "" }, { "docid": "8777de67e097d20c56351c0e94e5a482", "score": "0.62960863", "text": "def output_macro_name(macro_name, arg_count, return_type)\n putd \"#define \" + macro_signature_for(macro_name, arg_count, return_type)\nend", "title": "" }, { "docid": "03a34a4b024dded6f7159c0d3d085af7", "score": "0.6277763", "text": "def macro\n @macro\n end", "title": "" }, { "docid": "b16453d558c2011085d98bfe24474548", "score": "0.6245429", "text": "def register(name, api)\n @names[name] = api\n end", "title": "" }, { "docid": "4a81004d0b6aae967b6cc505d847a382", "score": "0.62192154", "text": "def register(name, &block)\n raise ArgumentError, 'Missing name' unless name\n raise ArgumentError, 'Missing block' unless block\n\n @registrations ||= {}\n @registrations[name] ||= []\n @registrations[name] << block\n end", "title": "" }, { "docid": "80c0ad2137b9bc1d2eeb8d893d3fd889", "score": "0.6179321", "text": "def initialize(macro, name)\n @macro = macro\n @name = name\n end", "title": "" }, { "docid": "54766e9f9bff5e7e0a19854f06bc6e1e", "score": "0.6155812", "text": "def register_utility(name)\n name = name.to_sym\n OmfRc::ResourceFactory.register_utility(name)\n end", "title": "" }, { "docid": "17cd3b78dd9843c3356d92b23f2656b8", "score": "0.61022234", "text": "def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end", "title": "" }, { "docid": "17cd3b78dd9843c3356d92b23f2656b8", "score": "0.61022234", "text": "def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end", "title": "" }, { "docid": "17cd3b78dd9843c3356d92b23f2656b8", "score": "0.61022234", "text": "def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end", "title": "" }, { "docid": "a91c8df22330097e774ab3dc7a418ace", "score": "0.61013424", "text": "def register! name, namespace = @default_registration_namespace, &callback_proc\n @@registration_guard.synchronize do\n raise Errors::RegistrationConflictError if registered_in_namespace? name, namespace\n @registered_callbacks[namespace] ||= Hash.new\n @registered_callbacks[namespace][name] = callback_proc\n end\n end", "title": "" }, { "docid": "5a74790636be2f26179ced39212b4535", "score": "0.60962355", "text": "def start_macro(name, args, lines)\n\t\tend", "title": "" }, { "docid": "c1c5b7b95e32e9c1a306e1b53bb31fe3", "score": "0.6086257", "text": "def register(name, namespace=nil, &block)\n # If we've already got a matching extension that passed the\n # version check, bail out.\n return if registered.has_key?(name.to_sym) &&\n !registered[name.to_sym].is_a?(String)\n\n registered[name.to_sym] = if block_given?\n block\n elsif namespace\n namespace\n end\n end", "title": "" }, { "docid": "cd058a1a50a0ef269a85128ae525413a", "score": "0.606732", "text": "def register( definition, name = nil )\n name = definition.name unless name\n name = @name_cleaner.call(name) if @name_cleaner\n assert( name, \"unable to find a name to use\", :definition => definition )\n \n unless @registry.member?(name) && @registry[name].object_id == definition.object_id then\n check{ assert([email protected]?(name), \"[#{@owner_description.to_s}] already has [#{@member_description.to_s}] named [#{name}]\", :registered => @order.join(\", \") ) } \n @registry[name] = definition\n @order << name\n @chain.register(definition, name) if @chain\n end\n \n definition\n end", "title": "" }, { "docid": "8f6933593ae105f4feaf94f72db056b0", "score": "0.6051697", "text": "def register(register_name, fake)\n register_name = register_name.to_sym\n if registered?(register_name)\n warn \"WARNING: Overwriting a fake for an already registered name #{register_name.inspect}.\"\n end\n registered_fakes[register_name] = Fakery::Fake.cast(fake)\n end", "title": "" }, { "docid": "08c04f3a42aac8c4fdaf7b7d03640bba", "score": "0.60446966", "text": "def register(name, metric)\n @registry.register(name, metric)\n end", "title": "" }, { "docid": "6e4e13874569bddb09caf6b434806041", "score": "0.6040423", "text": "def macro_definition_for(name)\n ALIASES[:by_alias][name.to_sym]\n end", "title": "" }, { "docid": "68698df51ceddd2ddd3e5511e685d990", "score": "0.60229063", "text": "def register(name, cls); end", "title": "" }, { "docid": "fc76a2824ef8b5d502e060cfc2338632", "score": "0.5956194", "text": "def register(name, mod, options = EMPTY_HASH)\n type(options.fetch(:type)).register(name, mod, options)\n end", "title": "" }, { "docid": "5fa2eaf2532442cf5b5068d76b6afed8", "score": "0.5920949", "text": "def register_hook(name, hook)\n hooks[name.to_s.downcase.strip.to_sym] << hook\n end", "title": "" }, { "docid": "47c0564b8086f9266b67000fc21ce330", "score": "0.59005386", "text": "def macro(name, content, args = {})\n # separate the macro name from the argument list with a colon\n arguments = args_string(args).sub('|', ':')\n \"\\n\\n{#{name}#{arguments}}#{content}{#{name}}\"\n end", "title": "" }, { "docid": "9e4fc0d2fb61d8e89240bec510c24b0a", "score": "0.5898932", "text": "def register(name, ss = Array.new)\n l = new(name, ss)\n const_set(l.to_s.to_sym, l)\n end", "title": "" }, { "docid": "b06b6900add1f65066143eccdb29adc4", "score": "0.58733565", "text": "def register(name, &blk)\n @callback[name] = blk\n end", "title": "" }, { "docid": "3491b568c7ca73c214fb32e3af1c23b0", "score": "0.5869536", "text": "def macro; end", "title": "" }, { "docid": "f82f9f884133bd7f3139770640339066", "score": "0.5849363", "text": "def register(name)\n observer = Hero::Observer.new(name)\n formula_class_name = name.to_s.strip.gsub(/\\s/, \"_\").gsub(/[^a-z_]/i, \"\").split(/_/).map(&:capitalize).join\n formula_class_name = \"HeroFormula#{formula_class_name}\"\n formula_class = Class.new(Hero::Formula)\n if Object.const_defined?(formula_class_name)\n Object.send(:remove_const, formula_class_name)\n end\n Object.const_set(formula_class_name, formula_class)\n formula = formula_class.instance\n formula.add_observer(observer)\n formula.instance_eval do\n @name = name\n @observer = observer\n end\n formulas[name] = formula\n end", "title": "" }, { "docid": "4ecbeca6797863e5efca60f0bd3cbf90", "score": "0.5830539", "text": "def register_preprocessor(*args, &block); end", "title": "" }, { "docid": "4ecbeca6797863e5efca60f0bd3cbf90", "score": "0.5830539", "text": "def register_preprocessor(*args, &block); end", "title": "" }, { "docid": "eeaa43deb78cdf54a9ab51f706823cc6", "score": "0.5811157", "text": "def register_plugin(name)\n @name = name\n Cyclid.plugins.register(self)\n end", "title": "" }, { "docid": "aa3f3c63f9a98cdb7267a0be0857e0c3", "score": "0.5803964", "text": "def register(name, type)\n name = name.to_sym\n if @types.has_key?(name)\n @types[name] << \"; \" << type\n else\n @types[name] = type\n end\n end", "title": "" }, { "docid": "211233c9333a74a232958c2ae74dd489", "score": "0.57915455", "text": "def register(name)\n if self.name.empty? then\n raise AnyError, \"Cannot register with empty name.\"\n else\n # Sets the hdl-like access to the type.\n obj = self # For using the right self within the proc\n High.space_reg(name) { obj }\n end\n end", "title": "" }, { "docid": "c757dcec8d60840ba1a2a516ce6a60e4", "score": "0.577105", "text": "def register(cmd_name, args, desc, &blk)\n @subs ||= {}\n @subs[cmd_name] = Cmd.new(args, desc, blk)\n end", "title": "" }, { "docid": "e2758f9830a764d02501c9a5ebe9095f", "score": "0.576542", "text": "def register method_name, *signature, on: Template::Context\n setup on, method_name, signature\n insert Registry.instance\n end", "title": "" }, { "docid": "7e61ce84f9a3958955b806e57b7cd7e9", "score": "0.57594633", "text": "def register_file(name)\n @included_files << Pathname.new(name).expand_path.to_s\n end", "title": "" }, { "docid": "068992452897364407a0c0d2853ffcb2", "score": "0.5743348", "text": "def run_macro(name_or_id)\n if req = client.request('tickets/macro', :ticket => @attributes['reference'], :macro => name_or_id.to_s)\n set_attributes(req)\n true\n else\n false\n end\n end", "title": "" }, { "docid": "7be50472d58068044984b033412230c1", "score": "0.57388407", "text": "def method_name\n 'usermacro'\n end", "title": "" }, { "docid": "2303f9948fb408ee9579ca2b36067ef2", "score": "0.5726745", "text": "def register(name, instance); end", "title": "" }, { "docid": "ad58f6548cad235aaebf59fdcbe6925b", "score": "0.57241875", "text": "def register(name, klass)\n adapter_map.update(name.to_s.underscore => klass)\n self\n end", "title": "" }, { "docid": "26244922c2174764d565de2cce7646ff", "score": "0.57240653", "text": "def register(name, &block)\n probes[name.to_s] = block\n self\n end", "title": "" }, { "docid": "cad16ccc5dda02789f6cee290caa1930", "score": "0.5704066", "text": "def register_processor(name, processor)\n @known_processors ||= {}\n @known_processors[name.to_s] = processor\n end", "title": "" }, { "docid": "11c872a98efa850b03d03b09313822eb", "score": "0.5703466", "text": "def register_variable(name, value)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "abcea6c7d2e62b89befab4aa811b3f86", "score": "0.5699237", "text": "def register_hook(name, block)\n return clear_hooks(name) if block.nil?\n\n @hooks ||= {}\n @hooks[name] ||= []\n\n block = Array(block)\n @hooks[name].concat(block)\n end", "title": "" }, { "docid": "68e16cb56acf5986954602706dbb18a2", "score": "0.5683087", "text": "def register(step_name, step)\n \tstep_registry.store(step_name.to_s, step)\n end", "title": "" }, { "docid": "50331af90a93fab97b85f2dcd37a2a5d", "score": "0.5674378", "text": "def register_hook(name, block)\n return clear_hooks(name) if block.nil?\n\n block = Array(block)\n @hooks[name].concat(block)\n end", "title": "" }, { "docid": "58d4c24181ac1070532847797075de69", "score": "0.56660426", "text": "def macro(id)\n response = get(\"macros/#{id}\")\n response.macro\n end", "title": "" }, { "docid": "778793c9d262f393130d01f9c2f2ee22", "score": "0.56659216", "text": "def register(name, plugin = false)\n Vedeu.log(type: :debug,\n message: \"Attempting to register plugin: #{name}\")\n\n plugins << plugin if plugin && not_loaded?(name)\n end", "title": "" }, { "docid": "3a95e7d3800605d9f666ab2621b31ffd", "score": "0.56474525", "text": "def register(name, namespace=nil, &block)\n # If we've already got an extension registered under this name, bail out\n raise \"There is already an extension registered with the name '#{name}'\" if registered.key?(name.to_sym)\n\n registered[name.to_sym] = if block_given?\n block\n elsif namespace && namespace.ancestors.include?(::Middleman::Extension)\n namespace\n else\n raise 'You must provide a Middleman::Extension or a block that returns a Middleman::Extension'\n end\n end", "title": "" }, { "docid": "26043549cfdc509ba1c8e02b305dec0a", "score": "0.5606544", "text": "def register(name, processor, executor = Processor::Executor::NULL)\n coerced_name = name.to_sym\n\n registry[coerced_name] =\n Processor::Builder.new(coerced_name, processor, executor)\n\n self\n end", "title": "" }, { "docid": "a0ec35b1cacadbbaf639e62e62f32f54", "score": "0.5597237", "text": "def register_name!\n if i = class_names.index(self)\n class_names.delete(i)\n end\n class_names[class_name] = self\n class_name\n end", "title": "" }, { "docid": "5a63e67e6586d8e7fc4f173cb22a9dd0", "score": "0.55955064", "text": "def add_define(name)\n $defs.push(\"-D#{name}\")\nend", "title": "" }, { "docid": "7d8015f735634d760223a2f292ed0a16", "score": "0.5586363", "text": "def define name, &block\n define_method(name, &block)\n end", "title": "" }, { "docid": "ccc691db80bddf21aa1f306c36c886f7", "score": "0.5585458", "text": "def register(name, test, cli = nil)\n if map.key?(name)\n raise ArgumentError, \"Another test has already claimed the name #{name.inspect}\"\n end\n\n raise ArgumentError, \"Name must be a symbol\" unless name.is_a?(Symbol)\n map[name] = test\n cli_map[name] = cli if cli\n end", "title": "" }, { "docid": "744a050841fe1e68e3065741ee7e70b1", "score": "0.55766976", "text": "def register(name, schema)\n if @schemas.key?(name)\n warn \"#{name} was already registered to #{@schemas[name]}\"\n end\n @schemas[name] = schema\n schema\n end", "title": "" }, { "docid": "f05bb14f30a9466fb34bb3a34d5926fa", "score": "0.55740386", "text": "def register(name, factory: nil, &block)\n name = normalize_name(name)\n\n if @factories.has_key?(name)\n raise ArgumentError.new(\"You tried to re-register a name that already has a factory registered: #{name.inspect}\")\n end\n\n factory ||= block\n @factories[name] = factory\n\n self\n end", "title": "" }, { "docid": "4861979e538ea6faf48ff90c2fc57652", "score": "0.55562896", "text": "def key(name, macro:, &block)\n raise ArgumentError, \"Key +#{name}+ is not a symbol\" unless name.is_a?(::Symbol)\n\n set_type(name, Types::Any.meta(default: true))\n\n macro = macro.new(\n name: name,\n compiler: compiler,\n schema_dsl: self,\n filter_schema_dsl: filter_schema_dsl\n )\n\n macro.value(&block) if block\n macros << macro\n macro\n end", "title": "" }, { "docid": "f551df0cdf153928c9c9980187bcba29", "score": "0.5551237", "text": "def register(path, name, options = {}, &block)\n path = path.to_s\n name = name.to_s\n prefix = path[-1]\n\n insure_path(path, name, options)\n return unless block_given?\n\n calls[path] = Command.new(prefix, name, options, &block)\n end", "title": "" }, { "docid": "2c7ba8973d0c817204906964a06012c7", "score": "0.5546986", "text": "def register_hook(name, block)\n return clear_hooks(name) if block.nil?\n\n @hooks ||= {}\n @hooks[name] ||= CallableArray.new\n @hooks[name] << block\n end", "title": "" }, { "docid": "bdeee821a1305dc31285c8b6f9afdeda", "score": "0.5546062", "text": "def register(name, mod)\n file_path = RUBY_ENGINE == 'opal' ? '' : caller[0][/[^:]*/].sub(DIR_PATH, '').sub(Dir.pwd, '')[1..-1]\n @plugins[name] = { mod: mod, file_path: file_path }\n end", "title": "" }, { "docid": "4837805b335b1c5ca32907421b6c9f84", "score": "0.5544185", "text": "def macro_aliases_for(name)\n ALIASES[:by_def][name.to_sym]\n end", "title": "" }, { "docid": "275a56985f24ba46854f62b9bd653220", "score": "0.5543176", "text": "def register(sym, *args, &block) # :doc:\n if m = caller.first.match(/^([^:]+:\\d+)/)\n source_fn = m[1]\n end\n\n name = usage = sym.to_s\n\n if Hash === args.last\n bangs = args.pop\n desc = bangs.delete(:desc)\n else\n bangs = {}\n end\n\n desc = '' unless desc\n\n if block.nil?\n source = args.pop.strip\n sql = squeeze!(source.dup)\n\n argstr = args.join(',')\n usage << \"(#{argstr})\" unless argstr.empty?\n\n blockstr = %{lambda{|#{argstr}|%{#{sql}} % [#{argstr}]}}\n block = Thread.new{ eval(blockstr) }.value\n args = []\n else\n source = nil\n usage << params(name, block)\n end\n\n @registrations[sym] = Registration.new(name, args, bangs, block, usage,\n desc, source, source_fn)\n end", "title": "" }, { "docid": "508a5abbfc503665229d51ece44b1dae", "score": "0.55363476", "text": "def register_namespace(name, uri, flush = true)\n if namespaces[name]\n raise ArgumentError, \"The namespace #{name.inspect} already exists\"\n end\n\n namespaces[name] = Namespace.new(:name => name, :uri => uri)\n\n flush_namespaces_cache if flush\n end", "title": "" }, { "docid": "b15e56f8ecc0732b782e3ca74903d01d", "score": "0.552301", "text": "def register(name, clazz)\n environments << [name, clazz]\n (class << self; self; end).\n send(:define_method, name) do |*args|\n clazz.new(*args)\n end\n end", "title": "" }, { "docid": "a56f6b0e4bba2b1aa5237d03f83b95eb", "score": "0.5497708", "text": "def find(macro_name); end", "title": "" }, { "docid": "a920ecf68d68e950afa5b4809e427622", "score": "0.549633", "text": "def register name = \"temp\"\n Registers::Temp.new name, \"r64\"\n end", "title": "" }, { "docid": "e1c7b5566a5eae45708cf9604d557ad2", "score": "0.5488336", "text": "def name(name, route)\n @named_routes[name] = route\n route\n end", "title": "" }, { "docid": "1911929d149cb8a1d48024b14869086d", "score": "0.5486564", "text": "def register(type_name, klass = T.unsafe(nil), **options, &block); end", "title": "" }, { "docid": "e097f6e34a88b801f66c948ce8262006", "score": "0.5482988", "text": "def register(name, object)\n validate_registration!(name, object)\n registrations[name] = object\n end", "title": "" }, { "docid": "e9097b1769f1a61313babf8ffbc8fd96", "score": "0.548182", "text": "def createRegister symbol\n s(:send, nil, :register,\n s(:sym, symbol),\n s(:lvar, symbol)\n )\n end", "title": "" }, { "docid": "a39b2e915db1f59b38f93e3d13b72a1d", "score": "0.5481268", "text": "def register\n \n end", "title": "" }, { "docid": "1f3ab1b222e1acb9a10bcd25d75de55d", "score": "0.5480629", "text": "def define_macro(pattern, replacement = nil)\n\t\t\tputs pattern.class\n\t\t\tif pattern.kind_of? Hash\n\t\t\t\tpattern.each { |k,v| puts \"with #{k} and #{v}...\"; macro(k,v) }\n\t\t\telse\n\t\t\t\traise Exception.new 'Second parameter cannot be nil unless the first is a hash' if replacement.nil?\n\t\t\t\treturn @macros[pattern].tap do\n\t\t\t\t\t@macros = Hash.new if @macros.nil?\n\t\t\t\t\t@macros[pattern] = replacement\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "dd8a34de1d49660d2bbb176387de1e40", "score": "0.5478923", "text": "def [](name)\n macros.detect { |macro| macro.name.equal?(name) }\n end", "title": "" }, { "docid": "cffb401a446d5477332cc24968af057c", "score": "0.54719806", "text": "def hook(name)\n @hook_name = name\n Container::Hook.register(name, self)\n end", "title": "" }, { "docid": "79e77820e40dd81cc5c2001504851687", "score": "0.5469844", "text": "def register_module\n module_names = module_name.split(\"::\").inject([]) {|n, c| n << (n.empty? ? [c] : [n.last] + [c]).flatten}\n module_names.each do |module_name_array|\n eval \"module ::#{module_name_array.join(\"::\")}; end\"\n end\n end", "title": "" }, { "docid": "4883123ff69e7805fe2d6f906a3e6f39", "score": "0.546641", "text": "def register_type(name, type)\n JRubyFX::DSL::NAME_TO_CLASSES[name.to_s] = type\n end", "title": "" }, { "docid": "64cda5174b95f4ab51b8d8569353be35", "score": "0.5447816", "text": "def register_method(name, klass)\n custom_methods[name] = klass\n end", "title": "" }, { "docid": "e279d24f9d6ecf843de80bfe0d0d8b85", "score": "0.5444607", "text": "def register_tag_namespace(name, klass, namespace = 'system_tags')\n tags_namespaced(namespace)[name.to_s] = klass\n end", "title": "" }, { "docid": "663d60afe0912f0b9c91234c61c32e35", "score": "0.54433435", "text": "def register_in_syntaxes(scope)\n @@syntaxes[@name_space] ||= {}\n @@syntaxes[@name_space][scope] = self if scope\n end", "title": "" }, { "docid": "72d676ce2d8707ca60afe64d00f23e23", "score": "0.54252326", "text": "def define(name, type, kind)\n end", "title": "" }, { "docid": "b7bd3e644ff939a11210e21d203a118a", "score": "0.5422916", "text": "def add_macro(aPhrase, aTemplate, useTable)\n MacroCollection.instance.add_macro(aPhrase, aTemplate, useTable)\n end", "title": "" }, { "docid": "23d67defd4fbcf6a4404ec0c28651ca7", "score": "0.54183924", "text": "def register\n end", "title": "" }, { "docid": "e0e8ed985f3df45e08d7d0080a002ece", "score": "0.5409504", "text": "def set_register(register_name, position, registers, extras = {})\n # TODO I'm pretty sure there's an easier way to handle the argument hash\n if extras[:tag]\n tag = extras[:tag]\n else\n tag = register_name\n end\n \n if extras[:content]\n content = extras[:content]\n else\n content = @words[position]\n end\n \n registers[register_name] = tag(tag, content)\n end", "title": "" }, { "docid": "3433a229933d9058758c72596f4ba6d9", "score": "0.540308", "text": "def register(name, plugin = false)\n return unless plugin && !loaded?(name)\n @plugins << plugin\n end", "title": "" }, { "docid": "695be68b92da1a1a002523726fbe7d50", "score": "0.5401682", "text": "def register(name, &method)\n pre_register(name, &method)\n\n @whitelist[name] = method\n\n post_register\n class_invariant\n end", "title": "" } ]
74a9a2476144120091a712efa875ebd2
Get the value from an esign tag in the document
[ { "docid": "189ddc0ecdfa163987b2be692b82b1f2", "score": "0.0", "text": "def get_document_tag(tagname, from: nil)\n from ||= @prepared_doc\n from.match(%r{<#{tagname}>(.*)</#{tagname}>})[1]\n end", "title": "" } ]
[ { "docid": "561a4ae7bb039eb789de809dfb661ff0", "score": "0.69584143", "text": "def get_value(element)\n\t\t\tif ['input','select','textarea'].include? element.tag_name.downcase\n\t\t\t\telement.attribute('value')\n\t\t\telse\n\t\t\t\telement.text\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "f575e2fa7755402d862b1e5ce596d500", "score": "0.69349253", "text": "def get_value(element)\n element.value\n end", "title": "" }, { "docid": "cf0bddc6f38672ba5ca34835f37faab6", "score": "0.67953616", "text": "def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end", "title": "" }, { "docid": "5f573a9bff490766e08e44be7c834b77", "score": "0.6773404", "text": "def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end", "title": "" }, { "docid": "7f68d2255ecccde7d4ba116fd425d33d", "score": "0.6660542", "text": "def user_get_value(element)\r\n begin\r\n key_processor(element)\r\n ****_get_text(@selector, @locator)\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end", "title": "" }, { "docid": "2c09cd9cdba5216ad1f9ad25c77fb5b7", "score": "0.6659272", "text": "def value\n `#{@el}.value`\n end", "title": "" }, { "docid": "7839bffc2b3ee4f0843ec63f25272be9", "score": "0.6651936", "text": "def get_value\n read_attribute('text_value')\n end", "title": "" }, { "docid": "846ae51ebf819efd18bd0432d5b07b5c", "score": "0.6651123", "text": "def first_value(tag)\n tag_summary(tag).first[1].first\n end", "title": "" }, { "docid": "672e22eef0c88de20b26f39dc9014cef", "score": "0.6650775", "text": "def value_of(xpath)\n found_elem = @document.at(value_of_prefix + xpath)\n return nil unless found_elem\n found_elem.inner_html\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "e4c5b30c0812e36eba942bfe832d32a9", "score": "0.66197675", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desird info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "74b69a6a02a6e141ee80c351e49952ec", "score": "0.6558224", "text": "def get_parameter_value(document, name)\n # Retrieve the XML node representing the desird info value\n parameter_element = REXML::XPath.first(document, \"/handler/parameters/parameter[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n parameter_element.nil? ? nil : parameter_element.text\n end", "title": "" }, { "docid": "d829f0f12b52b2028140e52851d80384", "score": "0.6557285", "text": "def node_value\n return @value\n end", "title": "" }, { "docid": "31e2b386cf4498e2b48faadb15e5f8ce", "score": "0.65240866", "text": "def get_info_value(document, name)\r\n # Retrieve the XML node representing the desired info value\r\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\r\n # If the desired element is nil, return nil; otherwise return the text value of the element\r\n info_element.nil? ? nil : info_element.text\r\n end", "title": "" }, { "docid": "d8935838b884c742050cab9e0d928705", "score": "0.65146685", "text": "def value(name)\n element.value_for(name)\n end", "title": "" }, { "docid": "7fba52add26f99a93b46afdbf528e116", "score": "0.6509527", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desired info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "7fba52add26f99a93b46afdbf528e116", "score": "0.6509527", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desired info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "7fba52add26f99a93b46afdbf528e116", "score": "0.6509527", "text": "def get_info_value(document, name)\n # Retrieve the XML node representing the desired info value\n info_element = REXML::XPath.first(document, \"/handler/infos/info[@name='#{name}']\")\n # If the desired element is nil, return nil; otherwise return the text value of the element\n info_element.nil? ? nil : info_element.text\n end", "title": "" }, { "docid": "6dbc11dca2a6dce29237553030c5bb0d", "score": "0.649878", "text": "def value\n node.value\n end", "title": "" }, { "docid": "d91e3203e973e8b940a730662b1e0809", "score": "0.64456", "text": "def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end", "title": "" }, { "docid": "9f9816659d3e5d934e958e6b590475af", "score": "0.6409256", "text": "def getValue page, attribute\n if attribute == 'rating'\n return page.search('.ratingValue').children[1].text\n end\nend", "title": "" }, { "docid": "7dfbc0cc5d229408d81a8d1984e561b0", "score": "0.64081156", "text": "def get_attribute_or_element_value(xml, attr, default = nil, &f)\n val = default\n begin\n snip = xml.elements[attr]\n if snip.elements.size > 0\n if snip.elements.size == 1 && snip.elements['object']\n # must be an otml reference to a different OTObject\n # return the refid\n val = snip.elements['object'].attributes['refid'].to_s\n else\n # otherwise just return the whole snippet\n val = snip.to_s\n end\n else\n val = snip.get_text.to_s\n end\n rescue\n begin\n val = xml.attributes[attr].to_s\n rescue\n # logger.warn(\"Couldn't find attribute or element: #{attr}\")\n end\n end\n begin\n if f\n val = yield(val)\n end\n rescue\n val = default\n end\n return val\n end", "title": "" }, { "docid": "0e80af0373563e67a34817192ed3ff1b", "score": "0.6359098", "text": "def get_tag_value (tag_path, fetch_datatype=false)\n\n $test_logger.log(\"Get tag value #{tag_path}\")\n\n raise \"XML doc not loaded\" if @xml_ilv_node == nil\n\n #Get target tag\n target_tag = @xml_ilv_node.root.elements[tag_path]\n\n #Fetch target value\n val = \"\"\n val = target_tag.get_text.value if target_tag && target_tag.get_text\n\n #Get data type for element\n if fetch_datatype\n data_type = ILVMessage.get_type_for_ele(target_tag)\n return val, data_type\n else\n return val\n end\n end", "title": "" }, { "docid": "1f230df009182c0c14d059b9360432e0", "score": "0.6309573", "text": "def value element_name\n begin\n el_attribute = el element_name\n el_attribute.attribute('value')\n rescue Exception => e\n $LOG.error \"error in getting element value \\n element name : #{element_name} \"+e.message\n raise \"error in getting element value \\n element name : #{element_name} \"+e.message\n end\n end", "title": "" }, { "docid": "93cdde7593e9fdc17ab85583be5e71c0", "score": "0.6258844", "text": "def value(context, xpath)\n values(context, xpath).first\n end", "title": "" }, { "docid": "96ef30723d8615e66c076e6514172e53", "score": "0.625105", "text": "def value_of_node(node_name)\n value_of_nodes(node_name).first\nend", "title": "" }, { "docid": "6d9b769f36b8bd8131ce878b4e39d6ea", "score": "0.62063557", "text": "def get_value(key)\n Element.new(\"#{@locator}//*[text()='#{key}']\")\n end", "title": "" }, { "docid": "503b667f43c8221f952e450a421cd11e", "score": "0.6174437", "text": "def value_for_tag(tag)\n self.__send__(fields[tag].name)\n end", "title": "" }, { "docid": "c0b0fadf90c9eb4d80194e5bacdbc25f", "score": "0.61594284", "text": "def value\n `#{@element}.innerHTML`\n end", "title": "" }, { "docid": "df6a8555f8621c2fe09f8c5b4a95703c", "score": "0.61590916", "text": "def get_node_value(node)\n node\n end", "title": "" }, { "docid": "58b838ecef8f76812080af513995422c", "score": "0.6156991", "text": "def value\n @attributes[:value]\n end", "title": "" }, { "docid": "f5fb034b56d38fccd957a33fb09cf451", "score": "0.61557066", "text": "def value\n children = if self.namespace\n xpath('ns:value', ns: self.namespace.href)\n else\n xpath(:value)\n end\n return children.first&.content if children.length < 2\n children.map(&:content)\n end", "title": "" }, { "docid": "552970c84b53bbbf2b1a98004f5d92a8", "score": "0.6107355", "text": "def extract_value(element)\n # Read value as CouchDB value for that key:\n cdbvalue = element.value\n # Convert encoding to UTF-8 with Ruby 1.9 'encode' method\n cdbvalue = cdbvalue.encode('utf-8', 'iso-8859-1') if cdbvalue.class == String\n return cdbvalue\nend", "title": "" }, { "docid": "de2f029132c070fb3faa31e12fb737cb", "score": "0.6104984", "text": "def value\n return @children['value'][:value]\n end", "title": "" }, { "docid": "578f1df144a06a5900cef0e1c05c60a5", "score": "0.6099573", "text": "def get_node_value (doc, node_name, embed_code)\n\n node_value = doc.get_elements(\"list/item/#{node_name}\")[0].get_text().value rescue nil\n \n if @log && @node_value == nil\n $LOG.info(\"Value not found for: #{node_name}, embed_code: #{embed_code}\") \n end\n\n return node_value\n end", "title": "" }, { "docid": "f0b04bc80b7c0639d9ecf3ee92dba424", "score": "0.6077804", "text": "def elt_text(xml,s) #:nodoc:\r\n if elt = xml.elements[s]\r\n return elt.text\r\n end\r\n return nil\r\n end", "title": "" }, { "docid": "c8d1bd7a5cd2649e84b1b61e65b8ae51", "score": "0.60674274", "text": "def get_element_value(value)\n case value[:func]\n when \"getValue\"\n \"$('\\##{value[:element]}').val();\"\n else \"\"\n end\n end", "title": "" }, { "docid": "5733c8e3511f4ae667e44c74b5e1d53f", "score": "0.6062386", "text": "def content(element_or_attribute)\n case element_or_attribute\n when REXML::Attribute\n return element_or_attribute.value\n when REXML::Element\n return element_or_attribute.text\n end\n end", "title": "" }, { "docid": "5733c8e3511f4ae667e44c74b5e1d53f", "score": "0.6062386", "text": "def content(element_or_attribute)\n case element_or_attribute\n when REXML::Attribute\n return element_or_attribute.value\n when REXML::Element\n return element_or_attribute.text\n end\n end", "title": "" }, { "docid": "86a38940b3ef059aa2658e9ef34c00e8", "score": "0.60491943", "text": "def value\n if self.namespace\n content_from 'ns:value', :ns => self.namespace.href\n else\n content_from :value\n end\n end", "title": "" }, { "docid": "11bf1d30f035dae8d70dbb335634cb17", "score": "0.6048982", "text": "def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end", "title": "" }, { "docid": "f96276d37f5b5b3db26c2245af4acb01", "score": "0.6044246", "text": "def find_element_value(element, element_link, client)\n element_id = element.match(/\\?id=(\\d+)/)[1]\n\n result = client.get(element_link + \"/?id=#{element_id}\")\n items = result['attributeElements']['elements']\n if items.empty?\n return \"ERROR_NOT_FOUND_GDC_FLEX\"\n else\n items.first['title']\n end\nend", "title": "" }, { "docid": "8f1fd94bef7697ce55ebf525ea15f2d2", "score": "0.60342306", "text": "def text\n getvalue\n end", "title": "" }, { "docid": "172905362168474c40e3768b157db41e", "score": "0.6021598", "text": "def value(node, attribute); end", "title": "" }, { "docid": "172905362168474c40e3768b157db41e", "score": "0.6021598", "text": "def value(node, attribute); end", "title": "" }, { "docid": "b239f26beb84a1780053f7b9a2d8f794", "score": "0.59956205", "text": "def val \n query = xpath\n trim_text = !query.index(\"text()\").nil?\n val = @document.find_by_xpath(query).collect {|node| (trim_text ? node.text.strip : node.text) }\n term.deserialize(val)\n end", "title": "" }, { "docid": "e62f6a75fd5c85b8feddcbbb07b26070", "score": "0.5991247", "text": "def text\n @tag_data[:text]\n end", "title": "" }, { "docid": "5f71b7c3e39e08b9d2309f8b19b79ef6", "score": "0.59825695", "text": "def value\n case tag_name\n when \"select\"\n if self[:multiple]\n selected_options.map { |option| option.value }\n else\n selected_option = @_node.selected_options.first\n selected_option ? Node.new(selected_option).value : nil\n end\n when \"option\"\n self[:value] || text\n when \"textarea\"\n @_node.getText\n else\n self[:value]\n end\n end", "title": "" }, { "docid": "1e193d2a152d7131bcfc071e4a3e08cc", "score": "0.598211", "text": "def tag()\n return @driver.get_sc_core_query_element_tag(@handle, @index)\n end", "title": "" }, { "docid": "27b71cd3d8a0450ed5bda3ecb2f1d232", "score": "0.596943", "text": "def get_value(n)\n content = if n.children?\n n.first.content\n else\n n.content\n end\n\n content.force_encoding('UTF-8') if content.respond_to?(:force_encoding)\n content\n end", "title": "" }, { "docid": "cbf5f0e7b3ed58700eed8c2d3324569f", "score": "0.59541965", "text": "def nodeValue\n @value\n end", "title": "" }, { "docid": "6d4db0cf6a0e477023d4e55657cd7b36", "score": "0.59539616", "text": "def vulnerability_value\n query_root_node(\"gdacs:vulnerability/@value\", @@NAMESPACES)\n end", "title": "" }, { "docid": "648dc237f625b90a8f1299a43a9311b3", "score": "0.5943237", "text": "def scrape_value(element)\n raise ArgumentError, \"scrape_value: element was nil!\" if element.nil?\n scrape element\n return @result.value\n end", "title": "" }, { "docid": "8ac97cd5b78432365f28fc8c9f4deb95", "score": "0.5942325", "text": "def value\n children[2]\n end", "title": "" }, { "docid": "8ac97cd5b78432365f28fc8c9f4deb95", "score": "0.5942325", "text": "def value\n children[2]\n end", "title": "" }, { "docid": "449993290df45b118155f3cc1a33a3d6", "score": "0.59364426", "text": "def value\n attributes['FieldValue']\n end", "title": "" }, { "docid": "a38bdff30ff3de5dbd775a169bb8a9ad", "score": "0.59054047", "text": "def getvalue\n @text1\n end", "title": "" }, { "docid": "d69a14cebb01f1832f255f31e84dcffc", "score": "0.5903082", "text": "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "title": "" }, { "docid": "cc9cf1ddd7334aa5cfcbb5400c04df2a", "score": "0.58924735", "text": "def [](key)\n if NOKOGIRI\n [email protected](key.to_s)\n\n return nil if element.size == 0\n else\n [email protected][key.to_s]\n\n return \"\" if element && !element.has_text?\n end\n\n element.text if element\n end", "title": "" }, { "docid": "adc403333797f59c5e91d1ccd7a79167", "score": "0.58768547", "text": "def value\n children[1]\n end", "title": "" }, { "docid": "adc403333797f59c5e91d1ccd7a79167", "score": "0.58768547", "text": "def value\n children[1]\n end", "title": "" }, { "docid": "adc403333797f59c5e91d1ccd7a79167", "score": "0.58768547", "text": "def value\n children[1]\n end", "title": "" }, { "docid": "ca6e24e8ffebe39f1aa29a0655a7272d", "score": "0.58308613", "text": "def tag\n return @tag\n end", "title": "" }, { "docid": "0e60395412e9e9db46aa765242c192fe", "score": "0.58273643", "text": "def value\n parsed_value\n end", "title": "" }, { "docid": "ef559ed8c8c0c987cc81a4b7de37534b", "score": "0.58267444", "text": "def get_value(key)\n Element.new(\"#{@locator}//*[text()=#{$browser.generate_concat_for_xpath_text key}]\")\n end", "title": "" }, { "docid": "35cb1f7bceead34dba6842aa9a351d26", "score": "0.58018327", "text": "def [](element)\n if @vm_root\n val = @vm_root.elements[element]\n return val.text if !val.nil? && val.text\n end\n\n nil\n end", "title": "" }, { "docid": "44f2a4f221787ab8ccbb88fc45a072bb", "score": "0.57922536", "text": "def value\n # since 'value' is an attribute on input fields, we override this here\n assert_exists\n @element.value\n end", "title": "" }, { "docid": "410994d25d1061d7792fe79500c75fdb", "score": "0.57867235", "text": "def value\n\t@value = @selenium.get_value(@locator)\n\treturn @value\n end", "title": "" }, { "docid": "f730b1d21400f41876c10a4bf9e1eb02", "score": "0.577586", "text": "def element_name() @stag.element_name end", "title": "" }, { "docid": "90bfe9ad2763c499187afbb067299aed", "score": "0.57706934", "text": "def extract_value_from(x_str, n)\n ret = \"\"\n return ret if x_str.nil? || x_str.empty?\n if x_str =~ /@/\n ret = n.at_xpath(x_str).value if n.at_xpath(x_str)\n else\n tn = n.at_xpath(x_str)\n if tn\n if tn.children.count > 0\n tn.children.each { |tnc|\n if tnc.text?\n ret = tnc.text\n end\n }\n else\n ret = tn.text\n end\n end\n end\n ret\n end", "title": "" }, { "docid": "96fe0d679911268ea5e7b38c3707bc5b", "score": "0.5763222", "text": "def json_value\n xml_value\n end", "title": "" }, { "docid": "d1443bfcd98744e3df69a695e501664b", "score": "0.5758716", "text": "def value\n data[1]\n end", "title": "" }, { "docid": "47098fa97839bc7c51758da8d23dc170", "score": "0.57540506", "text": "def getTag\n\t\treturn @tag\n\tend", "title": "" }, { "docid": "b1ff8574b3c977b3ae9a8537a0efac94", "score": "0.575296", "text": "def parse_value xpath\n node = parser_xml.xpath(xpath)\n return nil if node.empty?\n node.text.strip\n end", "title": "" }, { "docid": "96a52e2e0c1ce75c663832c8e985da33", "score": "0.5746128", "text": "def value\n attributes.fetch(:value)\n end", "title": "" }, { "docid": "a7ec57a8e4497de3185de7baa58a5f2c", "score": "0.574433", "text": "def getBTNodeVal(root)\n root.val\n end", "title": "" }, { "docid": "a1d5b624aee1058e493744a63d3d9f4b", "score": "0.5743617", "text": "def get_value name\n get name\n end", "title": "" }, { "docid": "eb8563b3eda21fca56442971e379faef", "score": "0.5742364", "text": "def get(tag)\n @orig[tag]\n end", "title": "" }, { "docid": "3ab10ad8fa626a11da834650052e077d", "score": "0.5742051", "text": "def read_value_from_body(value_name)\n start_mark = \"<!--#{value_name}-->\"\n end_mark = \"<!--end-#{value_name}-->\"\n read_from_body(start_mark, end_mark)\n end", "title": "" }, { "docid": "93d0e4641239f57227633292ba3ea2af", "score": "0.574067", "text": "def get_text\n `#{@element}.textContent`\n end", "title": "" }, { "docid": "9e3ceb62f5da94113b6533f201004f1b", "score": "0.5738725", "text": "def get_value\n read_attribute('number_value')\n end", "title": "" }, { "docid": "cefbaecf93e0adeb66306c9b28eddb16", "score": "0.57316744", "text": "def text\n element.text\n end", "title": "" }, { "docid": "4a1e542c2e51b79a051ef61069a55aad", "score": "0.5728783", "text": "def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end", "title": "" }, { "docid": "2982223640a7878e194ec5831183cc5f", "score": "0.5700374", "text": "def [](key)\n if key.to_s[0] == ?@\n tag = key.to_s[1..-1].to_sym\n c = child(tag)\n if c\n c.text\n else\n nil\n end\n else\n @attrs[key]\n end\n end", "title": "" }, { "docid": "d928222c81c81fa51f56234213681b85", "score": "0.56967014", "text": "def get_text(element)\n element.text\n end", "title": "" }, { "docid": "2244d77df0dfa805768dffb650924007", "score": "0.5691833", "text": "def value\n @children[0]\n end", "title": "" }, { "docid": "bf923afeccc55d660b3121fbb793cc18", "score": "0.5690304", "text": "def get\n if @element_reader.requires_parameters?\n self\n else\n element_value\n end\n end", "title": "" }, { "docid": "11c185b450730afb368b8ca575818868", "score": "0.5674834", "text": "def kw_element_txt(element)\r\n REXML::XPath.match(\r\n REXML::Document.new( REXML::XPath.first(self.xml, \"keywords\").text ),\r\n \"//#{element}\").first.text \r\n end", "title": "" }, { "docid": "8fd9bb59f360335688a9e4c62b7ab086", "score": "0.56666905", "text": "def thing\n return @children['thing'][:value]\n end", "title": "" }, { "docid": "8fd9bb59f360335688a9e4c62b7ab086", "score": "0.56666905", "text": "def thing\n return @children['thing'][:value]\n end", "title": "" }, { "docid": "319f1933dfe01f3095ceae4a5c032f9b", "score": "0.566198", "text": "def value\n @value ||= extract_value\n end", "title": "" }, { "docid": "439a4d20c36bbf3d5b87834a0fcddad5", "score": "0.56603575", "text": "def value\n self['value']\n end", "title": "" }, { "docid": "d8506cc6023a110ec72b4a4f97f1b251", "score": "0.56567246", "text": "def value\n @value ||= XmlRpc::API::Message.parse_value(@document.root.elements[\"params/param/value\"])\n end", "title": "" }, { "docid": "aa240fa2363211929aef5fd43b6fedc3", "score": "0.5643651", "text": "def get\n data[\"_value\"]\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "db54f03143413d0c9b2bbe42d344e743", "score": "0.0", "text": "def record_params\n params.require(:record).permit(:railcar_id, :horafinal, :estado,\n :horainicio, :space_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
063f33476343f6c7ce6f694270440528
Whether or not the Status Code is a client error. According to RFC 2616, client error status codes are in the range of 400 to 499, inclusive.
[ { "docid": "c7e8d60a5371dcd5cb2237ef574cf008", "score": "0.83365154", "text": "def client_error?\n (400...500).include?(@status_code)\n end", "title": "" } ]
[ { "docid": "dd036f48fbd0715fdba496fbb3557519", "score": "0.8468984", "text": "def client_error?\n @status.between?(400, 499) if @status\n end", "title": "" }, { "docid": "4d9b8df37c2d59f5b1e6987a10b41462", "score": "0.83947957", "text": "def is_client_error?\n code.to_i >= 400 && code.to_i <= 499\n end", "title": "" }, { "docid": "6a44e611439357bb51271e7010f098aa", "score": "0.83377695", "text": "def is_client_error?\n @code.in? 400..499\n end", "title": "" }, { "docid": "43fff0195c8221bb72960fa408eb8b95", "score": "0.8308011", "text": "def client_error?\n 400 <= code && code < 500\n end", "title": "" }, { "docid": "21095becf10cd63659a9cecfca3d55f0", "score": "0.81195617", "text": "def client_error?\n (400..499).cover?(code)\n end", "title": "" }, { "docid": "8aec8868ff92bdec01c28239936807d1", "score": "0.7995116", "text": "def client_error?\n (400..499).cover?(code)\n end", "title": "" }, { "docid": "64ce0aaa2789aaccbe4767bd8f5a75e2", "score": "0.78484756", "text": "def http_client_error?(code)\n http_status?(:client_error, code)\n end", "title": "" }, { "docid": "4a2bdc4d5c97b0221cbe7b9ed700d9e4", "score": "0.7632631", "text": "def client_error_status_code\n _undefined\n end", "title": "" }, { "docid": "f740eae3994458ad9163952b9b440dfd", "score": "0.76099074", "text": "def error_code?(status_code)\n !(200...300).include?(status_code)\n end", "title": "" }, { "docid": "8577f31cf1e715bc2cb26ba20e10f6c8", "score": "0.7604779", "text": "def status_is_clienterror?\n\t\treturn self.status_category == 4\n\tend", "title": "" }, { "docid": "fabb7137fb10ab3c412688d7c402c89a", "score": "0.75366163", "text": "def good_status_code?(status_code)\n status_code.to_i >= 200 && status_code.to_i < 400\n end", "title": "" }, { "docid": "3bfc5d2923a82f0d0c049761e389cbcc", "score": "0.75276667", "text": "def error?\n (400...600).include?(@status_code)\n end", "title": "" }, { "docid": "abfa04c2510c59b5bb9fb1240480cdcf", "score": "0.7479566", "text": "def is_good_status_code(status_code)\n status_code.to_i >= 200 && status_code.to_i < 400\n end", "title": "" }, { "docid": "c48c52f16b500c7993c8ec4a14b91d49", "score": "0.7304975", "text": "def http_error?\n !(200..299).include?(http_code)\n end", "title": "" }, { "docid": "ca3b9ecfea8a76e1711853b97eea4a2b", "score": "0.72002774", "text": "def error?\n http_status >= 400 && http_status <= 599\n end", "title": "" }, { "docid": "992737e7c088ff3e7a4b269ea854ebad", "score": "0.70778346", "text": "def is_http_status? code\n (200..206).to_a.concat((300..307).to_a).concat((400..417).to_a) \\\n .concat((500..505).to_a).include? code.to_i\n end", "title": "" }, { "docid": "e96785a6ac37b01a6e1d728f760abefd", "score": "0.6930615", "text": "def server_error?\n @status.between?(500, 599) if @status\n end", "title": "" }, { "docid": "c568aeef9985e0131f2a7c9d1964d086", "score": "0.69211155", "text": "def error?\n (500..599).include?(status)\n end", "title": "" }, { "docid": "bd9f6517d1983f869d7cbdab06134ec5", "score": "0.69047195", "text": "def error?\n # 4xx and 5xx are errors\n return @status >= 400 && @status < 600\n end", "title": "" }, { "docid": "c3d9ecca651c2966f62fc5369cd8bb1b", "score": "0.6887065", "text": "def http_error?(code)\n http_status?(:error, code)\n end", "title": "" }, { "docid": "54a95d5f51faa0c3c05b77b460abb12b", "score": "0.687154", "text": "def is_server_error?\n @code.in? 500..599\n end", "title": "" }, { "docid": "532205924f247218aabb95e9eadd4ec9", "score": "0.68645716", "text": "def server_error?\n (500...600).include?(@status_code)\n end", "title": "" }, { "docid": "c5eed0b7f3049309b443916bbcf1fd8b", "score": "0.6844418", "text": "def check_request\n if @req.code.to_i.between?(400, 499)\n raise Exceptions::SlicingDiceHTTPError, \"Client Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n elsif @req.code.to_i.between?(500, 600)\n raise Exceptions::SlicingDiceHTTPError, \"Server Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n else\n true\n end\n end", "title": "" }, { "docid": "7bd9060a46dd7d6b9e2f9f325a936141", "score": "0.6830572", "text": "def is_server_error?\n code.to_i >= 500 && code.to_i <= 599\n end", "title": "" }, { "docid": "48aab503da1681b9663a1f153e5a05c4", "score": "0.68214476", "text": "def http_valid_status_code?(http, status_codes = [200])\n status_codes = status_codes.is_a?(Array) ? status_codes : [status_codes]\n status_codes.include?(http.response_header.http_status)\n end", "title": "" }, { "docid": "987efb8f325a57ecf5fe971b04716a71", "score": "0.6821395", "text": "def server_error?\n (500..599).cover?(code)\n end", "title": "" }, { "docid": "7f98921dbe4433f50b4431fd7750d758", "score": "0.6801774", "text": "def server_error_status_code\n _undefined\n end", "title": "" }, { "docid": "7b0336aadebc4da330f8c657855f4d43", "score": "0.67989796", "text": "def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end", "title": "" }, { "docid": "3ceba185b0b4fb10e789bd6497a2951f", "score": "0.67709196", "text": "def valid_http_code_returned?(http_client, url)\n rubygems_valid_response?(http_client, url) || shields_io_valid_response?(http_client, url)\n end", "title": "" }, { "docid": "d9e8f9df83703970fa9c7915efa7127c", "score": "0.67403495", "text": "def validate_http_status\n return true if @http.code.to_i == 200\n DomainTools::Exceptions::raise_by_code(@http.code)\n end", "title": "" }, { "docid": "3fc0c7ae9f406ce0277c32045ed83b81", "score": "0.6683339", "text": "def error?\n reply_code > 0 && reply_code != 20201\n end", "title": "" }, { "docid": "a9bf56f4864d29d4503111a9e9ed402e", "score": "0.6674268", "text": "def status_code\n @status_code || errors.empty? ? 200 : 422\n end", "title": "" }, { "docid": "de12045414958a91b59722d03ec7d6d4", "score": "0.6672802", "text": "def http_err_code\n http_codes[@http_err]\n end", "title": "" }, { "docid": "a3d2d4ab2331a3f16de90149a43f407d", "score": "0.66129625", "text": "def http_server_error?(code)\n http_status?(:server_error, code)\n end", "title": "" }, { "docid": "67f858df4472e62acdc6840f711e021d", "score": "0.6601099", "text": "def failed_request?\n EXTERNAL_RESPONSE_CODES[:failure] == @code\n end", "title": "" }, { "docid": "67f858df4472e62acdc6840f711e021d", "score": "0.6601099", "text": "def failed_request?\n EXTERNAL_RESPONSE_CODES[:failure] == @code\n end", "title": "" }, { "docid": "67f858df4472e62acdc6840f711e021d", "score": "0.6601099", "text": "def failed_request?\n EXTERNAL_RESPONSE_CODES[:failure] == @code\n end", "title": "" }, { "docid": "0570314c1dfcbf95a9e68e0be0ccbde8", "score": "0.6591048", "text": "def status_is_servererror?\n\t\treturn self.status_category == 5\n\tend", "title": "" }, { "docid": "743ed1f92a7036643eaadc18dbfac66c", "score": "0.6569794", "text": "def ok?(code)\n [200, 201, 202, 204, 206].include?(code)\n end", "title": "" }, { "docid": "3657ea33753f347b5b2bfa961a8bd270", "score": "0.65531737", "text": "def bad_request_status\n status_message(400)\n end", "title": "" }, { "docid": "79aa09ad5d4eb43c1c3498dc75f864eb", "score": "0.64786536", "text": "def error?\n !!(status.to_s =~ /[4|5]\\d\\d/)\n end", "title": "" }, { "docid": "53df496cb72f7fb1ae2602cd460f4c45", "score": "0.6459196", "text": "def should_retry(status_code)\n !((status_code >= 400 && status_code < 500) || (status_code == 306) || (status_code == 501) || (status_code == 505)) end", "title": "" }, { "docid": "f2906495bd8cee7c41aac239cad7017a", "score": "0.64429134", "text": "def status_code\n response_value(:code)\n end", "title": "" }, { "docid": "0a5e6cb72e1de87f04554b7817ca02c8", "score": "0.643811", "text": "def response_codes_ok?\n response_codes.all? { |code| code == 200 || code == 201 || code == 302 || code == 304 || code == 401 }\n end", "title": "" }, { "docid": "fe561ccbec68259ffc8a62eda057475c", "score": "0.642055", "text": "def server_error?\n 500 <= code && code < 600\n end", "title": "" }, { "docid": "9ad7d31e612c4740b0733c15e40309ec", "score": "0.64057124", "text": "def is_successful?\n code.to_i >= 200 && code.to_i <= 299\n end", "title": "" }, { "docid": "13629c4a1e16b972b1298e2cb061ca89", "score": "0.63855356", "text": "def analyse_http_code(response_code)\n case response_code\n when 1 then\n # Failure to use the proxy\n return false\n when 400 .. 403 then\n # Proxy asks for authentication\n return false\n when 407 then\n # Proxy asks for authentication\n return false\n when 444 then\n return response_code\n else\n # If we get a valid return code, we add it to the final list\n return response_code\n end\n end", "title": "" }, { "docid": "623b08be8ba728935445497ba0d8a060", "score": "0.6380398", "text": "def valid?\n (200..299).include? status\n end", "title": "" }, { "docid": "5ff46b78b11a523a8e615c3910237a1b", "score": "0.6355061", "text": "def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end", "title": "" }, { "docid": "a140ea0a960932a11e1caa59e8ccd80f", "score": "0.6354083", "text": "def has_wrong_number?\n status_code == '1'\n end", "title": "" }, { "docid": "d6a586a1293f3d11ef7e254ba74efb58", "score": "0.635167", "text": "def is_error?(response_code)\n response_code = response_code.to_i if response_code.is_a?(String)\n FATAL_ERROR_CODES.include?(response_code)\n end", "title": "" }, { "docid": "d4da92545814c2b74d2614809288042b", "score": "0.6341824", "text": "def is_success?\n @code.in? 200..299\n end", "title": "" }, { "docid": "22de9a84dbcf2be522e383d636806702", "score": "0.6335867", "text": "def is_error?\n is_server_error? || is_client_error?\n end", "title": "" }, { "docid": "def06c0956ae3b5dbdbe6d55fbabe082", "score": "0.63279074", "text": "def valid?\n code == 200\n end", "title": "" }, { "docid": "91b2d95f2b152338474536b44b5731ed", "score": "0.6310717", "text": "def error?(res)\n res.code >= 400 || JSON.parse(res.body)[\"error\"]\n end", "title": "" }, { "docid": "e39223756f9f3714e89a6aadefe9f79b", "score": "0.6304748", "text": "def http_status?(range, code)\n entry = error = nil\n case code\n when Integer then entry = HTTP_STATUS_CODE_RANGE[range]\n when Symbol then entry = HTTP_SYMBOLIC_CODE_RANGE[range]\n else error = \"invalid HTTP code #{code.inspect}\"\n end\n Log.debug { error || \"invalid HTTP range #{range.inspect}\" } unless entry\n entry&.include?(code) || false\n end", "title": "" }, { "docid": "4d71bdcad4757511839462e4d5148851", "score": "0.6277189", "text": "def error?\n self.body.keys.include?(:err_code)\n end", "title": "" }, { "docid": "79dc9c071b8904eb9f313ea995b1cf29", "score": "0.6275491", "text": "def status_code\n STATUS_CODE\n end", "title": "" }, { "docid": "2f4025cc09e1d7d9475ccc2e3997abd6", "score": "0.626746", "text": "def successful?\n (200...300).include?(@status_code)\n end", "title": "" }, { "docid": "db438bce19639ad6d1ed3d8230e7be6e", "score": "0.62423587", "text": "def get_http_response_code\n raise 'To be implemented in child classes'\n end", "title": "" }, { "docid": "8de51c4c2048e05c2aeb1c3bd9a92eb8", "score": "0.62349325", "text": "def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end", "title": "" }, { "docid": "8de51c4c2048e05c2aeb1c3bd9a92eb8", "score": "0.62349325", "text": "def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end", "title": "" }, { "docid": "8de51c4c2048e05c2aeb1c3bd9a92eb8", "score": "0.62349325", "text": "def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end", "title": "" }, { "docid": "0f9c075bec8f0be08432b9b2e8ad80aa", "score": "0.62341815", "text": "def informational?\n (100...200).include?(@status_code)\n end", "title": "" }, { "docid": "7ffae2fdc0b02ca3a31cc60416c7a0c7", "score": "0.62278855", "text": "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "title": "" }, { "docid": "f313eb10acc5c5881fc8638d319f9f83", "score": "0.6212348", "text": "def unknown?\n !(100...600).include?(@status_code)\n end", "title": "" }, { "docid": "8c0c65902e98184377ecab5d87c3cda8", "score": "0.6209914", "text": "def ok_status_code\n _undefined\n end", "title": "" }, { "docid": "14be7d900334d8962ddf4f39e12272ba", "score": "0.61982983", "text": "def success?\n status < 400\n end", "title": "" }, { "docid": "164a6998c82ad7db238f1a93697c4cbd", "score": "0.6195351", "text": "def error_response?(response, _parsed_response)\n !(200..299).cover?(response.code)\n end", "title": "" }, { "docid": "439ed5e797ed60ba1f8a3bcc9861ae4e", "score": "0.6185376", "text": "def bad_req_code\n SendgridClient.bad_req_code\n end", "title": "" }, { "docid": "a9e060590c8652d017564308d84f0415", "score": "0.6184376", "text": "def ok?(http_code)\n http_code =~ /^20/ ||\n http_code =~ /^40/\n end", "title": "" }, { "docid": "dcff8d9996754e30a0c589e7d28dc9ec", "score": "0.6167723", "text": "def error?(response)\n response.key?('errorcode')\n end", "title": "" }, { "docid": "59d30d4c892ba312ec58e82fd7da8835", "score": "0.6158069", "text": "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "title": "" }, { "docid": "02a4f369ca0cce1b4a90956f057ddabd", "score": "0.61547947", "text": "def success?\n [200, 201, 204, 280, 281].include?(code)\n end", "title": "" }, { "docid": "2a78e88c6ad6336de59b110ba28965b0", "score": "0.61501056", "text": "def valid_status?(response)\n response.is_a?(Net::HTTPSuccess)\n end", "title": "" }, { "docid": "8feb967fe16d40d30aa137bf716d211d", "score": "0.6146123", "text": "def bad_req_code\n assert_equal SendgridClient.bad_req_code, MailgunClient.bad_req_code\n SendgridClient.bad_req_code\n end", "title": "" }, { "docid": "b5d1b8cbe8a9a81439ccbe72734d79b4", "score": "0.61337095", "text": "def valid_request?\n # 400 - Error with input\n # 403 - Key related error\n # 500 -Unknown error\n # Check http://www.mapquestapi.com/geocoding/status_codes.html for more details\n @valid = case status[:code]\n when 500\n raise InvalidRequest\n when 400, 403\n false\n else\n true\n end\n end", "title": "" }, { "docid": "7edaff8cdb818d5d5d9bcb79f5ac2eb5", "score": "0.61330956", "text": "def status_code\n @response.status\n end", "title": "" }, { "docid": "2689bf3031d05ff01a34c945b8516fb2", "score": "0.6114278", "text": "def success?\n 200 <= code && code < 300\n end", "title": "" }, { "docid": "6b62a14b3b457cdfb8405409548bde40", "score": "0.6112324", "text": "def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end", "title": "" }, { "docid": "00e1cf394b0a27546e82d82b2ee40a2a", "score": "0.61019456", "text": "def response_code_is_ok?\n return true if %w(00 24).include? response_code\n\n false\n end", "title": "" }, { "docid": "e2be11ec8a5247aa6e3554c8abf32e0e", "score": "0.60984075", "text": "def redirection?\n (300...400).include?(@status_code)\n end", "title": "" }, { "docid": "a6f9b75f9b59c4f6944715cf21b905b8", "score": "0.60957724", "text": "def status(response, expected_status_code, failure_message)\n if response.status == expected_status_code\n true\n else\n fail(\"#{failure_message}. Response: #{response.status} #{response.reason_phrase} #{response.body}\")\n end\n end", "title": "" }, { "docid": "a6f9b75f9b59c4f6944715cf21b905b8", "score": "0.60956013", "text": "def status(response, expected_status_code, failure_message)\n if response.status == expected_status_code\n true\n else\n fail(\"#{failure_message}. Response: #{response.status} #{response.reason_phrase} #{response.body}\")\n end\n end", "title": "" }, { "docid": "13d46db49b377cfabbe0ab6593ac0bc1", "score": "0.6089889", "text": "def check_for_errors\n info = MultiJson.load(self.body).first\n\n if info['result'] && info['result'] != 0\n if info['result'] == 500\n raise Webceo::Api::ServerError.new(self.status.to_i, self.body)\n else\n raise Webceo::Api::ClientError.new(self.status.to_i, self.body)\n end\n end\n end", "title": "" }, { "docid": "c3b9d7317042a36c7de687e5f1ca2355", "score": "0.60814416", "text": "def error_code\n @request['error']['code'].to_i\n end", "title": "" }, { "docid": "83ca67b469de4d6044888b56abaf9858", "score": "0.60747594", "text": "def http_error_code_for(errors)\n if errors.any? { |message| message.include? CONFLICT_MESSAGE }\n :conflict\n else :unprocessable_entity end\n end", "title": "" }, { "docid": "3fff2066a254cd43c618c0e53005c8ce", "score": "0.60491085", "text": "def success?\n (200..299).include?( code )\n end", "title": "" }, { "docid": "e4ab287b833fd9876c1ad5ddf6cb6f10", "score": "0.6026908", "text": "def status_code; end", "title": "" }, { "docid": "cb1ac3406d0f96de50a231b15c33db22", "score": "0.6022168", "text": "def error?\n response.is_a?(Hash) ? response.has_key?(:status) : false\n end", "title": "" }, { "docid": "365ce5e5d861fbdeb9eee39c5d56e43f", "score": "0.6020711", "text": "def status_error?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_ERROR)\n return false\n end", "title": "" }, { "docid": "ed5a5bb126b87c1085cbd8e32c5359cd", "score": "0.6008379", "text": "def client_error?; end", "title": "" }, { "docid": "b00cf79594369b86ea8af17004f2cfab", "score": "0.5990107", "text": "def error?\n status == STATUS_ERROR\n end", "title": "" }, { "docid": "89b698796fca010e28971cf977f9ad6c", "score": "0.5985648", "text": "def handle_error(client, e)\n code = case e\n when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::ENOTCONN\n # client disconnected on us and there's nothing we can do\n when Unicorn::RequestURITooLongError\n 414\n when Unicorn::RequestEntityTooLargeError\n 413\n when Unicorn::HttpParserError # try to tell the client they're bad\n 400\n else\n Unicorn.log_error(@logger, \"app error\", e)\n 500\n end\n if code\n client.kgio_trywrite(err_response(code, @request.response_start_sent))\n end\n client.close\n rescue\n end", "title": "" }, { "docid": "6abc0c4452bf70a0088e8d40137dff81", "score": "0.5980614", "text": "def error?\n @status == ERROR_FLAG\n end", "title": "" }, { "docid": "20da0c5b93264a0bf7571d3ab6a3d681", "score": "0.59798545", "text": "def status_codes\n STATUS_CODES\n end", "title": "" }, { "docid": "9b73720eea96f5da19bf38da5fcfbdeb", "score": "0.5975341", "text": "def ok?\n @result.code.to_i != 200\n end", "title": "" }, { "docid": "b325db4a4e02d91f5287fc09797403fb", "score": "0.5971259", "text": "def error?\n status[:error] || false\n end", "title": "" }, { "docid": "291da03b83b5060f59874c2157601285", "score": "0.59519726", "text": "def status_code\n 500 # This should not be called directly\n end", "title": "" }, { "docid": "b6534984d00a8f54fccdd93da0abc773", "score": "0.59444463", "text": "def request_succeeded?\n @errors.blank? && [200,0].member?(@response_code)\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c820f5b95c7d2c75ac195aaa48cc989d", "score": "0.0", "text": "def set_product_product\n @product_product = Product::Product.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
ccf82defcdd1874a1ff5df096ec758be
DELETE /tracks/1 DELETE /tracks/1.json
[ { "docid": "77a5f1e4365a659a9149610c9b277e86", "score": "0.0", "text": "def destroy\n \t@playlist = Playlist.find(params[:id])\n @playlist.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Playlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b19aee3fd29210a8b42aebb3bcbe5b9", "score": "0.783509", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8e6e7c2fb819eb6da85bf8fa253f89b", "score": "0.77724564", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8e6e7c2fb819eb6da85bf8fa253f89b", "score": "0.77724564", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8e6e7c2fb819eb6da85bf8fa253f89b", "score": "0.77724564", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8e6e7c2fb819eb6da85bf8fa253f89b", "score": "0.77724564", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6bdabe038157abbad955b87d0371f79f", "score": "0.7768109", "text": "def delete\n @playlist = Playlist.find(params[:playlist_id])\n @track = Track.find(params[:id])\n @playlist.tracks.delete(@track)\n render json: @track, :status => :'Tracks Deleted'\n end", "title": "" }, { "docid": "31017933180c2db12ffaa59a09dd93eb", "score": "0.77402896", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "12575fc4189849f4cba217226fbc14c2", "score": "0.765601", "text": "def destroy\n @ground_track.destroy\n respond_to do |format|\n format.html { redirect_to ground_tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "01ef7013158538334952ee585c81fc03", "score": "0.7607742", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "731fa3b5d3f085bd42aff9c6aff00631", "score": "0.7579974", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "731fa3b5d3f085bd42aff9c6aff00631", "score": "0.75795865", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "14843181aea657df46bfeb9312593fb6", "score": "0.757711", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_url) }\n end\n end", "title": "" }, { "docid": "2cf70e9c20604264c94dc14d15c24456", "score": "0.7550526", "text": "def destroy\n #@track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0f143de263ab9b055ed369265d053c68", "score": "0.75128955", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f143de263ab9b055ed369265d053c68", "score": "0.75128955", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f143de263ab9b055ed369265d053c68", "score": "0.75128955", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f143de263ab9b055ed369265d053c68", "score": "0.75128955", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f94ce36ece733be24adabaf3a10bd0e4", "score": "0.7500299", "text": "def destroy\n @mock_track.destroy\n respond_to do |format|\n format.html { redirect_to mock_tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f011c6019c267b283cca64170d0ed2e1", "score": "0.7483483", "text": "def destroy\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b9218b16c63cba084abda353ab4f2694", "score": "0.7443709", "text": "def destroy\n @track = Track.find(params[:id])\n @track.destroy\n respond_with @track\n end", "title": "" }, { "docid": "0065484b960a167927e5a96cdeebbe87", "score": "0.7428953", "text": "def destroy\n # @playlist.tracks.each do |track|\n # track\n # end\n @playlist.destroy\n respond_to do |format|\n format.html { redirect_to playlists_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f4e880d9b30ed3cbe88b3ead2c67171d", "score": "0.74228144", "text": "def destroy\n @sky_track.destroy\n respond_to do |format|\n format.html { redirect_to sky_tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "459a3707e5e54086292bf7b7f155a3e7", "score": "0.73861647", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to user_tracks_url @user, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "341cdf710dd661535807189d210a5fb7", "score": "0.73297936", "text": "def destroy\n authorize @track\n\t\ttrack_strong_delete(@track)\n head :no_content\n end", "title": "" }, { "docid": "36d380751a064e54f90193acc06418b6", "score": "0.7315643", "text": "def destroy\n @activity_track.destroy\n respond_to do |format|\n format.html { redirect_to activity_tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "36816c67dbf857abb7a116ddccc553a0", "score": "0.7298966", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to @track.player, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb2513b4c99a700799d184c448b3b270", "score": "0.7297569", "text": "def destroy\n @v1_song.destroy\n end", "title": "" }, { "docid": "6d228f2bb5c23f44fc63348261e06299", "score": "0.72944385", "text": "def destroy\n @spotify_track = SpotifyTrack.find(params[:id])\n @spotify_track.destroy\n\n respond_to do |format|\n format.html { redirect_to(spotify_tracks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "da985ebe1e1e328bbb8a5187eb6cece2", "score": "0.7292388", "text": "def destroy\n @track_datum = TrackDatum.find(params[:id])\n @track_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to track_data_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90be633c9783dd737536b68d9b594555", "score": "0.7284134", "text": "def destroy\n @track.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "2fd6e8d341cfd751fa7f4abec4974f78", "score": "0.7252476", "text": "def destroy\n authorize @artist\n artist_strong_delete(@artist, params[:delete_associated_tracks]==\"true\")\n\n head :no_content\n end", "title": "" }, { "docid": "6754094a86cd433be7165fe3cc2edff6", "score": "0.7235953", "text": "def destroy\n @subtitle_track = SubtitleTrack.find(params[:id])\n @subtitle_track.destroy\n\n respond_to do |format|\n format.html { redirect_to subtitle_tracks_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f378beb8fabea22119f9c60d88b2911b", "score": "0.72338164", "text": "def destroy\n authorize @track\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "24e38b402249b93db8bbce978fc3775b", "score": "0.72051996", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to(@track.cd, notice: \"La piste a été correctement détruite.\") }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4a2a7fe93c410b9d4144882f27b8b9a1", "score": "0.72041297", "text": "def destroy\n @release_track = ReleaseTrack.find(params[:id])\n @release_track.destroy\n\n respond_to do |format|\n format.html { redirect_to release_tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "98a710eaf079165106ffa4f3177841b0", "score": "0.7198954", "text": "def destroy\n @track.destroy\n respond_to do |format|\n format.html { redirect_to yams_core.tracks_url, notice: 'Track was successfully removed.' }\n format.json { head :no_content }\n format.js { render :destroy, notice: 'Track was successfully removed.' }\n end\n end", "title": "" }, { "docid": "db72850c262cb826a71be81a501b647f", "score": "0.7193857", "text": "def destroy\n @soundtrack.destroy\n respond_to do |format|\n format.html { redirect_to soundtracks_url, notice: 'Soundtrack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7b9542a2e8730aa90d741682627327e5", "score": "0.71802914", "text": "def destroy\n @track = track_owned_by_current_user params[:id]\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "833b520fb8bb93c410225883b73cff0e", "score": "0.7171876", "text": "def destroy\n @trackable.destroy\n respond_to do |format|\n format.html { redirect_to trackables_url, notice: 'Trackable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "00bc9644ff91c3e9b31e687b981dfad9", "score": "0.7171435", "text": "def destroy\n @track_head.destroy\n respond_to do |format|\n format.html { redirect_to track_heads_url, notice: 'Track head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fba1b3e8f44152a3987bc4203d5baa9e", "score": "0.71706384", "text": "def destroy\n @track_info = TrackInfo.find(params[:id])\n @track_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(@omatsuri) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "deea9f49d8afc8cb0228f307a05e36bf", "score": "0.71635085", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f7bcc842431123e01291dcb224e6bf2", "score": "0.7151667", "text": "def destroy\n @predicted_track.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a7fa1a6b97db565ee4e28c284c87436", "score": "0.7142316", "text": "def destroy\n @track = Track.find(params[:id], :conditions => { :user_id => current_user.id })\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to(tracks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f4083ab78413bdf087a5ce9026bf8d00", "score": "0.7136243", "text": "def destroy\n @time_track.destroy\n respond_to do |format|\n format.html { redirect_to time_tracks_url, notice: 'Time track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5fb0aae6408c6d90035c7c417a9a607", "score": "0.7133625", "text": "def destroy\n @track2.destroy\n respond_to do |format|\n format.html {redirect_back(fallback_location: root_path, notice: 'Eliminado exitosamente' )}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "37f3973477597d74fe3e1ce457d9924d", "score": "0.7118559", "text": "def destroy\n @track.delete\n\n flash[:notice] = \"Track '#{@track.title}' has been deleted.\"\n head :ok\n\n rescue ActiveRecord::ActiveRecordError\n head :forbidden\n end", "title": "" }, { "docid": "3d84a6b99fe18dec2628ca1c4d3361df", "score": "0.7093702", "text": "def destroy\n @playlist.playlist_track.delete_all\n @playlist.destroy\n\n render json: {status: 200, message: \"Deleted successfully\"}\n end", "title": "" }, { "docid": "1e6ccd2a3b964090005c95f8b19e26db", "score": "0.70914304", "text": "def destroy\n @spot_track.destroy\n respond_to do |format|\n format.html { redirect_to spot_tracks_url, notice: 'Spot track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "de6034768fab26d952e872f829d275cd", "score": "0.7065523", "text": "def destroy\n @tracks = Track.all\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { \n p \"JSON Track\"\n # render json: @tracks.to_json \n render json: @tracks.map { |track|\n track.as_json.merge({ image: url_for(track.cover_art), isPlaying: false })\n }\n }\n end\n end", "title": "" }, { "docid": "d5d934d23f998c6240f4d1b3cbdf140d", "score": "0.7050172", "text": "def destroy\n @track.xml_attachements.each do |xml|\n xml.uploaded_file.file.delete\n end\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Le tracé à été supprimé avec succès.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "80a79eee9a97420afca13a493dc6eb24", "score": "0.7036023", "text": "def destroy\n @audio_recording_track.destroy\n respond_to do |format|\n format.html { redirect_to audio_recording_tracks_url, notice: 'Audio recording track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8c47beef113d28106cc0c3346adfa4b0", "score": "0.7034943", "text": "def destroy\n @track_phrase.destroy\n respond_to do |format|\n format.html { redirect_to track_phrases_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e2546e64c25d9f308644c0432771635", "score": "0.7034682", "text": "def destroy\n @subtitle_track_set = SubtitleTrackSet.find(params[:id])\n @subtitle_track_set.destroy\n\n respond_to do |format|\n format.html { redirect_to subtitle_track_sets_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "705031f513e4ceaba56997f36981aa15", "score": "0.7026987", "text": "def destroy\n @tracking = Tracking.find(params[:id])\n @tracking.destroy\n\n respond_to do |format|\n format.html { redirect_to trackings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e4adf9748fb3eaf204345d2ca238dc7", "score": "0.70253223", "text": "def destroy\n @timetrack.destroy\n respond_to do |format|\n redirect_to @timetrack, warning: 'Guess you destroyed it.'\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "00f6c55e3ff5a650684727bed7bebbe1", "score": "0.70225984", "text": "def destroy\n @joins = AlbumTrack.where(track_id: @track.id)\n @joins.each do |join|\n join.destroy\n end\n puts @track.title\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "902df0009223cd93d54d9ef5e80b45d2", "score": "0.70203626", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to(songs_url) }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "65270a81c6fb50d37563bf8cc6a4ff0f", "score": "0.7017922", "text": "def destroy\n @song_upload = SongUpload.find(params[:id])\n @song_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to song_uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2635dcc35d6d05c3773ec6a43beeea71", "score": "0.70178264", "text": "def destroy\n @track_head2.destroy\n respond_to do |format|\n format.html {redirect_back(fallback_location: root_path, notice: 'Eliminado exitosamente' )}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c342728f3d03c190ecdccdf6bb414e5", "score": "0.70153743", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "6c342728f3d03c190ecdccdf6bb414e5", "score": "0.70153743", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d4b9a6bbf0f7aff82228468f4c709d05", "score": "0.7005271", "text": "def destroy\n @acquisition_track.destroy\n respond_to do |format|\n format.html { redirect_to acquisition_tracks_url, notice: 'Acquisition track was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2d64d1007c74d2df78ddca59493cfd9f", "score": "0.70023423", "text": "def destroy\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "257bc1a2a164764c8b3859f522d96207", "score": "0.6992302", "text": "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49ec61cd477dfea53b38834b66bec854", "score": "0.6992018", "text": "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "57dace182d7375e183f99c4db84378dc", "score": "0.69778687", "text": "def destroy\n @trackuser = Trackuser.find(params[:id])\n @trackuser.destroy\n\n respond_to do |format|\n format.html { redirect_to trackusers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4746565164bc76dda6af731069839af7", "score": "0.69729155", "text": "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4746565164bc76dda6af731069839af7", "score": "0.69729155", "text": "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4746565164bc76dda6af731069839af7", "score": "0.69729155", "text": "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4746565164bc76dda6af731069839af7", "score": "0.69729155", "text": "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e48dc429ee789eedf10d1ae5231b9cd", "score": "0.69665104", "text": "def destroy\n @audio.destroy\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b117b8591442d338a8f23cfa391effb6", "score": "0.69364077", "text": "def destroy\n respond_with Song.destroy(params[:id])\n end", "title": "" }, { "docid": "fc887a5f0698433926604fe143e9beeb", "score": "0.69273525", "text": "def destroy\n @tracking.destroy\n respond_to do |format|\n format.html { redirect_to trackings_url, notice: 'Tracking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b2e1947d2cc3c7769345115f3dae579", "score": "0.6925255", "text": "def destroy\n @mongotest = Mongotest.find(params[:id])\n @mongotest.destroy\n\n respond_to do |format|\n format.html { redirect_to mongotests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4630262a5da85c7c5712a252e903ac3e", "score": "0.69241387", "text": "def destroy\n @song = Song.find(params[:id])\n @song.song_structures.each do |song_structure|\n song_structure.destroy\n end\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
fae95d8bd67a7584bc927b9c47008809
Loads the configuration and authenticates the current user.
[ { "docid": "7fbd8f243d274b38e1c151a609870d42", "score": "0.63525426", "text": "def load_configuration\n # Note that the Portus user needs to authenticate through the DB.\n return nil if !::Portus::LDAP.enabled? || params[:account] == \"portus\"\n\n fill_user_params!\n return nil unless user_params_set?\n\n adapter.new(adapter_options)\n end", "title": "" } ]
[ { "docid": "f089cf3402fbc90634616be431461a6b", "score": "0.72733885", "text": "def load_from_config\n @credentials = @config.read('authentication')\n end", "title": "" }, { "docid": "97983803c5c7515ac937ee42dfb0007b", "score": "0.6814572", "text": "def authenticate\n @auth = GcalMapper::Authentification.new(@config.file, @config.client_email, @config.user_email, @config.password)\n @auth.authenticate\n end", "title": "" }, { "docid": "7dfba79e08e129704ba8f8c81b0e056d", "score": "0.68043935", "text": "def load_config\n config = YAML.load_file(File.dirname(File.expand_path(__FILE__)) +\n\t\t\t \"/../../config/sc2bc.yml\")\n @username = config[:username]\n @token = config[:token]\n @auth = { username: @username, token: @token }.freeze\n end", "title": "" }, { "docid": "240f4b5e3fad6dfc2a22309a8f22f5e3", "score": "0.65579635", "text": "def load(configurations)\n self.username = parsed(configurations, \"username\")\n self.password = parsed(configurations, \"password\")\n self.security_token = parsed(configurations, \"security_token\")\n self.client_id = parsed(configurations, \"client_id\")\n self.client_secret = parsed(configurations, \"client_secret\")\n self.host = parsed(configurations, \"host\")\n end", "title": "" }, { "docid": "cce30fde02d56b7ff02e8de01de50b62", "score": "0.654578", "text": "def acquia_conf_auth\n user_data = JSON.parse(File.read(acquia_conf_path))\n { username: user_data['email'], password: user_data['key'] }\n end", "title": "" }, { "docid": "faf95ffc458a0eeec5e0ec7a42c90e8f", "score": "0.65431184", "text": "def load_configuration\n # Note that the Portus user needs to authenticate through the DB.\n return nil if !::Portus::LDAP.enabled? || params[:account] == \"portus\"\n\n fill_user_params!\n return nil if params[:user].nil?\n return nil if params[:user][:username].blank? || params[:user][:password].blank?\n\n adapter.new(adapter_options)\n end", "title": "" }, { "docid": "00ed7454f46fbea7655db0128f30abd5", "score": "0.6516724", "text": "def set_user_config\n @user_config = UserConfig.find_by(user_id: current_user.id)\n end", "title": "" }, { "docid": "1bed5a697dfa03ef3622dcdc68f59a79", "score": "0.64620036", "text": "def config\n @config ||= user_api.user_class.user_config\n end", "title": "" }, { "docid": "b8b720eba90eb968fd589b1291bb2be1", "score": "0.64205396", "text": "def user_credentials\n acquia_conf_auth if File.exist? acquia_conf_path\n netrc_auth if File.exist? netrc_path\n end", "title": "" }, { "docid": "496cc45714364e46e0d4f064a62f7c4e", "score": "0.6384455", "text": "def auth_user\n @config[:auth_user]\n end", "title": "" }, { "docid": "27b8fc92e330755a726d66466de406d0", "score": "0.6348761", "text": "def user_setup\r\n logger.debug(\"USER_SETUP: #{session.inspect}\")\r\n\r\n # User.current=() needs a thread-global reference to the session.\r\n\r\n Thread.current[:session] = session\r\n\r\n # User.current needs a thread-global reference to the session[:user_id]\r\n\r\n Thread.current[:user_id] = session[:user_id]\r\n\r\n # This is used by the logout action to discard the old HTTP authentiction.\r\n # Logout redirects to login and that generates a new authentication request. That request is the only input that can tell the browser to\r\n # stop sending the old authentication data with every request!\r\n\r\n if flash[:skip_user_setup] == true\r\n flash[:skip_user_setup] = false\r\n return true\r\n end\r\n login = password = nil\r\n r = request.env\r\n\r\n # old_user = user = User.current\r\n # If the request contains an HTTP authentication, decode it.\r\n # Don't use it to authenticate the user yet.\r\n\r\n if (authdata = r['X-HTTP_AUTHORIZATION']) or (authdata = r['HTTP_AUTHORIZATION'])\r\n authdata = authdata.to_s.split\r\n\r\n # FIX: At the moment we only support Basic authentication. It's\r\n # prone to sniffing. Change to Digest authentication.\r\n\r\n if not authdata[0] == 'Basic'\r\n login, password = Base64.decode64(authdata[1]).split(':')[0..1]\r\n end\r\n end\r\n\r\n # If the HTTP authentication is for a different user name, the user wants\r\n # to change logins. This can happen if an operation requires an\r\n # administrative login and the current user isn't the administrator but\r\n # also has an administrative login. It can also happen with command-line\r\n # tools like \"wget\" or web services clients that operate on behalf of\r\n # several users.\r\n #\r\n # Note that HTTP authentication (at least Basic) can be sent without\r\n # the server first asking for it, and that's valid according to the\r\n # HTTP specification. So, I can get here without having asked the browser\r\n # to put up a login panel.\r\n #\r\n # Allow re-log-in if the user name and password authenticate properly.\r\n #\r\n #if login and (user.blank? or login != user.login)\r\n # user = User.sign_on(login, password)\r\n #end\r\n # Sign on the user via a web form.\r\n\r\n if request.post? && (p = params[:user])\r\n @current_user = User.sign_on(p[:login], p[:password]) if p[:login] && p[:password]\r\n flash[:login_succeeded] = true if @current_user\r\n end\r\n\r\n # Sign on the user via a security token.\r\n #if params[:id] and params[:token]\r\n # user = User.sign_on_by_token(params[:id], params['token'])\r\n #end\r\n #if @current_user != old_user && !@current_user.nil?\r\n # flash[:login_succeeded] = true\r\n #end\r\n\r\n end", "title": "" }, { "docid": "c7d3c57a65452503e0beff2f71d680c5", "score": "0.6346968", "text": "def setup_user_auth\n # try and setup using OAuth\n unless Authenticator.new(self, [:token]).allow?\n username, passwd = get_auth_data # parse from headers\n # authenticate per-scheme\n self.current_user = if username.nil?\n nil # no authentication provided - perhaps first connect (client should retry after 401)\n elsif username == \"token\"\n User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth\n else\n User.authenticate(:username => username, :password => passwd) # basic auth\n end\n end\n\n # have we identified the user?\n if current_user\n # check if the user has been banned\n user_block = current_user.blocks.active.take\n unless user_block.nil?\n set_locale\n if user_block.zero_hour?\n report_error t(\"application.setup_user_auth.blocked_zero_hour\"), :forbidden\n else\n report_error t(\"application.setup_user_auth.blocked\"), :forbidden\n end\n end\n\n # if the user hasn't seen the contributor terms then don't\n # allow editing - they have to go to the web site and see\n # (but can decline) the CTs to continue.\n if REQUIRE_TERMS_SEEN && !current_user.terms_seen && flash[:skip_terms].nil?\n set_locale\n report_error t(\"application.setup_user_auth.need_to_see_terms\"), :forbidden\n end\n end\n end", "title": "" }, { "docid": "c03eb03ac9eec07ef1a1b5d6206273f0", "score": "0.63333917", "text": "def connect\n @current_user = authenticated_user\n end", "title": "" }, { "docid": "640b98de29f779cfca7582ed7827056e", "score": "0.63224095", "text": "def user_config\n @user_config ||= UserConfig.parse\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "40e7f0bad3d2c167451cea9e5e04d34f", "score": "0.63120586", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "00461d5e2d839a588f6fe6da46b46c7b", "score": "0.63008964", "text": "def authentication\n {\n :username => configure.username,\n :api_key => configure.api_key\n }\n end", "title": "" }, { "docid": "abe2fd47ffece15cdad0da3094f69fdf", "score": "0.6265777", "text": "def connect\n\t\t\tself.current_user = find_verified_user\n\t\tend", "title": "" }, { "docid": "d8207d52050dff362cf314c64ba0145b", "score": "0.62529653", "text": "def authenticate_user!\n identify_user(true)\n end", "title": "" }, { "docid": "d8207d52050dff362cf314c64ba0145b", "score": "0.62529653", "text": "def authenticate_user!\n identify_user(true)\n end", "title": "" }, { "docid": "5360c1c6fc8987068d3ca99e82129e6d", "score": "0.62420255", "text": "def loadConfig\n config = YAML.load_file('config.yml')\n \n # server related options\n @host = config['default']['host']\n @port = config['default']['port']\n \n # user related options\n @login = config['default']['login']\n @password = config['default']['password']\n @location = config['default']['location']\n end", "title": "" }, { "docid": "2fa07bd253d45b5788d71baff22143ee", "score": "0.623811", "text": "def connect\n\t\t\t@current_user = find_verified_user\n\t\tend", "title": "" }, { "docid": "8ed1722f6153beea9f6cde564efb78b6", "score": "0.6230389", "text": "def load_user(name)\n user = TestsConfig[name]\n @username = user['username']\n @password = user['password']\n end", "title": "" }, { "docid": "e27b160ac701437a8a69bc63fff3cd87", "score": "0.6197777", "text": "def authenticate\n puts '#> authenticating'\n uname = params[:uname]\n upassword = params[:upassword]\n \n # no creadentials\n if uname.nil? or upassword.nil?\n # check if already logged in\n ticket = session[:ticket]\n if not ticket.nil?\n @user_id = decrypt(ticket)\n else\n record_user\n end\n else # check credentials\n get_user_from_credentials(uname, upassword)\n end\n \n if @user.nil? # we haven't got a user yet\n get_user_from_id\n end\n if @user.nil? and @user_id != Globals::DEFAULT[:user_id] # retry 'anon' as we might have picked up a crap cookie\n get_user_from_uid('anon')\n end\n if @user.nil? # FAILURE\n throw 'Authentication failed, unable to find even a default user to authenticate as'\n end\n # add the users details to the view state\n # but ensure that their password isn't exposed while\n # noting that an empty/null password will present\n # 'anon' as the password\n @user.set_password('')\n @view_state[:user] = @user\n end", "title": "" }, { "docid": "81e800888d73bc2322eb9c6b5b615b10", "score": "0.618754", "text": "def user_configuration\n\t\t\tread_configuration(user_configuration_filename)\n\t\tend", "title": "" }, { "docid": "e2976bd13a27242d56e2e44e348865c3", "score": "0.61771697", "text": "def initialize\n load_config \n super(url: self.config[:api_root])\n self.basic_auth(self.config[:username], self.config[:password])\n end", "title": "" }, { "docid": "897c03a946f74ac7b53b36433b3e7e67", "score": "0.617678", "text": "def load\n CurrentUser.user = User.anonymous\n\n if has_api_authentication?\n load_session_for_api\n elsif params[:signed_user_id]\n load_param_user(params[:signed_user_id])\n elsif session[:user_id]\n load_session_user\n end\n\n set_statement_timeout\n update_last_logged_in_at\n update_last_ip_addr\n set_time_zone\n set_safe_mode\n set_save_data_mode\n initialize_session_cookies\n CurrentUser.user.unban! if CurrentUser.user.ban_expired?\n ensure\n DanbooruLogger.add_session_attributes(request, session, CurrentUser.user)\n end", "title": "" }, { "docid": "20312974143d304a15b07b06b560148c", "score": "0.61563885", "text": "def auth_options\n { user: config.username, password: config.password }\n end", "title": "" }, { "docid": "d2cf7e3e33e42982fb271dc23677dbe4", "score": "0.6137115", "text": "def auth\n unless session[:user_id].nil? then\n @current_user = User.find(session[:user_id])\n @activeRole = session[:activeRole]\n end\n end", "title": "" }, { "docid": "ca2bc6ac4f7339a0e918a5d20f2f36c1", "score": "0.6134108", "text": "def load_user_credentials\n credentials_path = user_path\n YAML.load_file(credentials_path)\nend", "title": "" }, { "docid": "c8711eb9dcf093e7276886705caa41b0", "score": "0.61338747", "text": "def configure!( config_file = nil )\n c = Configuration.new( config_file )\n @username = c[\"username\"]\n @password = c[\"password\"]\n nil\n end", "title": "" }, { "docid": "07460b13a7ce435ffd16b6801c26a78b", "score": "0.610401", "text": "def auth\n @auth ||= Auth::Config.new\n end", "title": "" }, { "docid": "4275a5b49d6ebd4061754dbbd4f096f5", "score": "0.60996944", "text": "def user_config\n local_options = @config_options\n @user ||= PDK::Config::JSON.new('user', file: local_options['user.path']) do\n mount :module_defaults, PDK::Config::JSON.new(file: local_options['user.module_defaults.path'])\n\n # Due to the json-schema gem having issues with Windows based paths, and only supporting Draft 05 (or less) do\n # not use JSON validation yet. Once PDK drops support for EOL rubies, we will be able to use the json_schemer gem\n # Which has much more modern support\n # Reference - https://github.com/puppetlabs/pdk/pull/777\n # Reference - https://tickets.puppetlabs.com/browse/PDK-1526\n mount :analytics, PDK::Config::YAML.new(file: local_options['user.analytics.path'], persistent_defaults: true) do\n setting :disabled do\n validate PDK::Config::Validator.boolean\n default_to { PDK::Config.bolt_analytics_config.fetch('disabled', true) }\n end\n\n setting 'user-id' do\n validate PDK::Config::Validator.uuid\n default_to do\n require 'securerandom'\n\n PDK::Config.bolt_analytics_config.fetch('user-id', SecureRandom.uuid)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "e9e6811bddea1559c5064a844e84f9b8", "score": "0.60944176", "text": "def ensure_authed\n @credentials = Conflux::Auth.read_credentials\n\n if @credentials.nil?\n error(\"Permission Denied. Run `conflux login` to login to your Conflux account.\")\n end\n\n @email = @credentials[0]\n @password = @credentials[1]\n end", "title": "" }, { "docid": "b0ddf873879fc3ae51ed3f16e5724ff0", "score": "0.6093984", "text": "def authenticate\n Logger.debug(\"[authentication] starting\")\n @current_user = nil; @sm_user = nil; @session_auth = false; @user_session = nil\n\n # by default, do not create session\n update_session = false\n\n case true\n # Token auth - stateless\n when !!(token = get_token(request))\n authenticate_with_token(token)\n\n # Session auth (eg. cookies) - stateful\n when (not session[:user].blank?)\n authenticate_with_session\n update_session = true\n\n # Proxy cert auth - stateless\n when (use_proxy_auth? and proxy_provided?)\n authenticate_with_proxy\n\n # BasicAuth - stateless\n when password_provided?\n authenticate_with_password\n\n ## DISABLED, will be removed completely someday\n # when certificate_provided?\n # authenticate_with_certificate\n end\n\n if @current_user.nil? and @sm_user.nil?\n authentication_failed\n elsif update_session and @sm_user.nil? and not session[:user].nil?\n @user_session = UserSession.\n create_and_update_session(session[:user], session[:uuid])\n Logger.debug(\"[authentication] session updated\")\n else\n Logger.debug(\"[authentication] one-time authentication\")\n end\n\n Logger.debug(\"[authentication] user_id: #{@current_user.id}\") if @current_user\n end", "title": "" }, { "docid": "ac500c81c9932e76d3d2abc85fe8fa0d", "score": "0.6093663", "text": "def load_config\n config = YAML::load_file(@config_file)\n @host = config[\"host\"] || @host\n @user_name = config[\"user_name\"] || @user_name\n @password = config[\"password\"] || @password\n @path = config[\"path\"] || @path\n end", "title": "" }, { "docid": "bc0ef38837bb8e5beb5bd3ed3f7c7eaf", "score": "0.6066113", "text": "def authenticate!\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n end\n end", "title": "" }, { "docid": "1ca490c3b593ef976936bea509538e9a", "score": "0.60522336", "text": "def authenticate!\n # Authorize request if HTTP_ACCESS_TOKEN matches 'youhavenoprivacyandnosecrets'\n # Your actual access token should be generated using one of the several great libraries\n # for this purpose and stored in a database, this is just to show how Warden should be\n # set up.\n token = (request.env[\"HTTP_ACCESS_TOKEN\"] == nil) ? \n params[\"auth_token\"] : request.env[\"HTTP_ACCESS_TOKEN\"]\n user = User.find_by_access_token(token)\n user == nil ? fail!(\"Could not log in\") : success!(user)\n end", "title": "" }, { "docid": "301e2725a7cffd61561c1ebb44575d71", "score": "0.60469896", "text": "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "title": "" }, { "docid": "544eec6d5f8e96ba777ae87bfabfbc25", "score": "0.6043425", "text": "def load config\n end", "title": "" }, { "docid": "10688453504e090e16a23a8135c3f29a", "score": "0.6038278", "text": "def load_auth_from_yaml\n self.class.auth_yaml_paths.map { |path| File.expand_path(path) }.select { |path| File.exist?(path) }.each do |path|\n auth = YAML.load(File.read(path))\n @username = auth['username']\n @password = auth['password']\n return if @username && @password\n end\n\n raise \"Could not locate a fusemail authentication file in locations: #{self.class.auth_yaml_paths.inspect}\"\n end", "title": "" }, { "docid": "07698afe66e7db7856dbd5f6641ba3a7", "score": "0.6038211", "text": "def user_configuration\n @user_configuration ||=\n begin\n if !@user_configuration_file.nil? && File.exist?(@user_configuration_file)\n File.open(@user_configuration_file) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[Rails.env]\n end\n else\n {}\n end\n end\n end", "title": "" }, { "docid": "b44897f6218aef0fcab00cc7068261de", "score": "0.60334194", "text": "def auth_conf\n @auth_conf_content ||= File.read(File.join(fixture_dir, 'auth.conf'))\n end", "title": "" }, { "docid": "b3509cd4f152e0291f664f9c37240607", "score": "0.6025234", "text": "def load_credentials\n store.load_credentials\n end", "title": "" }, { "docid": "a8d9992cbcc925575dea594ba99b367a", "score": "0.60206115", "text": "def load_user\n @user = current_user\n end", "title": "" }, { "docid": "69626babd0a7e9c7c15e909159a225f1", "score": "0.60141045", "text": "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @current_user = User.find_by(auth_token: token)\n end\n end", "title": "" }, { "docid": "9bfa45bb6cb087e3cda9d520e4be8d99", "score": "0.60133547", "text": "def user\n user_config\n end", "title": "" }, { "docid": "fc9ea6699d2623205a753ad1a3e65df2", "score": "0.6009333", "text": "def authenticate\n authenticate_or_request_with_http_token do |token, options|\n @current_user = User.find_by token: token\n end\n end", "title": "" }, { "docid": "188402a776cc572ac42f3450fc1a4b35", "score": "0.6002148", "text": "def load_auth\n begin\n authdata = JSON.parse(File.read(opts[:auth_file]))\n [authdata['username'], authdata['password']]\n rescue\n end\n end", "title": "" }, { "docid": "0a88b4f4518f8b7e1892f92151cf8458", "score": "0.59941924", "text": "def set_user_configuration\n @user_configuration = UserConfiguration.find(params[:id])\n end", "title": "" }, { "docid": "a9f3e249e5d0144de8fdbd9ed1f51998", "score": "0.5992559", "text": "def authenticate_and_set_user\n \tauthenticate_user!\n \tif user_signed_in?\n \t\t@user = current_user\n \tend\n end", "title": "" }, { "docid": "b4230be7dce93909484e60ffaf6a5fe8", "score": "0.5989794", "text": "def user_config\n local_options = @config_options\n @user_config ||= PDK::Config::JSON.new('user', file: local_options['user.path']) do\n mount :module_defaults, PDK::Config::JSON.new(file: local_options['user.module_defaults.path'])\n\n # Due to the json-schema gem having issues with Windows based paths, and only supporting Draft 05 (or less) do\n # not use JSON validation yet. Once PDK drops support for EOL rubies, we will be able to use the json_schemer gem\n # Which has much more modern support\n # Reference - https://github.com/puppetlabs/pdk/pull/777\n # Reference - https://tickets.puppetlabs.com/browse/PDK-1526\n mount :analytics, PDK::Config::YAML.new(file: local_options['user.analytics.path'], persistent_defaults: true) do\n setting :disabled do\n validate PDK::Config::Validator.boolean\n default_to { PDK::Config.bolt_analytics_config.fetch('disabled', true) }\n end\n\n setting 'user-id' do\n validate PDK::Config::Validator.uuid\n default_to do\n require 'securerandom'\n\n PDK::Config.bolt_analytics_config.fetch('user-id', SecureRandom.uuid)\n end\n end\n end\n\n # Display the feature flags\n mount :pdk_feature_flags, PDK::Config::Namespace.new('pdk_feature_flags') do\n setting 'available' do\n default_to { PDK.available_feature_flags }\n end\n\n setting 'requested' do\n default_to { PDK.requested_feature_flags }\n end\n end\n end\n end", "title": "" }, { "docid": "c32556f2e0fd44e2ae099773ebff7952", "score": "0.5988265", "text": "def load_config!\n @user = YAML.load(File.read('spec/config/user.yml'))\n @user.each do |key, val|\n ZerigoDNS.config.send(\"#{key}=\", val)\n end\n end", "title": "" }, { "docid": "48591f2ca04e73bc84cfe2b6c250625e", "score": "0.5985812", "text": "def load_credentials\n store.load_credentials\n end", "title": "" }, { "docid": "926855ee0947b5fd3ecb1b08b1b94543", "score": "0.5980775", "text": "def current_user\n @_current_user ||= (session[:email] && session[:api_key]) && Nilavu::Auth::Configuration.load(session[:email])\n end", "title": "" }, { "docid": "0e785fec3108afd5bee87313985e283a", "score": "0.59717876", "text": "def load_user\n super\n @current_api_user = Spree.user_class.new if @current_api_user.nil?\n end", "title": "" }, { "docid": "093d3b21e6c1b03b521cb041cbb53242", "score": "0.59709764", "text": "def user\n @user ||= load_from('settings', @application.home_dir)\n end", "title": "" }, { "docid": "e9f7cc740958832742e41d20a23fb47f", "score": "0.5967487", "text": "def config\n {\n :host => uri.host,\n :port => uri.port,\n :encryption => encryption\n }.merge(\n (username && password) ?\n { :auth => {:method => :simple, :username => username, :password => password} } :\n { :auth => {:method => :anonymous} }\n )\n end", "title": "" }, { "docid": "01a046bf604acbed858849f78f71126f", "score": "0.59638894", "text": "def connect\n self.current_user = find_verified_user\n end", "title": "" }, { "docid": "e40ad9b18234514222723d6411717899", "score": "0.5960716", "text": "def authentication\n\n @current_user = User.find_by_id session[:user_id] unless session[:user_id].nil?\n\n\n # If we didn't log anyone in, clear out the sessions so we don't try again.\n if @current_user.nil?\n session[:user_id] = nil\n end\n end", "title": "" }, { "docid": "c51e0ffcdb7fe76bd6b8044b629ca801", "score": "0.5947988", "text": "def load_configuration cwd, project: nil\n global = false\n local_filename = project + '/credentials.yml'\n global_filename = Dir.home + '/.api-test-helper-credentials.yml'\n\n if File.exist?(local_filename)\n @filename = local_filename\n elsif File.exist?(global_filename)\n @filename = global_filename\n global = true\n end\n\n if @filename.nil?\n warn 'No credentials file found. Neither in ' + local_filename + ' nor in ' + global_filename + '.'\n raise KeyError\n end\n\n @credentials = YAML::load_file(@filename)\n\n unless @credentials.is_a? Hash and @credentials['Authorization']\n warn 'Authorization is missing in credentials file ' + @filename + '.'\n raise KeyError\n end\n\n if not global\n @credentials = @credentials['Authorization']\n else\n if @credentials['Authorization'][project]\n @credentials = @credentials['Authorization'][project]\n else\n warn \"No section #{project.inspect} found in Authorization (#{@filename}).\"\n raise KeyError\n end\n end\n end", "title": "" }, { "docid": "5c545e4bd0c4db2b0e4289b51070c998", "score": "0.59340245", "text": "def authenticate!\n Rails.logger.debug \"[AuthN] [#{self.class}] Authenticating ...\"\n\n if OPTIONS.block_all\n fail! 'BlockAll for DummyStrategy is active!'\n return\n end\n\n user = Hashie::Mash.new\n user.auth!.type = OPTIONS.fake_type || 'dummy'\n\n case user.auth.type\n when 'dummy', 'basic'\n user.auth!.credentials!.username = OPTIONS.fake_username || 'dummy_user'\n user.auth!.credentials!.password = OPTIONS.fake_password || 'dummy_password'\n user.identity = user.auth.credentials.username\n when 'x509', 'voms'\n user.auth!.credentials!.client_cert_dn = OPTIONS.fake_client_cert_dn || 'dummy_cert_dn'\n user.auth!.credentials!.client_cert = OPTIONS.fake_client_cert || 'dummy_cert'\n user.auth!.credentials!.client_cert_voms_attrs = OPTIONS.fake_voms_attrs || {}\n user.auth!.credentials!.issuer_cert_dn = OPTIONS.fake_issuer_cert_dn || 'dummy_issuer_cert_dn'\n user.auth!.credentials!.verification_status = OPTIONS.fake_verification_status || 'SUCCESS'\n user.identity = user.auth.credentials.client_cert_dn\n else\n user.identity = 'unknown'\n user.auth!.credentials = {}\n end\n\n Rails.logger.debug \"[AuthN] [#{self.class}] Authenticated #{user.to_hash.inspect}\"\n success! user.deep_freeze\n end", "title": "" }, { "docid": "e1ff45038c95ab3f9f8778c0c63012d6", "score": "0.5929249", "text": "def load_auth\n\t\t\tbegin\n\t\t\t\tauthdata = JSON.parse(File.read(opts[:auth_file]))\n\t\t\t\t[authdata['email'], authdata['password']]\n\t\t\trescue\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "b35bf2de13bf72953cdb91174bb38a71", "score": "0.5922414", "text": "def load_user\n @user = current_user\n end", "title": "" }, { "docid": "b35bf2de13bf72953cdb91174bb38a71", "score": "0.5922414", "text": "def load_user\n @user = current_user\n end", "title": "" }, { "docid": "e79b104b0869ea77de96ad82154c9362", "score": "0.5922075", "text": "def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'terms_engine.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]\n end\n else\n {}\n end\n end\n end", "title": "" }, { "docid": "bf334ff1cb270978844f04565de217f5", "score": "0.5918693", "text": "def authenticate\n if user = authenticate_with_http_basic { |u, p| User.authenticate(u, p) }\n @user = user\n else\n request_http_basic_authentication\n end\n end", "title": "" }, { "docid": "fcd0dae32cccc19a4f851e9cbf41a87c", "score": "0.5916758", "text": "def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'cxpbbg.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]\n end\n else\n {}\n end\n end\n end", "title": "" }, { "docid": "6b56ed862f2056f2f42538743b817c31", "score": "0.590158", "text": "def with_configured_user\n config = Console.config.api\n if config[:login]\n @user = new_user :login => config[:login], :password => config[:password]\n else\n @with_unique_user = true\n @user = new_user :login => \"#{uuid}@test1.com\", :password => 'foo'\n end\n end", "title": "" }, { "docid": "216e19e27ce648d80bb86b430d83bcfd", "score": "0.58998066", "text": "def initialize\n Gamewisp.load_configuration\n self.token_store = TokenStore.new\n self.auth = Authorizer.new 'createauth', self.token_store\n end", "title": "" }, { "docid": "07848002bcd71dca71329c2006a438ca", "score": "0.5899112", "text": "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "title": "" }, { "docid": "07848002bcd71dca71329c2006a438ca", "score": "0.5899112", "text": "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "title": "" }, { "docid": "96a5cbb8d557b4a6431dd7717d728a40", "score": "0.58879656", "text": "def require_login\n authenticate_user!\n end", "title": "" }, { "docid": "cea00918196aa947701b3f015373d563", "score": "0.58845097", "text": "def setup_user\n return unless session[:user_id]\n @user = User.find(session[:user_id]) rescue nil\n if @user\n @user.auth = OmniAuth::AuthHash.new(session[:auth]['credentials'])\n # OmniAuth uses 'token', google-api-client uses 'access_token'\n @user.auth.access_token = @user.auth['token']\n setup_api_client\n end\n end", "title": "" }, { "docid": "fb73f73675f9b323bec834a041e2590e", "score": "0.5882996", "text": "def credentials\n YAML.load_file(CONFIG_FILE)\n end", "title": "" }, { "docid": "d8cfc110e73e1c9d31dc65eea8d9490e", "score": "0.58761394", "text": "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n config = Configuration.find(:first)\n if not config.nil?\n username == config.user_name and password == config.password\n end\n end\n end", "title": "" }, { "docid": "a8e19c6a413eb542d7801ac391382986", "score": "0.587394", "text": "def load_user\n @auth_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end", "title": "" }, { "docid": "18995449e7d3ef7e0e84ebd354ff4060", "score": "0.58626735", "text": "def authenticate_user!\n optionally_authenticate_user!(true)\n end", "title": "" }, { "docid": "eec7247d5f949c01aa0a492e245d1333", "score": "0.5860439", "text": "def login_from_basic_auth\n username, passwd = get_auth_data\n self.current_user = User.authenticate(username, passwd) if username && passwd\n end", "title": "" }, { "docid": "889bb7e26cd772f68b4b4253c3b984a0", "score": "0.5855471", "text": "def authenticate\n\t\tif APP_CONFIG['perform_authentication']\n \tauthenticate_or_request_with_http_basic do |username, password|\n \t username == APP_CONFIG['username'] && password == APP_CONFIG['password']\n \tend\n\t\tend\n end", "title": "" }, { "docid": "dc48e81c573e77318fef5f5a26b36173", "score": "0.5840405", "text": "def configure\n load_defaults\n yield self\n raise \"You must add your own public api key to initializer .\" if self.public_api_key.nil?\n raise \"You must add your own private api key to initializer .\" if self.private_api_key.nil?\n raise \"Authentication method must be :header or :parameter .\" if !AUTHENTICATION_METHODS.include? self.authentication_method\n SqootClient.reload!\n true\n end", "title": "" }, { "docid": "cbf70909c43f06a22512c6fb93cbfaf1", "score": "0.58346117", "text": "def config\n unless File.exist? config_path\n system(\"vkpd auth 2>&1 >/dev/null\")\n end\n @config ||= YAML.load File.read(config_path)\n end", "title": "" }, { "docid": "2eb4deb33c8531c8f450bffa149a6bee", "score": "0.58245605", "text": "def initialize\r\n\t\tconfig_file = YAML.load_file('config.yml')\r\n\t\t@edumate_username = config_file['edumate_username']\r\n\t\t@edumate_password = config_file['edumate_password']\r\n\t\t@database_driver = config_file['database_driver']\r\n\tend", "title": "" }, { "docid": "6caf5d59c9edbadd55e2b2b663516238", "score": "0.58199877", "text": "def configure\n load_defaults\n yield self\n fail 'You must add your own public api key to initializer .' if public_api_key.nil?\n fail 'You must add your own private api key to initializer .' if private_api_key.nil?\n fail 'Authentication method must be :header or :parameter .' unless AUTHENTICATION_METHODS.include? authentication_method\n SqootClient.reload!\n true\n end", "title": "" }, { "docid": "e033d2a1ccae359cb09022bb97959c12", "score": "0.5815121", "text": "def initialize\n @auth = { username: Rails.configuration.x.ch_endpoint.uid, password: Rails.configuration.x.ch_endpoint.pwd }\n end", "title": "" }, { "docid": "5a85a48f98e8b70f90635cbcde9f5656", "score": "0.58120596", "text": "def basic_auth_required\n user = super\n self.current_user = user if User === user\n end", "title": "" }, { "docid": "903fb3b7d0baf58d9b338ae2d686c656", "score": "0.58086103", "text": "def authenticate_user!\n warden_handler.authenticate!\n end", "title": "" }, { "docid": "ffa9a1c862afd739fd685db61d6bdd11", "score": "0.5807634", "text": "def user_auth\n sugar_resp = sugar_do_rest_call(\n @url, \n 'login', \n :user_auth => {:user_name => @config['username'], :password => Digest::MD5.hexdigest(@config['password']), :version => @config['api_version']}\n )\n @session_id = sugar_resp['id']\n @logged_user= find_user_by_name @config['username']\n raise \"Error performing login to SugarCRM, returned session_id is nil\" if @session_id.blank?\n end", "title": "" }, { "docid": "a6c890e6d654f58bd7e276051dd9491e", "score": "0.580425", "text": "def auth(params = {})\n update_userpool_cache if @conf[:use_user_pool_cache]\n do_auth(params)\n end", "title": "" }, { "docid": "c7e6625d62e56ef1edb7f943b7bf0ef5", "score": "0.5803189", "text": "def setup!\n ensure_config_directory_exists!\n load_config\n load_users\n end", "title": "" }, { "docid": "6785c1047a56bb915cfd14dcd2fba3b1", "score": "0.5799923", "text": "def authenticate_user\n if !env['HTTP_AUTHORIZATION'].nil?\n # authentification with reverse proxy setting HTTP_AUTHORIZATION header\n user, pass = Base64.decode64(env['HTTP_AUTHORIZATION'].split[1]).split ':', 2\n elsif !request.env['REMOTE_USER'].nil?\n user = request.env['REMOTE_USER']\n else\n user = nil\n end\n\n if !user.nil?\n logger.debug \"Logging user #{user}\"\n\n #puts \"You have been automatically authenticated as #{session['REMOTE_USER']} thanks to kerberos !\"\n #If user is already logged in the application, we do not retrieve again his information from ldap\n if session[:user_id].nil?\n authenticated_user = User.find_or_create_from_ldap(user)\n if authenticated_user\n session[:user_id] = authenticated_user.id\n else\n flash[:error] = \"User information can not been retrieved. Please contact support team.\"\n render :text => authentication_failed_path\n end\n end\n\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n\n #1- User wants to access a page\n if !params[:scope].nil? && params[:scope] == \"#{BASE_URL}\"\n render :text => params[:redirect_uri]\n else\n #2 - User has been redirected on the application via a client application\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n render :text => @authorizer.redirect_uri\n end\n\n else\n render :text => authentication_failed_path\n end\n\n end", "title": "" }, { "docid": "ee04d33bec55f1578c03a882d9176136", "score": "0.57893896", "text": "def authenticate!\n access_token = get_access_token\n \n if @client.authorized?\n session[:access_token] = access_token.token\n session[:secret_token] = access_token.secret\n session[:user] = @client.info\n\n session[:user]\n else\n nil\n end\n end", "title": "" }, { "docid": "e50a1328c48b8c5edf6f1104e5009ffa", "score": "0.57893246", "text": "def authenticate\n\n end", "title": "" }, { "docid": "de7b05fe416a3049dd58cb271afa1aa6", "score": "0.5789031", "text": "def user_configuration\n @user_configuration ||= all_configurations[::Rails.env]\n end", "title": "" }, { "docid": "fd8c44084990fb3e5ba2c4caae87efbe", "score": "0.5781148", "text": "def auth\n {\n username: @username,\n password: @password\n }\n end", "title": "" }, { "docid": "455ccb12c54d73ccf6721ef33808612a", "score": "0.5775478", "text": "def authenticate!\n return unauthorized unless auth.provided? and auth.basic? and auth.credentials\n credentials = auth.credentials.map do |credential|\n config.hash_credentials ? Digest::SHA2.new(256).update(credential).to_s : credential\n end\n user = config.lookup.call(credentials.first, credentials.last)\n return user ? success!(auth.credentials.first) : unauthorized\n end", "title": "" } ]
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "f2e637ef879f4b18199c3ae7f27f8112", "score": "0.0", "text": "def update!(**args)\n @https_latency_data = args[:https_latency_data] if args.key?(:https_latency_data)\n @report_time = args[:report_time] if args.key?(:report_time)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update(properties)\n @__hash__.update(properties)\n end", "title": "" }, { "docid": "60506d5995c168a570c84bcbafd6d01b", "score": "0.7164913", "text": "def update props\n # not an alias because doc\n put props\n end", "title": "" }, { "docid": "ec25850e7b3d73876b69868b5e566a7a", "score": "0.71243227", "text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "title": "" }, { "docid": "b46342a57789464175130c5171865a4f", "score": "0.69842774", "text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "4aa62f56c7ec71b9c7d914558501001b", "score": "0.67206186", "text": "def update\n update_obj\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "b0508d605628b9b1ec78fe5f0697a746", "score": "0.67057854", "text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "d9b090f93fdffad34c5489c4c437c6f3", "score": "0.6662612", "text": "def update_properties(properties_element)\n end", "title": "" }, { "docid": "b7ed68c679d7eaccf546a282fab6e985", "score": "0.66259164", "text": "def apply\n update_keys\n update_columns\n update_properties\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "862f7aa179e3e1751693f78772c09a99", "score": "0.65159345", "text": "def assign_properties(properties); end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "d8b3bf9ec121e23dad3af2edca6e6094", "score": "0.6421526", "text": "def update(attributes); end", "title": "" }, { "docid": "63cce5e99d8dc677403b00708afc27c9", "score": "0.641709", "text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end", "title": "" }, { "docid": "3dc790e8b6e9e65eb288c97798a4c7f2", "score": "0.64154994", "text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end", "title": "" }, { "docid": "9373755ebb61f1f274f6c8504a5acace", "score": "0.64146614", "text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "71d6a0160cffce28db4d0a25d6dbda13", "score": "0.6385747", "text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf", "score": "0.6364864", "text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end", "title": "" }, { "docid": "575f3d0c94f466263e302883e13868a6", "score": "0.6330631", "text": "def _update\n update!\n end", "title": "" }, { "docid": "7c6d5966289f9347f75aa7b24903a328", "score": "0.6327251", "text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "title": "" }, { "docid": "210886bcfd68fae88847f8b3464d4058", "score": "0.6325362", "text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.6319025", "text": "def update\n \n end", "title": "" }, { "docid": "749afa4ff068e21c7d78bbad94c19d6c", "score": "0.6313444", "text": "def update!(attributes); end", "title": "" }, { "docid": "e8639be61ed6393bc612a8aef27789d3", "score": "0.6312355", "text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "5a8e82caac01cee661bc875a5b0cf723", "score": "0.6283673", "text": "def refresh\n set_attributes\n end", "title": "" }, { "docid": "9e076ce17f1607b2a6248469b63b9c05", "score": "0.62797445", "text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "7a41bc9d5a07220fb8626d1fa90d2d79", "score": "0.62639254", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "afd53a32bf51a2ff3c438cbf011b1ee6", "score": "0.6261246", "text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end", "title": "" }, { "docid": "118090da310d688caa13dea348732f3c", "score": "0.62579167", "text": "def update(attributes={})\n self.class.update(self, attributes)\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.62152076", "text": "def update\n \n end", "title": "" }, { "docid": "1c12f310aca206a2cefff8c291007668", "score": "0.6210263", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "3dfb66c3e13f181393bb4510e9fcd51f", "score": "0.62083745", "text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "5d229ea224b1dfa7ac9ce6808ca63fc4", "score": "0.62017816", "text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "title": "" }, { "docid": "6992c0833b982296b329ec1d8c7289de", "score": "0.6201711", "text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end", "title": "" }, { "docid": "2beb42793217599eea1dac4b91640e41", "score": "0.6196084", "text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "title": "" }, { "docid": "67f76e6622d1021031437ad609613c63", "score": "0.6192824", "text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end", "title": "" }, { "docid": "30aa07725af2114280d6e8f916ab079f", "score": "0.6183338", "text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend", "title": "" }, { "docid": "f1f71f298690a3bd1f5832b15038d8bb", "score": "0.6174291", "text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "7f11aed7030229ef429116ccba78c00f", "score": "0.61400205", "text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end", "title": "" }, { "docid": "22a21a1959eeb926dfe475d8878239d7", "score": "0.6127356", "text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" } ]